@idmission/websdk-ui 0.2.0-rc.1 → 0.2.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.
- package/README.md +147 -56
- package/dist/DocumentCaptureView.d.ts +37 -0
- package/dist/DocumentCaptureView.d.ts.map +1 -1
- package/dist/DocumentCaptureView.js +489 -6
- package/dist/FaceLivenessView.d.ts +1 -1
- package/dist/FaceLivenessView.d.ts.map +1 -1
- package/dist/FaceLivenessView.js +37 -29
- package/dist/IdCaptureView.d.ts +6 -5
- package/dist/IdCaptureView.d.ts.map +1 -1
- package/dist/IdCaptureView.js +52 -12
- package/dist/SelfieCaptureView.d.ts +1 -1
- package/dist/SelfieCaptureView.d.ts.map +1 -1
- package/dist/SelfieCaptureView.js +6 -3
- package/dist/SignatureCaptureView.d.ts +9 -1
- package/dist/SignatureCaptureView.d.ts.map +1 -1
- package/dist/SignatureCaptureView.js +51 -10
- package/dist/VideoIdCaptureView.d.ts +1 -1
- package/dist/VideoIdCaptureView.d.ts.map +1 -1
- package/dist/VideoIdCaptureView.js +24 -4
- package/dist/components/CameraFeed.d.ts +11 -3
- package/dist/components/CameraFeed.d.ts.map +1 -1
- package/dist/components/CameraFeed.js +24 -4
- package/dist/components/barcode/BarcodeGuideOverlay.d.ts +7 -1
- package/dist/components/barcode/BarcodeGuideOverlay.d.ts.map +1 -1
- package/dist/components/barcode/BarcodeGuideOverlay.js +2 -2
- package/dist/components/debug/debug.d.ts +4 -4
- package/dist/components/document/DocumentCaptureAutoCaptureDebugLayer.d.ts +29 -0
- package/dist/components/document/DocumentCaptureAutoCaptureDebugLayer.d.ts.map +1 -0
- package/dist/components/document/DocumentCaptureAutoCaptureDebugLayer.js +274 -0
- package/dist/components/document/DocumentCaptureAutoCaptureGuidance.d.ts +56 -0
- package/dist/components/document/DocumentCaptureAutoCaptureGuidance.d.ts.map +1 -0
- package/dist/components/document/DocumentCaptureAutoCaptureGuidance.js +101 -0
- package/dist/components/document/DocumentCaptureGuideOverlay.d.ts +31 -1
- package/dist/components/document/DocumentCaptureGuideOverlay.d.ts.map +1 -1
- package/dist/components/document/DocumentCaptureGuideOverlay.js +121 -2
- package/dist/components/document/DocumentCaptureReviewScreen.d.ts +44 -0
- package/dist/components/document/DocumentCaptureReviewScreen.d.ts.map +1 -0
- package/dist/components/document/DocumentCaptureReviewScreen.js +40 -0
- package/dist/components/document/types.d.ts +25 -0
- package/dist/components/document/types.d.ts.map +1 -1
- package/dist/components/document/types.js +18 -1
- package/dist/components/guides/IdCaptureGuides.d.ts.map +1 -1
- package/dist/components/guides/IdCaptureGuides.js +3 -4
- package/dist/components/review/ReviewScreen.d.ts.map +1 -1
- package/dist/components/review/ReviewScreen.js +1 -1
- package/dist/components/review/SignatureCaptureDiagnostics.d.ts +50 -0
- package/dist/components/review/SignatureCaptureDiagnostics.d.ts.map +1 -0
- package/dist/components/review/SignatureCaptureDiagnostics.js +142 -0
- package/dist/components/selfie/SelfieCaptureSurface.d.ts +11 -2
- package/dist/components/selfie/SelfieCaptureSurface.d.ts.map +1 -1
- package/dist/components/selfie/SelfieCaptureSurface.js +5 -2
- package/dist/components/videoId/VideoIdCaptureGuides.d.ts +4 -1
- package/dist/components/videoId/VideoIdCaptureGuides.d.ts.map +1 -1
- package/dist/components/videoId/VideoIdCaptureGuides.js +2 -2
- package/dist/flows/CompositeWizard.d.ts +5 -0
- package/dist/flows/CompositeWizard.d.ts.map +1 -1
- package/dist/flows/CompositeWizard.js +2 -1
- package/dist/flows/CustomerBiometricsEnrollmentFlow.d.ts +13 -0
- package/dist/flows/CustomerBiometricsEnrollmentFlow.d.ts.map +1 -1
- package/dist/flows/CustomerBiometricsEnrollmentFlow.js +8 -3
- package/dist/flows/CustomerIdAndBiometricsEnrollmentFlow.d.ts +25 -0
- package/dist/flows/CustomerIdAndBiometricsEnrollmentFlow.d.ts.map +1 -1
- package/dist/flows/CustomerIdAndBiometricsEnrollmentFlow.js +12 -5
- package/dist/flows/DocumentCaptureFlow.d.ts +7 -1
- package/dist/flows/DocumentCaptureFlow.d.ts.map +1 -1
- package/dist/flows/DocumentCaptureFlow.js +10 -7
- package/dist/flows/FaceValidationFlow.d.ts +7 -0
- package/dist/flows/FaceValidationFlow.d.ts.map +1 -1
- package/dist/flows/FaceValidationFlow.js +6 -2
- package/dist/flows/IdAndFaceValidationFlow.d.ts +19 -0
- package/dist/flows/IdAndFaceValidationFlow.d.ts.map +1 -1
- package/dist/flows/IdAndFaceValidationFlow.js +10 -4
- package/dist/flows/IdValidationFlow.d.ts +12 -0
- package/dist/flows/IdValidationFlow.d.ts.map +1 -1
- package/dist/flows/IdValidationFlow.js +6 -2
- package/dist/flows/SignatureKYCFlow.d.ts +13 -0
- package/dist/flows/SignatureKYCFlow.d.ts.map +1 -1
- package/dist/flows/SignatureKYCFlow.js +8 -3
- package/dist/flows/SubmissionProvider.d.ts.map +1 -1
- package/dist/flows/SubmissionProvider.js +2 -4
- package/dist/flows/VideoIdValidationFlow.d.ts +25 -1
- package/dist/flows/VideoIdValidationFlow.d.ts.map +1 -1
- package/dist/flows/VideoIdValidationFlow.js +12 -5
- package/dist/flows/approval.d.ts +15 -0
- package/dist/flows/approval.d.ts.map +1 -0
- package/dist/flows/approval.js +19 -0
- package/dist/flows/autoCaptureMountGuard.d.ts +22 -0
- package/dist/flows/autoCaptureMountGuard.d.ts.map +1 -0
- package/dist/flows/autoCaptureMountGuard.js +61 -0
- package/dist/flows/customerMatch/CustomerMatchFlow.d.ts +7 -0
- package/dist/flows/customerMatch/CustomerMatchFlow.d.ts.map +1 -1
- package/dist/flows/customerMatch/CustomerMatchFlow.js +4 -1
- package/dist/flows/latestCallbacks.d.ts +31 -0
- package/dist/flows/latestCallbacks.d.ts.map +1 -0
- package/dist/flows/latestCallbacks.js +56 -0
- package/dist/flows/ringScreens.d.ts +0 -3
- package/dist/flows/ringScreens.d.ts.map +1 -1
- package/dist/flows/ringScreens.js +2 -3
- package/dist/guidance/selfieStrings.d.ts +9 -1
- package/dist/guidance/selfieStrings.d.ts.map +1 -1
- package/dist/guidance/selfieStrings.js +59 -20
- package/dist/i18n/index.d.ts +28 -1177
- package/dist/i18n/index.d.ts.map +1 -1
- package/dist/i18n/index.js +58 -22
- package/dist/i18n/locales/threeOh.d.ts +4 -0
- package/dist/i18n/locales/threeOh.d.ts.map +1 -0
- package/dist/i18n/locales/threeOh.js +105 -0
- package/dist/index.d.ts +3 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +1 -0
- package/dist/testing/autoCaptureFrames.d.ts +23 -0
- package/dist/testing/autoCaptureFrames.d.ts.map +1 -0
- package/dist/testing/autoCaptureFrames.js +187 -0
- package/dist/testing/fakeDocumentController.d.ts +7 -1
- package/dist/testing/fakeDocumentController.d.ts.map +1 -1
- package/dist/testing/fakeDocumentController.js +10 -2
- package/dist/testing/index.d.ts +1 -0
- package/dist/testing/index.d.ts.map +1 -1
- package/dist/testing/index.js +1 -0
- package/dist/useIdmissionClient.d.ts +29 -0
- package/dist/useIdmissionClient.d.ts.map +1 -0
- package/dist/useIdmissionClient.js +44 -0
- package/dist/utils/canvas.d.ts.map +1 -1
- package/dist/utils/canvas.js +41 -0
- package/dist/version.d.ts +1 -1
- package/dist/version.d.ts.map +1 -1
- package/dist/version.js +1 -1
- package/package.json +3 -2
|
@@ -0,0 +1,142 @@
|
|
|
1
|
+
import { jsx as _jsx, Fragment as _Fragment, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
import { useMemo } from 'react';
|
|
3
|
+
import { styled } from 'styled-components';
|
|
4
|
+
import { TRIM_PADDING_END_MS, TRIM_PADDING_START_MS, } from '@idmission/websdk-core/signature';
|
|
5
|
+
export const ASSUMED_TRIM_PADDING = {
|
|
6
|
+
startMs: TRIM_PADDING_START_MS,
|
|
7
|
+
endMs: TRIM_PADDING_END_MS,
|
|
8
|
+
};
|
|
9
|
+
export function describeSignatureTrimWindow(metadata, padding = ASSUMED_TRIM_PADDING) {
|
|
10
|
+
const timing = metadata?.timingData;
|
|
11
|
+
if (!timing)
|
|
12
|
+
return { kind: 'unavailable', reason: 'no timing data' };
|
|
13
|
+
const { recordingStartedAt, signatureStartedAt, signatureEndedAt, recordingStoppedAt } = timing;
|
|
14
|
+
if (!recordingStartedAt || !recordingStoppedAt) {
|
|
15
|
+
return { kind: 'unavailable', reason: 'no recording bounds' };
|
|
16
|
+
}
|
|
17
|
+
if (!signatureStartedAt || !signatureEndedAt) {
|
|
18
|
+
return { kind: 'unavailable', reason: 'no signature marks — backend trims nothing' };
|
|
19
|
+
}
|
|
20
|
+
const recordingMs = recordingStoppedAt - recordingStartedAt;
|
|
21
|
+
const startMs = Math.max(signatureStartedAt - recordingStartedAt - padding.startMs, 0);
|
|
22
|
+
const endMs = Math.min(signatureEndedAt - recordingStartedAt + padding.endMs, recordingMs);
|
|
23
|
+
// The backend's own two refusals, reproduced so this reads the same way the
|
|
24
|
+
// trim task will: equal or reversed timestamps abort the trim entirely and
|
|
25
|
+
// the untrimmed clip goes to the PDF.
|
|
26
|
+
if (startMs === endMs)
|
|
27
|
+
return { kind: 'unavailable', reason: 'timestamps equal — trim aborts' };
|
|
28
|
+
if (startMs > endMs)
|
|
29
|
+
return { kind: 'unavailable', reason: 'timestamps out of order — trim aborts' };
|
|
30
|
+
return {
|
|
31
|
+
kind: 'window',
|
|
32
|
+
startMs,
|
|
33
|
+
endMs,
|
|
34
|
+
lengthMs: endMs - startMs,
|
|
35
|
+
shareOfRecording: recordingMs > 0 ? (endMs - startMs) / recordingMs : 0,
|
|
36
|
+
};
|
|
37
|
+
}
|
|
38
|
+
/**
|
|
39
|
+
* A trim that keeps most of the recording is not trimming. The threshold is a
|
|
40
|
+
* reviewer's prompt to look closer, not a spec: a genuinely long signature
|
|
41
|
+
* legitimately fills its recording, which is exactly why the fix belongs at
|
|
42
|
+
* the marks and never at a cap on the window.
|
|
43
|
+
*/
|
|
44
|
+
const TRIM_SHARE_SUSPECT = 0.7;
|
|
45
|
+
const secs = (ms) => ms === undefined ? '—' : `${(ms / 1000).toFixed(2)}s`;
|
|
46
|
+
const offset = (at, from) => at === undefined || at === 0 || from === undefined
|
|
47
|
+
? '—'
|
|
48
|
+
: `${at - from >= 0 ? '+' : ''}${((at - from) / 1000).toFixed(2)}s`;
|
|
49
|
+
const bytes = (n) => n === undefined ? '—' : `${(n / 1048576).toFixed(2)} MB (${n.toLocaleString()} B)`;
|
|
50
|
+
const bool = (value) => value === undefined ? '—' : value ? 'yes' : 'no';
|
|
51
|
+
export function SignatureCaptureDiagnostics({ artifact, className, }) {
|
|
52
|
+
const { metadata, videoBlob, validity } = artifact;
|
|
53
|
+
const trim = useMemo(() => describeSignatureTrimWindow(metadata), [metadata]);
|
|
54
|
+
const timing = metadata?.timingData;
|
|
55
|
+
const diagnostics = metadata?.diagnostics;
|
|
56
|
+
const started = timing?.recordingStartedAt;
|
|
57
|
+
const recordingMs = timing?.recordingStoppedAt && started ? timing.recordingStoppedAt - started : undefined;
|
|
58
|
+
const leadInMs = timing?.signatureStartedAt && started ? timing.signatureStartedAt - started : undefined;
|
|
59
|
+
const signingMs = timing?.signatureStartedAt && timing?.signatureEndedAt
|
|
60
|
+
? timing.signatureEndedAt - timing.signatureStartedAt
|
|
61
|
+
: undefined;
|
|
62
|
+
const tailMs = timing?.recordingStoppedAt && timing?.signatureEndedAt
|
|
63
|
+
? timing.recordingStoppedAt - timing.signatureEndedAt
|
|
64
|
+
: undefined;
|
|
65
|
+
return (_jsx(Panel, { className: className, "data-testid": "signature-capture-diagnostics", children: _jsx(Table, { children: _jsxs("tbody", { children: [_jsx(SectionRow, { label: "Trim window (backend formula, assumed padding)" }), trim.kind === 'window' ? (_jsxs(_Fragment, { children: [_jsx(Row, { label: "Clip start", value: secs(trim.startMs) }), _jsx(Row, { label: "Clip end", value: secs(trim.endMs) }), _jsx(Row, { label: "Clip length", value: secs(trim.lengthMs) }), _jsx(Row, { label: "Share of recording", value: `${Math.round(trim.shareOfRecording * 100)}%`, suspect: trim.shareOfRecording > TRIM_SHARE_SUSPECT, note: trim.shareOfRecording > TRIM_SHARE_SUSPECT
|
|
66
|
+
? 'the clip is nearly the whole recording — check the signature marks below'
|
|
67
|
+
: undefined })] })) : (_jsx(Row, { label: "Clip", value: trim.reason, suspect: true })), _jsx(Row, { label: "Padding assumed", value: `${secs(ASSUMED_TRIM_PADDING.startMs)} before / ${secs(ASSUMED_TRIM_PADDING.endMs)} after`, note: "the backend reads these from its own config; if it was set differently, the clip above shifts by the difference" }), _jsx(SectionRow, { label: "Marks (offset from recording start)" }), _jsx(Row, { label: "Start requested", value: offset(timing?.recordingStartRequestedAt, started) }), _jsx(Row, { label: "Recording started", value: started ? '+0.00s' : '—' }), _jsx(Row, { label: "First chunk", value: offset(timing?.firstChunkReceivedAt, started) }), _jsx(Row, { label: "Signature started", value: offset(timing?.signatureStartedAt, started) }), _jsx(Row, { label: "Signature ended", value: offset(timing?.signatureEndedAt, started) }), _jsx(Row, { label: "Accept clicked", value: offset(timing?.acceptClickedAt, started) }), _jsx(Row, { label: "Stop requested", value: offset(timing?.recordingStopRequestedAt, started) }), _jsx(Row, { label: "Last chunk", value: offset(timing?.lastChunkReceivedAt, started) }), _jsx(Row, { label: "Recording stopped", value: offset(timing?.recordingStoppedAt, started) }), _jsx(SectionRow, { label: "Intervals" }), _jsx(Row, { label: "Lead-in", value: secs(leadInMs), note: "recording start \u2192 first ink" }), _jsx(Row, { label: "Signing window", value: secs(signingMs), note: "first ink \u2192 last ink" }), _jsx(Row, { label: "Tail", value: secs(tailMs), note: "last ink \u2192 recording stop" }), _jsx(Row, { label: "Recording", value: secs(recordingMs) }), _jsx(SectionRow, { label: "Recording quality" }), _jsx(Row, { label: "MIME type", value: metadata?.mimeType ?? '—' }), _jsx(Row, { label: "Video size", value: bytes(videoBlob?.size) }), _jsx(Row, { label: "Signing FPS", value: diagnostics?.signingWindowFps?.toFixed(2) ?? '—' }), _jsx(Row, { label: "Frames", value: `${diagnostics?.totalFramesDrawn ?? '—'} drawn / ${diagnostics?.signingWindowFrameCount ?? '—'} in window` }), _jsx(Row, { label: "Max frame gap", value: secs(diagnostics?.maxFrameGapMs) }), _jsx(Row, { label: "Null chunks", value: String(diagnostics?.nullChunksReceived ?? '—') }), _jsx(Row, { label: "Final chunk", value: diagnostics?.finalChunkReceived === undefined
|
|
68
|
+
? '—'
|
|
69
|
+
: `${bool(diagnostics.finalChunkReceived)}${diagnostics.finalChunkTimedOut ? ' (timed out)' : ''} after ${secs(diagnostics.finalChunkWaitedMs)}`, suspect: diagnostics?.finalChunkTimedOut === true }), _jsx(Row, { label: "Times cleared", value: String(diagnostics?.timesSignatureCleared ?? '—') }), _jsx(Row, { label: "Hidden during capture", value: bool(diagnostics?.wasHiddenDuringCapture), suspect: diagnostics?.wasHiddenDuringCapture === true }), diagnostics?.recorderDiedState ? (_jsx(Row, { label: "Recorder died", value: `${diagnostics.recorderDiedState}${diagnostics.recorderDiedError ? ` — ${diagnostics.recorderDiedError}` : ''}`, suspect: true })) : null, diagnostics?.qualityWarning ? (_jsx(Row, { label: "Quality warning", value: `score ${diagnostics.qualityWarning.score} (watermark ${diagnostics.qualityWarning.watermarkScore})`, note: trippedSignals(diagnostics.qualityWarning) || undefined, suspect: true })) : null, _jsx(SectionRow, { label: "Signature validity" }), _jsx(Row, { label: "Valid", value: bool(validity?.isValid), suspect: validity?.isValid === false }), _jsx(Row, { label: "Concern", value: validity
|
|
70
|
+
? `${bool(validity.concern)} (${validity.concernScore}/${validity.concernThreshold})`
|
|
71
|
+
: '—', suspect: validity?.concern === true }), _jsx(Row, { label: "Points / strokes", value: validity
|
|
72
|
+
? `${validity.metrics.pointCount} / ${validity.metrics.strokeCount}`
|
|
73
|
+
: '—' })] }) }) }));
|
|
74
|
+
}
|
|
75
|
+
/** The signal names that tripped, so the score has a cause next to it. */
|
|
76
|
+
function trippedSignals(warning) {
|
|
77
|
+
const { device, frameDecode, ...top } = warning.signals;
|
|
78
|
+
const tripped = [
|
|
79
|
+
...Object.entries(top)
|
|
80
|
+
.filter(([, signal]) => signal?.tripped)
|
|
81
|
+
.map(([name]) => name),
|
|
82
|
+
...Object.entries(device)
|
|
83
|
+
.filter(([, signal]) => signal?.tripped)
|
|
84
|
+
.map(([name]) => `device.${name}`),
|
|
85
|
+
...(frameDecode?.tripped ? ['frameDecode'] : []),
|
|
86
|
+
];
|
|
87
|
+
return tripped.length ? `tripped: ${tripped.join(', ')}` : '';
|
|
88
|
+
}
|
|
89
|
+
function SectionRow({ label }) {
|
|
90
|
+
return (_jsx("tr", { children: _jsx(SectionCell, { colSpan: 2, children: label }) }));
|
|
91
|
+
}
|
|
92
|
+
function Row({ label, value, note, suspect, }) {
|
|
93
|
+
return (_jsxs("tr", { children: [_jsx(LabelCell, { children: label }), _jsxs(ValueCell, { "$suspect": suspect ?? false, children: [value, note ? _jsx(Note, { children: note }) : null] })] }));
|
|
94
|
+
}
|
|
95
|
+
const MONO = "'Monaco', 'Menlo', 'Ubuntu Mono', monospace";
|
|
96
|
+
const Panel = styled.div `
|
|
97
|
+
flex-shrink: 0;
|
|
98
|
+
width: min(720px, 90vw);
|
|
99
|
+
margin-top: 0.75rem;
|
|
100
|
+
padding: 0.625rem;
|
|
101
|
+
background: #f8f9fa;
|
|
102
|
+
border: 1px solid #e9ecef;
|
|
103
|
+
border-radius: 6px;
|
|
104
|
+
text-align: left;
|
|
105
|
+
overflow-x: auto;
|
|
106
|
+
`;
|
|
107
|
+
const Table = styled.table `
|
|
108
|
+
width: 100%;
|
|
109
|
+
border-collapse: collapse;
|
|
110
|
+
font-family: ${MONO};
|
|
111
|
+
font-size: 0.8125rem;
|
|
112
|
+
line-height: 1.35;
|
|
113
|
+
`;
|
|
114
|
+
const SectionCell = styled.th `
|
|
115
|
+
padding: 0.5rem 0 0.25rem;
|
|
116
|
+
border-bottom: 1px solid #e9ecef;
|
|
117
|
+
color: #495057;
|
|
118
|
+
font-size: 0.75rem;
|
|
119
|
+
font-weight: 700;
|
|
120
|
+
letter-spacing: 0.04em;
|
|
121
|
+
text-align: left;
|
|
122
|
+
text-transform: uppercase;
|
|
123
|
+
`;
|
|
124
|
+
const LabelCell = styled.td `
|
|
125
|
+
width: 45%;
|
|
126
|
+
padding: 0.1875rem 0.5rem 0.1875rem 0;
|
|
127
|
+
color: #495057;
|
|
128
|
+
font-weight: 600;
|
|
129
|
+
vertical-align: top;
|
|
130
|
+
`;
|
|
131
|
+
const ValueCell = styled.td `
|
|
132
|
+
padding: 0.1875rem 0;
|
|
133
|
+
color: ${(props) => (props.$suspect ? '#842029' : '#212529')};
|
|
134
|
+
font-weight: ${(props) => (props.$suspect ? 700 : 400)};
|
|
135
|
+
vertical-align: top;
|
|
136
|
+
word-break: break-word;
|
|
137
|
+
`;
|
|
138
|
+
const Note = styled.span `
|
|
139
|
+
display: block;
|
|
140
|
+
color: #6c757d;
|
|
141
|
+
font-weight: 400;
|
|
142
|
+
`;
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { ReactElement, ReactNode, type RefObject } from 'react';
|
|
2
|
-
import
|
|
2
|
+
import { FaceMessageCode } from '@idmission/websdk-core/selfieCapture';
|
|
3
|
+
import type { SelfieCaptureController, SelfieCaptureControllerState, SelfieGuidanceCode } from '@idmission/websdk-core/selfieCapture';
|
|
3
4
|
import { type FaceCaptureGuideOverlayClassNames, type FaceGuideStatus } from './FaceCaptureGuideOverlay';
|
|
4
5
|
import { type GuidanceMessageVariant } from '../GuidanceMessage';
|
|
5
6
|
import { type SelfieCaptureLoadingOverlayAssets, type SelfieCaptureLoadingOverlayClassNames, type SelfieCaptureLoadingOverlayColors, type SelfieCaptureLoadingOverlayMode, type SelfieCaptureLoadingOverlayVerbiage } from '../selfie_loading/SelfieCaptureLoadingOverlay';
|
|
@@ -94,6 +95,14 @@ export type SelfieCaptureSurfaceProps = {
|
|
|
94
95
|
showGuidancePill: boolean;
|
|
95
96
|
guidanceText: ReactNode;
|
|
96
97
|
guidanceVariant: GuidanceMessageVariant;
|
|
98
|
+
/**
|
|
99
|
+
* Stable identifier for the message currently in the pill, emitted as
|
|
100
|
+
* `data-guidance-code` so customers can target one message from their own
|
|
101
|
+
* stylesheet. `MANUAL_CAPTURE` is substituted here rather than by the callers
|
|
102
|
+
* because the manual-capture prompt REPLACES guidance in the same pill, so
|
|
103
|
+
* the code has to follow whichever text actually rendered.
|
|
104
|
+
*/
|
|
105
|
+
guidanceCode?: FaceMessageCode | SelfieGuidanceCode;
|
|
97
106
|
/** Renders sdk2's face-detection debug overlay (box + keypoints/mesh +
|
|
98
107
|
* sample points) and DebugStatsPane readout -- sdk2 SelfieCapture.tsx:
|
|
99
108
|
* 346-453. Default false; both SelfieCaptureView and FaceLivenessView
|
|
@@ -122,5 +131,5 @@ export type SelfieCaptureSurfaceProps = {
|
|
|
122
131
|
colors?: SelfieCaptureSurfaceColors;
|
|
123
132
|
assets?: SelfieCaptureSurfaceAssets;
|
|
124
133
|
};
|
|
125
|
-
export declare function SelfieCaptureSurface({ controller, state, loadingOverlayMode, sessionReady, autoContinueAfterLoading, showIntroScreen, transitionFromIdCapture, onExit, onLoadingStarted, onLoadingProgress, onLoadingCompleted, onLoadingFailed, onLoadingOverlayDismissed, onCameraAccessDenied, onModelError, onCameraTamperingDetected, onExitAfterTamperSealPopped, onUserCancel, customOverlayContent, allowManualSelfieCaptureOnLoadingError, fallbackCapture, silentFallback, manualCaptureText, manualCaptureButtonText, videoRef, renderCameraFeed, renderFaceGuide, showCaptureSurface, maskStatus, showGuidancePill, guidanceText, guidanceVariant, debugMode, showFaceLandmarks, debugShowSamplePoints, verbiage, classNames, colors, assets, }: SelfieCaptureSurfaceProps): ReactElement;
|
|
134
|
+
export declare function SelfieCaptureSurface({ controller, state, loadingOverlayMode, sessionReady, autoContinueAfterLoading, showIntroScreen, transitionFromIdCapture, onExit, onLoadingStarted, onLoadingProgress, onLoadingCompleted, onLoadingFailed, onLoadingOverlayDismissed, onCameraAccessDenied, onModelError, onCameraTamperingDetected, onExitAfterTamperSealPopped, onUserCancel, customOverlayContent, allowManualSelfieCaptureOnLoadingError, fallbackCapture, silentFallback, manualCaptureText, manualCaptureButtonText, videoRef, renderCameraFeed, renderFaceGuide, showCaptureSurface, maskStatus, showGuidancePill, guidanceText, guidanceVariant, guidanceCode, debugMode, showFaceLandmarks, debugShowSamplePoints, verbiage, classNames, colors, assets, }: SelfieCaptureSurfaceProps): ReactElement;
|
|
126
135
|
//# sourceMappingURL=SelfieCaptureSurface.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"SelfieCaptureSurface.d.ts","sourceRoot":"","sources":["../../../src/components/selfie/SelfieCaptureSurface.tsx"],"names":[],"mappings":"AA8BA,OAAO,EACL,YAAY,EACZ,SAAS,EACT,KAAK,SAAS,EAKf,MAAM,OAAO,CAAA;AAEd,OAAO,KAAK,EACV,uBAAuB,EACvB,4BAA4B,
|
|
1
|
+
{"version":3,"file":"SelfieCaptureSurface.d.ts","sourceRoot":"","sources":["../../../src/components/selfie/SelfieCaptureSurface.tsx"],"names":[],"mappings":"AA8BA,OAAO,EACL,YAAY,EACZ,SAAS,EACT,KAAK,SAAS,EAKf,MAAM,OAAO,CAAA;AAEd,OAAO,EAAE,eAAe,EAAE,MAAM,sCAAsC,CAAA;AACtE,OAAO,KAAK,EACV,uBAAuB,EACvB,4BAA4B,EAC5B,kBAAkB,EACnB,MAAM,sCAAsC,CAAA;AAE7C,OAAO,EAEL,KAAK,iCAAiC,EACtC,KAAK,eAAe,EACrB,MAAM,2BAA2B,CAAA;AAClC,OAAO,EAGL,KAAK,sBAAsB,EAC5B,MAAM,oBAAoB,CAAA;AAG3B,OAAO,EAEL,KAAK,iCAAiC,EACtC,KAAK,qCAAqC,EAC1C,KAAK,iCAAiC,EACtC,KAAK,+BAA+B,EACpC,KAAK,mCAAmC,EACzC,MAAM,+CAA+C,CAAA;AACtD,OAAO,EAEL,KAAK,qBAAqB,EAC1B,KAAK,mBAAmB,EACzB,MAAM,sBAAsB,CAAA;AAC7B,OAAO,EAEL,KAAK,+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oB;IACpB,SAAS,CAAC,EAAE,OAAO,CAAA;IACnB,iBAAiB,CAAC,EAAE,OAAO,CAAA;IAC3B;;;;;;;;OAQG;IACH,qBAAqB,CAAC,EAAE,OAAO,CAAA;IAC/B,QAAQ,CAAC,EAAE,4BAA4B,CAAA;IACvC,UAAU,CAAC,EAAE,8BAA8B,CAAA;IAC3C,MAAM,CAAC,EAAE,0BAA0B,CAAA;IACnC,MAAM,CAAC,EAAE,0BAA0B,CAAA;CACpC,CAAA;AAED,wBAAgB,oBAAoB,CAAC,EACnC,UAAU,EACV,KAAK,EACL,kBAAkB,EAClB,YAAY,EACZ,wBAAwB,EACxB,eAAe,EACf,uBAAuB,EACvB,MAAM,EACN,gBAAgB,EAChB,iBAAiB,EACjB,kBAAkB,EAClB,eAAe,EACf,yBAAyB,EACzB,oBAAoB,EACpB,YAAY,EACZ,yBAAyB,EACzB,2BAA2B,EAC3B,YAAY,EACZ,oBAAoB,EACpB,sCAA8C,EAC9C,eAAsB,EACtB,cAAsB,EACtB,iBAAiB,EACjB,uBAAuB,EACvB,QAAQ,EACR,gBAAuB,EACvB,eAAsB,EACtB,kBAAkB,EAClB,UAAU,EACV,gBAAgB,EAChB,YAAY,EACZ,eAAe,EACf,YAAY,EACZ,SAAiB,EACjB,iBAAyB,EACzB,qBAA4B,EAC5B,QAAa,EACb,UAAe,EACf,MAAW,EACX,MAAW,GACZ,EAAE,yBAAyB,GAAG,YAAY,CAma1C"}
|
|
@@ -31,6 +31,7 @@ import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-run
|
|
|
31
31
|
// `state.capturedSelfie`/`state.liveness`.
|
|
32
32
|
import { useCallback, useEffect, useRef, useState, } from 'react';
|
|
33
33
|
import { styled } from 'styled-components';
|
|
34
|
+
import { FaceMessageCode } from '@idmission/websdk-core/selfieCapture';
|
|
34
35
|
import { SelfieCameraFeed } from './SelfieCameraFeed';
|
|
35
36
|
import { FaceCaptureGuideOverlay, } from './FaceCaptureGuideOverlay';
|
|
36
37
|
import { GuidanceMessage, GuidanceMessageContainer, } from '../GuidanceMessage';
|
|
@@ -40,7 +41,7 @@ import { SelfieCaptureLoadingOverlay, } from '../selfie_loading/SelfieCaptureLoa
|
|
|
40
41
|
import { ErrorScreen, } from '../error/ErrorScreen';
|
|
41
42
|
import { SelfieCaptureFallback, } from '../fallback/SelfieCaptureFallback';
|
|
42
43
|
import { DebugStatsPane, FaceDetectionKeypointMarker, ObjectDetectionDebugOverlayDiv, SelfieCaptureFaceDebugBox, useDebugScalingDetails, } from '../debug/debug';
|
|
43
|
-
export function SelfieCaptureSurface({ controller, state, loadingOverlayMode, sessionReady, autoContinueAfterLoading, showIntroScreen, transitionFromIdCapture, onExit, onLoadingStarted, onLoadingProgress, onLoadingCompleted, onLoadingFailed, onLoadingOverlayDismissed, onCameraAccessDenied, onModelError, onCameraTamperingDetected, onExitAfterTamperSealPopped, onUserCancel, customOverlayContent, allowManualSelfieCaptureOnLoadingError = false, fallbackCapture = true, silentFallback = false, manualCaptureText, manualCaptureButtonText, videoRef, renderCameraFeed = true, renderFaceGuide = true, showCaptureSurface, maskStatus, showGuidancePill, guidanceText, guidanceVariant, debugMode = false, showFaceLandmarks = false, debugShowSamplePoints = true, verbiage = {}, classNames = {}, colors = {}, assets = {}, }) {
|
|
44
|
+
export function SelfieCaptureSurface({ controller, state, loadingOverlayMode, sessionReady, autoContinueAfterLoading, showIntroScreen, transitionFromIdCapture, onExit, onLoadingStarted, onLoadingProgress, onLoadingCompleted, onLoadingFailed, onLoadingOverlayDismissed, onCameraAccessDenied, onModelError, onCameraTamperingDetected, onExitAfterTamperSealPopped, onUserCancel, customOverlayContent, allowManualSelfieCaptureOnLoadingError = false, fallbackCapture = true, silentFallback = false, manualCaptureText, manualCaptureButtonText, videoRef, renderCameraFeed = true, renderFaceGuide = true, showCaptureSurface, maskStatus, showGuidancePill, guidanceText, guidanceVariant, guidanceCode, debugMode = false, showFaceLandmarks = false, debugShowSamplePoints = true, verbiage = {}, classNames = {}, colors = {}, assets = {}, }) {
|
|
44
45
|
// Same ref-callback + effect-keyed-only-on-[controller] pattern as
|
|
45
46
|
// IdCaptureView/SelfieCaptureView (see SelfieCaptureView.tsx's header
|
|
46
47
|
// comment for the full rationale).
|
|
@@ -201,7 +202,9 @@ export function SelfieCaptureSurface({ controller, state, loadingOverlayMode, se
|
|
|
201
202
|
controller.actions.retry();
|
|
202
203
|
}
|
|
203
204
|
}, [controller, state.error]);
|
|
204
|
-
return (_jsxs(_Fragment, { children: [renderCameraFeed ? (_jsx(SelfieCameraFeed, { videoRef: setVideoRef, isRearFacing: state.camera.isRearFacing, className: classNames.cameraFeed })) : null, renderFaceGuide && showCaptureSurface && (_jsx(FaceCaptureGuideOverlay, { status: maskStatus, classNames: classNames.guides })), (showGuidancePill || manualCaptureEnabled) && (_jsx(GuidanceMessageContainer, { "$top": "12px", className: classNames.guidanceMessageContainer, children: _jsx(GuidanceMessage, { "$variant": guidanceVariant, className: classNames.guidanceMessage,
|
|
205
|
+
return (_jsxs(_Fragment, { children: [renderCameraFeed ? (_jsx(SelfieCameraFeed, { videoRef: setVideoRef, isRearFacing: state.camera.isRearFacing, className: classNames.cameraFeed })) : null, renderFaceGuide && showCaptureSurface && (_jsx(FaceCaptureGuideOverlay, { status: maskStatus, classNames: classNames.guides })), (showGuidancePill || manualCaptureEnabled) && (_jsx(GuidanceMessageContainer, { "$top": "12px", className: classNames.guidanceMessageContainer, children: _jsx(GuidanceMessage, { "$variant": guidanceVariant, className: classNames.guidanceMessage, "data-guidance-code": manualCaptureEnabled
|
|
206
|
+
? FaceMessageCode.MANUAL_CAPTURE
|
|
207
|
+
: guidanceCode, children: manualCaptureEnabled ? manualCaptureText : guidanceText }) })), manualCaptureEnabled && (_jsx(ManualCaptureButtonContainer, { className: classNames.manualCaptureBtnContainer, children: _jsx(LoaderButton, { variant: "positive", finished: true, className: classNames.manualCaptureBtn, onClick: () => controller.actions.captureNow(), children: manualCaptureButtonText }) })), (debugMode || showFaceLandmarks) &&
|
|
205
208
|
showCaptureSurface &&
|
|
206
209
|
state.prediction?.face && (_jsxs(ObjectDetectionDebugOverlayDiv, { children: [_jsx(SelfieCaptureFaceDebugBox, { face: state.prediction.face, scaling: debugScaling, color: state.prediction.faceReady ? 'green' : 'red', showBoundingBox: debugMode, showLandmarks: debugMode || showFaceLandmarks }), debugMode &&
|
|
207
210
|
debugShowSamplePoints &&
|
|
@@ -3,6 +3,7 @@ import { type IdCardGuideStatus } from '../guides/IdCaptureGuidesCommon';
|
|
|
3
3
|
import { type IdCaptureGuideImages } from '../guide_images';
|
|
4
4
|
import type { FlipIdPromptClassNames } from '../guides/FlipIdPrompt';
|
|
5
5
|
import type { FaceGuideStatus } from '../selfie/FaceCaptureGuideOverlay';
|
|
6
|
+
import type { VideoIdCaptureGuidanceCode } from '@idmission/websdk-core/videoIdCapture';
|
|
6
7
|
export type VideoIdCaptureGuideAction = 'SHOW_ID_FRONT' | 'FLIP_ID' | 'SHOW_ID_BACK' | 'SHOW_PASSPORT';
|
|
7
8
|
export type VideoIdCaptureGuidesClassNames = {
|
|
8
9
|
container?: string;
|
|
@@ -21,6 +22,8 @@ export type VideoIdCaptureGuidesProps = {
|
|
|
21
22
|
requestedAction?: VideoIdCaptureGuideAction;
|
|
22
23
|
idDocumentType?: 'idCard' | 'passport';
|
|
23
24
|
instruction?: ReactNode;
|
|
25
|
+
/** Stable identifier for `instruction`, emitted as `data-guidance-code`. */
|
|
26
|
+
guidanceCode?: VideoIdCaptureGuidanceCode;
|
|
24
27
|
satisfied?: boolean;
|
|
25
28
|
faceGuideStatus?: FaceGuideStatus;
|
|
26
29
|
faceGuideBorderWidth?: number;
|
|
@@ -38,5 +41,5 @@ export type VideoIdCaptureGuidesProps = {
|
|
|
38
41
|
* stage. Unlike the standalone ID overlay, both subjects remain framed in a
|
|
39
42
|
* single camera composition while the document advances through its stages.
|
|
40
43
|
*/
|
|
41
|
-
export declare function VideoIdCaptureGuides({ requestedAction, idDocumentType, instruction, satisfied, faceGuideStatus, faceGuideBorderWidth, faceGuideBorderColor, idCardGuideStatus, idCardGuideBorderWidth, idCardGuideBorderColor, idCardCaptureProgress, images: suppliedImages, isMirrored, classNames, }: VideoIdCaptureGuidesProps): import("react/jsx-runtime").JSX.Element;
|
|
44
|
+
export declare function VideoIdCaptureGuides({ requestedAction, idDocumentType, instruction, guidanceCode, satisfied, faceGuideStatus, faceGuideBorderWidth, faceGuideBorderColor, idCardGuideStatus, idCardGuideBorderWidth, idCardGuideBorderColor, idCardCaptureProgress, images: suppliedImages, isMirrored, classNames, }: VideoIdCaptureGuidesProps): import("react/jsx-runtime").JSX.Element;
|
|
42
45
|
//# sourceMappingURL=VideoIdCaptureGuides.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"VideoIdCaptureGuides.d.ts","sourceRoot":"","sources":["../../../src/components/videoId/VideoIdCaptureGuides.tsx"],"names":[],"mappings":"AAAA,OAAO,EAEL,KAAK,SAAS,EAMf,MAAM,OAAO,CAAA;AAId,OAAO,EAGL,KAAK,iBAAiB,EACvB,MAAM,iCAAiC,CAAA;AACxC,OAAO,EAGL,KAAK,oBAAoB,EAG1B,MAAM,iBAAiB,CAAA;AACxB,OAAO,KAAK,EAAE,sBAAsB,EAAE,MAAM,wBAAwB,CAAA;AACpE,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,mCAAmC,CAAA;
|
|
1
|
+
{"version":3,"file":"VideoIdCaptureGuides.d.ts","sourceRoot":"","sources":["../../../src/components/videoId/VideoIdCaptureGuides.tsx"],"names":[],"mappings":"AAAA,OAAO,EAEL,KAAK,SAAS,EAMf,MAAM,OAAO,CAAA;AAId,OAAO,EAGL,KAAK,iBAAiB,EACvB,MAAM,iCAAiC,CAAA;AACxC,OAAO,EAGL,KAAK,oBAAoB,EAG1B,MAAM,iBAAiB,CAAA;AACxB,OAAO,KAAK,EAAE,sBAAsB,EAAE,MAAM,wBAAwB,CAAA;AACpE,OAAO,KAAK,E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C,EAAE,8BAA8B,CAAA;CAC5C,CAAA;AAED;;;;GAIG;AACH,wBAAgB,oBAAoB,CAAC,EACnC,eAAiC,EACjC,cAAyB,EACzB,WAAW,EACX,YAAY,EACZ,SAAiB,EACjB,eAA2B,EAC3B,oBAAoB,EACpB,oBAAoB,EACpB,iBAA2B,EAC3B,sBAAsB,EACtB,sBAAsB,EACtB,qBAAqB,EACrB,MAAM,EAAE,cAA4C,EACpD,UAAkB,EAClB,UAAe,GAChB,EAAE,yBAAyB,2CA0I3B"}
|
|
@@ -12,7 +12,7 @@ import useResizeObserver from '../../layout/useResizeObserver';
|
|
|
12
12
|
* stage. Unlike the standalone ID overlay, both subjects remain framed in a
|
|
13
13
|
* single camera composition while the document advances through its stages.
|
|
14
14
|
*/
|
|
15
|
-
export function VideoIdCaptureGuides({ requestedAction = 'SHOW_ID_FRONT', idDocumentType = 'idCard', instruction, satisfied = false, faceGuideStatus = 'success', faceGuideBorderWidth, faceGuideBorderColor, idCardGuideStatus = 'ready', idCardGuideBorderWidth, idCardGuideBorderColor, idCardCaptureProgress, images: suppliedImages = defaultIdCaptureGuideImages, isMirrored = false, classNames = {}, }) {
|
|
15
|
+
export function VideoIdCaptureGuides({ requestedAction = 'SHOW_ID_FRONT', idDocumentType = 'idCard', instruction, guidanceCode, satisfied = false, faceGuideStatus = 'success', faceGuideBorderWidth, faceGuideBorderColor, idCardGuideStatus = 'ready', idCardGuideBorderWidth, idCardGuideBorderColor, idCardCaptureProgress, images: suppliedImages = defaultIdCaptureGuideImages, isMirrored = false, classNames = {}, }) {
|
|
16
16
|
const theme = useTheme();
|
|
17
17
|
const resolvedFaceBorderWidth = faceGuideBorderWidth ?? theme.idVideoCapture?.faceGuides?.borderWidth ?? 5;
|
|
18
18
|
const resolvedFaceBorderColor = faceGuideBorderColor ??
|
|
@@ -55,7 +55,7 @@ export function VideoIdCaptureGuides({ requestedAction = 'SHOW_ID_FRONT', idDocu
|
|
|
55
55
|
height: '100%',
|
|
56
56
|
aspectRatio,
|
|
57
57
|
}), [aspectRatio, idCardGuideHeight, idCardGuideWidth]);
|
|
58
|
-
return (_jsx(Container, { className: classNames.container, children: _jsxs(Inner, { children: [_jsx(FaceGuideContainer, { className: classNames.faceGuideContainer, children: _jsx(SelfieCaptureAnimatedMaskWithStatus, { className: classNames.faceGuide, status: faceGuideStatus, borderWidth: resolvedFaceBorderWidth, borderColor: resolvedFaceBorderColor, verticalAlign: "bottom" }) }), _jsx(IdCardGuideContainer, { ref: idCardGuideRef, className: classNames.idCardGuideContainer, children: _jsxs(IdCardGuideInner, { className: classNames.idCardGuideInner, style: { aspectRatio }, children: [_jsx(StyledIdCardGuideImageContainer, { className: classNames.idCardGuideImageContainer, status: idCardGuideStatus, borderWidth: resolvedIdBorderWidth, borderColor: resolvedIdBorderColor, aspectRatio: aspectRatio, "$isVisible": requestedAction !== 'FLIP_ID', progress: idCardCaptureProgress, children: _jsx(IdCardGuideImage, { alt: "", className: classNames.idCardGuideImage, "$isMirrored": isMirrored, style: imageStyle, src: currentImage.url, onLoad: onImageLoaded }) }), requestedAction === 'FLIP_ID' ? (_jsx(VideoIdCaptureFlipPrompt, { images: images, isMirrored: isMirrored, borderWidth: resolvedIdBorderWidth, borderColor: resolvedIdBorderColor, imageStyle: imageStyle, aspectRatio: aspectRatio, classNames: classNames.flipIdPrompt })) : null] }) }), _jsx(InstructionsContainer, { className: classNames.instructionsContainer, children: _jsx(Instructions, { className: classNames.instructions, "$textColor": theme.idVideoCapture?.idCardGuides?.instructionsTextColor, "$background": theme.idVideoCapture?.idCardGuides?.instructionsBackgroundColor, children: instruction }) })] }) }));
|
|
58
|
+
return (_jsx(Container, { className: classNames.container, children: _jsxs(Inner, { children: [_jsx(FaceGuideContainer, { className: classNames.faceGuideContainer, children: _jsx(SelfieCaptureAnimatedMaskWithStatus, { className: classNames.faceGuide, status: faceGuideStatus, borderWidth: resolvedFaceBorderWidth, borderColor: resolvedFaceBorderColor, verticalAlign: "bottom" }) }), _jsx(IdCardGuideContainer, { ref: idCardGuideRef, className: classNames.idCardGuideContainer, children: _jsxs(IdCardGuideInner, { className: classNames.idCardGuideInner, style: { aspectRatio }, children: [_jsx(StyledIdCardGuideImageContainer, { className: classNames.idCardGuideImageContainer, status: idCardGuideStatus, borderWidth: resolvedIdBorderWidth, borderColor: resolvedIdBorderColor, aspectRatio: aspectRatio, "$isVisible": requestedAction !== 'FLIP_ID', progress: idCardCaptureProgress, children: _jsx(IdCardGuideImage, { alt: "", className: classNames.idCardGuideImage, "$isMirrored": isMirrored, style: imageStyle, src: currentImage.url, onLoad: onImageLoaded }) }), requestedAction === 'FLIP_ID' ? (_jsx(VideoIdCaptureFlipPrompt, { images: images, isMirrored: isMirrored, borderWidth: resolvedIdBorderWidth, borderColor: resolvedIdBorderColor, imageStyle: imageStyle, aspectRatio: aspectRatio, classNames: classNames.flipIdPrompt })) : null] }) }), _jsx(InstructionsContainer, { className: classNames.instructionsContainer, children: _jsx(Instructions, { className: classNames.instructions, "data-guidance-code": guidanceCode, "$textColor": theme.idVideoCapture?.idCardGuides?.instructionsTextColor, "$background": theme.idVideoCapture?.idCardGuides?.instructionsBackgroundColor, children: instruction }) })] }) }));
|
|
59
59
|
}
|
|
60
60
|
function VideoIdCaptureFlipPrompt({ images, isMirrored, borderWidth, borderColor, imageStyle, aspectRatio, classNames = {}, }) {
|
|
61
61
|
const orientation = getOrientation(true);
|
|
@@ -16,6 +16,11 @@ export type CompositeWizardFinishingScreenProps = {
|
|
|
16
16
|
/** Ports sdk2 CompositeWizard.tsx:118-123. */
|
|
17
17
|
export type CompositeWizardSuccessScreenProps = {
|
|
18
18
|
mode?: 'default' | 'ring';
|
|
19
|
+
/**
|
|
20
|
+
* Whether the response earns the ring success screen. Defaults to the
|
|
21
|
+
* action-keyed `isApprovedResponse`, the same verdict `onApproved` uses;
|
|
22
|
+
* a flow with no server verdict (signature KYC) supplies `() => true`.
|
|
23
|
+
*/
|
|
19
24
|
isApproved?: (response: SubmissionResponse) => boolean;
|
|
20
25
|
verbiage?: RingSuccessScreenVerbiage;
|
|
21
26
|
classNames?: RingSuccessScreenClassNames;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"CompositeWizard.d.ts","sourceRoot":"","sources":["../../src/flows/CompositeWizard.tsx"],"names":[],"mappings":"AAAA,OAAO,EACL,KAAK,SAAS,EAMf,MAAM,OAAO,CAAA;AACd,OAAO,EAEL,gBAAgB,EAEhB,KAAK,mBAAmB,EACxB,KAAK,kBAAkB,EACxB,MAAM,+BAA+B,CAAA;AAQtC,OAAO,EAEL,KAAK,2BAA2B,EACjC,MAAM,qBAAqB,CAAA;
|
|
1
|
+
{"version":3,"file":"CompositeWizard.d.ts","sourceRoot":"","sources":["../../src/flows/CompositeWizard.tsx"],"names":[],"mappings":"AAAA,OAAO,EACL,KAAK,SAAS,EAMf,MAAM,OAAO,CAAA;AACd,OAAO,EAEL,gBAAgB,EAEhB,KAAK,mBAAmB,EACxB,KAAK,kBAAkB,EACxB,MAAM,+BAA+B,CAAA;AAQtC,OAAO,EAEL,KAAK,2BAA2B,EACjC,MAAM,qBAAqB,CAAA;AAK5B,OAAO,EAEL,KAAK,6BAA6B,EAClC,KAAK,2BAA2B,EACjC,MAAM,wCAAwC,CAAA;AAC/C,OAAO,EAEL,KAAK,2BAA2B,EAChC,KAAK,yBAAyB,EAC/B,MAAM,sCAAsC,CAAA;AAG7C,MAAM,MAAM,mBAAmB,GAAG;IAChC,EAAE,EAAE,MAAM,CAAA;IACV,MAAM,EAAE,CAAC,QAAQ,EAAE,CAAC,SAAS,CAAC,EAAE,mBAAmB,KAAK,IAAI,KAAK,SAAS,CAAA;CAC3E,CAAA;AAED,8CAA8C;AAC9C,MAAM,MAAM,mCAAmC,GAAG;IAChD,IAAI,CAAC,EAAE,SAAS,GAAG,MAAM,CAAA;IACzB,QAAQ,CAAC,EAAE,2BAA2B,CAAA;IACtC,UAAU,CAAC,EAAE,6BAA6B,CAAA;CAC3C,CAAA;AAED,8CAA8C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AAgB,EAChB,eAAe,EACf,aAAa,GACd,EAAE,oBAAoB,2UAqLtB;AAED;;;;;GAKG;AACH,wBAAgB,sBAAsB,CACpC,SAAS,EAAE,mBAAmB,GAC7B,MAAM,EAAE,CAgBV;AAaD,wBAAgB,oBAAoB,CAClC,MAAM,EAAE,gBAAgB,EACxB,SAAS,EAAE,mBAAmB,GAC7B,MAAM,CA8BR"}
|
|
@@ -6,6 +6,7 @@ import { completeFlowStep, createFlowSequence, isFlowSequenceComplete, } from '.
|
|
|
6
6
|
import { SubmissionErrorOverlay } from './overlays';
|
|
7
7
|
import { SubmissionSuccess, } from './SubmissionSuccess';
|
|
8
8
|
import { useSubmission } from './SubmissionProvider';
|
|
9
|
+
import { isApprovedResponse } from './approval';
|
|
9
10
|
import { OrbStatusScreen } from './OrbStatusScreen';
|
|
10
11
|
import { useSessionReady } from './AuthStateContext';
|
|
11
12
|
import { RingFinishingScreen, } from '../components/ring/RingFinishingScreen';
|
|
@@ -124,7 +125,7 @@ export function CompositeWizard({ steps, sessionReady: sessionReadyProp, initial
|
|
|
124
125
|
if (submissionStatus === SubmissionStatus.SUBMITTED &&
|
|
125
126
|
submissionResponse &&
|
|
126
127
|
successScreen?.mode === 'ring' &&
|
|
127
|
-
successScreen.isApproved
|
|
128
|
+
(successScreen.isApproved ?? ((r) => isApprovedResponse(action, r)))(submissionResponse)) {
|
|
128
129
|
return (_jsx(RingSuccessScreen, { elapsedMs: readFlowElapsedMs(), capturedLabels: capturedArtifactLabels(artifactsRef.current), verbiage: successScreen.verbiage, classNames: successScreen.classNames }));
|
|
129
130
|
}
|
|
130
131
|
if (submissionStatus === SubmissionStatus.SUBMITTED &&
|
|
@@ -8,7 +8,20 @@ export type CustomerBiometricsEnrollmentFlowProps = Omit<CommonFlowProps, 'submi
|
|
|
8
8
|
};
|
|
9
9
|
selfieController?: SelfieCaptureController;
|
|
10
10
|
signatureController?: SignatureCaptureController;
|
|
11
|
+
/**
|
|
12
|
+
* Controller configuration. Read ONCE, when the flow builds its controller:
|
|
13
|
+
* changing a non-callback field after mount has no effect — remount with a
|
|
14
|
+
* `key` or pass your own `controller`. Callback fields follow the latest
|
|
15
|
+
* render, so the whole object can be written inline. `checkLivenessOptions` is the
|
|
16
|
+
* exception: it is read live on every liveness check.
|
|
17
|
+
*/
|
|
11
18
|
faceCapture?: FaceLivenessFlowConfig;
|
|
19
|
+
/**
|
|
20
|
+
* Controller configuration. Read ONCE, when the flow builds its controller:
|
|
21
|
+
* changing a non-callback field after mount has no effect — remount with a
|
|
22
|
+
* `key` or pass your own `controller`. Callback fields follow the latest
|
|
23
|
+
* render, so the whole object can be written inline.
|
|
24
|
+
*/
|
|
12
25
|
signatureCapture?: SignatureCaptureControllerConfig;
|
|
13
26
|
faceView?: FaceLivenessFlowViewProps;
|
|
14
27
|
signatureView?: SignatureFlowViewProps;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"CustomerBiometricsEnrollmentFlow.d.ts","sourceRoot":"","sources":["../../src/flows/CustomerBiometricsEnrollmentFlow.tsx"],"names":[],"mappings":"AAiBA,OAAO,EAEL,KAAK,uBAAuB,EAC7B,MAAM,sCAAsC,CAAA;AAE7C,OAAO,EAEL,KAAK,0BAA0B,EAC/B,KAAK,gCAAgC,EACtC,MAAM,yCAAyC,CAAA;
|
|
1
|
+
{"version":3,"file":"CustomerBiometricsEnrollmentFlow.d.ts","sourceRoot":"","sources":["../../src/flows/CustomerBiometricsEnrollmentFlow.tsx"],"names":[],"mappings":"AAiBA,OAAO,EAEL,KAAK,uBAAuB,EAC7B,MAAM,sCAAsC,CAAA;AAE7C,OAAO,EAEL,KAAK,0BAA0B,EAC/B,KAAK,gCAAgC,EACtC,MAAM,yCAAyC,CAAA;AAiBhD,OAAO,EAIL,KAAK,sBAAsB,EAC3B,KAAK,sBAAsB,EAC5B,MAAM,iBAAiB,CAAA;AACxB,OAAO,KAAK,EACV,eAAe,EACf,sBAAsB,EACtB,yBAAyB,EACzB,oBAAoB,EACrB,MAAM,SAAS,CAAA;AAEhB,MAAM,MAAM,qCAAqC,GAAG,IAAI,CACtD,eAAe,EACf,YAAY,CACb,GAAG;IACF,UAAU,EAAE,oBAAoB,GAAG;QAAE,YAAY,EAAE,MAAM,CAAA;KAAE,CAAA;IAC3D,gBAAgB,CAAC,EAAE,uBAAuB,CAAA;IAC1C,mBAAmB,CAAC,EAAE,0BAA0B,CAAA;IAChD;;;;;;OAMG;IACH,WAAW,CAAC,EAAE,sBAAsB,CAAA;IACpC;;;;;OAKG;IACH,gBAAgB,CAAC,EAAE,gCAAgC,CAAA;IACnD,QAAQ,CAAC,EAAE,yBAAyB,CAAA;IACpC,aAAa,CAAC,EAAE,sBAAsB,CAAA;IACtC,6DAA6D;IAC7D,gBAAgB,CAAC,EAAE,sBAAsB,CAAA;IACzC;;;;OAIG;IACH,qBAAqB,CAAC,EAAE,sBAAsB,CAAA;IAC9C,qEAAqE;IACrE,mBAAmB,CAAC,EAAE,OAAO,CAAA;IAC7B,cAAc,CAAC,EAAE,CAAC,KAAK,EAAE,KAAK,KAAK,IAAI,CAAA;CACxC,CAAA;AAOD,wBAAgB,gCAAgC,CAAC,EAC/C,MAAM,EACN,UAAU,EACV,gBAAgB,EAChB,mBAAmB,EACnB,WAAgC,EAChC,gBAA0C,EAC1C,QAA0B,EAC1B,aAAa,EACb,gBAAgB,EAChB,qBAAqB,EACrB,mBAAmB,EACnB,gBAAkC,EAClC,KAAK,EACL,SAAS,EACT,iBAAyB,EACzB,eAAuB,EACvB,0BAA0B,EAC1B,4BAA4B,EAC5B,oBAAoB,EACpB,WAAW,EACX,cAAc,EACd,QAAQ,EACR,GAAG,SAAS,EACb,EAAE,qCAAqC,2CAyLvC"}
|
|
@@ -21,6 +21,7 @@ import { CompositeWizard } from './CompositeWizard';
|
|
|
21
21
|
import { buildAdditionalDocumentsStep } from './additionalDocuments';
|
|
22
22
|
import { buildSelfieArtifacts } from './artifacts';
|
|
23
23
|
import { FlowChassis } from './FlowChassis';
|
|
24
|
+
import { useLatestCallbacks } from './latestCallbacks';
|
|
24
25
|
import { buildRingScreenProps } from './ringScreens';
|
|
25
26
|
import { impliedAutoContinueAfterLoading, impliedSkipSuccessScreen, isRingIntroActive, } from './ringIntroImplications';
|
|
26
27
|
import { createSharedCameraAcquirer, withVirtualCameras, } from './sharedCamera';
|
|
@@ -31,6 +32,10 @@ const EMPTY_FACE_VIEW = {};
|
|
|
31
32
|
const EMPTY_ARTIFACTS = {};
|
|
32
33
|
export function CustomerBiometricsEnrollmentFlow({ client, submission, selfieController, signatureController, faceCapture = EMPTY_FACE_CAPTURE, signatureCapture = EMPTY_SIGNATURE_CAPTURE, faceView = EMPTY_FACE_VIEW, signatureView, captureSignature, captureSignatureVideo, allowVirtualCameras, initialArtifacts = EMPTY_ARTIFACTS, theme, className, showSuccessScreen = false, showDiagnostics = false, captureAdditionalDocuments, additionalDocumentClassNames, ringScreenClassNames, onSubmitted, onCaptureError, children, ...callbacks }) {
|
|
33
34
|
const { checkLivenessOptions, ...selfieCaptureConfig } = faceCapture;
|
|
35
|
+
// Config callbacks follow the latest render; see useLatestCallbacks.
|
|
36
|
+
const latestSelfieCapture = useLatestCallbacks(selfieCaptureConfig);
|
|
37
|
+
const latestSelfieLiveness = useLatestCallbacks(selfieCaptureConfig.liveness);
|
|
38
|
+
const latestSignatureCapture = useLatestCallbacks(signatureCapture);
|
|
34
39
|
const clientRef = useRef(client);
|
|
35
40
|
const checkLivenessOptionsRef = useRef(checkLivenessOptions);
|
|
36
41
|
useEffect(() => {
|
|
@@ -50,12 +55,12 @@ export function CustomerBiometricsEnrollmentFlow({ client, submission, selfieCon
|
|
|
50
55
|
acquireCamera));
|
|
51
56
|
const [resolvedSelfieController] = useState(() => selfieController ??
|
|
52
57
|
createSelfieCaptureController({
|
|
53
|
-
...
|
|
58
|
+
...latestSelfieCapture,
|
|
54
59
|
camera: withVirtualCameras(selfieCaptureConfig.camera, allowVirtualCameras),
|
|
55
60
|
deferCameraAcquisition: selfieCaptureConfig.deferCameraAcquisition ??
|
|
56
61
|
isRingIntroActive(faceView),
|
|
57
62
|
liveness: {
|
|
58
|
-
...
|
|
63
|
+
...latestSelfieLiveness,
|
|
59
64
|
checkLiveness: (image) => clientRef.current.checkLiveness(image, checkLivenessOptionsRef.current),
|
|
60
65
|
},
|
|
61
66
|
io: { ...selfieCaptureConfig.io, acquireCamera: sharedAcquireCamera },
|
|
@@ -63,7 +68,7 @@ export function CustomerBiometricsEnrollmentFlow({ client, submission, selfieCon
|
|
|
63
68
|
const [resolvedSignatureController] = useState(() => signatureMode
|
|
64
69
|
? (signatureController ??
|
|
65
70
|
createSignatureCaptureController({
|
|
66
|
-
...
|
|
71
|
+
...latestSignatureCapture,
|
|
67
72
|
// `signatureMode`, NOT `signatureCapture.mode ?? signatureMode`:
|
|
68
73
|
// `buildSignatureStep` picks the STAGE from the captureSignature /
|
|
69
74
|
// captureSignatureVideo pair alone, so honouring a stale mode
|
|
@@ -13,9 +13,34 @@ export type CustomerIdAndBiometricsEnrollmentFlowProps = Omit<CommonFlowProps, '
|
|
|
13
13
|
selfieController?: SelfieCaptureController;
|
|
14
14
|
signatureController?: SignatureCaptureController;
|
|
15
15
|
videoIdController?: VideoIdCaptureController;
|
|
16
|
+
/**
|
|
17
|
+
* Controller configuration. Read ONCE, when the flow builds its controller:
|
|
18
|
+
* changing a non-callback field after mount has no effect — remount with a
|
|
19
|
+
* `key` or pass your own `controller`. Callback fields follow the latest
|
|
20
|
+
* render, so the whole object can be written inline.
|
|
21
|
+
*/
|
|
16
22
|
idCapture?: IdCaptureFlowConfig;
|
|
23
|
+
/**
|
|
24
|
+
* Controller configuration. Read ONCE, when the flow builds its controller:
|
|
25
|
+
* changing a non-callback field after mount has no effect — remount with a
|
|
26
|
+
* `key` or pass your own `controller`. Callback fields follow the latest
|
|
27
|
+
* render, so the whole object can be written inline. `checkLivenessOptions` is the
|
|
28
|
+
* exception: it is read live on every liveness check.
|
|
29
|
+
*/
|
|
17
30
|
faceCapture?: FaceLivenessFlowConfig;
|
|
31
|
+
/**
|
|
32
|
+
* Controller configuration. Read ONCE, when the flow builds its controller:
|
|
33
|
+
* changing a non-callback field after mount has no effect — remount with a
|
|
34
|
+
* `key` or pass your own `controller`. Callback fields follow the latest
|
|
35
|
+
* render, so the whole object can be written inline.
|
|
36
|
+
*/
|
|
18
37
|
signatureCapture?: SignatureCaptureControllerConfig;
|
|
38
|
+
/**
|
|
39
|
+
* Controller configuration. Read ONCE, when the flow builds its controller:
|
|
40
|
+
* changing a non-callback field after mount has no effect — remount with a
|
|
41
|
+
* `key` or pass your own `controller`. Callback fields follow the latest
|
|
42
|
+
* render, so the whole object can be written inline.
|
|
43
|
+
*/
|
|
19
44
|
videoIdCapture?: VideoIdCaptureControllerConfig;
|
|
20
45
|
idView?: IdCaptureFlowViewProps;
|
|
21
46
|
faceView?: FaceLivenessFlowViewProps;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"CustomerIdAndBiometricsEnrollmentFlow.d.ts","sourceRoot":"","sources":["../../src/flows/CustomerIdAndBiometricsEnrollmentFlow.tsx"],"names":[],"mappings":"AAeA,OAAO,EAEL,KAAK,mBAAmB,EACzB,MAAM,kCAAkC,CAAA;AACzC,OAAO,EAEL,KAAK,uBAAuB,EAC7B,MAAM,sCAAsC,CAAA;AAC7C,OAAO,EAEL,KAAK,0BAA0B,EAC/B,KAAK,gCAAgC,EACtC,MAAM,yCAAyC,CAAA;AAChD,OAAO,EAEL,KAAK,wBAAwB,EAC7B,KAAK,8BAA8B,EACpC,MAAM,uCAAuC,CAAA;
|
|
1
|
+
{"version":3,"file":"CustomerIdAndBiometricsEnrollmentFlow.d.ts","sourceRoot":"","sources":["../../src/flows/CustomerIdAndBiometricsEnrollmentFlow.tsx"],"names":[],"mappings":"AAeA,OAAO,EAEL,KAAK,mBAAmB,EACzB,MAAM,kCAAkC,CAAA;AACzC,OAAO,EAEL,KAAK,uBAAuB,EAC7B,MAAM,sCAAsC,CAAA;AAC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IAC9C;;;;;;;;;;;;OAYG;IACH,cAAc,CAAC,EAAE,sBAAsB,CAAA;IACvC,qEAAqE;IACrE,mBAAmB,CAAC,EAAE,OAAO,CAAA;IAC7B,cAAc,CAAC,EAAE,CAAC,KAAK,EAAE,KAAK,KAAK,IAAI,CAAA;CACxC,CAAA;AAeD,wBAAgB,qCAAqC,CAAC,EACpD,MAAM,EACN,UAAU,EACV,YAAY,EACZ,gBAAgB,EAChB,mBAAmB,EACnB,iBAAiB,EACjB,SAA4B,EAC5B,WAAgC,EAChC,gBAA0C,EAC1C,cAAuC,EACvC,MAAsB,EACtB,QAA0B,EAC1B,aAAa,EACb,WAAW,EACX,gBAAgB,EAChB,qBAAqB,EACrB,cAAsB,EACtB,mBAAmB,EACnB,gBAAkC,EAClC,KAAK,EACL,SAAS,EACT,iBAAyB,EACzB,eAAuB,EACvB,0BAA0B,EAC1B,4BAA4B,EAC5B,oBAAoB,EACpB,WAAW,EACX,cAAc,EACd,QAAQ,EACR,GAAG,SAAS,EACb,EAAE,0CAA0C,2CAsT5C"}
|
|
@@ -21,6 +21,7 @@ import { CompositeWizard } from './CompositeWizard';
|
|
|
21
21
|
import { buildAdditionalDocumentsStep } from './additionalDocuments';
|
|
22
22
|
import { buildSelfieArtifacts } from './artifacts';
|
|
23
23
|
import { FlowChassis } from './FlowChassis';
|
|
24
|
+
import { useLatestCallbacks } from './latestCallbacks';
|
|
24
25
|
import { buildRingScreenProps } from './ringScreens';
|
|
25
26
|
import { impliedAutoContinueAfterLoading, impliedSkipSuccessScreen, isRingIntroActive, isRingModeActive, } from './ringIntroImplications';
|
|
26
27
|
import { OrbStatusScreen } from './OrbStatusScreen';
|
|
@@ -44,6 +45,12 @@ const PREPARING_FALLBACKS = { preparingText: 'Getting things ready…' };
|
|
|
44
45
|
export function CustomerIdAndBiometricsEnrollmentFlow({ client, submission, idController, selfieController, signatureController, videoIdController, idCapture = EMPTY_ID_CAPTURE, faceCapture = EMPTY_FACE_CAPTURE, signatureCapture = EMPTY_SIGNATURE_CAPTURE, videoIdCapture = EMPTY_VIDEO_ID_CAPTURE, idView = EMPTY_ID_VIEW, faceView = EMPTY_FACE_VIEW, signatureView, videoIdView, captureSignature, captureSignatureVideo, captureVideoId = false, allowVirtualCameras, initialArtifacts = EMPTY_ARTIFACTS, theme, className, showSuccessScreen = false, showDiagnostics = false, captureAdditionalDocuments, additionalDocumentClassNames, ringScreenClassNames, onSubmitted, onCaptureError, children, ...callbacks }) {
|
|
45
46
|
const preparing = useTranslations(undefined, PREPARING_FALLBACKS);
|
|
46
47
|
const { checkLivenessOptions, ...selfieCaptureConfig } = faceCapture;
|
|
48
|
+
// Config callbacks follow the latest render; see useLatestCallbacks.
|
|
49
|
+
const latestSelfieCapture = useLatestCallbacks(selfieCaptureConfig);
|
|
50
|
+
const latestSelfieLiveness = useLatestCallbacks(selfieCaptureConfig.liveness);
|
|
51
|
+
const latestIdCapture = useLatestCallbacks(idCapture);
|
|
52
|
+
const latestSignatureCapture = useLatestCallbacks(signatureCapture);
|
|
53
|
+
const latestVideoIdCapture = useLatestCallbacks(videoIdCapture);
|
|
47
54
|
const clientRef = useRef(client);
|
|
48
55
|
const checkLivenessOptionsRef = useRef(checkLivenessOptions);
|
|
49
56
|
useEffect(() => {
|
|
@@ -85,7 +92,7 @@ export function CustomerIdAndBiometricsEnrollmentFlow({ client, submission, idCo
|
|
|
85
92
|
acquireCamera));
|
|
86
93
|
const [resolvedIdController] = useState(() => idController ??
|
|
87
94
|
createIdCaptureController({
|
|
88
|
-
...
|
|
95
|
+
...latestIdCapture,
|
|
89
96
|
client,
|
|
90
97
|
// The flow-level prop covers EVERY stage's camera, the ID stage
|
|
91
98
|
// included — it was reaching the selfie and signature controllers
|
|
@@ -101,12 +108,12 @@ export function CustomerIdAndBiometricsEnrollmentFlow({ client, submission, idCo
|
|
|
101
108
|
}));
|
|
102
109
|
const [resolvedSelfieController] = useState(() => selfieController ??
|
|
103
110
|
createSelfieCaptureController({
|
|
104
|
-
...
|
|
111
|
+
...latestSelfieCapture,
|
|
105
112
|
camera: withVirtualCameras(selfieCaptureConfig.camera, allowVirtualCameras),
|
|
106
113
|
deferCameraAcquisition: selfieCaptureConfig.deferCameraAcquisition ??
|
|
107
114
|
(faceView.loadingOverlayMode === 'ring' && faceView.showIntroScreen),
|
|
108
115
|
liveness: {
|
|
109
|
-
...
|
|
116
|
+
...latestSelfieLiveness,
|
|
110
117
|
checkLiveness: (image) => clientRef.current.checkLiveness(image, checkLivenessOptionsRef.current),
|
|
111
118
|
},
|
|
112
119
|
io: { ...selfieCaptureConfig.io, acquireCamera: sharedAcquireCamera },
|
|
@@ -114,7 +121,7 @@ export function CustomerIdAndBiometricsEnrollmentFlow({ client, submission, idCo
|
|
|
114
121
|
const [resolvedSignatureController] = useState(() => signatureMode
|
|
115
122
|
? (signatureController ??
|
|
116
123
|
createSignatureCaptureController({
|
|
117
|
-
...
|
|
124
|
+
...latestSignatureCapture,
|
|
118
125
|
// `signatureMode`, NOT `signatureCapture.mode ?? signatureMode`:
|
|
119
126
|
// `buildSignatureStep` picks the STAGE from the captureSignature /
|
|
120
127
|
// captureSignatureVideo pair alone, so honouring a stale mode
|
|
@@ -130,7 +137,7 @@ export function CustomerIdAndBiometricsEnrollmentFlow({ client, submission, idCo
|
|
|
130
137
|
const [resolvedVideoIdController] = useState(() => captureVideoId
|
|
131
138
|
? (videoIdController ??
|
|
132
139
|
createVideoIdCaptureController({
|
|
133
|
-
...
|
|
140
|
+
...latestVideoIdCapture,
|
|
134
141
|
camera: withVirtualCameras({ preferFrontFacingCamera: true, ...videoIdCapture.camera }, allowVirtualCameras),
|
|
135
142
|
deferCameraAcquisition: videoIdCapture.deferCameraAcquisition ??
|
|
136
143
|
(videoIdView?.loadingOverlayMode === 'ring' &&
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { type CapturedDocument, type DocumentCaptureCompleteHandler, type DocumentCaptureController, type DocumentCaptureControllerConfig } from '@idmission/websdk-core/documentCapture';
|
|
2
|
-
import type
|
|
2
|
+
import { type DocumentCapturePrompt } from '../components/document/types';
|
|
3
3
|
import type { CommonFlowProps, DocumentCaptureFlowViewProps } from './types';
|
|
4
4
|
/**
|
|
5
5
|
* The submission-outcome callbacks are omitted rather than inherited-and-ignored.
|
|
@@ -11,6 +11,12 @@ import type { CommonFlowProps, DocumentCaptureFlowViewProps } from './types';
|
|
|
11
11
|
*/
|
|
12
12
|
export type DocumentCaptureFlowProps = Omit<CommonFlowProps, 'captureAdditionalDocuments' | 'showSuccessScreen' | 'showDiagnostics' | 'onComplete' | 'onApproved' | 'onDenied' | 'onSubmissionStarted' | 'onRequestFailure'> & {
|
|
13
13
|
controller?: DocumentCaptureController;
|
|
14
|
+
/**
|
|
15
|
+
* Controller configuration. Read ONCE, when the flow builds its controller:
|
|
16
|
+
* changing a non-callback field after mount has no effect — remount with a
|
|
17
|
+
* `key` or pass your own `controller`. Callback fields follow the latest
|
|
18
|
+
* render, so the whole object can be written inline.
|
|
19
|
+
*/
|
|
14
20
|
capture?: Omit<DocumentCaptureControllerConfig, 'client' | 'documents'>;
|
|
15
21
|
view?: DocumentCaptureFlowViewProps;
|
|
16
22
|
/** Core inputs composed with React presentation and per-document callbacks. */
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"DocumentCaptureFlow.d.ts","sourceRoot":"","sources":["../../src/flows/DocumentCaptureFlow.tsx"],"names":[],"mappings":"AAeA,OAAO,EAGL,KAAK,gBAAgB,EACrB,KAAK,8BAA8B,EACnC,KAAK,yBAAyB,EAC9B,KAAK,+BAA+B,EACrC,MAAM,wCAAwC,CAAA;AAE/C,OAAO,KAAK,
|
|
1
|
+
{"version":3,"file":"DocumentCaptureFlow.d.ts","sourceRoot":"","sources":["../../src/flows/DocumentCaptureFlow.tsx"],"names":[],"mappings":"AAeA,OAAO,EAGL,KAAK,gBAAgB,EACrB,KAAK,8BAA8B,EACnC,KAAK,yBAAyB,EAC9B,KAAK,+BAA+B,EACrC,MAAM,wCAAwC,CAAA;AAE/C,OAAO,EAEL,KAAK,qBAAqB,EAC3B,MAAM,8BAA8B,CAAA;AAOrC,OAAO,KAAK,EAAE,eAAe,EAAE,4BAA4B,EAAE,MAAM,SAAS,CAAA;AAE5E;;;;;;;GAOG;AACH,MAAM,MAAM,wBAAwB,GAAG,IAAI,CACzC,eAAe,EACb,4BAA4B,GAC5B,mBAAmB,GACnB,iBAAiB,GACjB,YAAY,GACZ,YAAY,GACZ,UAAU,GACV,qBAAqB,GACrB,kBAAkB,CACrB,GAAG;IACF,UAAU,CAAC,EAAE,yBAAyB,CAAA;IACtC;;;;;OAKG;IACH,OAAO,CAAC,EAAE,IAAI,CAAC,+BAA+B,EAAE,QAAQ,GAAG,WAAW,CAAC,CAAA;IACvE,IAAI,CAAC,EAAE,4BAA4B,CAAA;IACnC,+EAA+E;IAC/E,SAAS,CAAC,EAAE,SAAS,qBAAqB,EAAE,CAAA;IAC5C,kBAAkB,CAAC,EAAE,CAAC,QAAQ,EAAE,gBAAgB,EAAE,KAAK,EAAE,MAAM,KAAK,IAAI,CAAA;IACxE,kBAAkB,CAAC,EAAE,CAAC,QAAQ,EAAE,gBAAgB,EAAE,KAAK,EAAE,MAAM,KAAK,IAAI,CAAA;IACxE,UAAU,CAAC,EAAE,8BAA8B,CAAA;CAC5C,CAAA;AAQD,wBAAgB,mBAAmB,CAAC,EAClC,MAAM,EACN,UAAU,EACV,OAAuB,EACvB,IAAiB,EACjB,SAA2B,EAC3B,UAA6B,EAC7B,gBAAkC,EAClC,KAAK,EACL,SAAS,EACT,kBAAkB,EAClB,kBAAkB,EAClB,UAAU,EACV,QAAQ,EACR,GAAG,SAAS,EACb,EAAE,wBAAwB,2CAiI1B"}
|
|
@@ -13,10 +13,13 @@ import { useCallback, useEffect, useMemo, useRef, useState } from 'react';
|
|
|
13
13
|
import { SubmissionAction, } from '@idmission/websdk-core/client';
|
|
14
14
|
import { createDocumentCaptureController, toCapturedDocument, } from '@idmission/websdk-core/documentCapture';
|
|
15
15
|
import { useDocumentCapture } from '../bindings/useDocumentCapture';
|
|
16
|
+
import { toDocumentCaptureInput, } from '../components/document/types';
|
|
16
17
|
import { error } from '../utils/logger';
|
|
18
|
+
import { useAutoCaptureMountGuard } from './autoCaptureMountGuard';
|
|
17
19
|
import { buildDocumentCaptureStep } from './documentCapture';
|
|
18
20
|
import { CompositeWizard } from './CompositeWizard';
|
|
19
21
|
import { FlowChassis } from './FlowChassis';
|
|
22
|
+
import { useLatestCallbacks } from './latestCallbacks';
|
|
20
23
|
const EMPTY_DOCUMENTS = [];
|
|
21
24
|
const EMPTY_CAPTURE = {};
|
|
22
25
|
const EMPTY_VIEW = {};
|
|
@@ -27,25 +30,25 @@ export function DocumentCaptureFlow({ client, controller, capture = EMPTY_CAPTUR
|
|
|
27
30
|
// props without being torn down and rebuilt on every render.
|
|
28
31
|
const documentsRef = useRef(documents);
|
|
29
32
|
documentsRef.current = documents;
|
|
33
|
+
// `autoCapture` is mount-time-only and the controller has no reconfigure
|
|
34
|
+
// path, so a late change is ignored — loudly rather than silently (#351).
|
|
35
|
+
useAutoCaptureMountGuard(documents);
|
|
30
36
|
const capturedRef = useRef(onDocumentCaptured);
|
|
31
37
|
capturedRef.current = onDocumentCaptured;
|
|
32
38
|
const uploadedRef = useRef(onDocumentUploaded);
|
|
33
39
|
uploadedRef.current = onDocumentUploaded;
|
|
34
40
|
const completeRef = useRef(onComplete);
|
|
35
41
|
completeRef.current = onComplete;
|
|
42
|
+
// Config callbacks follow the latest render; see useLatestCallbacks.
|
|
43
|
+
const latestCapture = useLatestCallbacks(capture);
|
|
36
44
|
const [resolvedController] = useState(() => controller ??
|
|
37
45
|
createDocumentCaptureController({
|
|
38
|
-
...
|
|
46
|
+
...latestCapture,
|
|
39
47
|
client,
|
|
40
48
|
jobID: submission.jobID,
|
|
41
49
|
taskID: submission.taskID,
|
|
42
50
|
// Only the React-free half crosses into core.
|
|
43
|
-
documents: documentsRef.current.map(
|
|
44
|
-
title,
|
|
45
|
-
aspectRatio,
|
|
46
|
-
processAsPOA,
|
|
47
|
-
content,
|
|
48
|
-
})),
|
|
51
|
+
documents: documentsRef.current.map(toDocumentCaptureInput),
|
|
49
52
|
}));
|
|
50
53
|
// Callbacks are derived from subscribed state rather than passed into the
|
|
51
54
|
// controller's own config, because `controller` is a caller-supplied prop:
|