@idmission/websdk-ui 0.2.0-rc.2 → 0.5.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +168 -56
- package/dist/DocumentCaptureView.d.ts +44 -5
- package/dist/DocumentCaptureView.d.ts.map +1 -1
- package/dist/DocumentCaptureView.js +517 -30
- package/dist/FaceLivenessView.d.ts +3 -3
- package/dist/FaceLivenessView.d.ts.map +1 -1
- package/dist/FaceLivenessView.js +82 -40
- package/dist/IdCaptureView.d.ts +33 -20
- package/dist/IdCaptureView.d.ts.map +1 -1
- package/dist/IdCaptureView.js +196 -33
- package/dist/SelfieCaptureView.d.ts +19 -2
- package/dist/SelfieCaptureView.d.ts.map +1 -1
- package/dist/SelfieCaptureView.js +17 -5
- package/dist/SignatureCaptureView.d.ts +23 -2
- package/dist/SignatureCaptureView.d.ts.map +1 -1
- package/dist/SignatureCaptureView.js +138 -22
- package/dist/VideoIdCaptureView.d.ts +15 -3
- package/dist/VideoIdCaptureView.d.ts.map +1 -1
- package/dist/VideoIdCaptureView.js +35 -8
- package/dist/bindings/useDocumentCapture.d.ts.map +1 -1
- package/dist/bindings/useDocumentCapture.js +2 -1
- package/dist/bindings/useIdCapture.d.ts.map +1 -1
- package/dist/bindings/useIdCapture.js +2 -1
- package/dist/bindings/useSelfieCapture.d.ts.map +1 -1
- package/dist/bindings/useSelfieCapture.js +2 -1
- package/dist/bindings/useSignatureCapture.d.ts.map +1 -1
- package/dist/bindings/useSignatureCapture.js +2 -1
- package/dist/bindings/useVideoIdCapture.d.ts.map +1 -1
- package/dist/bindings/useVideoIdCapture.js +2 -1
- 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/common/BrowserEdgeTint.d.ts +63 -0
- package/dist/components/common/BrowserEdgeTint.d.ts.map +1 -0
- package/dist/components/common/BrowserEdgeTint.js +111 -0
- package/dist/components/common/LoaderButton.d.ts +9 -0
- package/dist/components/common/LoaderButton.d.ts.map +1 -1
- package/dist/components/common/LoaderButton.js +44 -321
- package/dist/components/common/ScreenReaderStatus.d.ts +8 -0
- package/dist/components/common/ScreenReaderStatus.d.ts.map +1 -0
- package/dist/components/common/ScreenReaderStatus.js +18 -0
- package/dist/components/common/overlay.d.ts +6 -0
- package/dist/components/common/overlay.d.ts.map +1 -1
- package/dist/components/common/overlay.js +7 -1
- package/dist/components/debug/debug.d.ts +10 -4
- package/dist/components/debug/debug.d.ts.map +1 -1
- package/dist/components/debug/debug.js +5 -1
- 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 +273 -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 +128 -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/error/CameraAccessDeniedOverlay.d.ts +8 -1
- package/dist/components/error/CameraAccessDeniedOverlay.d.ts.map +1 -1
- package/dist/components/error/useCameraAccessDeniedReport.d.ts +12 -0
- package/dist/components/error/useCameraAccessDeniedReport.d.ts.map +1 -0
- package/dist/components/error/useCameraAccessDeniedReport.js +31 -0
- package/dist/components/face_liveness/FaceLivenessFailure.d.ts +4 -1
- package/dist/components/face_liveness/FaceLivenessFailure.d.ts.map +1 -1
- package/dist/components/face_liveness/FaceLivenessFailure.js +4 -2
- package/dist/components/face_liveness/FaceLivenessSuccess.d.ts +4 -1
- package/dist/components/face_liveness/FaceLivenessSuccess.d.ts.map +1 -1
- package/dist/components/face_liveness/FaceLivenessSuccess.js +6 -2
- package/dist/components/guides/IdCaptureFitGuide.d.ts +2 -0
- package/dist/components/guides/IdCaptureFitGuide.d.ts.map +1 -1
- package/dist/components/guides/IdCaptureFitGuide.js +4 -1
- package/dist/components/guides/IdCaptureGuideOverlay.d.ts +2 -0
- package/dist/components/guides/IdCaptureGuideOverlay.d.ts.map +1 -1
- package/dist/components/guides/IdCaptureGuideOverlay.js +3 -1
- package/dist/components/guides/IdCaptureGuides.d.ts +14 -0
- package/dist/components/guides/IdCaptureGuides.d.ts.map +1 -1
- package/dist/components/guides/IdCaptureGuides.js +23 -9
- package/dist/components/guides/IdCaptureGuidesCommon.d.ts.map +1 -1
- package/dist/components/guides/IdCaptureGuidesCommon.js +12 -7
- package/dist/components/loading/IdCaptureLoadingOverlayDefault.d.ts +9 -0
- package/dist/components/loading/IdCaptureLoadingOverlayDefault.d.ts.map +1 -1
- package/dist/components/loading/IdCaptureLoadingOverlayDefault.js +26 -4
- package/dist/components/loading/RingIntroScreen.d.ts.map +1 -1
- package/dist/components/loading/RingIntroScreen.js +4 -34
- package/dist/components/review/ReviewScreen.d.ts +10 -1
- package/dist/components/review/ReviewScreen.d.ts.map +1 -1
- package/dist/components/review/ReviewScreen.js +8 -8
- package/dist/components/review/SignatureCaptureDiagnostics.d.ts +54 -0
- package/dist/components/review/SignatureCaptureDiagnostics.d.ts.map +1 -0
- package/dist/components/review/SignatureCaptureDiagnostics.js +144 -0
- package/dist/components/selfie/FaceCaptureGuideOverlay.d.ts +9 -2
- package/dist/components/selfie/FaceCaptureGuideOverlay.d.ts.map +1 -1
- package/dist/components/selfie/FaceCaptureGuideOverlay.js +10 -4
- package/dist/components/selfie/SelfieCaptureAnimatedMask.d.ts +8 -1
- package/dist/components/selfie/SelfieCaptureAnimatedMask.d.ts.map +1 -1
- package/dist/components/selfie/SelfieCaptureAnimatedMask.js +55 -21
- package/dist/components/selfie/SelfieCaptureSurface.d.ts +19 -3
- package/dist/components/selfie/SelfieCaptureSurface.d.ts.map +1 -1
- package/dist/components/selfie/SelfieCaptureSurface.js +78 -14
- package/dist/components/selfie_loading/SelfieCaptureLoadingOverlayDefault.d.ts +9 -0
- package/dist/components/selfie_loading/SelfieCaptureLoadingOverlayDefault.d.ts.map +1 -1
- package/dist/components/selfie_loading/SelfieCaptureLoadingOverlayDefault.js +26 -4
- 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/AuthStateContext.d.ts.map +1 -1
- package/dist/flows/AuthStateContext.js +2 -1
- package/dist/flows/CaptureProgress.d.ts +14 -0
- package/dist/flows/CaptureProgress.d.ts.map +1 -0
- package/dist/flows/CaptureProgress.js +51 -0
- package/dist/flows/CompositeWizard.d.ts +5 -0
- package/dist/flows/CompositeWizard.d.ts.map +1 -1
- package/dist/flows/CompositeWizard.js +6 -1
- package/dist/flows/CustomerBiometricsEnrollmentFlow.d.ts +1 -1
- package/dist/flows/CustomerBiometricsEnrollmentFlow.d.ts.map +1 -1
- package/dist/flows/CustomerBiometricsEnrollmentFlow.js +6 -3
- package/dist/flows/CustomerIdAndBiometricsEnrollmentFlow.d.ts +1 -1
- package/dist/flows/CustomerIdAndBiometricsEnrollmentFlow.d.ts.map +1 -1
- package/dist/flows/CustomerIdAndBiometricsEnrollmentFlow.js +5 -2
- package/dist/flows/DocumentCaptureFlow.d.ts +2 -2
- package/dist/flows/DocumentCaptureFlow.d.ts.map +1 -1
- package/dist/flows/DocumentCaptureFlow.js +6 -6
- package/dist/flows/FaceValidationFlow.d.ts +2 -2
- package/dist/flows/FaceValidationFlow.d.ts.map +1 -1
- package/dist/flows/FaceValidationFlow.js +2 -2
- package/dist/flows/FlowChassis.d.ts +3 -1
- package/dist/flows/FlowChassis.d.ts.map +1 -1
- package/dist/flows/FlowChassis.js +23 -4
- package/dist/flows/IdAndFaceValidationFlow.d.ts +1 -1
- package/dist/flows/IdAndFaceValidationFlow.d.ts.map +1 -1
- package/dist/flows/IdAndFaceValidationFlow.js +5 -2
- package/dist/flows/IdValidationFlow.d.ts +1 -1
- package/dist/flows/IdValidationFlow.d.ts.map +1 -1
- package/dist/flows/IdValidationFlow.js +18 -4
- package/dist/flows/SignatureKYCFlow.d.ts +18 -3
- package/dist/flows/SignatureKYCFlow.d.ts.map +1 -1
- package/dist/flows/SignatureKYCFlow.js +94 -11
- package/dist/flows/SubmissionProvider.d.ts.map +1 -1
- package/dist/flows/SubmissionProvider.js +10 -5
- package/dist/flows/VideoIdValidationFlow.d.ts +1 -1
- package/dist/flows/VideoIdValidationFlow.d.ts.map +1 -1
- package/dist/flows/VideoIdValidationFlow.js +6 -3
- package/dist/flows/additionalDocuments.d.ts.map +1 -1
- package/dist/flows/additionalDocuments.js +3 -6
- package/dist/flows/approval.d.ts +2 -0
- package/dist/flows/approval.d.ts.map +1 -0
- package/dist/flows/approval.js +1 -0
- package/dist/flows/artifacts.d.ts +1 -1
- package/dist/flows/artifacts.d.ts.map +1 -1
- package/dist/flows/artifacts.js +29 -9
- 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 +1 -1
- package/dist/flows/customerMatch/CustomerMatchFlow.d.ts.map +1 -1
- package/dist/flows/customerMatch/CustomerMatchFlow.js +5 -6
- package/dist/flows/ringScreens.d.ts +1 -3
- package/dist/flows/ringScreens.d.ts.map +1 -1
- package/dist/flows/ringScreens.js +19 -5
- package/dist/flows/types.d.ts +17 -3
- package/dist/flows/types.d.ts.map +1 -1
- package/dist/guidance/selfieStrings.d.ts +9 -1
- package/dist/guidance/selfieStrings.d.ts.map +1 -1
- package/dist/guidance/selfieStrings.js +67 -24
- package/dist/guidance/strings.d.ts +34 -1
- package/dist/guidance/strings.d.ts.map +1 -1
- package/dist/guidance/strings.js +39 -0
- 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 +159 -0
- package/dist/index.d.ts +12 -6
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +4 -0
- package/dist/testing/autoCaptureFrames.d.ts +23 -0
- package/dist/testing/autoCaptureFrames.d.ts.map +1 -0
- package/dist/testing/autoCaptureFrames.js +193 -0
- package/dist/testing/buildSelfieState.d.ts.map +1 -1
- package/dist/testing/buildSelfieState.js +5 -0
- package/dist/testing/classNamesLeaves.js +1 -1
- 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/fakeSelfieController.d.ts.map +1 -1
- package/dist/testing/fakeSelfieController.js +7 -0
- 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/theme/index.d.ts +10 -0
- package/dist/theme/index.d.ts.map +1 -1
- package/dist/useDocumentUpload.d.ts +63 -0
- package/dist/useDocumentUpload.d.ts.map +1 -0
- package/dist/useDocumentUpload.js +45 -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 +9 -7
|
@@ -0,0 +1,273 @@
|
|
|
1
|
+
import { jsx as _jsx, Fragment as _Fragment, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
// The POA auto-capture tuning overlay (#341, built by #353).
|
|
3
|
+
//
|
|
4
|
+
// This is a SHIPPED debug layer, not prototype scaffolding. The paper and the
|
|
5
|
+
// applicants are in Mexico, so the instrument #343 and #344 are measured with
|
|
6
|
+
// has to reach a published 2.4.x build — which is why it lives here rather
|
|
7
|
+
// than on a branch, and why its enablement is the existing 2.x `debugMode`
|
|
8
|
+
// rather than a new prop.
|
|
9
|
+
//
|
|
10
|
+
// Governing rule, from #341: EVERY GATE SHOWS VALUE, THRESHOLD, AND VERDICT.
|
|
11
|
+
// A verdict alone cannot distinguish "the threshold is wrong" from "the signal
|
|
12
|
+
// is wrong", and that distinction is the entire point of the exercise. Two
|
|
13
|
+
// consequences visible below:
|
|
14
|
+
//
|
|
15
|
+
// - Fill prints the WINDOWED MEAN the verdict is taken on, this frame's
|
|
16
|
+
// instantaneous value, and the window's peak-to-peak spread. #343 gated on
|
|
17
|
+
// the aggregate precisely because the instant dithers across the box
|
|
18
|
+
// encodings' grid; showing only one of the two would make "the threshold is
|
|
19
|
+
// wrong" and "the signal is jittering" indistinguishable, which is the
|
|
20
|
+
// confusion this pane exists to prevent. The spread is also the reading
|
|
21
|
+
// #380 answers the hysteresis question from.
|
|
22
|
+
// - Fill prints both components as well as the max. `computePoaFraming`
|
|
23
|
+
// reports the max because that is what the gate compares, but the max
|
|
24
|
+
// hides which axis is binding.
|
|
25
|
+
// - Margins print to four decimals and gate NOTHING. #343 deleted the margin
|
|
26
|
+
// gate; they survive as the reading that says which way to move, and at
|
|
27
|
+
// four places because that is how every number already on the map is
|
|
28
|
+
// recorded.
|
|
29
|
+
//
|
|
30
|
+
// Everything above is packed into the SAME FOUR LINES the pre-#343 pane used,
|
|
31
|
+
// which is a constraint rather than tidiness: #353's device pass found the
|
|
32
|
+
// pane hitting its 45% cap and covering the top edge of the sheet — the very
|
|
33
|
+
// edge the operator is there to frame. A row added here costs a row of paper.
|
|
34
|
+
//
|
|
35
|
+
// The on-glass text is a LIVENESS CHECK, not the deliverable. The ~300-frame
|
|
36
|
+
// ring buffer behind COPY is what gets replayed into Storybook and pinned as
|
|
37
|
+
// fixtures; nobody tunes a 1.3%-wide band by reading numbers off a phone in
|
|
38
|
+
// their hand.
|
|
39
|
+
import { useCallback, useState } from 'react';
|
|
40
|
+
import { warn } from '../../utils/logger';
|
|
41
|
+
import { styled } from 'styled-components';
|
|
42
|
+
import { DebugBoundingBoxOverlay, CameraDebugStatus, DebugStatsPane, DebugStatsPaneDiv, IdCaptureDetectedObjectDebugBox, useDebugScalingDetails, } from '../debug/debug';
|
|
43
|
+
import { useGuideLayout } from '../../layout/GuideLayoutContext';
|
|
44
|
+
/** Human wording for each gate, in the order the engine reports them. */
|
|
45
|
+
/** Short enough that the triple fits one line on a phone. */
|
|
46
|
+
const GUIDANCE_LABELS = {
|
|
47
|
+
none: '—',
|
|
48
|
+
noDocument: 'no doc',
|
|
49
|
+
tooClose: 'close',
|
|
50
|
+
tooFar: 'far',
|
|
51
|
+
notStable: 'move',
|
|
52
|
+
outOfFocus: 'blur',
|
|
53
|
+
holdStill: 'OK',
|
|
54
|
+
};
|
|
55
|
+
const GATE_LABELS = {
|
|
56
|
+
noDocument: 'no document',
|
|
57
|
+
tooClose: 'too close',
|
|
58
|
+
tooFar: 'too far',
|
|
59
|
+
outOfFocus: 'out of focus',
|
|
60
|
+
notStable: 'not stable',
|
|
61
|
+
};
|
|
62
|
+
/**
|
|
63
|
+
* Fixed-width so a value changing from 0.9990 to 0.0130 does not reflow the
|
|
64
|
+
* pane. `toFixed` on a negative margin keeps its sign, which is the point —
|
|
65
|
+
* negative means the box runs off that edge.
|
|
66
|
+
*/
|
|
67
|
+
function n(value, places = 3) {
|
|
68
|
+
if (value === null || value === undefined || !Number.isFinite(value)) {
|
|
69
|
+
return '—';
|
|
70
|
+
}
|
|
71
|
+
return value.toFixed(places);
|
|
72
|
+
}
|
|
73
|
+
/** Margins get four places: see the header on the 1.3%-wide band. */
|
|
74
|
+
function margin(value) {
|
|
75
|
+
return n(value, 4);
|
|
76
|
+
}
|
|
77
|
+
/** Labels shown on glass. The rest are counted, not listed. */
|
|
78
|
+
const PEAK_SCORES_SHOWN = 4;
|
|
79
|
+
/**
|
|
80
|
+
* The highest-scoring labels, with the remainder reduced to a count so the
|
|
81
|
+
* pane cannot grow over the sheet it is measuring. `scores` is keyed by the
|
|
82
|
+
* label the model emitted (#341), so an unmapped class shows up here as
|
|
83
|
+
* `class_NN` rather than silently vanishing — which is the reason this row
|
|
84
|
+
* exists at all, and why the count matters when the list is truncated.
|
|
85
|
+
*/
|
|
86
|
+
function formatPeakScores(scores) {
|
|
87
|
+
const ranked = Object.entries(scores).sort((a, b) => b[1] - a[1]);
|
|
88
|
+
if (ranked.length === 0)
|
|
89
|
+
return 'no detections';
|
|
90
|
+
const shown = ranked
|
|
91
|
+
.slice(0, PEAK_SCORES_SHOWN)
|
|
92
|
+
.map(([label, score]) => `${label} ${n(score, 2)}`)
|
|
93
|
+
.join(' ');
|
|
94
|
+
const hidden = ranked.length - PEAK_SCORES_SHOWN;
|
|
95
|
+
return hidden > 0 ? `${shown} +${hidden} more` : shown;
|
|
96
|
+
}
|
|
97
|
+
function Gate({ pass, children, }) {
|
|
98
|
+
return (_jsxs(_Fragment, { children: [pass ? '✅' : '❌', " ", children, _jsx("br", {})] }));
|
|
99
|
+
}
|
|
100
|
+
export function DocumentCaptureAutoCaptureDebugLayer({ state, getLog, compact = false, }) {
|
|
101
|
+
const { guideRect } = useGuideLayout();
|
|
102
|
+
// Tapping the pane hides the boxes: #341 asked for this because rectangles
|
|
103
|
+
// drawn over the sheet visibly bias how the operator frames it, and the
|
|
104
|
+
// framing IS the measurement.
|
|
105
|
+
const [showBoxes, setShowBoxes] = useState(true);
|
|
106
|
+
// Freeze latches the last live reading. At 30fps the numbers that matter are
|
|
107
|
+
// unreadable in motion, and the interesting frame is always the one that just
|
|
108
|
+
// went past.
|
|
109
|
+
const [frozen, setFrozen] = useState(null);
|
|
110
|
+
const [copied, setCopied] = useState(null);
|
|
111
|
+
const [saved, setSaved] = useState(null);
|
|
112
|
+
const live = state.autoCapture;
|
|
113
|
+
const shown = frozen ?? live;
|
|
114
|
+
/**
|
|
115
|
+
* Writes the ring buffer to a file.
|
|
116
|
+
*
|
|
117
|
+
* #353's device pass produced 300 real frames and did not keep them, which
|
|
118
|
+
* is why #343 had to answer the dither question from a synthetic proxy — so
|
|
119
|
+
* #380 made saving the buffer the deliverable rather than a nicety. COPY
|
|
120
|
+
* survives beside this because the payload is ~600KB and iOS pasteboard
|
|
121
|
+
* handling of that is its own adventure; a download lands in Files, which
|
|
122
|
+
* AirDrops.
|
|
123
|
+
*/
|
|
124
|
+
const saveLog = useCallback(() => {
|
|
125
|
+
const log = getLog();
|
|
126
|
+
const blob = new Blob([JSON.stringify(log)], { type: 'application/json' });
|
|
127
|
+
const url = URL.createObjectURL(blob);
|
|
128
|
+
const anchor = document.createElement('a');
|
|
129
|
+
anchor.href = url;
|
|
130
|
+
// Frame count in the name: a truncated download announces itself, and a
|
|
131
|
+
// session produces several files that are otherwise indistinguishable.
|
|
132
|
+
anchor.download = `poa-autocapture-${log.length}f-${Date.now()}.json`;
|
|
133
|
+
document.body.appendChild(anchor);
|
|
134
|
+
anchor.click();
|
|
135
|
+
anchor.remove();
|
|
136
|
+
// Revoked on a timeout, not immediately: iOS Safari has not necessarily
|
|
137
|
+
// read the blob by the time click() returns.
|
|
138
|
+
setTimeout(() => URL.revokeObjectURL(url), 60_000);
|
|
139
|
+
setSaved(`${log.length}f saved`);
|
|
140
|
+
}, [getLog]);
|
|
141
|
+
const copyLog = useCallback(() => {
|
|
142
|
+
const log = getLog();
|
|
143
|
+
const text = JSON.stringify(log);
|
|
144
|
+
// Clipboard access needs a secure context and, on iOS, a user gesture —
|
|
145
|
+
// this IS one, but a tunnelled http:// Storybook is not secure, which is
|
|
146
|
+
// exactly how these sessions get run. The console fallback keeps the log
|
|
147
|
+
// recoverable there instead of the button silently doing nothing.
|
|
148
|
+
const fallback = () => {
|
|
149
|
+
// `warn`, not `debug` or `log`: those two sit above the default level and
|
|
150
|
+
// would be swallowed, and this is the one path where the operator has no
|
|
151
|
+
// other way to reach the buffer. It IS a degradation notice — the
|
|
152
|
+
// clipboard was unavailable — so the level is honest as well as audible.
|
|
153
|
+
//
|
|
154
|
+
// Deliberately the UI package's own logger, per AGENTS.md. `debugMode`
|
|
155
|
+
// raises CORE's level, not this one, so routing through `debug()` here
|
|
156
|
+
// would silence the fallback in exactly the session that needs it.
|
|
157
|
+
warn('[autoCapture] diagnostics log', text);
|
|
158
|
+
setCopied(`${log.length}f → console`);
|
|
159
|
+
};
|
|
160
|
+
if (!navigator.clipboard?.writeText) {
|
|
161
|
+
fallback();
|
|
162
|
+
return;
|
|
163
|
+
}
|
|
164
|
+
navigator.clipboard.writeText(text).then(() => setCopied(`${log.length}f copied`), fallback);
|
|
165
|
+
}, [getLog]);
|
|
166
|
+
const scaling = useDebugScalingDetails({
|
|
167
|
+
enabled: true,
|
|
168
|
+
pageWidth: guideRect?.width || 1,
|
|
169
|
+
pageHeight: guideRect?.height || 1,
|
|
170
|
+
videoWidth: state.videoWidth,
|
|
171
|
+
videoHeight: state.videoHeight,
|
|
172
|
+
});
|
|
173
|
+
const framing = shown?.framing ?? null;
|
|
174
|
+
const fillWindow = shown?.fillWindow ?? null;
|
|
175
|
+
const focus = shown?.focus ?? null;
|
|
176
|
+
const stability = shown?.stability ?? null;
|
|
177
|
+
return (_jsxs(_Fragment, { children: [showBoxes && !compact && (_jsx(DebugBoundingBoxOverlay
|
|
178
|
+
// Document capture prefers the rear camera and a rear feed is not
|
|
179
|
+
// mirrored, so the boxes must not be either — same rule as the feed.
|
|
180
|
+
, { "$flipX": !state.camera.isRearFacing, scaling: scaling, guideRect: guideRect, children: (shown?.detectedObjects ?? []).map((obj, i) => (_jsx(IdCaptureDetectedObjectDebugBox, { obj: obj, scaling: scaling, flipX: !state.camera.isRearFacing,
|
|
181
|
+
// The box geometry is being measured on is called out, because
|
|
182
|
+
// several labels fire on one sheet and only one drives the gates.
|
|
183
|
+
color: obj.label === shown?.target?.label ? 'green' : 'orange' }, i))) })), _jsx(PaneAnchor, { children: _jsx(DebugStatsPane, { children: _jsxs(InteractivePane, { "data-testid": "autocapture-debug-pane", onClick: () => setShowBoxes((visible) => !visible), children: [compact ? null : (_jsxs(_Fragment, { children: [_jsx(CameraDebugStatus, { ready: state.camera.ready, width: state.videoWidth, height: state.videoHeight }), _jsx("br", {})] })), compact ? null : (_jsxs(Gate, { pass: state.models.state === 'ready', children: ["Models: ", state.models.state, state.models.state === 'downloading'
|
|
184
|
+
? ` ${Math.round(state.models.downloadProgress)}%`
|
|
185
|
+
: '', state.models.error ? ` — ${state.models.error.message}` : ''] })), compact ? null : !shown ? ('Waiting for the first frame…') : (_jsxs(_Fragment, { children: [_jsxs(Gate, { pass: shown.frameRate > 10, children: [n(shown.frameRate, 1), " fps (", n(shown.detectionTimeMs, 0), "ms detect)"] }), _jsxs(Gate, { pass: !!shown.target, children: ["Target:", ' ', shown.target
|
|
186
|
+
? `${shown.target.label} ${n(shown.target.score)}`
|
|
187
|
+
: 'none', ' ', "\u2265 ", n(shown.targetMinScore)] }), framing ? (_jsxs(_Fragment, { children: [_jsxs(Row, { children: ["L ", margin(framing.leftMargin), " R", ' ', margin(framing.rightMargin), " min", ' ', margin(framing.minMargin), _jsx("br", {}), "T ", margin(framing.topMargin), " B", ' ', margin(framing.bottomMargin)] }), _jsxs(Row, { children: ["Rect ", Math.round(shown.guideRect.width), "\u00D7", Math.round(shown.guideRect.height), " of", ' ', shown.frameWidth, "\u00D7", shown.frameHeight, shown.guideRect.width < shown.frameWidth ||
|
|
188
|
+
shown.guideRect.height < shown.frameHeight
|
|
189
|
+
? ' (guide)'
|
|
190
|
+
: ' (full frame)'] })] })) : (_jsx(Row, { children: "No box \u2014 framing unmeasurable" })), fillWindow && (_jsxs(_Fragment, { children: [_jsxs(Gate, { pass: fillWindow.mean >= fillWindow.fillMin, children: ["Fill ", n(fillWindow.mean), " \u2265 ", n(fillWindow.fillMin), " (guide)"] }), _jsxs(Gate, { pass: (fillWindow.frameMean ?? fillWindow.mean) <=
|
|
191
|
+
fillWindow.fillMax, children: ["Frame fill ", n(fillWindow.frameMean ?? fillWindow.mean), " \u2264", ' ', n(fillWindow.fillMax), " (camera)"] }), _jsxs(Gate, { pass: !fillWindow.frameEdgeContact, children: ["Frame edge ", fillWindow.frameEdgeContact ? 'touched' : 'clear'] }), _jsxs(Row, { children: ["now ", n(fillWindow.instant), " \u00B1", n(fillWindow.spread, 4), ' ', fillWindow.framesTracked, "/", fillWindow.framesNeeded, "f", framing
|
|
192
|
+
? ` (w ${n(framing.fillWidth)} h ${n(framing.fillHeight)})`
|
|
193
|
+
: ''] })] })), focus ? (_jsxs(Gate, { pass: focus.thresholdMet, children: ["Focus ", n(focus.score), " \u2265 ", n(focus.threshold), " (", focus.branch, ")"] })) : (_jsxs(Row, { children: ["Focus:", ' ', shown.target ? 'model unavailable' : 'no box to measure'] })), stability && (_jsxs(Gate, { pass: stability.isStable, children: ["IoU ", n(stability.worstIou), " \u2265 ", n(stability.threshold), " (", stability.framesTracked, "/", stability.framesNeeded, "f)"] })), _jsxs(Row, { children: ["Failing:", ' ', shown.failingGates.length === 0
|
|
194
|
+
? 'none'
|
|
195
|
+
: shown.failingGates
|
|
196
|
+
.map((gate) => GATE_LABELS[gate])
|
|
197
|
+
.join(' › ')] }), _jsxs(Row, { children: ["Msg: ", GUIDANCE_LABELS[shown.guidance.raw], " \u2192", ' ', GUIDANCE_LABELS[shown.guidance.pendingCandidate], " \u2192", ' ', GUIDANCE_LABELS[shown.guidance.displayed], " (", Math.round(shown.guidance.displayedForMs), "ms)"] }), _jsx(Row, { children: formatPeakScores(shown.scores) })] })), _jsxs(Controls, { children: [_jsx(Chip, { type: "button", "data-testid": "autocapture-debug-freeze", "$active": frozen !== null, onClick: (event) => {
|
|
198
|
+
event.stopPropagation();
|
|
199
|
+
setFrozen(frozen ? null : (live ?? null));
|
|
200
|
+
}, children: frozen ? 'FROZEN' : 'LIVE' }), _jsx(Chip, { type: "button", "data-testid": "autocapture-debug-save", onClick: (event) => {
|
|
201
|
+
event.stopPropagation();
|
|
202
|
+
saveLog();
|
|
203
|
+
}, children: saved ?? 'SAVE LOG' }), _jsx(Chip, { type: "button", "data-testid": "autocapture-debug-copy", onClick: (event) => {
|
|
204
|
+
event.stopPropagation();
|
|
205
|
+
copyLog();
|
|
206
|
+
}, children: copied ?? 'COPY' })] })] }) }) })] }));
|
|
207
|
+
}
|
|
208
|
+
/**
|
|
209
|
+
* Re-anchors the shared stats pane to the TOP of the capture surface.
|
|
210
|
+
*
|
|
211
|
+
* `DebugStatsPaneDiv` sits at `bottom: 20px`, which is right where
|
|
212
|
+
* `DocumentCaptureView` puts its instructions and the Capture button —
|
|
213
|
+
* `IdCaptureView` has nothing there, so the shared default has never had to
|
|
214
|
+
* dodge anything. A pane covering the shutter is worse than no pane: the
|
|
215
|
+
* operator has to be able to frame the sheet AND take the picture while
|
|
216
|
+
* reading the numbers. Anchoring at the top also leaves the lower two-thirds
|
|
217
|
+
* of the guide box clear, which is where the sheet actually sits.
|
|
218
|
+
*
|
|
219
|
+
* `pointer-events: none` on the anchor is what keeps a full-surface div from
|
|
220
|
+
* swallowing every tap; `InteractivePane` re-enables them for itself alone.
|
|
221
|
+
*/
|
|
222
|
+
const PaneAnchor = styled.div `
|
|
223
|
+
position: absolute;
|
|
224
|
+
inset: 0;
|
|
225
|
+
pointer-events: none;
|
|
226
|
+
|
|
227
|
+
${DebugStatsPaneDiv} {
|
|
228
|
+
top: 0;
|
|
229
|
+
bottom: auto;
|
|
230
|
+
left: 0;
|
|
231
|
+
right: 0;
|
|
232
|
+
margin: 0;
|
|
233
|
+
font-size: 11px;
|
|
234
|
+
line-height: 1.4;
|
|
235
|
+
/* Capped so a long detection list cannot grow over the whole sheet; the
|
|
236
|
+
ring buffer is the record, this is only the liveness check. */
|
|
237
|
+
max-height: 45%;
|
|
238
|
+
overflow-y: auto;
|
|
239
|
+
/* The shared pane's rgba(0,0,0,0.5) was chosen against IdCaptureView,
|
|
240
|
+
where it sits over a held ID at the BOTTOM of the frame. Here it sits
|
|
241
|
+
over the top of a sheet of white paper, in the daylight someone reads a
|
|
242
|
+
utility bill in, and 11px limegreen at half opacity stops being legible
|
|
243
|
+
exactly when the sheet is well framed — the frames that matter most.
|
|
244
|
+
Scoped to this anchor so IdCaptureView's pane is untouched. */
|
|
245
|
+
background: rgba(0, 0, 0, 0.78);
|
|
246
|
+
}
|
|
247
|
+
`;
|
|
248
|
+
// `DebugStatsPaneDiv` sets `pointer-events: none` so the shared pane can never
|
|
249
|
+
// swallow a capture tap. This one has to be tappable, so it re-enables them on
|
|
250
|
+
// its own subtree only.
|
|
251
|
+
const InteractivePane = styled.span `
|
|
252
|
+
pointer-events: auto;
|
|
253
|
+
display: block;
|
|
254
|
+
cursor: pointer;
|
|
255
|
+
user-select: none;
|
|
256
|
+
`;
|
|
257
|
+
const Row = styled.span `
|
|
258
|
+
display: block;
|
|
259
|
+
`;
|
|
260
|
+
const Controls = styled.span `
|
|
261
|
+
display: flex;
|
|
262
|
+
gap: 6px;
|
|
263
|
+
margin-top: 6px;
|
|
264
|
+
`;
|
|
265
|
+
const Chip = styled.button `
|
|
266
|
+
font: bold 11px monospace;
|
|
267
|
+
padding: 4px 8px;
|
|
268
|
+
border: 1px solid limegreen;
|
|
269
|
+
border-radius: 3px;
|
|
270
|
+
background: ${({ $active }) => ($active ? 'limegreen' : 'transparent')};
|
|
271
|
+
color: ${({ $active }) => ($active ? 'black' : 'limegreen')};
|
|
272
|
+
cursor: pointer;
|
|
273
|
+
`;
|
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
import type { ReactElement } from 'react';
|
|
2
|
+
import type { PoaGuidanceCode } from '@idmission/websdk-core/documentCapture';
|
|
3
|
+
/**
|
|
4
|
+
* Which verbiage member renders each code.
|
|
5
|
+
*
|
|
6
|
+
* `notStable` and `outOfFocus` map to DIFFERENT members that happen to carry
|
|
7
|
+
* the same default string. Keeping the members distinct is what lets an
|
|
8
|
+
* integrator separate them later without a breaking change, while the shared
|
|
9
|
+
* default reflects #383's finding that on paper a focus failure IS a motion
|
|
10
|
+
* failure — so "hold still" is right for both, and a second sentence saying it
|
|
11
|
+
* differently is a distinction the applicant cannot act on.
|
|
12
|
+
*/
|
|
13
|
+
export declare const AUTO_CAPTURE_GUIDANCE_VERBIAGE_KEYS: {
|
|
14
|
+
readonly noDocument: "autoCaptureNoDocumentText";
|
|
15
|
+
readonly tooClose: "autoCaptureTooCloseText";
|
|
16
|
+
readonly tooFar: "autoCaptureTooFarText";
|
|
17
|
+
readonly notStable: "autoCaptureNotStableText";
|
|
18
|
+
readonly outOfFocus: "autoCaptureOutOfFocusText";
|
|
19
|
+
readonly holdStill: "autoCaptureHoldStillText";
|
|
20
|
+
};
|
|
21
|
+
export type AutoCaptureGuidanceVerbiageKey = (typeof AUTO_CAPTURE_GUIDANCE_VERBIAGE_KEYS)[keyof typeof AUTO_CAPTURE_GUIDANCE_VERBIAGE_KEYS];
|
|
22
|
+
/**
|
|
23
|
+
* A resolved verbiage bag.
|
|
24
|
+
*
|
|
25
|
+
* Optional because `useTranslations` types its result from a verbiage type
|
|
26
|
+
* whose members are optional, even though every fallback key is always filled
|
|
27
|
+
* at runtime. Widening here beats asserting at the call site.
|
|
28
|
+
*/
|
|
29
|
+
export type ResolvedGuidanceMessages = Partial<Record<AutoCaptureGuidanceVerbiageKey, string | ReactElement>>;
|
|
30
|
+
export type DocumentCaptureAutoCaptureGuidanceProps = {
|
|
31
|
+
/** The stabilized code. `'none'` renders nothing — the pre-first-frame state. */
|
|
32
|
+
code: PoaGuidanceCode;
|
|
33
|
+
/** Resolved strings, keyed as above. */
|
|
34
|
+
messages: ResolvedGuidanceMessages;
|
|
35
|
+
className?: string;
|
|
36
|
+
};
|
|
37
|
+
export declare function DocumentCaptureAutoCaptureGuidance({ code, messages, className, }: DocumentCaptureAutoCaptureGuidanceProps): ReactElement | null;
|
|
38
|
+
/**
|
|
39
|
+
* Why a Capture button just appeared (#345).
|
|
40
|
+
*
|
|
41
|
+
* This replaced a bottom sheet that asked "Having trouble? Would you like to
|
|
42
|
+
* take the photo yourself?" over two buttons. The sheet had to go: it covered
|
|
43
|
+
* the guidance pill, which is the only thing on screen that answers its own
|
|
44
|
+
* question, and it made the applicant confirm a permission they already had.
|
|
45
|
+
*
|
|
46
|
+
* So the button simply appears and this says why. It is a CAPTION, not a
|
|
47
|
+
* dialog: no scrim, no actions, nothing to dismiss, and the loop keeps running
|
|
48
|
+
* behind it. Rendered in the same stack as the pill so the live guidance still
|
|
49
|
+
* reads as the more urgent of the two.
|
|
50
|
+
*/
|
|
51
|
+
export type DocumentCaptureManualCaptureHintProps = {
|
|
52
|
+
message: string | ReactElement | undefined;
|
|
53
|
+
className?: string;
|
|
54
|
+
};
|
|
55
|
+
export declare function DocumentCaptureManualCaptureHint({ message, className, }: DocumentCaptureManualCaptureHintProps): ReactElement | null;
|
|
56
|
+
//# sourceMappingURL=DocumentCaptureAutoCaptureGuidance.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"DocumentCaptureAutoCaptureGuidance.d.ts","sourceRoot":"","sources":["../../../src/components/document/DocumentCaptureAutoCaptureGuidance.tsx"],"names":[],"mappings":"AAOA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,OAAO,CAAA;AAEzC,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,wCAAwC,CAAA;AAE7E;;;;;;;;;GASG;AACH,eAAO,MAAM,mCAAmC;;;;;;;CAOqB,CAAA;AAErE,MAAM,MAAM,8BAA8B,GACxC,CAAC,OAAO,mCAAmC,CAAC,CAAC,MAAM,OAAO,mCAAmC,CAAC,CAAA;AAEhG;;;;;;GAMG;AACH,MAAM,MAAM,wBAAwB,GAAG,OAAO,CAC5C,MAAM,CAAC,8BAA8B,EAAE,MAAM,GAAG,YAAY,CAAC,CAC9D,CAAA;AAED,MAAM,MAAM,uCAAuC,GAAG;IACpD,iFAAiF;IACjF,IAAI,EAAE,eAAe,CAAA;IACrB,wCAAwC;IACxC,QAAQ,EAAE,wBAAwB,CAAA;IAClC,SAAS,CAAC,EAAE,MAAM,CAAA;CACnB,CAAA;AAED,wBAAgB,kCAAkC,CAAC,EACjD,IAAI,EACJ,QAAQ,EACR,SAAS,GACV,EAAE,uCAAuC,GAAG,YAAY,GAAG,IAAI,CAsB/D;AA4ED;;;;;;;;;;;;GAYG;AACH,MAAM,MAAM,qCAAqC,GAAG;IAClD,OAAO,EAAE,MAAM,GAAG,YAAY,GAAG,SAAS,CAAA;IAC1C,SAAS,CAAC,EAAE,MAAM,CAAA;CACnB,CAAA;AAED,wBAAgB,gCAAgC,CAAC,EAC/C,OAAO,EACP,SAAS,GACV,EAAE,qCAAqC,GAAG,YAAY,GAAG,IAAI,CAe7D"}
|
|
@@ -0,0 +1,128 @@
|
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
import { styled } from 'styled-components';
|
|
3
|
+
/**
|
|
4
|
+
* Which verbiage member renders each code.
|
|
5
|
+
*
|
|
6
|
+
* `notStable` and `outOfFocus` map to DIFFERENT members that happen to carry
|
|
7
|
+
* the same default string. Keeping the members distinct is what lets an
|
|
8
|
+
* integrator separate them later without a breaking change, while the shared
|
|
9
|
+
* default reflects #383's finding that on paper a focus failure IS a motion
|
|
10
|
+
* failure — so "hold still" is right for both, and a second sentence saying it
|
|
11
|
+
* differently is a distinction the applicant cannot act on.
|
|
12
|
+
*/
|
|
13
|
+
export const AUTO_CAPTURE_GUIDANCE_VERBIAGE_KEYS = {
|
|
14
|
+
noDocument: 'autoCaptureNoDocumentText',
|
|
15
|
+
tooClose: 'autoCaptureTooCloseText',
|
|
16
|
+
tooFar: 'autoCaptureTooFarText',
|
|
17
|
+
notStable: 'autoCaptureNotStableText',
|
|
18
|
+
outOfFocus: 'autoCaptureOutOfFocusText',
|
|
19
|
+
holdStill: 'autoCaptureHoldStillText',
|
|
20
|
+
};
|
|
21
|
+
export function DocumentCaptureAutoCaptureGuidance({ code, messages, className, }) {
|
|
22
|
+
if (code === 'none')
|
|
23
|
+
return null;
|
|
24
|
+
const satisfied = code === 'holdStill';
|
|
25
|
+
return (_jsxs(GuidanceChip, { className: className, "$satisfied": satisfied, "data-testid": "document-auto-capture-guidance",
|
|
26
|
+
// The pill is the only thing on screen that changes as the applicant
|
|
27
|
+
// moves, so it is announced. `polite` rather than `assertive`: the
|
|
28
|
+
// stabilizer already rate-limits it to one change per 250ms, and
|
|
29
|
+
// `assertive` would interrupt a screen reader mid-sentence every time.
|
|
30
|
+
role: "status", "aria-live": "polite", children: [_jsx(StateDot, { "$satisfied": satisfied, "aria-hidden": "true" }), messages[AUTO_CAPTURE_GUIDANCE_VERBIAGE_KEYS[code]]] }));
|
|
31
|
+
}
|
|
32
|
+
/** The unsatisfied chip, when the theme sets no `guidanceMessages.warning`. */
|
|
33
|
+
const WARNING_BACKGROUND = '#f4b740';
|
|
34
|
+
const WARNING_TEXT = '#1f1500';
|
|
35
|
+
/**
|
|
36
|
+
* A floating chip, coloured by whether the applicant has anything to fix:
|
|
37
|
+
* amber while any gate fails, the theme's positive colour once they all pass.
|
|
38
|
+
*
|
|
39
|
+
* THE FILL MUST NOT DEPEND ON WHAT IS BEHIND IT. It used to be a translucent
|
|
40
|
+
* near-black, which works over live video and nowhere else. Under
|
|
41
|
+
* `snapToGuides` the chip sits on the surround, which is that same near-black,
|
|
42
|
+
* so only its text and a faint shadow outline showed, and the outline read as
|
|
43
|
+
* a bite out of the guide box's bottom edge. Amber stays visible on the
|
|
44
|
+
* surround, over the page, and over a fullscreen feed.
|
|
45
|
+
*
|
|
46
|
+
* It reads `guidanceMessages.warning`, NOT `default`. The base theme sets
|
|
47
|
+
* `default` to white for ID capture's pill, so reading `default` here would
|
|
48
|
+
* turn every default-theme integrator's chip white.
|
|
49
|
+
*
|
|
50
|
+
* IT DOES NOT POSITION ITSELF. It used to anchor to the surface bottom with a
|
|
51
|
+
* caller-supplied lift, and the lift was a constant sized for a button row —
|
|
52
|
+
* which stopped being where the shutter is the moment the shutter moved onto
|
|
53
|
+
* the guide box's bottom edge. On a letterboxed desktop those two places are
|
|
54
|
+
* nowhere near each other, and the disc landed on top of the pill. The view
|
|
55
|
+
* now owns one stack that anchors off the shutter itself, so the two cannot
|
|
56
|
+
* disagree about where the bottom is.
|
|
57
|
+
*
|
|
58
|
+
* The colour change is a one-shot transition on a state change. Deliberately
|
|
59
|
+
* NOT a pulse, glow or shimmer: those repaint every frame, on top of live
|
|
60
|
+
* video, for the entire time someone is framing a document.
|
|
61
|
+
*/
|
|
62
|
+
const GuidanceChip = styled.div `
|
|
63
|
+
display: flex;
|
|
64
|
+
align-items: center;
|
|
65
|
+
gap: 9px;
|
|
66
|
+
max-width: min(88%, 31ch);
|
|
67
|
+
padding: 11px 18px;
|
|
68
|
+
border-radius: 18px;
|
|
69
|
+
font-size: 15px;
|
|
70
|
+
font-weight: 600;
|
|
71
|
+
line-height: 1.33;
|
|
72
|
+
text-align: left;
|
|
73
|
+
color: ${({ $satisfied, theme }) => $satisfied
|
|
74
|
+
? (theme?.guidanceMessages?.positive?.textColor ?? '#fff')
|
|
75
|
+
: (theme?.guidanceMessages?.warning?.textColor ?? WARNING_TEXT)};
|
|
76
|
+
background: ${({ $satisfied, theme }) => $satisfied
|
|
77
|
+
? (theme?.guidanceMessages?.positive?.backgroundColor ??
|
|
78
|
+
'var(--idm-color-positive-700)')
|
|
79
|
+
: (theme?.guidanceMessages?.warning?.backgroundColor ??
|
|
80
|
+
WARNING_BACKGROUND)};
|
|
81
|
+
box-shadow: 0 6px 20px rgba(0, 0, 0, 0.3);
|
|
82
|
+
transition:
|
|
83
|
+
background-color 160ms ease-out,
|
|
84
|
+
color 160ms ease-out;
|
|
85
|
+
`;
|
|
86
|
+
/**
|
|
87
|
+
* Follows the text colour while unsatisfied, so a themed chip needs no dot
|
|
88
|
+
* colour of its own.
|
|
89
|
+
*/
|
|
90
|
+
const StateDot = styled.span `
|
|
91
|
+
flex: none;
|
|
92
|
+
width: 7px;
|
|
93
|
+
height: 7px;
|
|
94
|
+
border-radius: 50%;
|
|
95
|
+
background: ${({ $satisfied }) => ($satisfied ? '#7ef0d2' : 'currentColor')};
|
|
96
|
+
opacity: ${({ $satisfied }) => ($satisfied ? 1 : 0.6)};
|
|
97
|
+
transition:
|
|
98
|
+
background-color 160ms ease-out,
|
|
99
|
+
opacity 160ms ease-out;
|
|
100
|
+
`;
|
|
101
|
+
export function DocumentCaptureManualCaptureHint({ message, className, }) {
|
|
102
|
+
if (!message)
|
|
103
|
+
return null;
|
|
104
|
+
return (_jsx(ManualCaptureHint, { className: className, "data-testid": "document-auto-capture-manual-hint",
|
|
105
|
+
// Announced once, when it appears. `polite` and NOT a live region that
|
|
106
|
+
// keeps re-reading: the text never changes after this point, so anything
|
|
107
|
+
// stronger would repeat a sentence the applicant has already heard on
|
|
108
|
+
// every unrelated pill update.
|
|
109
|
+
role: "status", children: message }));
|
|
110
|
+
}
|
|
111
|
+
/**
|
|
112
|
+
* Quieter than the pill, deliberately.
|
|
113
|
+
*
|
|
114
|
+
* Standing explanation sitting above live, changing guidance: if the two
|
|
115
|
+
* competed the applicant would read the wrong one. No dot, lower contrast, no
|
|
116
|
+
* background of its own beyond what legibility over video requires.
|
|
117
|
+
*/
|
|
118
|
+
const ManualCaptureHint = styled.div `
|
|
119
|
+
max-width: min(88%, 38ch);
|
|
120
|
+
padding: 7px 14px;
|
|
121
|
+
border-radius: 12px;
|
|
122
|
+
font-size: 12px;
|
|
123
|
+
font-weight: 500;
|
|
124
|
+
line-height: 1.4;
|
|
125
|
+
text-align: center;
|
|
126
|
+
color: rgba(255, 255, 255, 0.86);
|
|
127
|
+
background: rgba(10, 14, 19, 0.7);
|
|
128
|
+
`;
|
|
@@ -7,9 +7,39 @@ export type DocumentCaptureGuideOverlayProps = {
|
|
|
7
7
|
borderRadius?: number;
|
|
8
8
|
borderColor?: string;
|
|
9
9
|
borderWidth?: number;
|
|
10
|
+
/**
|
|
11
|
+
* Draw four corner brackets instead of a continuous border.
|
|
12
|
+
*
|
|
13
|
+
* Used by the auto-capture guided screen. The brackets are not decoration:
|
|
14
|
+
* the failure this whole flow exists to prevent is a page with its CORNERS
|
|
15
|
+
* cut off, so marking the corners specifically is the guidance.
|
|
16
|
+
*
|
|
17
|
+
* They are drawn on the same canvas as the mask, from the same `rect`, so
|
|
18
|
+
* they cannot drift out of alignment with the hole the way a DOM overlay
|
|
19
|
+
* positioned from `guideRect` could.
|
|
20
|
+
*/
|
|
21
|
+
cornerBrackets?: boolean;
|
|
22
|
+
/**
|
|
23
|
+
* Arm length of each bracket, px. Omitted scales with the box.
|
|
24
|
+
*
|
|
25
|
+
* PROPORTIONAL BY DEFAULT, and that matters more than it sounds: a fixed
|
|
26
|
+
* length that reads as a frame on a 190px-wide phone guide is 5% of a
|
|
27
|
+
* 650px-wide desktop one, where it stops reading as a corner at all and
|
|
28
|
+
* looks like a stray mark. Clamped at both ends so it neither disappears on
|
|
29
|
+
* a tiny box nor turns into a near-continuous border on a huge one.
|
|
30
|
+
*/
|
|
31
|
+
cornerLength?: number;
|
|
10
32
|
maskColor: string;
|
|
11
33
|
padding?: number;
|
|
12
34
|
classNames?: DocumentCaptureGuideOverlayClassNames;
|
|
13
35
|
};
|
|
14
|
-
export declare function DocumentCaptureGuideOverlay({ aspectRatio, borderRadius, borderColor, borderWidth, maskColor, padding, classNames, }: DocumentCaptureGuideOverlayProps): import("react/jsx-runtime").JSX.Element;
|
|
36
|
+
export declare function DocumentCaptureGuideOverlay({ aspectRatio, borderRadius, borderColor, borderWidth, cornerBrackets, cornerLength, maskColor, padding, classNames, }: DocumentCaptureGuideOverlayProps): import("react/jsx-runtime").JSX.Element;
|
|
37
|
+
/**
|
|
38
|
+
* Bracket arm length for a guide box of this size.
|
|
39
|
+
*
|
|
40
|
+
* Exported because it is the rule that already regressed once: a fixed 34px
|
|
41
|
+
* arm read as a frame on a phone-sized guide and as a stray mark on a
|
|
42
|
+
* desktop-sized one, and nothing in a diff would have shown that.
|
|
43
|
+
*/
|
|
44
|
+
export declare function cornerArmLength(width: number, height: number, radius?: number): number;
|
|
15
45
|
//# sourceMappingURL=DocumentCaptureGuideOverlay.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"DocumentCaptureGuideOverlay.d.ts","sourceRoot":"","sources":["../../../src/components/document/DocumentCaptureGuideOverlay.tsx"],"names":[],"mappings":"AAsCA,MAAM,MAAM,qCAAqC,GAAG;IAClD,SAAS,CAAC,EAAE,MAAM,CAAA;CACnB,CAAA;AAED,MAAM,MAAM,gCAAgC,GAAG;IAC7C,sEAAsE;IACtE,WAAW,CAAC,EAAE,MAAM,CAAA;IACpB,YAAY,CAAC,EAAE,MAAM,CAAA;IACrB,WAAW,CAAC,EAAE,MAAM,CAAA;IACpB,WAAW,CAAC,EAAE,MAAM,CAAA;IACpB,SAAS,EAAE,MAAM,CAAA;IACjB,OAAO,CAAC,EAAE,MAAM,CAAA;IAChB,UAAU,CAAC,EAAE,qCAAqC,CAAA;CACnD,CAAA;AAED,wBAAgB,2BAA2B,CAAC,EAC1C,WAAW,EACX,YAAiB,EACjB,WAAW,EACX,WAAW,EACX,SAAS,EACT,OAAO,EACP,UAAe,GAChB,EAAE,gCAAgC,
|
|
1
|
+
{"version":3,"file":"DocumentCaptureGuideOverlay.d.ts","sourceRoot":"","sources":["../../../src/components/document/DocumentCaptureGuideOverlay.tsx"],"names":[],"mappings":"AAsCA,MAAM,MAAM,qCAAqC,GAAG;IAClD,SAAS,CAAC,EAAE,MAAM,CAAA;CACnB,CAAA;AAED,MAAM,MAAM,gCAAgC,GAAG;IAC7C,sEAAsE;IACtE,WAAW,CAAC,EAAE,MAAM,CAAA;IACpB,YAAY,CAAC,EAAE,MAAM,CAAA;IACrB,WAAW,CAAC,EAAE,MAAM,CAAA;IACpB,WAAW,CAAC,EAAE,MAAM,CAAA;IACpB;;;;;;;;;;OAUG;IACH,cAAc,CAAC,EAAE,OAAO,CAAA;IACxB;;;;;;;;OAQG;IACH,YAAY,CAAC,EAAE,MAAM,CAAA;IACrB,SAAS,EAAE,MAAM,CAAA;IACjB,OAAO,CAAC,EAAE,MAAM,CAAA;IAChB,UAAU,CAAC,EAAE,qCAAqC,CAAA;CACnD,CAAA;AAED,wBAAgB,2BAA2B,CAAC,EAC1C,WAAW,EACX,YAAiB,EACjB,WAAW,EACX,WAAW,EACX,cAAsB,EACtB,YAAY,EACZ,SAAS,EACT,OAAO,EACP,UAAe,GAChB,EAAE,gCAAgC,2CAgJlC;AA+BD;;;;;;GAMG;AACH,wBAAgB,eAAe,CAC7B,KAAK,EAAE,MAAM,EACb,MAAM,EAAE,MAAM,EACd,MAAM,SAAI,GACT,MAAM,CAuBR"}
|