@idmission/websdk-ui 0.2.0-rc.2 → 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 +135 -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/DocumentCaptureFlow.d.ts +1 -1
- package/dist/flows/DocumentCaptureFlow.d.ts.map +1 -1
- package/dist/flows/DocumentCaptureFlow.js +6 -6
- package/dist/flows/SubmissionProvider.d.ts.map +1 -1
- package/dist/flows/SubmissionProvider.js +2 -4
- 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/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,i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3B,gBAAgB,EAAE,OAAO,CAAA;IACzB,YAAY,EAAE,SAAS,CAAA;IACvB,eAAe,EAAE,sBAAsB,CAAA;IACvC;;;;;;OAMG;IACH,YAAY,CAAC,EAAE,eAAe,GAAG,kBAAkB,CAAA;IACnD;;;;;;;;;;wBAUoB;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,EAG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AM,CAAA;IAC/B,sBAAsB,CAAC,EAAE,MAAM,CAAA;IAC/B,qBAAqB,CAAC,EAAE,MAAM,CAAA;IAC9B,MAAM,CAAC,EAAE,oBAAoB,CAAA;IAC7B,UAAU,CAAC,EAAE,OAAO,CAAA;IACpB,UAAU,CAAC,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;AAC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AgB,eAAe,CAAC,EAC9B,KAAK,EACL,YAAY,EAAE,gBAAgB,EAC9B,gBAAqB,EACrB,WAAmB,EACnB,iBAAyB,EACzB,eAAuB,EACvB,iBAAiB,EACjB,oBAAoB,EACpB,WAAW,EACX,aAAa,EACb,eAAe,EACf,gBAAgB,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 &&
|
|
@@ -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.
|
|
@@ -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,7 +13,9 @@ 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';
|
|
@@ -28,6 +30,9 @@ export function DocumentCaptureFlow({ client, controller, capture = EMPTY_CAPTUR
|
|
|
28
30
|
// props without being torn down and rebuilt on every render.
|
|
29
31
|
const documentsRef = useRef(documents);
|
|
30
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);
|
|
31
36
|
const capturedRef = useRef(onDocumentCaptured);
|
|
32
37
|
capturedRef.current = onDocumentCaptured;
|
|
33
38
|
const uploadedRef = useRef(onDocumentUploaded);
|
|
@@ -43,12 +48,7 @@ export function DocumentCaptureFlow({ client, controller, capture = EMPTY_CAPTUR
|
|
|
43
48
|
jobID: submission.jobID,
|
|
44
49
|
taskID: submission.taskID,
|
|
45
50
|
// Only the React-free half crosses into core.
|
|
46
|
-
documents: documentsRef.current.map(
|
|
47
|
-
title,
|
|
48
|
-
aspectRatio,
|
|
49
|
-
processAsPOA,
|
|
50
|
-
content,
|
|
51
|
-
})),
|
|
51
|
+
documents: documentsRef.current.map(toDocumentCaptureInput),
|
|
52
52
|
}));
|
|
53
53
|
// Callbacks are derived from subscribed state rather than passed into the
|
|
54
54
|
// controller's own config, because `controller` is a caller-supplied prop:
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"SubmissionProvider.d.ts","sourceRoot":"","sources":["../../src/flows/SubmissionProvider.tsx"],"names":[],"mappings":"AAAA,OAAO,EAEL,KAAK,SAAS,EAOf,MAAM,OAAO,CAAA;AACd,OAAO,EACL,gBAAgB,EAChB,KAAK,eAAe,EACpB,KAAK,mBAAmB,EACxB,KAAK,gBAAgB,EACrB,KAAK,mBAAmB,EACxB,KAAK,gBAAgB,EACrB,KAAK,iBAAiB,EACtB,KAAK,kBAAkB,EACvB,KAAK,iBAAiB,EACvB,MAAM,+BAA+B,CAAA;
|
|
1
|
+
{"version":3,"file":"SubmissionProvider.d.ts","sourceRoot":"","sources":["../../src/flows/SubmissionProvider.tsx"],"names":[],"mappings":"AAAA,OAAO,EAEL,KAAK,SAAS,EAOf,MAAM,OAAO,CAAA;AACd,OAAO,EACL,gBAAgB,EAChB,KAAK,eAAe,EACpB,KAAK,mBAAmB,EACxB,KAAK,gBAAgB,EAC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
2
|
import { createContext, useCallback, useContext, useMemo, useRef, useState, useSyncExternalStore, } from 'react';
|
|
3
3
|
import { SubmissionStatus, } from '@idmission/websdk-core/client';
|
|
4
4
|
import { useAuthState } from './AuthStateContext';
|
|
5
|
+
import { isApprovedResponse } from './approval';
|
|
5
6
|
const SubmissionContext = createContext(null);
|
|
6
7
|
const EMPTY_SUBMISSION_OPTIONS = {};
|
|
7
|
-
function isApproved(response) {
|
|
8
|
-
return response.resultData.verificationResult === 'Approved';
|
|
9
|
-
}
|
|
10
8
|
export function SubmissionProvider({ client, action, options = EMPTY_SUBMISSION_OPTIONS, geolocation = null, children, onSubmissionStarted, onComplete, onApproved, onDenied, onRequestFailure, }) {
|
|
11
9
|
const clientState = useSyncExternalStore(client.subscribe, client.getState, client.getState);
|
|
12
10
|
const { state: authState } = useAuthState();
|
|
@@ -43,7 +41,7 @@ export function SubmissionProvider({ client, action, options = EMPTY_SUBMISSION_
|
|
|
43
41
|
return null;
|
|
44
42
|
setSubmissionResponse(response);
|
|
45
43
|
onComplete?.(response);
|
|
46
|
-
if (
|
|
44
|
+
if (isApprovedResponse(action, response))
|
|
47
45
|
onApproved?.(response);
|
|
48
46
|
else
|
|
49
47
|
onDenied?.(response);
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import { SubmissionAction, type SubmissionResponse } from '@idmission/websdk-core/client';
|
|
2
|
+
/**
|
|
3
|
+
* The `verificationResult` the server sends back when a submission for
|
|
4
|
+
* `action` succeeded. Every flow classifies its response through this ONE
|
|
5
|
+
* predicate — it drives `onApproved`/`onDenied` and the ring success screen.
|
|
6
|
+
*
|
|
7
|
+
* The values are the server's, not ours, and they differ by endpoint: the
|
|
8
|
+
* validation endpoints answer `'Approved'`, but `/enroll` (code 34) answers
|
|
9
|
+
* `'Customer Onboarded'` — which sdk2 checked explicitly in both enrollment
|
|
10
|
+
* flows (CustomerBiometricsEnrollment.tsx:67, CustomerIdAndBiometricsEnrollment.tsx:114)
|
|
11
|
+
* and which the chassis briefly reported as a denial when the whole SDK shared
|
|
12
|
+
* the validation string.
|
|
13
|
+
*/
|
|
14
|
+
export declare function isApprovedResponse(action: SubmissionAction, response: SubmissionResponse): boolean;
|
|
15
|
+
//# sourceMappingURL=approval.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"approval.d.ts","sourceRoot":"","sources":["../../src/flows/approval.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,gBAAgB,EAChB,KAAK,kBAAkB,EACxB,MAAM,+BAA+B,CAAA;AAEtC;;;;;;;;;;;GAWG;AACH,wBAAgB,kBAAkB,CAChC,MAAM,EAAE,gBAAgB,EACxB,QAAQ,EAAE,kBAAkB,GAC3B,OAAO,CAKT"}
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import { SubmissionAction, } from '@idmission/websdk-core/client';
|
|
2
|
+
/**
|
|
3
|
+
* The `verificationResult` the server sends back when a submission for
|
|
4
|
+
* `action` succeeded. Every flow classifies its response through this ONE
|
|
5
|
+
* predicate — it drives `onApproved`/`onDenied` and the ring success screen.
|
|
6
|
+
*
|
|
7
|
+
* The values are the server's, not ours, and they differ by endpoint: the
|
|
8
|
+
* validation endpoints answer `'Approved'`, but `/enroll` (code 34) answers
|
|
9
|
+
* `'Customer Onboarded'` — which sdk2 checked explicitly in both enrollment
|
|
10
|
+
* flows (CustomerBiometricsEnrollment.tsx:67, CustomerIdAndBiometricsEnrollment.tsx:114)
|
|
11
|
+
* and which the chassis briefly reported as a denial when the whole SDK shared
|
|
12
|
+
* the validation string.
|
|
13
|
+
*/
|
|
14
|
+
export function isApprovedResponse(action, response) {
|
|
15
|
+
const result = response.resultData['verificationResult'];
|
|
16
|
+
return action === SubmissionAction.ENROLL
|
|
17
|
+
? result === 'Customer Onboarded'
|
|
18
|
+
: result === 'Approved';
|
|
19
|
+
}
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import type { DocumentCapturePrompt } from '../components/document/types';
|
|
2
|
+
/**
|
|
3
|
+
* A comparable summary of what auto-capture each document asked for.
|
|
4
|
+
*
|
|
5
|
+
* Resolved rather than compared raw, so a caller who re-spreads an equivalent
|
|
6
|
+
* bag every render (`autoCapture: {}`, or `{ minScore: undefined }`) does not
|
|
7
|
+
* trip the warning — only a change that would actually have configured the
|
|
8
|
+
* engine differently does.
|
|
9
|
+
*
|
|
10
|
+
* PRESENCE is preserved as `null` rather than folded into the resolved
|
|
11
|
+
* defaults, because `undefined` -> `{}` is precisely the late-flag race this
|
|
12
|
+
* exists to catch, and resolving both would make them identical.
|
|
13
|
+
*/
|
|
14
|
+
export declare function autoCaptureSignature(documents: readonly DocumentCapturePrompt[]): string;
|
|
15
|
+
/**
|
|
16
|
+
* Warn once if `documents`' auto-capture configuration changes after mount.
|
|
17
|
+
*
|
|
18
|
+
* Warns rather than reconfigures: the change genuinely has no effect, and a
|
|
19
|
+
* caller who cannot see that is the failure mode.
|
|
20
|
+
*/
|
|
21
|
+
export declare function useAutoCaptureMountGuard(documents: readonly DocumentCapturePrompt[]): void;
|
|
22
|
+
//# sourceMappingURL=autoCaptureMountGuard.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"autoCaptureMountGuard.d.ts","sourceRoot":"","sources":["../../src/flows/autoCaptureMountGuard.ts"],"names":[],"mappings":"AAoBA,OAAO,KAAK,EAAE,qBAAqB,EAAE,MAAM,8BAA8B,CAAA;AAEzE;;;;;;;;;;;GAWG;AACH,wBAAgB,oBAAoB,CAClC,SAAS,EAAE,SAAS,qBAAqB,EAAE,GAC1C,MAAM,CAQR;AAED;;;;;GAKG;AACH,wBAAgB,wBAAwB,CACtC,SAAS,EAAE,SAAS,qBAAqB,EAAE,GAC1C,IAAI,CAoBN"}
|
|
@@ -0,0 +1,61 @@
|
|
|
1
|
+
// Makes the mount-time-only `autoCapture` contract audible (#351).
|
|
2
|
+
//
|
|
3
|
+
// `DocumentCaptureFlow` builds its controller inside `useState(() => …)` from
|
|
4
|
+
// `documentsRef.current`, and `documentCapture/controller.ts` has no
|
|
5
|
+
// reconfigure path — so `autoCapture` is read once, at mount, and every later
|
|
6
|
+
// change is ignored. A reconfigure path was ruled against: it is real surface
|
|
7
|
+
// on a controller that has none today, bought to serve a race the consumer can
|
|
8
|
+
// simply not have (AMEX's `DocumentCaptureScreen` should gate on `flagsLoaded`,
|
|
9
|
+
// not just `sessionLoaded`).
|
|
10
|
+
//
|
|
11
|
+
// The SILENCE is the expensive half. All four of this repo's cascade-default
|
|
12
|
+
// incidents were "the value was quietly wrong and nothing said so", and this
|
|
13
|
+
// one has the same shape: a capture screen that mounts before the flags land
|
|
14
|
+
// has auto-capture off for that applicant's whole session, with no error and
|
|
15
|
+
// no log. The field-visible half of the same ruling is
|
|
16
|
+
// `autoCaptureStatus: 'disabled:lateFlag'` on the capture metadata.
|
|
17
|
+
import { useEffect, useRef } from 'react';
|
|
18
|
+
import { resolveAutoCapture } from '@idmission/websdk-core/documentCapture';
|
|
19
|
+
import { warn } from '../utils/logger';
|
|
20
|
+
/**
|
|
21
|
+
* A comparable summary of what auto-capture each document asked for.
|
|
22
|
+
*
|
|
23
|
+
* Resolved rather than compared raw, so a caller who re-spreads an equivalent
|
|
24
|
+
* bag every render (`autoCapture: {}`, or `{ minScore: undefined }`) does not
|
|
25
|
+
* trip the warning — only a change that would actually have configured the
|
|
26
|
+
* engine differently does.
|
|
27
|
+
*
|
|
28
|
+
* PRESENCE is preserved as `null` rather than folded into the resolved
|
|
29
|
+
* defaults, because `undefined` -> `{}` is precisely the late-flag race this
|
|
30
|
+
* exists to catch, and resolving both would make them identical.
|
|
31
|
+
*/
|
|
32
|
+
export function autoCaptureSignature(documents) {
|
|
33
|
+
return JSON.stringify(documents.map((document) => document.autoCapture
|
|
34
|
+
? resolveAutoCapture(document.autoCapture, undefined)
|
|
35
|
+
: null));
|
|
36
|
+
}
|
|
37
|
+
/**
|
|
38
|
+
* Warn once if `documents`' auto-capture configuration changes after mount.
|
|
39
|
+
*
|
|
40
|
+
* Warns rather than reconfigures: the change genuinely has no effect, and a
|
|
41
|
+
* caller who cannot see that is the failure mode.
|
|
42
|
+
*/
|
|
43
|
+
export function useAutoCaptureMountGuard(documents) {
|
|
44
|
+
const mounted = useRef(null);
|
|
45
|
+
const warned = useRef(false);
|
|
46
|
+
const signature = autoCaptureSignature(documents);
|
|
47
|
+
useEffect(() => {
|
|
48
|
+
if (mounted.current === null) {
|
|
49
|
+
mounted.current = signature;
|
|
50
|
+
return;
|
|
51
|
+
}
|
|
52
|
+
if (warned.current || signature === mounted.current)
|
|
53
|
+
return;
|
|
54
|
+
warned.current = true;
|
|
55
|
+
warn('[DocumentCaptureFlow] `autoCapture` changed after mount and has been ' +
|
|
56
|
+
'ignored: the controller is built once and has no reconfigure path. ' +
|
|
57
|
+
'Mount this flow only once the value is known — if it comes from a ' +
|
|
58
|
+
'feature flag, gate the screen on the flags having loaded, not just ' +
|
|
59
|
+
'the session.');
|
|
60
|
+
}, [signature]);
|
|
61
|
+
}
|
|
@@ -1,9 +1,6 @@
|
|
|
1
|
-
import type { SubmissionResponse } from '@idmission/websdk-core/client';
|
|
2
1
|
import type { CompositeWizardFinishingScreenProps, CompositeWizardSuccessScreenProps } from './CompositeWizard';
|
|
3
2
|
import type { RingFinishingScreenClassNames, RingFinishingScreenVerbiage } from '../components/ring/RingFinishingScreen';
|
|
4
3
|
import type { RingSuccessScreenClassNames, RingSuccessScreenVerbiage } from '../components/ring/RingSuccessScreen';
|
|
5
|
-
/** sdk2's `isApprovedResponse` (IdValidation.tsx:89-90), shared by every flow. */
|
|
6
|
-
export declare const isApprovedResponse: (response: SubmissionResponse) => boolean;
|
|
7
4
|
export type RingScreenOptions = {
|
|
8
5
|
/** Usually `view.loadingOverlayMode === 'ring'` for the flow's FIRST stage. */
|
|
9
6
|
ringMode: boolean;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ringScreens.d.ts","sourceRoot":"","sources":["../../src/flows/ringScreens.ts"],"names":[],"mappings":"AAOA,OAAO,KAAK,
|
|
1
|
+
{"version":3,"file":"ringScreens.d.ts","sourceRoot":"","sources":["../../src/flows/ringScreens.ts"],"names":[],"mappings":"AAOA,OAAO,KAAK,EACV,mCAAmC,EACnC,iCAAiC,EAClC,MAAM,mBAAmB,CAAA;AAC1B,OAAO,KAAK,EACV,6BAA6B,EAC7B,2BAA2B,EAC5B,MAAM,wCAAwC,CAAA;AAC/C,OAAO,KAAK,EACV,2BAA2B,EAC3B,yBAAyB,EAC1B,MAAM,sCAAsC,CAAA;AAE7C,MAAM,MAAM,iBAAiB,GAAG;IAC9B,+EAA+E;IAC/E,QAAQ,EAAE,OAAO,CAAA;IACjB,iBAAiB,CAAC,EAAE,2BAA2B,CAAA;IAC/C,eAAe,CAAC,EAAE,yBAAyB,CAAA;IAC3C,kBAAkB,CAAC,EAAE,2BAA2B,CAAA;IAChD,gBAAgB,CAAC,EAAE,yBAAyB,CAAA;IAC5C;;;;;OAKG;IACH,mBAAmB,CAAC,EAAE,6BAA6B,CAAA;IACnD,iBAAiB,CAAC,EAAE,2BAA2B,CAAA;CAChD,CAAA;AAED,wBAAgB,oBAAoB,CAAC,EACnC,QAAQ,EACR,iBAAiB,EACjB,eAAe,EACf,kBAAkB,EAClB,gBAAgB,EAChB,mBAAmB,EACnB,iBAAiB,GAClB,EAAE,iBAAiB,GAAG;IACrB,eAAe,EAAE,mCAAmC,CAAA;IACpD,aAAa,EAAE,iCAAiC,CAAA;CACjD,CAgBA"}
|
|
@@ -1,5 +1,3 @@
|
|
|
1
|
-
/** sdk2's `isApprovedResponse` (IdValidation.tsx:89-90), shared by every flow. */
|
|
2
|
-
export const isApprovedResponse = (response) => response.resultData['verificationResult'] === 'Approved';
|
|
3
1
|
export function buildRingScreenProps({ ringMode, finishingVerbiage, successVerbiage, finishingOverrides, successOverrides, finishingClassNames, successClassNames, }) {
|
|
4
2
|
const mode = ringMode ? 'ring' : 'default';
|
|
5
3
|
return {
|
|
@@ -8,9 +6,10 @@ export function buildRingScreenProps({ ringMode, finishingVerbiage, successVerbi
|
|
|
8
6
|
verbiage: { ...finishingVerbiage, ...finishingOverrides },
|
|
9
7
|
classNames: finishingClassNames,
|
|
10
8
|
},
|
|
9
|
+
// No `isApproved`: CompositeWizard classifies from the submission action
|
|
10
|
+
// (approval.ts), so enrollment's 'Customer Onboarded' counts as success.
|
|
11
11
|
successScreen: {
|
|
12
12
|
mode,
|
|
13
|
-
isApproved: isApprovedResponse,
|
|
14
13
|
verbiage: { ...successVerbiage, ...successOverrides },
|
|
15
14
|
classNames: successClassNames,
|
|
16
15
|
},
|