@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,101 @@
|
|
|
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
|
+
/**
|
|
33
|
+
* A floating pill over the feed, not a slab in a bar.
|
|
34
|
+
*
|
|
35
|
+
* IT DOES NOT POSITION ITSELF. It used to anchor to the surface bottom with a
|
|
36
|
+
* caller-supplied lift, and the lift was a constant sized for a button row —
|
|
37
|
+
* which stopped being where the shutter is the moment the shutter moved onto
|
|
38
|
+
* the guide box's bottom edge. On a letterboxed desktop those two places are
|
|
39
|
+
* nowhere near each other, and the disc landed on top of the pill. The view
|
|
40
|
+
* now owns one stack that anchors off the shutter itself, so the two cannot
|
|
41
|
+
* disagree about where the bottom is.
|
|
42
|
+
*
|
|
43
|
+
* The colour change is a one-shot transition on a state change. Deliberately
|
|
44
|
+
* NOT a pulse, glow or shimmer: those repaint every frame, on top of live
|
|
45
|
+
* video, for the entire time someone is framing a document.
|
|
46
|
+
*/
|
|
47
|
+
const GuidanceChip = styled.div `
|
|
48
|
+
display: flex;
|
|
49
|
+
align-items: center;
|
|
50
|
+
gap: 8px;
|
|
51
|
+
max-width: min(88%, 34ch);
|
|
52
|
+
padding: 10px 16px;
|
|
53
|
+
border-radius: 999px;
|
|
54
|
+
font-size: 13.5px;
|
|
55
|
+
font-weight: 600;
|
|
56
|
+
line-height: 1.35;
|
|
57
|
+
text-align: left;
|
|
58
|
+
color: #fff;
|
|
59
|
+
background: ${({ $satisfied, theme }) => $satisfied
|
|
60
|
+
? (theme?.guidanceMessages?.positive?.backgroundColor ??
|
|
61
|
+
'var(--idm-color-positive-700)')
|
|
62
|
+
: 'rgba(10, 14, 19, 0.88)'};
|
|
63
|
+
box-shadow: 0 2px 12px rgba(0, 0, 0, 0.35);
|
|
64
|
+
transition: background-color 160ms ease-out;
|
|
65
|
+
`;
|
|
66
|
+
const StateDot = styled.span `
|
|
67
|
+
flex: none;
|
|
68
|
+
width: 7px;
|
|
69
|
+
height: 7px;
|
|
70
|
+
border-radius: 50%;
|
|
71
|
+
background: ${({ $satisfied }) => ($satisfied ? '#7ef0d2' : '#ea8557')};
|
|
72
|
+
transition: background-color 160ms ease-out;
|
|
73
|
+
`;
|
|
74
|
+
export function DocumentCaptureManualCaptureHint({ message, className, }) {
|
|
75
|
+
if (!message)
|
|
76
|
+
return null;
|
|
77
|
+
return (_jsx(ManualCaptureHint, { className: className, "data-testid": "document-auto-capture-manual-hint",
|
|
78
|
+
// Announced once, when it appears. `polite` and NOT a live region that
|
|
79
|
+
// keeps re-reading: the text never changes after this point, so anything
|
|
80
|
+
// stronger would repeat a sentence the applicant has already heard on
|
|
81
|
+
// every unrelated pill update.
|
|
82
|
+
role: "status", children: message }));
|
|
83
|
+
}
|
|
84
|
+
/**
|
|
85
|
+
* Quieter than the pill, deliberately.
|
|
86
|
+
*
|
|
87
|
+
* Standing explanation sitting above live, changing guidance: if the two
|
|
88
|
+
* competed the applicant would read the wrong one. No dot, lower contrast, no
|
|
89
|
+
* background of its own beyond what legibility over video requires.
|
|
90
|
+
*/
|
|
91
|
+
const ManualCaptureHint = styled.div `
|
|
92
|
+
max-width: min(88%, 38ch);
|
|
93
|
+
padding: 7px 14px;
|
|
94
|
+
border-radius: 12px;
|
|
95
|
+
font-size: 12px;
|
|
96
|
+
font-weight: 500;
|
|
97
|
+
line-height: 1.4;
|
|
98
|
+
text-align: center;
|
|
99
|
+
color: rgba(255, 255, 255, 0.86);
|
|
100
|
+
background: rgba(10, 14, 19, 0.7);
|
|
101
|
+
`;
|
|
@@ -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"}
|
|
@@ -35,7 +35,7 @@ import { computeGuideRect } from './guideRect';
|
|
|
35
35
|
* deliberately a little larger than the hole rather than pixel-matched to it.
|
|
36
36
|
*/
|
|
37
37
|
const FEED_BLEED_PX = 2;
|
|
38
|
-
export function DocumentCaptureGuideOverlay({ aspectRatio, borderRadius = 25, borderColor, borderWidth, maskColor, padding, classNames = {}, }) {
|
|
38
|
+
export function DocumentCaptureGuideOverlay({ aspectRatio, borderRadius = 25, borderColor, borderWidth, cornerBrackets = false, cornerLength, maskColor, padding, classNames = {}, }) {
|
|
39
39
|
const { ref: wrapperRef, width: wrapperWidth = 0, height: wrapperHeight = 0, } = useResizeObserver();
|
|
40
40
|
const canvasRef = useRef(null);
|
|
41
41
|
const { setGuideRect } = useGuideLayout();
|
|
@@ -115,17 +115,33 @@ export function DocumentCaptureGuideOverlay({ aspectRatio, borderRadius = 25, bo
|
|
|
115
115
|
ctx.roundRect(rect.x, rect.y, rect.width, rect.height, borderRadius);
|
|
116
116
|
ctx.lineWidth = resolvedBorderWidth;
|
|
117
117
|
ctx.strokeStyle = borderColor ?? 'white';
|
|
118
|
-
|
|
118
|
+
// Brackets replace the continuous border rather than joining it — stroking
|
|
119
|
+
// both leaves a full rectangle with four thicker corners.
|
|
120
|
+
if (!cornerBrackets)
|
|
121
|
+
ctx.stroke();
|
|
119
122
|
// Punch the guide box out of the mask. The fill colour is irrelevant under
|
|
120
123
|
// 'destination-out'; only its alpha matters.
|
|
121
124
|
ctx.fillStyle = 'rgba(0,0,0,1)';
|
|
122
125
|
ctx.globalCompositeOperation = 'destination-out';
|
|
123
126
|
ctx.fill();
|
|
124
127
|
ctx.globalCompositeOperation = 'source-over';
|
|
128
|
+
// AFTER the punch: 'destination-out' would erase the brackets along with
|
|
129
|
+
// the hole, and they are meant to sit on top of the live feed.
|
|
130
|
+
if (cornerBrackets) {
|
|
131
|
+
drawCornerBrackets(ctx, rect, {
|
|
132
|
+
radius: borderRadius,
|
|
133
|
+
length: cornerLength ??
|
|
134
|
+
cornerArmLength(rect.width, rect.height, borderRadius),
|
|
135
|
+
lineWidth: resolvedBorderWidth,
|
|
136
|
+
color: borderColor ?? 'white',
|
|
137
|
+
});
|
|
138
|
+
}
|
|
125
139
|
}, [
|
|
126
140
|
aspectRatio,
|
|
127
141
|
borderColor,
|
|
128
142
|
borderRadius,
|
|
143
|
+
cornerBrackets,
|
|
144
|
+
cornerLength,
|
|
129
145
|
maskColor,
|
|
130
146
|
resolvedBorderWidth,
|
|
131
147
|
resolvedPadding,
|
|
@@ -138,8 +154,111 @@ export function DocumentCaptureGuideOverlay({ aspectRatio, borderRadius = 25, bo
|
|
|
138
154
|
useEffect(() => () => setGuideRect(null), [setGuideRect]);
|
|
139
155
|
return (_jsx(CanvasWrapper, { ref: wrapperRef, className: classNames.container, "$maskColor": maskColor, children: _jsx(Canvas, { ref: canvasRef }) }));
|
|
140
156
|
}
|
|
157
|
+
/**
|
|
158
|
+
* Four L-shaped brackets tracing the guide box's corners.
|
|
159
|
+
*
|
|
160
|
+
* `arcTo` reuses the same corner radius as the punched hole, so a bracket sits
|
|
161
|
+
* exactly on the edge of the cut-out instead of near it. Arms are clamped so
|
|
162
|
+
* they can never meet in the middle of a short side and quietly become a
|
|
163
|
+
* continuous border.
|
|
164
|
+
*/
|
|
165
|
+
/**
|
|
166
|
+
* TOTAL corner run — arc included — as a fraction of the guide box's short
|
|
167
|
+
* side.
|
|
168
|
+
*
|
|
169
|
+
* "Total" is the correction that matters. The accepted design drew each
|
|
170
|
+
* bracket as a 26px box on a 192px-wide guide (~13%) with the corner radius
|
|
171
|
+
* INSIDE that 26px. Adding the arm on top of the radius instead made the
|
|
172
|
+
* visible run `radius + arm` — 64px where the design had 26 — which reads as a
|
|
173
|
+
* heavy rounded rectangle with four gaps rather than as four corner marks.
|
|
174
|
+
*/
|
|
175
|
+
const CORNER_ARM_RATIO = 0.12;
|
|
176
|
+
const CORNER_ARM_MIN = 20;
|
|
177
|
+
const CORNER_ARM_MAX = 96;
|
|
178
|
+
/**
|
|
179
|
+
* Shortest straight arm worth drawing.
|
|
180
|
+
*
|
|
181
|
+
* Applied BEFORE the quarter-side ceiling, so a box small enough for the floor
|
|
182
|
+
* and the ceiling to disagree still cannot grow arms that meet in the middle.
|
|
183
|
+
*/
|
|
184
|
+
const CORNER_ARM_FLOOR = 8;
|
|
185
|
+
/**
|
|
186
|
+
* Bracket arm length for a guide box of this size.
|
|
187
|
+
*
|
|
188
|
+
* Exported because it is the rule that already regressed once: a fixed 34px
|
|
189
|
+
* arm read as a frame on a phone-sized guide and as a stray mark on a
|
|
190
|
+
* desktop-sized one, and nothing in a diff would have shown that.
|
|
191
|
+
*/
|
|
192
|
+
export function cornerArmLength(width, height, radius = 0) {
|
|
193
|
+
const short = Math.min(width, height);
|
|
194
|
+
if (short <= 0)
|
|
195
|
+
return 0;
|
|
196
|
+
const total = Math.max(CORNER_ARM_MIN, Math.min(CORNER_ARM_MAX, short * CORNER_ARM_RATIO));
|
|
197
|
+
// The straight arm is what is LEFT of the run once the corner arc has taken
|
|
198
|
+
// its share, so the total mark stays the size the design specified whatever
|
|
199
|
+
// the radius is.
|
|
200
|
+
//
|
|
201
|
+
// Floored, because on a small box the radius can eat the whole run: at the
|
|
202
|
+
// default radius of 25 anything with a short side under ~208px yields a
|
|
203
|
+
// NEGATIVE remainder, and each bracket collapses to a bare quarter-arc with
|
|
204
|
+
// no arms — the outline silently stops reading as four corners. Below that
|
|
205
|
+
// size the design's total mark is unachievable anyway, so a visible bracket
|
|
206
|
+
// beats an exactly-sized invisible one.
|
|
207
|
+
const arm = Math.max(CORNER_ARM_FLOOR, total - radius);
|
|
208
|
+
// The quarter-side ceiling lives HERE, not only at the draw call, so this
|
|
209
|
+
// function is the whole truth about arm length. On a very small box the
|
|
210
|
+
// floor alone would let two opposing arms meet and silently turn four
|
|
211
|
+
// brackets back into the continuous border they replaced.
|
|
212
|
+
return Math.min(arm, short / 4);
|
|
213
|
+
}
|
|
214
|
+
function drawCornerBrackets(ctx, rect, opts) {
|
|
215
|
+
const radius = Math.min(opts.radius, rect.width / 2, rect.height / 2);
|
|
216
|
+
const maxArm = Math.min(rect.width, rect.height) / 4;
|
|
217
|
+
const arm = Math.max(0, Math.min(opts.length, maxArm));
|
|
218
|
+
if (arm <= 0)
|
|
219
|
+
return;
|
|
220
|
+
const { x, y, width, height } = rect;
|
|
221
|
+
const right = x + width;
|
|
222
|
+
const bottom = y + height;
|
|
223
|
+
ctx.save();
|
|
224
|
+
ctx.strokeStyle = opts.color;
|
|
225
|
+
ctx.lineWidth = opts.lineWidth;
|
|
226
|
+
ctx.lineCap = 'round';
|
|
227
|
+
ctx.lineJoin = 'round';
|
|
228
|
+
const corners = [
|
|
229
|
+
// [startX, startY, cornerX, cornerY, endX, endY]
|
|
230
|
+
[x, y + radius + arm, x, y, x + radius + arm, y],
|
|
231
|
+
[right - radius - arm, y, right, y, right, y + radius + arm],
|
|
232
|
+
[right, bottom - radius - arm, right, bottom, right - radius - arm, bottom],
|
|
233
|
+
[x + radius + arm, bottom, x, bottom, x, bottom - radius - arm],
|
|
234
|
+
];
|
|
235
|
+
for (const [sx, sy, cx, cy, ex, ey] of corners) {
|
|
236
|
+
ctx.beginPath();
|
|
237
|
+
ctx.moveTo(sx, sy);
|
|
238
|
+
ctx.arcTo(cx, cy, ex, ey, radius);
|
|
239
|
+
ctx.lineTo(ex, ey);
|
|
240
|
+
ctx.stroke();
|
|
241
|
+
}
|
|
242
|
+
ctx.restore();
|
|
243
|
+
}
|
|
141
244
|
const CanvasWrapper = styled.div `
|
|
142
245
|
flex-grow: 1;
|
|
246
|
+
/* REQUIRED, not tidying. setCanvasDimensions puts an explicit pixel height on
|
|
247
|
+
the child canvas, and a flex item's default min-height of auto floors it at
|
|
248
|
+
its content — so this wrapper can grow but can never shrink back.
|
|
249
|
+
|
|
250
|
+
It bit on exactly one transition: while auto-capture is guiding, the header
|
|
251
|
+
is absolutely positioned and out of flow, so the wrapper is measured at the
|
|
252
|
+
FULL surface height and the canvas is pinned there. Accepting the manual
|
|
253
|
+
fallback swaps in the in-flow heading bar, the column then needs this item
|
|
254
|
+
to give back that height, an auto min-height refuses, and the surface
|
|
255
|
+
overflows by the header's height — carrying the footer, and the Capture
|
|
256
|
+
button the applicant just asked for, below the fold with nothing to
|
|
257
|
+
scroll.
|
|
258
|
+
|
|
259
|
+
No backticks in this comment: it lives inside a styled-components template
|
|
260
|
+
literal, where one would end the template. */
|
|
261
|
+
min-height: 0;
|
|
143
262
|
background-clip: padding-box;
|
|
144
263
|
box-shadow: inset 0 0 0 2px ${(props) => props.$maskColor};
|
|
145
264
|
`;
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
import type { ReactElement } from 'react';
|
|
2
|
+
import type { DocumentUploadState } from '@idmission/websdk-core/documentCapture';
|
|
3
|
+
export type DocumentCaptureReviewScreenClassNames = {
|
|
4
|
+
/** Class name for the full-screen review container. */
|
|
5
|
+
reviewContainer?: string;
|
|
6
|
+
/** Class name for the review card. */
|
|
7
|
+
reviewCard?: string;
|
|
8
|
+
/** Class name for the review heading. */
|
|
9
|
+
reviewHeading?: string;
|
|
10
|
+
/** 2.x: the captured-page image. */
|
|
11
|
+
previewImage?: string;
|
|
12
|
+
/** 2.x: the button row. */
|
|
13
|
+
buttonsRow?: string;
|
|
14
|
+
/** 2.x: the discard-and-recapture button. */
|
|
15
|
+
retryCaptureBtn?: string;
|
|
16
|
+
/** 2.x: the upload button before an upload starts. */
|
|
17
|
+
uploadBtn?: string;
|
|
18
|
+
/** 2.x: the upload button once one has started. */
|
|
19
|
+
uploadProgressBtn?: string;
|
|
20
|
+
};
|
|
21
|
+
export type DocumentCaptureReviewScreenProps = {
|
|
22
|
+
/** Object URL of the accepted frame. */
|
|
23
|
+
contentUrl: string;
|
|
24
|
+
headingText: string | ReactElement | undefined;
|
|
25
|
+
retryText: string | ReactElement | undefined;
|
|
26
|
+
uploadText: string | ReactElement | undefined;
|
|
27
|
+
uploadingText: string | ReactElement | undefined;
|
|
28
|
+
retryUploadText: string | ReactElement | undefined;
|
|
29
|
+
successText: string | ReactElement | undefined;
|
|
30
|
+
uploadState: DocumentUploadState;
|
|
31
|
+
onRetry: () => void;
|
|
32
|
+
onUpload: () => void;
|
|
33
|
+
classNames?: DocumentCaptureReviewScreenClassNames;
|
|
34
|
+
/**
|
|
35
|
+
* Accessible name for the captured page.
|
|
36
|
+
*
|
|
37
|
+
* Required, and deliberately has no default: a default here would be an
|
|
38
|
+
* English literal shipped to every locale, and this component has no access
|
|
39
|
+
* to the verbiage bag to translate one.
|
|
40
|
+
*/
|
|
41
|
+
alt: string;
|
|
42
|
+
};
|
|
43
|
+
export declare function DocumentCaptureReviewScreen({ contentUrl, headingText, retryText, uploadText, uploadingText, retryUploadText, successText, uploadState, onRetry, onUpload, classNames, alt, }: DocumentCaptureReviewScreenProps): ReactElement;
|
|
44
|
+
//# sourceMappingURL=DocumentCaptureReviewScreen.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"DocumentCaptureReviewScreen.d.ts","sourceRoot":"","sources":["../../../src/components/document/DocumentCaptureReviewScreen.tsx"],"names":[],"mappings":"AA0BA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,OAAO,CAAA;AAEzC,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,wCAAwC,CAAA;AAUjF,MAAM,MAAM,qCAAqC,GAAG;IAClD,uDAAuD;IACvD,eAAe,CAAC,EAAE,MAAM,CAAA;IACxB,sCAAsC;IACtC,UAAU,CAAC,EAAE,MAAM,CAAA;IACnB,yCAAyC;IACzC,aAAa,CAAC,EAAE,MAAM,CAAA;IACtB,oCAAoC;IACpC,YAAY,CAAC,EAAE,MAAM,CAAA;IACrB,2BAA2B;IAC3B,UAAU,CAAC,EAAE,MAAM,CAAA;IACnB,6CAA6C;IAC7C,eAAe,CAAC,EAAE,MAAM,CAAA;IACxB,sDAAsD;IACtD,SAAS,CAAC,EAAE,MAAM,CAAA;IAClB,mDAAmD;IACnD,iBAAiB,CAAC,EAAE,MAAM,CAAA;CAC3B,CAAA;AAED,MAAM,MAAM,gCAAgC,GAAG;IAC7C,wCAAwC;IACxC,UAAU,EAAE,MAAM,CAAA;IAClB,WAAW,EAAE,MAAM,GAAG,YAAY,GAAG,SAAS,CAAA;IAC9C,SAAS,EAAE,MAAM,GAAG,YAAY,GAAG,SAAS,CAAA;IAC5C,UAAU,EAAE,MAAM,GAAG,YAAY,GAAG,SAAS,CAAA;IAC7C,aAAa,EAAE,MAAM,GAAG,YAAY,GAAG,SAAS,CAAA;IAChD,eAAe,EAAE,MAAM,GAAG,YAAY,GAAG,SAAS,CAAA;IAClD,WAAW,EAAE,MAAM,GAAG,YAAY,GAAG,SAAS,CAAA;IAC9C,WAAW,EAAE,mBAAmB,CAAA;IAChC,OAAO,EAAE,MAAM,IAAI,CAAA;IACnB,QAAQ,EAAE,MAAM,IAAI,CAAA;IACpB,UAAU,CAAC,EAAE,qCAAqC,CAAA;IAClD;;;;;;OAMG;IACH,GAAG,EAAE,MAAM,CAAA;CACZ,CAAA;AAED,wBAAgB,2BAA2B,CAAC,EAC1C,UAAU,EACV,WAAW,EACX,SAAS,EACT,UAAU,EACV,aAAa,EACb,eAAe,EACf,WAAW,EACX,WAAW,EACX,OAAO,EACP,QAAQ,EACR,UAAe,EACf,GAAG,GACJ,EAAE,gCAAgC,GAAG,YAAY,CA8DjD"}
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
import { styled } from 'styled-components';
|
|
3
|
+
import { ButtonsColumn, GrayOverlayContainer, OverlayInner, WideBorderButton, WideButton, } from '../common/overlay';
|
|
4
|
+
import { FlexCard } from '../common/Card';
|
|
5
|
+
export function DocumentCaptureReviewScreen({ contentUrl, headingText, retryText, uploadText, uploadingText, retryUploadText, successText, uploadState, onRetry, onUpload, classNames = {}, alt, }) {
|
|
6
|
+
const started = uploadState !== 'not_started';
|
|
7
|
+
const uploading = uploadState === 'in_progress';
|
|
8
|
+
const succeeded = uploadState === 'succeeded';
|
|
9
|
+
return (_jsx(GrayOverlayContainer, { className: classNames.reviewContainer, "data-testid": "document-capture-review", children: _jsx(OverlayInner, { children: _jsxs(FlexCard, { className: classNames.reviewCard, children: [_jsx(ReviewHeading, { className: classNames.reviewHeading, children: headingText }), _jsx(ImageWrap, { children: _jsx(PreviewImage, { className: classNames.previewImage, src: contentUrl, alt: alt }) }), _jsxs(ButtonsColumn, { className: classNames.buttonsRow, children: [_jsx(WideButton, { className: started ? classNames.uploadProgressBtn : classNames.uploadBtn, variant: uploadState === 'failed' ? 'negative' : 'positive', onClick: onUpload, disabled: uploading || succeeded, finished: !uploading, children: succeeded
|
|
10
|
+
? successText
|
|
11
|
+
: uploadState === 'failed'
|
|
12
|
+
? retryUploadText
|
|
13
|
+
: uploading
|
|
14
|
+
? uploadingText
|
|
15
|
+
: uploadText }), !succeeded && (_jsx(WideBorderButton, { className: classNames.retryCaptureBtn, variant: "warning", onClick: onRetry, disabled: uploading, finished: true, children: retryText }))] })] }) }) }));
|
|
16
|
+
}
|
|
17
|
+
const ReviewHeading = styled.h2 `
|
|
18
|
+
margin: 0 0 16px;
|
|
19
|
+
font-size: 18px;
|
|
20
|
+
font-weight: 650;
|
|
21
|
+
text-align: center;
|
|
22
|
+
`;
|
|
23
|
+
// `min-height: 0` is what actually lets this shrink inside the flex card —
|
|
24
|
+
// without it the default `min-height: auto` floors the wrapper at the image's
|
|
25
|
+
// intrinsic height and the buttons get pushed off the bottom of a phone.
|
|
26
|
+
const ImageWrap = styled.div `
|
|
27
|
+
flex: 1;
|
|
28
|
+
min-height: 0;
|
|
29
|
+
display: flex;
|
|
30
|
+
align-items: center;
|
|
31
|
+
justify-content: center;
|
|
32
|
+
margin-bottom: 18px;
|
|
33
|
+
`;
|
|
34
|
+
const PreviewImage = styled.img `
|
|
35
|
+
max-width: 100%;
|
|
36
|
+
max-height: 100%;
|
|
37
|
+
object-fit: contain;
|
|
38
|
+
border-radius: 4px;
|
|
39
|
+
border: 1px solid #e2e2e8;
|
|
40
|
+
`;
|
|
@@ -13,4 +13,29 @@ export type DocumentCapturePrompt = DocumentCaptureInput & {
|
|
|
13
13
|
onUploaded?: (document: CapturedDocument) => void;
|
|
14
14
|
};
|
|
15
15
|
export type { CapturedDocument } from '@idmission/websdk-core/documentCapture';
|
|
16
|
+
/**
|
|
17
|
+
* `DocumentCaptureInput` with every field required to be PRESENT, though still
|
|
18
|
+
* allowed to be `undefined`.
|
|
19
|
+
*
|
|
20
|
+
* The intersection is doing real work: `Required<T>` (and any `-?` mapped type)
|
|
21
|
+
* strips `undefined` from the value as well as removing the optional marker,
|
|
22
|
+
* which no optional field can then satisfy. `Record<keyof T, unknown>` demands
|
|
23
|
+
* the key and nothing about the value, and `DocumentCaptureInput` types it.
|
|
24
|
+
*/
|
|
25
|
+
type EveryCoreInputField = DocumentCaptureInput & Record<keyof DocumentCaptureInput, unknown>;
|
|
26
|
+
/**
|
|
27
|
+
* Strip the React half off a caller's document, keeping every core field.
|
|
28
|
+
*
|
|
29
|
+
* The allowlist destructure this replaces —
|
|
30
|
+
* `({ title, aspectRatio, processAsPOA, content }) => ({ ... })` — silently
|
|
31
|
+
* dropped anything added to `DocumentCaptureInput` afterwards: the result stayed
|
|
32
|
+
* assignable, so nothing anywhere errored, and a per-document field could reach
|
|
33
|
+
* the flow and never reach the engine (#340). `autoCapture` was the field that
|
|
34
|
+
* would have hit it first.
|
|
35
|
+
*
|
|
36
|
+
* The `EveryCoreInputField` return annotation is the fix: omit a field and this
|
|
37
|
+
* function stops compiling; add one core does not declare and the object
|
|
38
|
+
* literal trips excess-property checking.
|
|
39
|
+
*/
|
|
40
|
+
export declare function toDocumentCaptureInput(document: DocumentCapturePrompt): EveryCoreInputField;
|
|
16
41
|
//# sourceMappingURL=types.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../src/components/document/types.ts"],"names":[],"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,CAAC,CAAA;AAE7C;;;;;;;;;;;;;GAaG;AACH,wBAAgB,sBAAsB,CACpC,QAAQ,EAAE,qBAAqB,GAC9B,mBAAmB,CAGrB"}
|
|
@@ -1 +1,18 @@
|
|
|
1
|
-
|
|
1
|
+
/**
|
|
2
|
+
* Strip the React half off a caller's document, keeping every core field.
|
|
3
|
+
*
|
|
4
|
+
* The allowlist destructure this replaces —
|
|
5
|
+
* `({ title, aspectRatio, processAsPOA, content }) => ({ ... })` — silently
|
|
6
|
+
* dropped anything added to `DocumentCaptureInput` afterwards: the result stayed
|
|
7
|
+
* assignable, so nothing anywhere errored, and a per-document field could reach
|
|
8
|
+
* the flow and never reach the engine (#340). `autoCapture` was the field that
|
|
9
|
+
* would have hit it first.
|
|
10
|
+
*
|
|
11
|
+
* The `EveryCoreInputField` return annotation is the fix: omit a field and this
|
|
12
|
+
* function stops compiling; add one core does not declare and the object
|
|
13
|
+
* literal trips excess-property checking.
|
|
14
|
+
*/
|
|
15
|
+
export function toDocumentCaptureInput(document) {
|
|
16
|
+
const { title, aspectRatio, processAsPOA, autoCapture, content } = document;
|
|
17
|
+
return { title, aspectRatio, processAsPOA, autoCapture, content };
|
|
18
|
+
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"IdCaptureGuides.d.ts","sourceRoot":"","sources":["../../../src/components/guides/IdCaptureGuides.tsx"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"IdCaptureGuides.d.ts","sourceRoot":"","sources":["../../../src/components/guides/IdCaptureGuides.tsx"],"names":[],"mappings":"AAyEA,OAAO,EAAmB,KAAK,wBAAwB,EAAE,MAAM,kCAAkC,CAAA;AAEjG,OAAO,EAGL,KAAK,wBAAwB,EAC9B,MAAM,YAAY,CAAA;AACnB,OAAO,EAEL,2BAA2B,EAC5B,MAAM,qBAAqB,CAAA;AAC5B,OAAO,EAEL,KAAK,+BAA+B,EACrC,MAAM,yBAAyB,CAAA;AAChC,OAAO,KAAK,EAAE,iBA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oC,EACpC,UAAe,EACf,QAAQ,EAAE,WAAgB,EAC1B,MAAM,EAAE,cAAc,EACtB,sBAA6B,GAC9B,EAAE,oBAAoB,2CAkHtB"}
|
|
@@ -72,17 +72,16 @@ import { jsx as _jsx, Fragment as _Fragment, jsxs as _jsxs } from "react/jsx-run
|
|
|
72
72
|
// remains, since the header ("SCAN THE BARCODE") has no guidance-code
|
|
73
73
|
// equivalent and stays customizable exactly as in sdk2.
|
|
74
74
|
import { useTheme } from 'styled-components';
|
|
75
|
-
import { useTranslation } from 'react-i18next';
|
|
76
75
|
import { isSatisfiedCode } from '@idmission/websdk-core/idCapture';
|
|
77
76
|
import { guidanceMessageKey, instructionKey } from '../../guidance/strings';
|
|
78
|
-
import { useTranslations } from '../../i18n';
|
|
77
|
+
import { useSdkTranslation, useTranslations, } from '../../i18n';
|
|
79
78
|
import { IdCaptureFitGuide, } from './IdCaptureFitGuide';
|
|
80
79
|
import { IdCaptureGuideOverlay, } from './IdCaptureGuideOverlay';
|
|
81
80
|
import { defaultIdCaptureGuideImages } from '../guide_images';
|
|
82
81
|
import { BarcodeGuideOverlay, } from '../barcode/BarcodeGuideOverlay';
|
|
83
82
|
import { BarcodeSuccessOverlay } from '../barcode/BarcodeSuccessOverlay';
|
|
84
83
|
export function IdCaptureGuides({ state, isRearFacing, guideType = 'fit', guideBoxDisabled = false, guideBoxFollowsMask = false, guideBoxBorderRadius, guideBoxMaxWidth, guideBoxMaxHeight, cameraFeedMode = 'snapToGuides', images = defaultIdCaptureGuideImages, classNames = {}, verbiage: rawVerbiage = {}, status: statusOverride, portraitGuidesOnMobile = true, }) {
|
|
85
|
-
const { t } =
|
|
84
|
+
const { t } = useSdkTranslation();
|
|
86
85
|
const theme = useTheme();
|
|
87
86
|
const barcodeVerbiage = useTranslations(rawVerbiage, {
|
|
88
87
|
barcodeHeaderText: 'SCAN THE BARCODE',
|
|
@@ -120,7 +119,7 @@ export function IdCaptureGuides({ state, isRearFacing, guideType = 'fit', guideB
|
|
|
120
119
|
if (isBarcodeSuccess) {
|
|
121
120
|
return _jsx(BarcodeSuccessOverlay, {});
|
|
122
121
|
}
|
|
123
|
-
return (_jsx(BarcodeGuideOverlay, { headerText: barcodeVerbiage.barcodeHeaderText, instructionText: instruction, classNames: classNames }));
|
|
122
|
+
return (_jsx(BarcodeGuideOverlay, { headerText: barcodeVerbiage.barcodeHeaderText, instructionText: instruction, instructionCode: state.rawGuidance.code, classNames: classNames }));
|
|
124
123
|
}
|
|
125
124
|
// Client barcode scanning happens silently in the background
|
|
126
125
|
// during normal ID back capture - no special UI needed here
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ReviewScreen.d.ts","sourceRoot":"","sources":["../../../src/components/review/ReviewScreen.tsx"],"names":[],"mappings":"AAsBA,OAAO,KAAK,EACV,iBAAiB,EAEjB,eAAe,EAChB,MAAM,kCAAkC,CAAA;AAazC,OAAO,EAAE,KAAK,wBAAwB,EAAmB,MAAM,YAAY,CAAA;AAC3E,OAAO,EAGL,KAAK,sBAAsB,EAC5B,MAAM,0BAA0B,CAAA;AAcjC,MAAM,MAAM,sBAAsB,GAAG;IACnC,SAAS,CAAC,EAAE,MAAM,CAAA;IAClB,KAAK,CAAC,EAAE,MAAM,CAAA;IACd,IAAI,CAAC,EAAE,MAAM,CAAA;IACb,OAAO,CAAC,EAAE,MAAM,CAAA;IAChB,cAAc,CAAC,EAAE,MAAM,CAAA;IACvB,QAAQ,CAAC,EAAE,MAAM,CAAA;IACjB,QAAQ,CAAC,EAAE,MAAM,CAAA;IACjB,KAAK,CAAC,EAAE,MAAM,CAAA;IACd,UAAU,CAAC,EAAE,MAAM,CAAA;IACnB,QAAQ,CAAC,EAAE,MAAM,CAAA;IACjB,SAAS,CAAC,EAAE,MAAM,CAAA;CACnB,CAAA;AAED,MAAM,MAAM,oBAAoB,GAAG;IACjC,WAAW,CAAC,EAAE,wBAAwB,CAAA;IACtC,UAAU,CAAC,EAAE,wBAAwB,CAAA;IACrC,cAAc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AW,CAAC,EAAE,wBAAwB,CAAA;IACtC,UAAU,CAAC,EAAE,wBAAwB,CAAA;IACrC,cAAc,CAAC,EAAE,wBAAwB,CAAA;IACzC,SAAS,CAAC,EAAE,wBAAwB,CAAA;CACrC,CAAA;AAED,MAAM,MAAM,iBAAiB,GAAG;IAC9B,iBAAiB,EAAE,iBAAiB,CAAA;IACpC,UAAU,EAAE,eAAe,CAAA;IAC3B,YAAY,CAAC,EAAE,OAAO,CAAA;IACtB,QAAQ,EAAE,MAAM,IAAI,CAAA;IACpB,OAAO,EAAE,MAAM,IAAI,CAAA;IACnB,WAAW,CAAC,EAAE,sBAAsB,CAAA;IACpC,QAAQ,CAAC,EAAE,oBAAoB,CAAA;IAC/B,UAAU,CAAC,EAAE,sBAAsB,CAAA;CACpC,CAAA;AAED,eAAO,MAAM,YAAY,GAAI,qHAS1B,iBAAiB,4CA+FnB,CAAA"}
|
|
@@ -61,7 +61,7 @@ export const ReviewScreen = ({ capturedDocuments, submission, sessionReady = tru
|
|
|
61
61
|
? verbiage.submittingText
|
|
62
62
|
: !sessionReady
|
|
63
63
|
? 'Initializing...'
|
|
64
|
-
: verbiage.submitText }), _jsx(WideBorderButton, { className: classNames.retryBtn, variant: "warning", onClick: onRetry, finished: true, children: verbiage.retryText })] })] }) }) }));
|
|
64
|
+
: verbiage.submitText }), _jsx(WideBorderButton, { className: classNames.retryBtn, variant: "warning", onClick: onRetry, disabled: submission !== 'idle', finished: true, children: verbiage.retryText })] })] }) }) }));
|
|
65
65
|
};
|
|
66
66
|
const Heading = styled.h1 `
|
|
67
67
|
font-size: 1.5rem;
|
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
import type { VideoSignatureMetadata } from '@idmission/websdk-core/signature';
|
|
2
|
+
import type { SignatureCaptureArtifact } from '@idmission/websdk-core/signatureCapture';
|
|
3
|
+
/**
|
|
4
|
+
* What the backend will trim the signature video to, recomputed here from the
|
|
5
|
+
* same marks it reads.
|
|
6
|
+
*
|
|
7
|
+
* The portal derives the MediaConvert clip from `timingData` alone
|
|
8
|
+
* (api/internal/mediaconvertclient/timestamps.go), and nothing has ever shown
|
|
9
|
+
* that derivation to a human — not the SDK, not the review screen, not the
|
|
10
|
+
* capture metadata, which carries the raw marks but never the window they
|
|
11
|
+
* imply. A signing window that stopped meaning "the user was signing" was
|
|
12
|
+
* therefore invisible until the PDFs it fed started failing a size limit four
|
|
13
|
+
* days later. This is the missing readout.
|
|
14
|
+
*
|
|
15
|
+
* The formula is the backend's. The PADDINGS are not knowable from here: the
|
|
16
|
+
* portal reads MEDIA_CONVERT_SIGNATURE_VIDEO_PADDING_START_MS / _END_MS out of
|
|
17
|
+
* parameter store, so an environment can set them to anything and the SDK is
|
|
18
|
+
* never told. TRIM_PADDING_START_MS / _END_MS are what this assumes, they are
|
|
19
|
+
* the values the Go config falls back to when the parameter is unset, and the
|
|
20
|
+
* table SHOWS them rather than burying the assumption here — a reviewer
|
|
21
|
+
* comparing this against a real trim needs to see which padding was used
|
|
22
|
+
* before concluding the two disagree. Callers who know their backend's values
|
|
23
|
+
* can pass them.
|
|
24
|
+
*
|
|
25
|
+
* This panel is deliberately untranslated, like its sibling
|
|
26
|
+
* ReviewDiagnosticsPanel: it is a debug readout of field names and numbers
|
|
27
|
+
* (mimeType, signingWindowFps), shown only to whoever turned it on, and the
|
|
28
|
+
* locale-parity gate scans `t()` call sites rather than raw copy.
|
|
29
|
+
*/
|
|
30
|
+
export type SignatureTrimWindow = {
|
|
31
|
+
kind: 'window';
|
|
32
|
+
startMs: number;
|
|
33
|
+
endMs: number;
|
|
34
|
+
lengthMs: number;
|
|
35
|
+
shareOfRecording: number;
|
|
36
|
+
} | {
|
|
37
|
+
kind: 'unavailable';
|
|
38
|
+
reason: string;
|
|
39
|
+
};
|
|
40
|
+
export type SignatureTrimPadding = {
|
|
41
|
+
startMs: number;
|
|
42
|
+
endMs: number;
|
|
43
|
+
};
|
|
44
|
+
export declare const ASSUMED_TRIM_PADDING: SignatureTrimPadding;
|
|
45
|
+
export declare function describeSignatureTrimWindow(metadata: VideoSignatureMetadata | null, padding?: SignatureTrimPadding): SignatureTrimWindow;
|
|
46
|
+
export declare function SignatureCaptureDiagnostics({ artifact, className, }: {
|
|
47
|
+
artifact: SignatureCaptureArtifact;
|
|
48
|
+
className?: string;
|
|
49
|
+
}): import("react/jsx-runtime").JSX.Element;
|
|
50
|
+
//# sourceMappingURL=SignatureCaptureDiagnostics.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"SignatureCaptureDiagnostics.d.ts","sourceRoot":"","sources":["../../../src/components/review/SignatureCaptureDiagnostics.tsx"],"names":[],"mappings":"AAMA,OAAO,KAAK,EACV,sBAAsB,EAEvB,MAAM,kCAAkC,CAAA;AACzC,OAAO,KAAK,EAAE,wBAAwB,EAAE,MAAM,yCAAyC,CAAA;AAEvF;;;;;;;;;;;;;;;;;;;;;;;;;;GA0BG;AACH,MAAM,MAAM,mBAAmB,GAC3B;IAAE,IAAI,EAAE,QAAQ,CAAC;IAAC,OAAO,EAAE,MAAM,CAAC;IAAC,KAAK,EAAE,MAAM,CAAC;IAAC,QAAQ,EAAE,MAAM,CAAC;IAAC,gBAAgB,EAAE,MAAM,CAAA;CAAE,GAC9F;IAAE,IAAI,EAAE,aAAa,CAAC;IAAC,MAAM,EAAE,MAAM,CAAA;CAAE,CAAA;AAE3C,MAAM,MAAM,oBAAoB,GAAG;IAAE,OAAO,EAAE,MAAM,CAAC;IAAC,KAAK,EAAE,MAAM,CAAA;CAAE,CAAA;AAErE,eAAO,MAAM,oBAAoB,EAAE,oBAGlC,CAAA;AAED,wBAAgB,2BAA2B,CACzC,QAAQ,EAAE,sBAAsB,GAAG,IAAI,EACvC,OAAO,GAAE,oBAA2C,GACnD,mBAAmB,CAmCrB;AAwBD,wBAAgB,2BAA2B,CAAC,EAC1C,QAAQ,EACR,SAAS,GACV,EAAE;IACD,QAAQ,EAAE,wBAAwB,CAAA;IAClC,SAAS,CAAC,EAAE,MAAM,CAAA;CACnB,2CAuIA"}
|