@idmission/websdk-ui 0.2.0-rc.2 → 0.5.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 (212) hide show
  1. package/README.md +168 -56
  2. package/dist/DocumentCaptureView.d.ts +44 -5
  3. package/dist/DocumentCaptureView.d.ts.map +1 -1
  4. package/dist/DocumentCaptureView.js +517 -30
  5. package/dist/FaceLivenessView.d.ts +3 -3
  6. package/dist/FaceLivenessView.d.ts.map +1 -1
  7. package/dist/FaceLivenessView.js +82 -40
  8. package/dist/IdCaptureView.d.ts +33 -20
  9. package/dist/IdCaptureView.d.ts.map +1 -1
  10. package/dist/IdCaptureView.js +196 -33
  11. package/dist/SelfieCaptureView.d.ts +19 -2
  12. package/dist/SelfieCaptureView.d.ts.map +1 -1
  13. package/dist/SelfieCaptureView.js +17 -5
  14. package/dist/SignatureCaptureView.d.ts +23 -2
  15. package/dist/SignatureCaptureView.d.ts.map +1 -1
  16. package/dist/SignatureCaptureView.js +138 -22
  17. package/dist/VideoIdCaptureView.d.ts +15 -3
  18. package/dist/VideoIdCaptureView.d.ts.map +1 -1
  19. package/dist/VideoIdCaptureView.js +35 -8
  20. package/dist/bindings/useDocumentCapture.d.ts.map +1 -1
  21. package/dist/bindings/useDocumentCapture.js +2 -1
  22. package/dist/bindings/useIdCapture.d.ts.map +1 -1
  23. package/dist/bindings/useIdCapture.js +2 -1
  24. package/dist/bindings/useSelfieCapture.d.ts.map +1 -1
  25. package/dist/bindings/useSelfieCapture.js +2 -1
  26. package/dist/bindings/useSignatureCapture.d.ts.map +1 -1
  27. package/dist/bindings/useSignatureCapture.js +2 -1
  28. package/dist/bindings/useVideoIdCapture.d.ts.map +1 -1
  29. package/dist/bindings/useVideoIdCapture.js +2 -1
  30. package/dist/components/CameraFeed.d.ts +11 -3
  31. package/dist/components/CameraFeed.d.ts.map +1 -1
  32. package/dist/components/CameraFeed.js +24 -4
  33. package/dist/components/barcode/BarcodeGuideOverlay.d.ts +7 -1
  34. package/dist/components/barcode/BarcodeGuideOverlay.d.ts.map +1 -1
  35. package/dist/components/barcode/BarcodeGuideOverlay.js +2 -2
  36. package/dist/components/common/BrowserEdgeTint.d.ts +63 -0
  37. package/dist/components/common/BrowserEdgeTint.d.ts.map +1 -0
  38. package/dist/components/common/BrowserEdgeTint.js +111 -0
  39. package/dist/components/common/LoaderButton.d.ts +9 -0
  40. package/dist/components/common/LoaderButton.d.ts.map +1 -1
  41. package/dist/components/common/LoaderButton.js +44 -321
  42. package/dist/components/common/ScreenReaderStatus.d.ts +8 -0
  43. package/dist/components/common/ScreenReaderStatus.d.ts.map +1 -0
  44. package/dist/components/common/ScreenReaderStatus.js +18 -0
  45. package/dist/components/common/overlay.d.ts +6 -0
  46. package/dist/components/common/overlay.d.ts.map +1 -1
  47. package/dist/components/common/overlay.js +7 -1
  48. package/dist/components/debug/debug.d.ts +10 -4
  49. package/dist/components/debug/debug.d.ts.map +1 -1
  50. package/dist/components/debug/debug.js +5 -1
  51. package/dist/components/document/DocumentCaptureAutoCaptureDebugLayer.d.ts +29 -0
  52. package/dist/components/document/DocumentCaptureAutoCaptureDebugLayer.d.ts.map +1 -0
  53. package/dist/components/document/DocumentCaptureAutoCaptureDebugLayer.js +273 -0
  54. package/dist/components/document/DocumentCaptureAutoCaptureGuidance.d.ts +56 -0
  55. package/dist/components/document/DocumentCaptureAutoCaptureGuidance.d.ts.map +1 -0
  56. package/dist/components/document/DocumentCaptureAutoCaptureGuidance.js +128 -0
  57. package/dist/components/document/DocumentCaptureGuideOverlay.d.ts +31 -1
  58. package/dist/components/document/DocumentCaptureGuideOverlay.d.ts.map +1 -1
  59. package/dist/components/document/DocumentCaptureGuideOverlay.js +121 -2
  60. package/dist/components/document/DocumentCaptureReviewScreen.d.ts +44 -0
  61. package/dist/components/document/DocumentCaptureReviewScreen.d.ts.map +1 -0
  62. package/dist/components/document/DocumentCaptureReviewScreen.js +40 -0
  63. package/dist/components/document/types.d.ts +25 -0
  64. package/dist/components/document/types.d.ts.map +1 -1
  65. package/dist/components/document/types.js +18 -1
  66. package/dist/components/error/CameraAccessDeniedOverlay.d.ts +8 -1
  67. package/dist/components/error/CameraAccessDeniedOverlay.d.ts.map +1 -1
  68. package/dist/components/error/useCameraAccessDeniedReport.d.ts +12 -0
  69. package/dist/components/error/useCameraAccessDeniedReport.d.ts.map +1 -0
  70. package/dist/components/error/useCameraAccessDeniedReport.js +31 -0
  71. package/dist/components/face_liveness/FaceLivenessFailure.d.ts +4 -1
  72. package/dist/components/face_liveness/FaceLivenessFailure.d.ts.map +1 -1
  73. package/dist/components/face_liveness/FaceLivenessFailure.js +4 -2
  74. package/dist/components/face_liveness/FaceLivenessSuccess.d.ts +4 -1
  75. package/dist/components/face_liveness/FaceLivenessSuccess.d.ts.map +1 -1
  76. package/dist/components/face_liveness/FaceLivenessSuccess.js +6 -2
  77. package/dist/components/guides/IdCaptureFitGuide.d.ts +2 -0
  78. package/dist/components/guides/IdCaptureFitGuide.d.ts.map +1 -1
  79. package/dist/components/guides/IdCaptureFitGuide.js +4 -1
  80. package/dist/components/guides/IdCaptureGuideOverlay.d.ts +2 -0
  81. package/dist/components/guides/IdCaptureGuideOverlay.d.ts.map +1 -1
  82. package/dist/components/guides/IdCaptureGuideOverlay.js +3 -1
  83. package/dist/components/guides/IdCaptureGuides.d.ts +14 -0
  84. package/dist/components/guides/IdCaptureGuides.d.ts.map +1 -1
  85. package/dist/components/guides/IdCaptureGuides.js +23 -9
  86. package/dist/components/guides/IdCaptureGuidesCommon.d.ts.map +1 -1
  87. package/dist/components/guides/IdCaptureGuidesCommon.js +12 -7
  88. package/dist/components/loading/IdCaptureLoadingOverlayDefault.d.ts +9 -0
  89. package/dist/components/loading/IdCaptureLoadingOverlayDefault.d.ts.map +1 -1
  90. package/dist/components/loading/IdCaptureLoadingOverlayDefault.js +26 -4
  91. package/dist/components/loading/RingIntroScreen.d.ts.map +1 -1
  92. package/dist/components/loading/RingIntroScreen.js +4 -34
  93. package/dist/components/review/ReviewScreen.d.ts +10 -1
  94. package/dist/components/review/ReviewScreen.d.ts.map +1 -1
  95. package/dist/components/review/ReviewScreen.js +8 -8
  96. package/dist/components/review/SignatureCaptureDiagnostics.d.ts +54 -0
  97. package/dist/components/review/SignatureCaptureDiagnostics.d.ts.map +1 -0
  98. package/dist/components/review/SignatureCaptureDiagnostics.js +144 -0
  99. package/dist/components/selfie/FaceCaptureGuideOverlay.d.ts +9 -2
  100. package/dist/components/selfie/FaceCaptureGuideOverlay.d.ts.map +1 -1
  101. package/dist/components/selfie/FaceCaptureGuideOverlay.js +10 -4
  102. package/dist/components/selfie/SelfieCaptureAnimatedMask.d.ts +8 -1
  103. package/dist/components/selfie/SelfieCaptureAnimatedMask.d.ts.map +1 -1
  104. package/dist/components/selfie/SelfieCaptureAnimatedMask.js +55 -21
  105. package/dist/components/selfie/SelfieCaptureSurface.d.ts +19 -3
  106. package/dist/components/selfie/SelfieCaptureSurface.d.ts.map +1 -1
  107. package/dist/components/selfie/SelfieCaptureSurface.js +78 -14
  108. package/dist/components/selfie_loading/SelfieCaptureLoadingOverlayDefault.d.ts +9 -0
  109. package/dist/components/selfie_loading/SelfieCaptureLoadingOverlayDefault.d.ts.map +1 -1
  110. package/dist/components/selfie_loading/SelfieCaptureLoadingOverlayDefault.js +26 -4
  111. package/dist/components/videoId/VideoIdCaptureGuides.d.ts +4 -1
  112. package/dist/components/videoId/VideoIdCaptureGuides.d.ts.map +1 -1
  113. package/dist/components/videoId/VideoIdCaptureGuides.js +2 -2
  114. package/dist/flows/AuthStateContext.d.ts.map +1 -1
  115. package/dist/flows/AuthStateContext.js +2 -1
  116. package/dist/flows/CaptureProgress.d.ts +14 -0
  117. package/dist/flows/CaptureProgress.d.ts.map +1 -0
  118. package/dist/flows/CaptureProgress.js +51 -0
  119. package/dist/flows/CompositeWizard.d.ts +5 -0
  120. package/dist/flows/CompositeWizard.d.ts.map +1 -1
  121. package/dist/flows/CompositeWizard.js +6 -1
  122. package/dist/flows/CustomerBiometricsEnrollmentFlow.d.ts +1 -1
  123. package/dist/flows/CustomerBiometricsEnrollmentFlow.d.ts.map +1 -1
  124. package/dist/flows/CustomerBiometricsEnrollmentFlow.js +6 -3
  125. package/dist/flows/CustomerIdAndBiometricsEnrollmentFlow.d.ts +1 -1
  126. package/dist/flows/CustomerIdAndBiometricsEnrollmentFlow.d.ts.map +1 -1
  127. package/dist/flows/CustomerIdAndBiometricsEnrollmentFlow.js +5 -2
  128. package/dist/flows/DocumentCaptureFlow.d.ts +2 -2
  129. package/dist/flows/DocumentCaptureFlow.d.ts.map +1 -1
  130. package/dist/flows/DocumentCaptureFlow.js +6 -6
  131. package/dist/flows/FaceValidationFlow.d.ts +2 -2
  132. package/dist/flows/FaceValidationFlow.d.ts.map +1 -1
  133. package/dist/flows/FaceValidationFlow.js +2 -2
  134. package/dist/flows/FlowChassis.d.ts +3 -1
  135. package/dist/flows/FlowChassis.d.ts.map +1 -1
  136. package/dist/flows/FlowChassis.js +23 -4
  137. package/dist/flows/IdAndFaceValidationFlow.d.ts +1 -1
  138. package/dist/flows/IdAndFaceValidationFlow.d.ts.map +1 -1
  139. package/dist/flows/IdAndFaceValidationFlow.js +5 -2
  140. package/dist/flows/IdValidationFlow.d.ts +1 -1
  141. package/dist/flows/IdValidationFlow.d.ts.map +1 -1
  142. package/dist/flows/IdValidationFlow.js +18 -4
  143. package/dist/flows/SignatureKYCFlow.d.ts +18 -3
  144. package/dist/flows/SignatureKYCFlow.d.ts.map +1 -1
  145. package/dist/flows/SignatureKYCFlow.js +94 -11
  146. package/dist/flows/SubmissionProvider.d.ts.map +1 -1
  147. package/dist/flows/SubmissionProvider.js +10 -5
  148. package/dist/flows/VideoIdValidationFlow.d.ts +1 -1
  149. package/dist/flows/VideoIdValidationFlow.d.ts.map +1 -1
  150. package/dist/flows/VideoIdValidationFlow.js +6 -3
  151. package/dist/flows/additionalDocuments.d.ts.map +1 -1
  152. package/dist/flows/additionalDocuments.js +3 -6
  153. package/dist/flows/approval.d.ts +2 -0
  154. package/dist/flows/approval.d.ts.map +1 -0
  155. package/dist/flows/approval.js +1 -0
  156. package/dist/flows/artifacts.d.ts +1 -1
  157. package/dist/flows/artifacts.d.ts.map +1 -1
  158. package/dist/flows/artifacts.js +29 -9
  159. package/dist/flows/autoCaptureMountGuard.d.ts +22 -0
  160. package/dist/flows/autoCaptureMountGuard.d.ts.map +1 -0
  161. package/dist/flows/autoCaptureMountGuard.js +61 -0
  162. package/dist/flows/customerMatch/CustomerMatchFlow.d.ts +1 -1
  163. package/dist/flows/customerMatch/CustomerMatchFlow.d.ts.map +1 -1
  164. package/dist/flows/customerMatch/CustomerMatchFlow.js +5 -6
  165. package/dist/flows/ringScreens.d.ts +1 -3
  166. package/dist/flows/ringScreens.d.ts.map +1 -1
  167. package/dist/flows/ringScreens.js +19 -5
  168. package/dist/flows/types.d.ts +17 -3
  169. package/dist/flows/types.d.ts.map +1 -1
  170. package/dist/guidance/selfieStrings.d.ts +9 -1
  171. package/dist/guidance/selfieStrings.d.ts.map +1 -1
  172. package/dist/guidance/selfieStrings.js +67 -24
  173. package/dist/guidance/strings.d.ts +34 -1
  174. package/dist/guidance/strings.d.ts.map +1 -1
  175. package/dist/guidance/strings.js +39 -0
  176. package/dist/i18n/index.d.ts +28 -1177
  177. package/dist/i18n/index.d.ts.map +1 -1
  178. package/dist/i18n/index.js +58 -22
  179. package/dist/i18n/locales/threeOh.d.ts +4 -0
  180. package/dist/i18n/locales/threeOh.d.ts.map +1 -0
  181. package/dist/i18n/locales/threeOh.js +159 -0
  182. package/dist/index.d.ts +12 -6
  183. package/dist/index.d.ts.map +1 -1
  184. package/dist/index.js +4 -0
  185. package/dist/testing/autoCaptureFrames.d.ts +23 -0
  186. package/dist/testing/autoCaptureFrames.d.ts.map +1 -0
  187. package/dist/testing/autoCaptureFrames.js +193 -0
  188. package/dist/testing/buildSelfieState.d.ts.map +1 -1
  189. package/dist/testing/buildSelfieState.js +5 -0
  190. package/dist/testing/classNamesLeaves.js +1 -1
  191. package/dist/testing/fakeDocumentController.d.ts +7 -1
  192. package/dist/testing/fakeDocumentController.d.ts.map +1 -1
  193. package/dist/testing/fakeDocumentController.js +10 -2
  194. package/dist/testing/fakeSelfieController.d.ts.map +1 -1
  195. package/dist/testing/fakeSelfieController.js +7 -0
  196. package/dist/testing/index.d.ts +1 -0
  197. package/dist/testing/index.d.ts.map +1 -1
  198. package/dist/testing/index.js +1 -0
  199. package/dist/theme/index.d.ts +10 -0
  200. package/dist/theme/index.d.ts.map +1 -1
  201. package/dist/useDocumentUpload.d.ts +63 -0
  202. package/dist/useDocumentUpload.d.ts.map +1 -0
  203. package/dist/useDocumentUpload.js +45 -0
  204. package/dist/useIdmissionClient.d.ts +29 -0
  205. package/dist/useIdmissionClient.d.ts.map +1 -0
  206. package/dist/useIdmissionClient.js +44 -0
  207. package/dist/utils/canvas.d.ts.map +1 -1
  208. package/dist/utils/canvas.js +41 -0
  209. package/dist/version.d.ts +1 -1
  210. package/dist/version.d.ts.map +1 -1
  211. package/dist/version.js +1 -1
  212. package/package.json +9 -7
@@ -0,0 +1,193 @@
1
+ // A recorded auto-capture frame log, and the builder that made it.
2
+ //
3
+ // The engine's ring buffer is the deliverable of a tuning session (#341), so
4
+ // "a log round-trips into the replay story" is #353's own resolution
5
+ // criterion. That means the log has to be a first-class, replayable artifact
6
+ // rather than a console paste — hence a shared fixture that the Storybook
7
+ // replay story, the debug-layer tests and the geometry fixtures all read.
8
+ //
9
+ // The numbers below are transcribed from #342's real-corpus measurements, so
10
+ // the story shows what a real POA capture actually looks like rather than
11
+ // round invented values:
12
+ // - a correctly framed sheet fills 0.72-0.97 of the binding axis, a sheet
13
+ // cropped to its address block runs past 1.0 (#343's ground truth)
14
+ // - POA scores 0.73-0.85, while `Single page` collapses to 0.05-0.33 on the
15
+ // same sheet (#339's re-partition finding)
16
+ // - focus on a printed bill reads 0.87-0.92 (#344)
17
+ //
18
+ // The fill window is built by the ENGINE'S OWN aggregator rather than
19
+ // recomputed here, so a fixture cannot drift away from the gate it stands in
20
+ // for — the whole point of #343's ruling is that the verdict is taken on the
21
+ // aggregate, and a hand-rolled mean would be a second implementation of it.
22
+ import { computePoaFillWindow, POA_FILL_MAX, touchesFrameEdge, } from '@idmission/websdk-core/documentCapture';
23
+ /** A 1080x1920 portrait phone frame — the shape AMEX users actually hold. */
24
+ export const FIXTURE_FRAME_WIDTH = 1080;
25
+ export const FIXTURE_FRAME_HEIGHT = 1920;
26
+ const FILL_MIN = 0.7;
27
+ // The engine's own constant, so the fixture cannot drift from the gate.
28
+ const FILL_MAX = POA_FILL_MAX;
29
+ /** #344's POA-specific slot, taken to its 0.5 fallback by #380's live frames. */
30
+ const FOCUS_THRESHOLD = 0.5;
31
+ const STABILITY_THRESHOLD = 0.5;
32
+ const STABILITY_FRAMES = 12;
33
+ const MIN_SCORE = 0.55;
34
+ export function buildAutoCaptureFrame(spec, index = 0) {
35
+ const { bounds, poaScore = 0.81, singlePageScore = 0.09, focusScore = 0.9, worstIou = 0.93, framesTracked = STABILITY_FRAMES, priorFills, } = spec;
36
+ const scores = bounds
37
+ ? { POA: poaScore, 'Single page': singlePageScore }
38
+ : {};
39
+ const box = bounds && {
40
+ xMin: bounds[0] * FIXTURE_FRAME_WIDTH,
41
+ yMin: bounds[1] * FIXTURE_FRAME_HEIGHT,
42
+ xMax: bounds[2] * FIXTURE_FRAME_WIDTH,
43
+ yMax: bounds[3] * FIXTURE_FRAME_HEIGHT,
44
+ width: (bounds[2] - bounds[0]) * FIXTURE_FRAME_WIDTH,
45
+ height: (bounds[3] - bounds[1]) * FIXTURE_FRAME_HEIGHT,
46
+ };
47
+ const framing = bounds &&
48
+ box && {
49
+ leftMargin: bounds[0],
50
+ rightMargin: 1 - bounds[2],
51
+ topMargin: bounds[1],
52
+ bottomMargin: 1 - bounds[3],
53
+ minMargin: Math.min(bounds[0], 1 - bounds[2], bounds[1], 1 - bounds[3]),
54
+ fill: Math.max(bounds[2] - bounds[0], bounds[3] - bounds[1]),
55
+ fillWidth: bounds[2] - bounds[0],
56
+ fillHeight: bounds[3] - bounds[1],
57
+ };
58
+ const fills = framing
59
+ ? [
60
+ framing.fill,
61
+ ...(priorFills ??
62
+ Array.from({ length: STABILITY_FRAMES - 1 }, () => framing.fill)),
63
+ ].slice(0, STABILITY_FRAMES)
64
+ : [];
65
+ // The prior readings are the same sheet in the same place, so they share
66
+ // this frame's contact. Passed rather than left to the default, or a fixture
67
+ // with its box on the frame edge would report a crop as capturable.
68
+ const atEdge = !!box && touchesFrameEdge(box, FIXTURE_FRAME_WIDTH, FIXTURE_FRAME_HEIGHT);
69
+ const fillWindow = computePoaFillWindow(fills, { fillMin: FILL_MIN, fillMax: FILL_MAX, framesNeeded: STABILITY_FRAMES }, fills.map(() => atEdge));
70
+ const isStable = framesTracked >= STABILITY_FRAMES && worstIou >= STABILITY_THRESHOLD;
71
+ // Built in POA_GATE_ORDER: noDocument, tooClose, tooFar, notStable,
72
+ // outOfFocus. `notStable` sits above `outOfFocus` because on paper a focus
73
+ // failure IS a motion failure (#383), so "hold still" is the instruction
74
+ // that fixes both.
75
+ const failingGates = [];
76
+ if (!framing)
77
+ failingGates.push('noDocument');
78
+ if (fillWindow.tooClose)
79
+ failingGates.push('tooClose');
80
+ if (fillWindow.tooFar)
81
+ failingGates.push('tooFar');
82
+ if (!isStable)
83
+ failingGates.push('notStable');
84
+ // The engine reports `focus: null` when there is no box to crop, and an
85
+ // absent signal is not a failing one.
86
+ if (framing && focusScore < FOCUS_THRESHOLD)
87
+ failingGates.push('outOfFocus');
88
+ const satisfied = failingGates.length === 0;
89
+ const timeRunning = index * 33;
90
+ return {
91
+ frameId: index,
92
+ timeRunning,
93
+ detectedObjects: box && framing
94
+ ? [
95
+ { label: 'POA', score: poaScore, box },
96
+ { label: 'Single page', score: singlePageScore, box },
97
+ ]
98
+ : [],
99
+ scores,
100
+ target: box && framing ? { label: 'POA', score: poaScore, box } : null,
101
+ targetMinScore: MIN_SCORE,
102
+ framing,
103
+ fillWindow,
104
+ // Null without a box: the crop IS the box, so there is nothing to score.
105
+ // #353 lost a real detour to this being rendered as "model not loaded".
106
+ focus: framing
107
+ ? {
108
+ score: focusScore,
109
+ threshold: FOCUS_THRESHOLD,
110
+ branch: 'mobile',
111
+ thresholdMet: focusScore >= FOCUS_THRESHOLD,
112
+ predictionTimeMs: 9,
113
+ }
114
+ : null,
115
+ stability: {
116
+ worstIou: box ? worstIou : null,
117
+ threshold: STABILITY_THRESHOLD,
118
+ framesTracked: box ? framesTracked : 0,
119
+ framesNeeded: STABILITY_FRAMES,
120
+ isStable: !!box && isStable,
121
+ },
122
+ failingGates,
123
+ satisfied,
124
+ // The fixtures feed the overlay, not the stabilizer, so the raw code is
125
+ // simply carried through to `displayed`. A replayed session's real
126
+ // debounce history lives in the recorded log, not here.
127
+ guidance: {
128
+ raw: satisfied ? 'holdStill' : (failingGates[0] ?? 'holdStill'),
129
+ pendingCandidate: satisfied ? 'holdStill' : (failingGates[0] ?? 'none'),
130
+ displayed: satisfied ? 'holdStill' : (failingGates[0] ?? 'none'),
131
+ displayedForMs: timeRunning,
132
+ },
133
+ detectionTimeMs: 27,
134
+ frameRate: 34.8,
135
+ // These fixtures declare no guide aspect, so the guide rect IS the frame
136
+ // and every `bounds` fraction below keeps meaning what it meant.
137
+ guideRect: {
138
+ x: 0,
139
+ y: 0,
140
+ width: FIXTURE_FRAME_WIDTH,
141
+ height: FIXTURE_FRAME_HEIGHT,
142
+ },
143
+ frameWidth: FIXTURE_FRAME_WIDTH,
144
+ frameHeight: FIXTURE_FRAME_HEIGHT,
145
+ videoWidth: FIXTURE_FRAME_WIDTH,
146
+ videoHeight: FIXTURE_FRAME_HEIGHT,
147
+ };
148
+ }
149
+ /**
150
+ * One AMEX-shaped framing attempt against #343's two-sided window: the user
151
+ * starts too far back, walks the sheet in, over-corrects until it crops in
152
+ * past `FILL_MAX`, then settles inside the window.
153
+ *
154
+ * The over-corrected frames are the AMEX failure in miniature — a sheet
155
+ * cropped to its address block has paper edge to edge, so its `fill` runs past
156
+ * 1.0 while a complete sheet reads 0.72-0.97. #343 measured exactly this
157
+ * separation, and `dithered` reproduces why the verdict is taken on the
158
+ * aggregate: the same held sheet reads across 2-3 grid cells frame to frame,
159
+ * so the instantaneous value straddles the threshold while the mean does not.
160
+ */
161
+ const FRAMING_ATTEMPT = [
162
+ // Nothing detected: below #342's hard detection floor at 0.40 linear scale.
163
+ { bounds: null, framesTracked: 0 },
164
+ { bounds: null, framesTracked: 0 },
165
+ // Detected but small — `tooFar`. Focus stays high the whole way in: #344
166
+ // found it flat at 0.86-0.93 on a sheet shrunk to 0.4 linear, because the
167
+ // crop is the box. `FILL_MIN` is the only gate that catches this.
168
+ { bounds: [0.28, 0.31, 0.72, 0.69], poaScore: 0.74, focusScore: 0.88, framesTracked: 3 },
169
+ { bounds: [0.23, 0.26, 0.77, 0.74], poaScore: 0.79, focusScore: 0.89, framesTracked: 7 },
170
+ // Over-corrected past FILL_MAX: cropped in, the failure AMEX receives.
171
+ { bounds: [-0.0002, 0.02, 0.994, 0.98], poaScore: 0.83, focusScore: 0.9, worstIou: 0.71 },
172
+ { bounds: [0.004, 0.011, 0.998, 0.986], poaScore: 0.82, focusScore: 0.91, worstIou: 0.88 },
173
+ // Blurred mid-correction: under #344's 0.6 seed, over `singlePage`'s 0.3.
174
+ { bounds: [0.03, 0.04, 0.96, 0.95], poaScore: 0.8, focusScore: 0.38, worstIou: 0.9 },
175
+ // Settled inside the window. Every gate passes — but the instantaneous
176
+ // reading still dithers across the grid, which is what the mean absorbs.
177
+ {
178
+ bounds: [0.03, 0.04, 0.955, 0.95],
179
+ poaScore: 0.81,
180
+ focusScore: 0.9,
181
+ worstIou: 0.96,
182
+ priorFills: [0.938, 0.921, 0.938, 0.905, 0.921, 0.938, 0.921, 0.905, 0.938, 0.921, 0.938],
183
+ },
184
+ {
185
+ bounds: [0.028, 0.04, 0.958, 0.95],
186
+ poaScore: 0.82,
187
+ focusScore: 0.91,
188
+ worstIou: 0.97,
189
+ priorFills: [0.925, 0.938, 0.921, 0.938, 0.905, 0.921, 0.938, 0.921, 0.905, 0.938, 0.921],
190
+ },
191
+ ];
192
+ /** The recorded log, oldest frame first — the order the ring buffer keeps. */
193
+ export const RECORDED_AUTO_CAPTURE_LOG = FRAMING_ATTEMPT.map(buildAutoCaptureFrame);
@@ -1 +1 @@
1
- {"version":3,"file":"buildSelfieState.d.ts","sourceRoot":"","sources":["../../src/testing/buildSelfieState.ts"],"names":[],"mappings":"AAQA,OAAO,EAIL,KAAK,uBAAuB,EAC5B,KAAK,uBAAuB,EAC5B,KAAK,oBAAoB,EACzB,KAAK,iBAAiB,EACtB,KAAK,4BAA4B,EACjC,KAAK,iBAAiB,EACvB,MAAM,sCAAsC,CAAA;AAE7C,wBAAgB,0BAA0B,CACxC,SAAS,GAAE,OAAO,CAAC,4BAA4B,CAAM,GACpD,4BAA4B,CAgB9B;AAMD,eAAO,MAAM,mBAAmB,EAAE,iBAMjC,CAAA;AAED,eAAO,MAAM,mBAAmB,EAAE,iBAIjC,CAAA;AAMD,wBAAgB,mBAAmB,CACjC,SAAS,GAAE,OAAO,CAAC,uBAAuB,CAAM,GAC/C,uBAAuB,CAezB;AAID,wBAAgB,aAAa,CAC3B,SAAS,GAAE,OAAO,CAAC,oBAAoB,CAAM,GAC5C,oBAAoB,CAKtB;AAID,wBAAgB,iBAAiB,CAC/B,SAAS,GAAE,OAAO,CAAC,uBAAuB,CAAM,GAC/C,uBAAuB,CAYzB"}
1
+ {"version":3,"file":"buildSelfieState.d.ts","sourceRoot":"","sources":["../../src/testing/buildSelfieState.ts"],"names":[],"mappings":"AAQA,OAAO,EAIL,KAAK,uBAAuB,EAC5B,KAAK,uBAAuB,EAC5B,KAAK,oBAAoB,EACzB,KAAK,iBAAiB,EACtB,KAAK,4BAA4B,EACjC,KAAK,iBAAiB,EACvB,MAAM,sCAAsC,CAAA;AAE7C,wBAAgB,0BAA0B,CACxC,SAAS,GAAE,OAAO,CAAC,4BAA4B,CAAM,GACpD,4BAA4B,CAmB9B;AAMD,eAAO,MAAM,mBAAmB,EAAE,iBAMjC,CAAA;AAED,eAAO,MAAM,mBAAmB,EAAE,iBAIjC,CAAA;AAMD,wBAAgB,mBAAmB,CACjC,SAAS,GAAE,OAAO,CAAC,uBAAuB,CAAM,GAC/C,uBAAuB,CAiBzB;AAID,wBAAgB,aAAa,CAC3B,SAAS,GAAE,OAAO,CAAC,oBAAoB,CAAM,GAC5C,oBAAoB,CAKtB;AAID,wBAAgB,iBAAiB,CAC/B,SAAS,GAAE,OAAO,CAAC,uBAAuB,CAAM,GAC/C,uBAAuB,CAYzB"}
@@ -21,6 +21,9 @@ export function buildSelfieControllerState(overrides = {}) {
21
21
  liveness: null,
22
22
  challenge: null,
23
23
  livenessTimedOut: false,
24
+ retryPending: false,
25
+ captureRecovery: null,
26
+ handOverFace: { status: 'off', lastCheck: null },
24
27
  ...overrides,
25
28
  };
26
29
  }
@@ -51,6 +54,8 @@ export function faceReadyPrediction(overrides = {}) {
51
54
  faceLookingAway: false,
52
55
  faceTooClose: false,
53
56
  faceTooFar: false,
57
+ eyesClosed: false,
58
+ eyesCalibrating: false,
54
59
  faceReady: true,
55
60
  faceReadyAt: null,
56
61
  faceIsStable: true,
@@ -9,7 +9,7 @@
9
9
  // is declared, and a leaf that stops rendering fails the suite.
10
10
  //
11
11
  // This uses the TypeScript compiler API rather than a regex, for the same
12
- // reason `websdk-compat/scripts/classNameSnapshot.mjs` does: a bag is not
12
+ // reason `websdk-compat/scripts/styleBagSnapshot.mjs` does: a bag is not
13
13
  // always a type literal. `IdCaptureGuidesClassNames` is an INTERSECTION of
14
14
  // three bags, and a literal-only read contributes ZERO leaves for it — the
15
15
  // same "declared but invisible" failure this harness exists to catch. A
@@ -1,5 +1,5 @@
1
1
  import type { SubmissionArtifacts } from '@idmission/websdk-core/client';
2
- import { type DocumentCaptureController, type DocumentCaptureControllerState } from '@idmission/websdk-core/documentCapture';
2
+ import { type AutoCaptureDiagnostics, type DocumentCaptureController, type DocumentCaptureControllerState } from '@idmission/websdk-core/documentCapture';
3
3
  export type FakeDocumentControllerCall = {
4
4
  method: string;
5
5
  args: unknown[];
@@ -24,6 +24,12 @@ export type FakeDocumentControllerOptions = {
24
24
  */
25
25
  isRearFacing?: boolean;
26
26
  artifacts?: SubmissionArtifacts;
27
+ /**
28
+ * Stands in for the engine's ring buffer. The replay story hands back a
29
+ * recorded log here, so `getAutoCaptureLog()` returns real frames without a
30
+ * camera or a model — which is what makes the log round-trip testable.
31
+ */
32
+ autoCaptureLog?: readonly AutoCaptureDiagnostics[];
27
33
  };
28
34
  /**
29
35
  * Unlike the other fakes in this directory, this one drives the REAL reducer
@@ -1 +1 @@
1
- {"version":3,"file":"fakeDocumentController.d.ts","sourceRoot":"","sources":["../../src/testing/fakeDocumentController.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,+BAA+B,CAAA;AACxE,OAAO,EAEL,KAAK,yBAAyB,EAC9B,KAAK,8BAA8B,EACpC,MAAM,wCAAwC,CAAA;AAE/C,MAAM,MAAM,0BAA0B,GAAG;IACvC,MAAM,EAAE,MAAM,CAAA;IACd,IAAI,EAAE,OAAO,EAAE,CAAA;CAChB,CAAA;AAED,MAAM,MAAM,6BAA6B,GAAG,yBAAyB,GAAG;IACtE,KAAK,EAAE,0BAA0B,EAAE,CAAA;IACnC,QAAQ,CAAC,KAAK,EAAE,OAAO,CAAC,8BAA8B,CAAC,GAAG,IAAI,CAAA;IAC9D,8EAA8E;IAC9E,QAAQ,CAAC,aAAa,EAAE,gBAAgB,GAAG,IAAI,CAAA;CAChD,CAAA;AAED,MAAM,MAAM,6BAA6B,GAAG;IAC1C,0EAA0E;IAC1E,WAAW,CAAC,EAAE,OAAO,CAAA;IACrB,yEAAyE;IACzE,eAAe,CAAC,EAAE,IAAI,CAAA;IACtB,6EAA6E;IAC7E,kBAAkB,CAAC,EAAE,MAAM,CAAA;IAC3B;;;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AE,8BAA8B,EAC5C,OAAO,GAAE,6BAAkC,GAC1C,6BAA6B,CA+G/B"}
@@ -1,4 +1,4 @@
1
- import { reduceDocumentCapture, } from '@idmission/websdk-core/documentCapture';
1
+ import { buildAttemptMetadata, reduceDocumentCapture, } from '@idmission/websdk-core/documentCapture';
2
2
  const DEFAULT_CONTENT_URL = 'data:image/gif;base64,R0lGODlhAQABAIAAAP///wAAACH5BAEAAAAALAAAAAABAAEAAAICRAEAOw==';
3
3
  /**
4
4
  * Unlike the other fakes in this directory, this one drives the REAL reducer
@@ -9,7 +9,7 @@ const DEFAULT_CONTENT_URL = 'data:image/gif;base64,R0lGODlhAQABAIAAAP///wAAACH5B
9
9
  * and the network upload are still faked; nothing here touches a device.
10
10
  */
11
11
  export function createFakeDocumentCaptureController(initialState, options = {}) {
12
- const { uploadFails = false, capturedContent = new Blob(['fake-frame'], { type: 'image/jpeg' }), capturedContentUrl = DEFAULT_CONTENT_URL, isRearFacing = true, artifacts = {}, } = options;
12
+ const { uploadFails = false, capturedContent = new Blob(['fake-frame'], { type: 'image/jpeg' }), capturedContentUrl = DEFAULT_CONTENT_URL, isRearFacing = true, artifacts = {}, autoCaptureLog = [], } = options;
13
13
  let state = initialState;
14
14
  let uploadCounter = 0;
15
15
  // Mirrors the real controller's disposal contract so tests written against
@@ -46,6 +46,7 @@ export function createFakeDocumentCaptureController(initialState, options = {})
46
46
  attachedVideo = null;
47
47
  },
48
48
  getState: () => state,
49
+ getAutoCaptureLog: () => autoCaptureLog.slice(),
49
50
  subscribe(listener) {
50
51
  listeners.add(listener);
51
52
  return () => {
@@ -74,6 +75,13 @@ export function createFakeDocumentCaptureController(initialState, options = {})
74
75
  type: 'captureCompleted',
75
76
  content: capturedContent,
76
77
  contentUrl: capturedContentUrl,
78
+ captureMode: 'Manual',
79
+ // The control-arm record: a manual shutter with no engine behind it,
80
+ // and therefore auto-capture fields ABSENT rather than zeroed (#377).
81
+ captureMetadata: buildAttemptMetadata(null, {
82
+ captureMode: 'Manual',
83
+ autoCaptureStatus: 'disabled:unconfigured',
84
+ }),
77
85
  });
78
86
  },
79
87
  retry() {
@@ -1 +1 @@
1
- {"version":3,"file":"fakeSelfieController.d.ts","sourceRoot":"","sources":["../../src/testing/fakeSelfieController.ts"],"names":[],"mappings":"AA+BA,OAAO,KAAK,EACV,uBAAuB,EACvB,4BAA4B,EAE7B,MAAM,sCAAsC,CAAA;AAG7C,MAAM,MAAM,wBAAwB,GAAG;IAAE,MAAM,EAAE,MAAM,CAAC;IAAC,IAAI,EAAE,OAAO,EAAE,CAAA;CAAE,CAAA;AAE1E,MAAM,MAAM,2BAA2B,GAAG,uBAAuB,GAAG;IAClE,QAAQ,CAAC,OAAO,EAAE,OAAO,CAAC,4BAA4B,CAAC,GAAG,IAAI,CAAA;IAC9D,aAAa,EAAE,gBAAgB,GAAG,IAAI,CAAA;IACtC,WAAW,EAAE,MAAM,CAAA;IACnB,KAAK,EAAE,wBAAwB,EAAE,CAAA;IACjC,gBAAgB,CAAC,KAAK,EAAE,OAAO,GAAG,IAAI,CAAA;IACtC,uBAAuB,CAAC,KAAK,EAAE,OAAO,GAAG,IAAI,CAAA;CAC9C,CAAA;AAuBD,wBAAgB,iCAAiC,CAC/C,OAAO,GAAE,OAAO,CAAC,4BAA4B,CAAM,GAClD,2BAA2B,CA+H7B"}
1
+ {"version":3,"file":"fakeSelfieController.d.ts","sourceRoot":"","sources":["../../src/testing/fakeSelfieController.ts"],"names":[],"mappings":"AA+BA,OAAO,KAAK,EACV,uBAAuB,EACvB,4BAA4B,EAE7B,MAAM,sCAAsC,CAAA;AAG7C,MAAM,MAAM,wBAAwB,GAAG;IAAE,MAAM,EAAE,MAAM,CAAC;IAAC,IAAI,EAAE,OAAO,EAAE,CAAA;CAAE,CAAA;AAE1E,MAAM,MAAM,2BAA2B,GAAG,uBAAuB,GAAG;IAClE,QAAQ,CAAC,OAAO,EAAE,OAAO,CAAC,4BAA4B,CAAC,GAAG,IAAI,CAAA;IAC9D,aAAa,EAAE,gBAAgB,GAAG,IAAI,CAAA;IACtC,WAAW,EAAE,MAAM,CAAA;IACnB,KAAK,EAAE,wBAAwB,EAAE,CAAA;IACjC,gBAAgB,CAAC,KAAK,EAAE,OAAO,GAAG,IAAI,CAAA;IACtC,uBAAuB,CAAC,KAAK,EAAE,OAAO,GAAG,IAAI,CAAA;CAC9C,CAAA;AAuBD,wBAAgB,iCAAiC,CAC/C,OAAO,GAAE,OAAO,CAAC,4BAA4B,CAAM,GAClD,2BAA2B,CAwI7B"}
@@ -128,9 +128,16 @@ export function createFakeSelfieCaptureController(initial = {}) {
128
128
  setThrottleMs(ms) {
129
129
  recordCall('setThrottleMs', [ms]);
130
130
  },
131
+ releaseCamera() {
132
+ recordCall('releaseCamera', []);
133
+ },
131
134
  retry() {
132
135
  recordCall('retry', []);
133
136
  },
137
+ exitCapture() {
138
+ recordCall('exitCapture', []);
139
+ setState({ phase: 'loading' });
140
+ },
134
141
  async requestCamera() {
135
142
  recordCall('requestCamera', []);
136
143
  if (queuedRequestCameraRejection) {
@@ -9,6 +9,7 @@ export { createFakeDocumentCaptureController, type FakeDocumentCaptureController
9
9
  export { buildVideoIdControllerState } from './buildVideoIdState';
10
10
  export { createFakeVideoIdCaptureController, type FakeVideoIdCaptureController, type FakeVideoIdControllerCall, } from './fakeVideoIdController';
11
11
  export { createFakeIdmissionClient, buildSubmissionResponse, livenessRejectedResult, type FakeClientSubmitCall, type FakeIdmissionClient, } from './fakeClient';
12
+ export { buildAutoCaptureFrame, RECORDED_AUTO_CAPTURE_LOG, FIXTURE_FRAME_WIDTH, FIXTURE_FRAME_HEIGHT, } from './autoCaptureFrames';
12
13
  export { alignFileAndBlobGlobals } from './alignGlobals';
13
14
  export { stubVideoCaptureDomGlobals } from './stubVideoCaptureDom';
14
15
  export { stubSignatureCanvasGlobals } from './stubSignatureCanvas';
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/testing/index.ts"],"names":[],"mappings":"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CaptureController, } from './fakeDocumentController';
13
13
  export { buildVideoIdControllerState } from './buildVideoIdState';
14
14
  export { createFakeVideoIdCaptureController, } from './fakeVideoIdController';
15
15
  export { createFakeIdmissionClient, buildSubmissionResponse, livenessRejectedResult, } from './fakeClient';
16
+ export { buildAutoCaptureFrame, RECORDED_AUTO_CAPTURE_LOG, FIXTURE_FRAME_WIDTH, FIXTURE_FRAME_HEIGHT, } from './autoCaptureFrames';
16
17
  export { alignFileAndBlobGlobals } from './alignGlobals';
17
18
  export { stubVideoCaptureDomGlobals } from './stubVideoCaptureDom';
18
19
  export { stubSignatureCanvasGlobals } from './stubSignatureCanvas';
@@ -62,6 +62,15 @@ export interface Theme {
62
62
  backgroundColor?: string;
63
63
  textColor?: string;
64
64
  };
65
+ /**
66
+ * Guidance asking the applicant to change something. Only POA document
67
+ * auto-capture reads it so far, and it defaults to amber with near-black
68
+ * text there.
69
+ */
70
+ warning?: {
71
+ backgroundColor?: string;
72
+ textColor?: string;
73
+ };
65
74
  };
66
75
  idCapture?: {
67
76
  loadingOverlay?: {
@@ -131,6 +140,7 @@ export interface Theme {
131
140
  unsatisfiedColor?: string;
132
141
  satisfiedColor?: string;
133
142
  failureColor?: string;
143
+ spotlightColor?: string;
134
144
  };
135
145
  capturePreview?: {
136
146
  disabled?: boolean;
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/theme/index.tsx"],"names":[],"mappings":"AAAA,OAAO,EACL,aAAa,EACb,SAAS,EAGV,MAAM,OAAO,CAAA;AACd,OAAO,EACL,YAAY,EAEb,MAAM,mBAAmB,CAAA;AAC1B,OAAO,EAAE,KAAK,EAAE,MAAM,SAAS,CAAA;AAG/B,MAAM,WAAW,KAAK;IACpB,IAAI,CAAC,EAAE,MAAM,OAAO,MAAM,CAAA;IAE1B,YAAY,CAAC,EAAE,OAAO,CAAA;IACtB,UAAU,CAAC,EAAE,MAAM,CAAA;IACnB,UAAU,CAAC,EAAE,MAAM,CAAA;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AC,EAAE,MAAM,CAAA;SACnB,CAAA;KACF,CAAA;CACF;AA+MD,eAAO,MAAM,MAAM;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAGlB,CAAA;AAED,MAAM,MAAM,UAAU,GAAG,MAAM,OAAO,MAAM,GAAG,KAAK,CAAA;AAEpD,eAAO,MAAM,YAAY,GAAI,OAAO,UAAU,KAAG,YAchD,CAAA;AAED,eAAO,MAAM,aAAa,GAAI,kCAG3B;IACD,QAAQ,EAAE,SAAS,CAAA;IACnB,KAAK,EAAE,UAAU,CAAA;CAClB,4CAkBA,CAAA;AAuBD,OAAO,QAAQ,mBAAmB,CAAC;IAEjC,UAAiB,YAAa,SAAQ,KAAK;KAAG;CAC/C"}
@@ -0,0 +1,63 @@
1
+ import { type DocumentMetadata, type DocumentUploadProgressEvent } from '@idmission/websdk-core/client';
2
+ /**
3
+ * Per-call upload callbacks.
4
+ *
5
+ * These are supplied to each `uploadDocument` call rather than to the hook,
6
+ * and that is the whole point of this hook existing alongside
7
+ * `useIdmissionClient`. The client's `onDocumentUploadProgress` is one
8
+ * callback shared by every upload it performs, so a host uploading several
9
+ * documents at once receives one interleaved stream of events and has to
10
+ * demultiplex them by `event.metadata`. Here each call owns its own
11
+ * `onProgress`, so N concurrent uploads produce N independent progress
12
+ * streams and the host never has to correlate anything.
13
+ */
14
+ export type DocumentUploadHandlers = {
15
+ onProgress?: (event: DocumentUploadProgressEvent) => void;
16
+ onUploaded?: (documentId: string, metadata?: DocumentMetadata) => Promise<void> | void;
17
+ onUploadFailed?: (error: Error, metadata?: DocumentMetadata) => void;
18
+ };
19
+ /**
20
+ * Where to upload. Only `sessionId` is required: the document service URL is
21
+ * derived from the session URN by `resolveClientUrls`, the same resolution
22
+ * the full client uses, so a host that already knows its session does not
23
+ * also have to know its environment's URLs.
24
+ *
25
+ * `sessionId` is live — it may arrive after first render, and the value read
26
+ * is the one committed at the time of the call, never the one captured when
27
+ * the returned function was created.
28
+ */
29
+ export type UseDocumentUploadOptions = {
30
+ sessionId: string | null | undefined;
31
+ authUrl?: string | null;
32
+ documentServiceUrl?: string | null;
33
+ };
34
+ export type UploadDocument = (blob: Blob, metadata?: DocumentMetadata, handlers?: DocumentUploadHandlers) => Promise<string>;
35
+ export type DocumentUploader = {
36
+ /**
37
+ * Uploads one document and resolves to its URN. Each call is independent:
38
+ * two calls in flight at once share no state, no cursor and no progress
39
+ * channel, so `Promise.all([upload(a), upload(b)])` is the supported way to
40
+ * upload several documents concurrently.
41
+ *
42
+ * Rejects if no session is available yet — check `ready` first, or let the
43
+ * rejection surface.
44
+ */
45
+ uploadDocument: UploadDocument;
46
+ /** True once a session is available and `uploadDocument` can be called. */
47
+ ready: boolean;
48
+ };
49
+ /**
50
+ * Uploads documents to the IDmission document service, one independent call
51
+ * at a time, with per-call progress.
52
+ *
53
+ * Use this when the host owns the file-selection UI and needs a document URN
54
+ * back — a multi-file picker with a progress bar per file, say. When the SDK
55
+ * should own capture and submission instead, use the flow components or
56
+ * `useIdmissionClient`.
57
+ *
58
+ * The returned `uploadDocument` keeps a stable identity for the life of the
59
+ * mount, so it is safe in a dependency array; it always reads the latest
60
+ * committed options.
61
+ */
62
+ export declare function useDocumentUpload(options: UseDocumentUploadOptions): DocumentUploader;
63
+ //# sourceMappingURL=useDocumentUpload.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"useDocumentUpload.d.ts","sourceRoot":"","sources":["../src/useDocumentUpload.ts"],"names":[],"mappings":"AACA,OAAO,EAGL,KAAK,gBAAgB,EACrB,KAAK,2BAA2B,EACjC,MAAM,+BAA+B,CAAA;AAItC;;;;;;;;;;;GAWG;AACH,MAAM,MAAM,sBAAsB,GAAG;IACnC,UAAU,CAAC,EAAE,CAAC,KAAK,EAAE,2BAA2B,KAAK,IAAI,CAAA;IACzD,UAAU,CAAC,EAAE,CAAC,UAAU,EAAE,MAAM,EAAE,QAAQ,CAAC,EAAE,gBAAgB,KAAK,OAAO,CAAC,IAAI,CAAC,GAAG,IAAI,CAAA;IACtF,cAAc,CAAC,EAAE,CAAC,KAAK,EAAE,KAAK,EAAE,QAAQ,CAAC,EAAE,gBAAgB,KAAK,IAAI,CAAA;CACrE,CAAA;AAED;;;;;;;;;GASG;AACH,MAAM,MAAM,wBAAwB,GAAG;IACrC,SAAS,EAAE,MAAM,GAAG,IAAI,GAAG,SAAS,CAAA;IACpC,OAAO,CAAC,EAAE,MAAM,GAAG,IAAI,CAAA;IACvB,kBAAkB,CAAC,EAAE,MAAM,GAAG,IAAI,CAAA;CACnC,CAAA;AAED,MAAM,MAAM,cAAc,GAAG,CAC3B,IAAI,EAAE,IAAI,EACV,QAAQ,CAAC,EAAE,gBAAgB,EAC3B,QAAQ,CAAC,EAAE,sBAAsB,KAC9B,OAAO,CAAC,MAAM,CAAC,CAAA;AAEpB,MAAM,MAAM,gBAAgB,GAAG;IAC7B;;;;;;;;OAQG;IACH,cAAc,EAAE,cAAc,CAAA;IAC9B,2EAA2E;IAC3E,KAAK,EAAE,OAAO,CAAA;CACf,CAAA;AAED;;;;;;;;;;;;GAYG;AACH,wBAAgB,iBAAiB,CAAC,OAAO,EAAE,wBAAwB,GAAG,gBAAgB,CAgCrF"}
@@ -0,0 +1,45 @@
1
+ import { useCallback, useEffect, useLayoutEffect, useRef } from 'react';
2
+ import { resolveClientUrls, uploadDocument as coreUploadDocument, } from '@idmission/websdk-core/client';
3
+ const useIsomorphicLayoutEffect = typeof window === 'undefined' ? useEffect : useLayoutEffect;
4
+ /**
5
+ * Uploads documents to the IDmission document service, one independent call
6
+ * at a time, with per-call progress.
7
+ *
8
+ * Use this when the host owns the file-selection UI and needs a document URN
9
+ * back — a multi-file picker with a progress bar per file, say. When the SDK
10
+ * should own capture and submission instead, use the flow components or
11
+ * `useIdmissionClient`.
12
+ *
13
+ * The returned `uploadDocument` keeps a stable identity for the life of the
14
+ * mount, so it is safe in a dependency array; it always reads the latest
15
+ * committed options.
16
+ */
17
+ export function useDocumentUpload(options) {
18
+ const committed = useRef(options);
19
+ useIsomorphicLayoutEffect(() => {
20
+ committed.current = options;
21
+ });
22
+ const uploadDocument = useCallback(async (blob, metadata, handlers) => {
23
+ const { sessionId, authUrl, documentServiceUrl } = committed.current;
24
+ if (!sessionId) {
25
+ throw new Error('IDmission session is not ready');
26
+ }
27
+ const urls = resolveClientUrls({
28
+ sessionId,
29
+ authUrl: authUrl ?? undefined,
30
+ documentServiceUrl: documentServiceUrl ?? undefined,
31
+ });
32
+ return coreUploadDocument(blob, metadata, {
33
+ documentServiceUrl: urls.documentServiceUrl,
34
+ sessionId,
35
+ onProgress: handlers?.onProgress,
36
+ onUploaded: handlers?.onUploaded
37
+ ? async (documentId, uploadedMetadata) => {
38
+ await handlers.onUploaded?.(documentId, uploadedMetadata);
39
+ }
40
+ : undefined,
41
+ onUploadFailed: handlers?.onUploadFailed,
42
+ });
43
+ }, []);
44
+ return { uploadDocument, ready: Boolean(options.sessionId) };
45
+ }
@@ -0,0 +1,29 @@
1
+ import { type IdmissionClient, type IdmissionClientConfig } from '@idmission/websdk-core/client';
2
+ type ClientMountOptions = Pick<IdmissionClientConfig, 'authUrl' | 'submissionUrl' | 'documentServiceUrl' | 'timeoutMs'>;
3
+ type ClientCallbackOptions = Pick<IdmissionClientConfig, 'onBeforeSubmit' | 'onSubmit' | 'onBeforeLivenessCheck' | 'onResponseReceived' | 'onRequestFailure' | 'onBeforeDocumentUpload' | 'onDocumentUploadProgress' | 'onDocumentUploaded' | 'onDocumentUploadFailed' | 'onAuthError'>;
4
+ export type IdmissionClientSession = IdmissionClientConfig['sessionId'] | null | undefined;
5
+ /**
6
+ * React-owned client configuration.
7
+ *
8
+ * `sessionId` is live and may arrive after the first render. It is read when
9
+ * validation or retry resolves a session; changing it does not silently
10
+ * replace an already validated session. The URL and timeout fields are
11
+ * mount-only. Callback presence is also mount-only, while every callback
12
+ * supplied at mount delegates to its latest committed defined implementation.
13
+ *
14
+ * Remount the hook owner with a React `key` to intentionally replace the
15
+ * client or change any mount-only field. In particular, adding or removing
16
+ * `onSubmit` requires a remount because its presence selects customer handoff
17
+ * versus SDK submission.
18
+ */
19
+ export type UseIdmissionClientOptions = ClientMountOptions & ClientCallbackOptions & {
20
+ sessionId: IdmissionClientSession;
21
+ };
22
+ /**
23
+ * Owns one stateful IDmission client for the lifetime of this React mount.
24
+ * Inline options are safe; consumers do not need `useMemo`, `useCallback`, or
25
+ * callback refs to preserve the client or keep its live values current.
26
+ */
27
+ export declare function useIdmissionClient(options: UseIdmissionClientOptions): IdmissionClient;
28
+ export {};
29
+ //# sourceMappingURL=useIdmissionClient.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"useIdmissionClient.d.ts","sourceRoot":"","sources":["../src/useIdmissionClient.ts"],"names":[],"mappings":"AACA,OAAO,EAEL,KAAK,eAAe,EACpB,KAAK,qBAAqB,EAC3B,MAAM,+BAA+B,CAAA;AAKtC,KAAK,kBAAkB,GAAG,IAAI,CAC5B,qBAAqB,EACrB,SAAS,GAAG,eAAe,GAAG,oBAAoB,GAAG,WAAW,CACjE,CAAA;AAED,KAAK,qBAAqB,GAAG,IAAI,CAC/B,qBAAqB,EACnB,gBAAgB,GAChB,UAAU,GACV,uBAAuB,GACvB,oBAAoB,GACpB,kBAAkB,GAClB,wBAAwB,GACxB,0BAA0B,GAC1B,oBAAoB,GACpB,wBAAwB,GACxB,aAAa,CAChB,CAAA;AAED,MAAM,MAAM,sBAAsB,GAAG,qBAAqB,CAAC,WAAW,CAAC,GAAG,IAAI,GAAG,SAAS,CAAA;AAE1F;;;;;;;;;;;;;GAaG;AACH,MAAM,MAAM,yBAAyB,GAAG,kBAAkB,GACxD,qBAAqB,GAAG;IACtB,SAAS,EAAE,sBAAsB,CAAA;CAClC,CAAA;AAEH;;;;GAIG;AACH,wBAAgB,kBAAkB,CAAC,OAAO,EAAE,yBAAyB,GAAG,eAAe,CAuCtF"}
@@ -0,0 +1,44 @@
1
+ import { useEffect, useLayoutEffect, useRef, useState } from 'react';
2
+ import { createIdmissionClient, } from '@idmission/websdk-core/client';
3
+ import { withLatestCallbacks } from './flows/latestCallbacks';
4
+ const useIsomorphicLayoutEffect = typeof window === 'undefined' ? useEffect : useLayoutEffect;
5
+ /**
6
+ * Owns one stateful IDmission client for the lifetime of this React mount.
7
+ * Inline options are safe; consumers do not need `useMemo`, `useCallback`, or
8
+ * callback refs to preserve the client or keep its live values current.
9
+ */
10
+ export function useIdmissionClient(options) {
11
+ const committedSession = useRef(options.sessionId);
12
+ const committedCallbacks = useRef(options);
13
+ useIsomorphicLayoutEffect(() => {
14
+ committedSession.current = options.sessionId;
15
+ committedCallbacks.current = {
16
+ onBeforeSubmit: options.onBeforeSubmit ?? committedCallbacks.current.onBeforeSubmit,
17
+ onSubmit: options.onSubmit ?? committedCallbacks.current.onSubmit,
18
+ onBeforeLivenessCheck: options.onBeforeLivenessCheck ?? committedCallbacks.current.onBeforeLivenessCheck,
19
+ onResponseReceived: options.onResponseReceived ?? committedCallbacks.current.onResponseReceived,
20
+ onRequestFailure: options.onRequestFailure ?? committedCallbacks.current.onRequestFailure,
21
+ onBeforeDocumentUpload: options.onBeforeDocumentUpload ?? committedCallbacks.current.onBeforeDocumentUpload,
22
+ onDocumentUploadProgress: options.onDocumentUploadProgress ?? committedCallbacks.current.onDocumentUploadProgress,
23
+ onDocumentUploaded: options.onDocumentUploaded ?? committedCallbacks.current.onDocumentUploaded,
24
+ onDocumentUploadFailed: options.onDocumentUploadFailed ?? committedCallbacks.current.onDocumentUploadFailed,
25
+ onAuthError: options.onAuthError ?? committedCallbacks.current.onAuthError,
26
+ };
27
+ });
28
+ return useState(() => {
29
+ const mountedCallbacks = options;
30
+ const liveCallbacks = withLatestCallbacks(mountedCallbacks, () => committedCallbacks.current);
31
+ return createIdmissionClient({
32
+ ...options,
33
+ ...liveCallbacks,
34
+ sessionId: async () => {
35
+ const session = committedSession.current;
36
+ if (typeof session === 'function')
37
+ return session();
38
+ if (!session)
39
+ throw new Error('IDmission session is not ready');
40
+ return session;
41
+ },
42
+ });
43
+ })[0];
44
+ }
@@ -1 +1 @@
1
- {"version":3,"file":"canvas.d.ts","sourceRoot":"","sources":["../../src/utils/canvas.ts"],"names":[],"mappings":"AAAA,wBAAgB,mBAAmB,CACjC,MAAM,EAAE,iBAAiB,EACzB,KAAK,EAAE,MAAM,EACb,MAAM,EAAE,MAAM,QAUf;AAED,wBAAgB,qBAAqB,CAAC,MAAM,EAAE,iBAAiB,QAK9D"}
1
+ {"version":3,"file":"canvas.d.ts","sourceRoot":"","sources":["../../src/utils/canvas.ts"],"names":[],"mappings":"AAkCA,wBAAgB,mBAAmB,CACjC,MAAM,EAAE,iBAAiB,EACzB,KAAK,EAAE,MAAM,EACb,MAAM,EAAE,MAAM,QAoBf;AAED,wBAAgB,qBAAqB,CAAC,MAAM,EAAE,iBAAiB,QAK9D"}