@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
|
@@ -10,14 +10,17 @@ import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-run
|
|
|
10
10
|
// - `requestCameraAccess()` is the controller's `actions.requestCamera()`;
|
|
11
11
|
// the auto-request effect keeps sdk2's condition (:83-96) verbatim.
|
|
12
12
|
import { useEffect, useRef } from 'react';
|
|
13
|
-
import { styled, useTheme } from 'styled-components';
|
|
13
|
+
import { keyframes, styled, useTheme } from 'styled-components';
|
|
14
14
|
import { useDocumentCapture } from './bindings/useDocumentCapture';
|
|
15
15
|
import { CameraFeedWrapper, CameraVideoTag, } from './components/CameraFeed';
|
|
16
16
|
import { ButtonsRow } from './components/common/ButtonsRow';
|
|
17
17
|
import { LoaderButton } from './components/common/LoaderButton';
|
|
18
|
+
import { DocumentCaptureAutoCaptureDebugLayer } from './components/document/DocumentCaptureAutoCaptureDebugLayer';
|
|
19
|
+
import { DocumentCaptureAutoCaptureGuidance, DocumentCaptureManualCaptureHint, } from './components/document/DocumentCaptureAutoCaptureGuidance';
|
|
20
|
+
import { DocumentCaptureReviewScreen } from './components/document/DocumentCaptureReviewScreen';
|
|
18
21
|
import { DocumentCaptureGuideOverlay, } from './components/document/DocumentCaptureGuideOverlay';
|
|
19
22
|
import { GuideLayoutProvider, useGuideLayout } from './layout/GuideLayoutContext';
|
|
20
|
-
import { useLanguage, useTranslations, } from './i18n';
|
|
23
|
+
import { SdkLanguageProvider, useLanguage, useTranslations, } from './i18n';
|
|
21
24
|
import { useSessionReady } from './flows/AuthStateContext';
|
|
22
25
|
/** The verbiage fallbacks, exported so the i18n parity test reads the real
|
|
23
26
|
* literals rather than a second copy that could drift from them. */
|
|
@@ -34,6 +37,43 @@ export const DOCUMENT_CAPTURE_FALLBACK_VERBIAGE = {
|
|
|
34
37
|
uploadingBtnText: 'Uploading...',
|
|
35
38
|
retryUploadBtnText: 'Retry',
|
|
36
39
|
successBtnText: 'Upload succeeded!',
|
|
40
|
+
// Only three of these eight are NEW strings; the rest are already translated
|
|
41
|
+
// in all eight locales and are adopted verbatim. `documentCaptureStrings.test.ts`
|
|
42
|
+
// iterates this object and asserts each value is a key in every locale, so
|
|
43
|
+
// the new members are covered with no test edit at all — the strongest
|
|
44
|
+
// reason the verbiage route wins over `guidanceMessageKey`.
|
|
45
|
+
autoCaptureNoDocumentText: 'Document not detected',
|
|
46
|
+
autoCaptureTooCloseText: 'Move back, make sure all 4 edges of the page are visible.',
|
|
47
|
+
autoCaptureTooFarText: 'Move closer, fill the frame with the whole page.',
|
|
48
|
+
autoCaptureNotStableText: 'Please hold still...',
|
|
49
|
+
// Shares notStable's string on purpose. #345's ladder ordering rests on a
|
|
50
|
+
// focus failure BEING a motion failure on paper; if "hold still" is correct
|
|
51
|
+
// for both, a second sentence saying the same thing differently is a
|
|
52
|
+
// distinction the applicant cannot act on. The CODES stay distinct for the
|
|
53
|
+
// overlay and the metadata; only the rendered string is shared. This
|
|
54
|
+
// declines the already-translated 'Document out of focus - try improving the
|
|
55
|
+
// lighting', which would have been free: it prescribes LIGHTING, and the
|
|
56
|
+
// cause is motion. A free translation is not worth wrong advice.
|
|
57
|
+
autoCaptureOutOfFocusText: 'Please hold still...',
|
|
58
|
+
// A free orphan: translated in all eight locales and emitted by NOTHING in
|
|
59
|
+
// packages/ or sdk2/src, because `documentTypeDisplayNames` has no
|
|
60
|
+
// `Document` member and `guidanceMessageKey`'s HOLD_STILL interpolation
|
|
61
|
+
// therefore cannot produce it. POA's satisfied code adopts it.
|
|
62
|
+
autoCaptureHoldStillText: 'Document detected, hold still...',
|
|
63
|
+
// Says what happened and what to do, in that order, because the button
|
|
64
|
+
// appears unannounced and the applicant's first question is why. Not a
|
|
65
|
+
// question itself: the old wording asked "Having trouble? Would you like to
|
|
66
|
+
// take the photo yourself?" over two buttons, which made someone confirm a
|
|
67
|
+
// permission they already had. It refers to "the button" rather than naming
|
|
68
|
+
// it, since `Capture` renders differently in every locale
|
|
69
|
+
// (Capturar/Erfassen/Acquisisci/撮影/Съемка/拍攝).
|
|
70
|
+
manualCaptureHintText: 'Automatic capture is having trouble. Tap the button to take the photo yourself.',
|
|
71
|
+
reviewHeadingText: 'Document captured',
|
|
72
|
+
// Deliberately the SAME English source string as the heading: source strings
|
|
73
|
+
// are the translation keys, so reusing this one is already translated into
|
|
74
|
+
// all eight locales and adds no locale-parity surface. A distinct phrase
|
|
75
|
+
// would read better and would also be eight untranslated strings.
|
|
76
|
+
reviewImageAltText: 'Document captured',
|
|
37
77
|
};
|
|
38
78
|
/**
|
|
39
79
|
* Owns its own `GuideLayoutProvider`, matching IdCaptureView (:364). The guide
|
|
@@ -49,9 +89,9 @@ export const DOCUMENT_CAPTURE_FALLBACK_VERBIAGE = {
|
|
|
49
89
|
* the overlay and the feed sit under it.
|
|
50
90
|
*/
|
|
51
91
|
export function DocumentCaptureView(props) {
|
|
52
|
-
return (_jsx(GuideLayoutProvider, { children: _jsx(DocumentCaptureSurface, { ...props }) }));
|
|
92
|
+
return (_jsx(SdkLanguageProvider, { lang: props.lang ?? 'auto', children: _jsx(GuideLayoutProvider, { children: _jsx(DocumentCaptureSurface, { ...props }) }) }));
|
|
53
93
|
}
|
|
54
|
-
function DocumentCaptureSurface({ controller, lang = 'auto', sessionReady: sessionReadyProp, onCompleted, onCameraAccessDenied, onCameraTamperingDetected, onExitAfterTamperSealPopped, documents, cameraFeedMode, aspectRatio, instructions, classNames = {}, verbiage: rawVerbiage = {}, }) {
|
|
94
|
+
function DocumentCaptureSurface({ controller, lang = 'auto', sessionReady: sessionReadyProp, onCompleted, onCameraAccessDenied, onCameraTamperingDetected, onExitAfterTamperSealPopped, documents, cameraFeedMode, aspectRatio, instructions, debugMode = false, classNames = {}, verbiage: rawVerbiage = {}, }) {
|
|
55
95
|
// Omitted means "follow the session": mounted inside a flow this view now
|
|
56
96
|
// renders during session validation, so its own loading overlay is the one
|
|
57
97
|
// loading surface (2.x behaviour — see useSessionReady). An explicit prop
|
|
@@ -124,6 +164,143 @@ function DocumentCaptureSurface({ controller, lang = 'auto', sessionReady: sessi
|
|
|
124
164
|
return;
|
|
125
165
|
void controller.actions.requestCamera();
|
|
126
166
|
}, [cameraAccessNeeded, controller]);
|
|
167
|
+
/**
|
|
168
|
+
* Whether auto-capture is currently doing the guiding — #345's three-row
|
|
169
|
+
* table, in one expression.
|
|
170
|
+
*
|
|
171
|
+
* | condition | screen |
|
|
172
|
+
* |---------------------------------------------|----------------------------|
|
|
173
|
+
* | opted in, models loading or loaded | guided; nothing to tap |
|
|
174
|
+
* | opted in, detector MODEL_LOAD_FAILED | today's screen, button live|
|
|
175
|
+
* | not opted in (flag off, control arm) | today's screen, button live|
|
|
176
|
+
*
|
|
177
|
+
* `idCapture` needs a whole takeover screen (`IdCaptureFallback`) on a model
|
|
178
|
+
* failure because it has no manual mode otherwise. `documentCapture`'s manual
|
|
179
|
+
* mode IS its current screen, so the same rule ports with zero new UI —
|
|
180
|
+
* falling out of `autoCaptureGuiding` restores exactly what shipped before.
|
|
181
|
+
*
|
|
182
|
+
* THE CAPTURE BUTTON APPEARING IS NOT AN EXIT FROM THE TREATMENT. Reaching
|
|
183
|
+
* #345's escape used to drop the whole guided screen — brackets, dark
|
|
184
|
+
* surround, floating header and pill all reverted to the 2.x bars mid
|
|
185
|
+
* capture, which read as a different screen rather than as gaining a button.
|
|
186
|
+
* It also contradicted `autoCaptureShutter.ts`, which says guidance and
|
|
187
|
+
* measurement continue precisely BECAUSE the pill is the most valuable thing
|
|
188
|
+
* on screen for someone about to hand-frame a POA.
|
|
189
|
+
*
|
|
190
|
+
* So the treatment survives it, and `manualShutterOnScreen` below is the
|
|
191
|
+
* narrower question of whether a Capture button belongs on screen. Keeping
|
|
192
|
+
* the header out of flow across that transition also removes the layout
|
|
193
|
+
* swap that pushed the footer past the fold.
|
|
194
|
+
*
|
|
195
|
+
* `!entry.content` is load-bearing and NOT the same test as
|
|
196
|
+
* `cameraCaptureRequired`. That one asks "was this document pre-supplied?",
|
|
197
|
+
* which stays false for a document the applicant captures — so without this
|
|
198
|
+
* the guidance pill survives its own shutter and sits over the frozen
|
|
199
|
+
* preview still saying "hold still", which reads as a hung screen.
|
|
200
|
+
*/
|
|
201
|
+
const autoCaptureGuiding = !!entry?.item.autoCapture &&
|
|
202
|
+
cameraCaptureRequired &&
|
|
203
|
+
!entry.content &&
|
|
204
|
+
state.models.state !== 'error';
|
|
205
|
+
/**
|
|
206
|
+
* Whether the Capture button is on screen.
|
|
207
|
+
*
|
|
208
|
+
* Granted by the shutter reducer once auto-capture has struggled for a full
|
|
209
|
+
* budget — no dialog, no accept step. It is an ADDITION: auto-capture stays
|
|
210
|
+
* armed behind it and can still fire.
|
|
211
|
+
*/
|
|
212
|
+
const manualShutterOnScreen = autoCaptureGuiding && !!state.autoCaptureShutter?.manualShutterAvailable;
|
|
213
|
+
/**
|
|
214
|
+
* How long the burst window a tap just opened will run for, or null.
|
|
215
|
+
*
|
|
216
|
+
* Pressing a phone's screen moves the phone, so the tap opens a short window
|
|
217
|
+
* and the sharpest frame in it is what gets saved. That is a few hundred
|
|
218
|
+
* milliseconds during which the applicant has tapped and no photo has
|
|
219
|
+
* appeared — long enough that without feedback they learn to tap it twice,
|
|
220
|
+
* and the second tap is another jostle.
|
|
221
|
+
*/
|
|
222
|
+
const manualBurstMs = state.autoCaptureShutter?.manualBurstMs ?? null;
|
|
223
|
+
/**
|
|
224
|
+
* Where the shutter's centre sits: on the guide box's bottom edge.
|
|
225
|
+
*
|
|
226
|
+
* `null` until the overlay has published a rect, which is also the case for
|
|
227
|
+
* a caller who supplies no `aspectRatio` — the dock falls back to the bottom
|
|
228
|
+
* of the surface there, since there is no edge to straddle.
|
|
229
|
+
*/
|
|
230
|
+
const shutterCentreY = guideRect && guideRect.height > 0 ? guideRect.y + guideRect.height : null;
|
|
231
|
+
/**
|
|
232
|
+
* The full-screen review takes over once the applicant has CAPTURED a frame.
|
|
233
|
+
*
|
|
234
|
+
* Keyed on the entry's OWN `captureMode`, not on `cameraCaptureRequired`.
|
|
235
|
+
* That looks like the same question and is not: `cameraCaptureRequired` reads
|
|
236
|
+
* the view's OPTIONAL `documents` prop, so a caller who drives the controller
|
|
237
|
+
* directly and never passes it — legal, and what this view's own tests do —
|
|
238
|
+
* would get "Document captured / Retry capture" over a gallery blob that
|
|
239
|
+
* never touched a camera, offering a retry that opens a camera that path
|
|
240
|
+
* never used. `captureMode` records what actually happened: `'Upload'` for a
|
|
241
|
+
* caller-supplied blob, `'Auto'`/`'Manual'` for a frame this flow took.
|
|
242
|
+
*
|
|
243
|
+
* It LAYERS over the capture surface rather than replacing it, and that is
|
|
244
|
+
* not a style choice. `attach()` binds `srcObject` exactly once against the
|
|
245
|
+
* element it was handed, and the camera stays acquired through a capture —
|
|
246
|
+
* only the detection loop stops. Returning the review INSTEAD of the capture
|
|
247
|
+
* tree unmounts the <video>, so the retry re-mounts a fresh element with no
|
|
248
|
+
* stream: the feed goes black and `captureFrame` keeps grabbing the orphaned
|
|
249
|
+
* element's last frame, silently re-uploading the image the applicant just
|
|
250
|
+
* rejected. `DocumentCaptureView.test.tsx` pins this; it is why the preview
|
|
251
|
+
* has always been layered rather than swapped.
|
|
252
|
+
*/
|
|
253
|
+
/**
|
|
254
|
+
* Whether the pill is currently showing the satisfied code.
|
|
255
|
+
*
|
|
256
|
+
* Read from `guidance.displayed`, NOT from `satisfied`, so the brackets and
|
|
257
|
+
* the pill change together. Driving the brackets off the raw per-frame
|
|
258
|
+
* verdict would flip them green on 1-3 frame excursions the stabilizer
|
|
259
|
+
* deliberately swallows — the visual equivalent of re-opening #383.
|
|
260
|
+
*/
|
|
261
|
+
const satisfiedOnScreen = state.autoCapture?.guidance.displayed === 'holdStill';
|
|
262
|
+
/**
|
|
263
|
+
* The surround outside the guide box.
|
|
264
|
+
*
|
|
265
|
+
* OPAQUE under `snapToGuides`, and that is a correctness fix rather than a
|
|
266
|
+
* taste one: in that mode the feed is sized to the guide box, so outside it
|
|
267
|
+
* there is no camera for a translucent scrim to be translucent OVER — it
|
|
268
|
+
* composites against the host page instead. `rgba(10,14,19,0.62)` over a
|
|
269
|
+
* white page resolves to `rgb(103,106,109)`, a flat mid-grey, which is what
|
|
270
|
+
* made the screen look washed out and unfinished.
|
|
271
|
+
*
|
|
272
|
+
* Opaque also gives the notch/Dynamic Island and both safe areas a deliberate
|
|
273
|
+
* colour instead of whatever the host happens to paint.
|
|
274
|
+
*
|
|
275
|
+
* Under `fullscreen` the feed IS edge to edge, so translucency shows the
|
|
276
|
+
* surroundings and is worth keeping.
|
|
277
|
+
*/
|
|
278
|
+
const guidedMaskColor = theme.documentCapture?.guideBox?.maskColor ??
|
|
279
|
+
(resolvedFeedMode === 'snapToGuides'
|
|
280
|
+
? GUIDED_SURROUND_COLOR
|
|
281
|
+
: 'rgba(10, 14, 19, 0.62)');
|
|
282
|
+
// `guideBox` has no themed border colour today, so this is the one place a
|
|
283
|
+
// value is picked rather than inherited. White reads on any feed.
|
|
284
|
+
const bracketColor = '#ffffff';
|
|
285
|
+
const bracketSatisfiedColor = theme.colors?.positive?.[600] ?? 'var(--idm-color-positive-600)';
|
|
286
|
+
// The review image's accessible name. `title` is the integrator's own string
|
|
287
|
+
// and already in their language; the fallback is translated. A verbiage
|
|
288
|
+
// entry replaced by a component cannot be an alt attribute, so that case
|
|
289
|
+
// falls through to the untranslated source string rather than to no name at
|
|
290
|
+
// all — an unnamed image is the worse failure.
|
|
291
|
+
const reviewImageAlt = entry?.item.title ??
|
|
292
|
+
(typeof verbiage.reviewImageAltText === 'string'
|
|
293
|
+
? verbiage.reviewImageAltText
|
|
294
|
+
: 'Document captured');
|
|
295
|
+
const capturedMode = entry?.captureMetadata?.captureMode ?? null;
|
|
296
|
+
// GATED ON THE OPT-IN, not on the capture mode alone. Every capture carries
|
|
297
|
+
// metadata now — that is #377's whole point, so a rollout has a control arm —
|
|
298
|
+
// which meant keying on `captureMode` handed the new full-screen review card
|
|
299
|
+
// to every 2.x integrator who never asked for any of this. Presence of
|
|
300
|
+
// `autoCapture` is the opt-in for the SCREEN as much as for the shutter.
|
|
301
|
+
const showReview = !!contentUrl &&
|
|
302
|
+
!!entry?.item.autoCapture &&
|
|
303
|
+
(capturedMode === 'Auto' || capturedMode === 'Manual');
|
|
127
304
|
// Completion is derived rather than event-driven so it survives a remount:
|
|
128
305
|
// the ref only stops it firing twice within one mount.
|
|
129
306
|
const everyUploaded = state.documents.length > 0 &&
|
|
@@ -161,12 +338,37 @@ function DocumentCaptureSurface({ controller, lang = 'auto', sessionReady: sessi
|
|
|
161
338
|
tamperReportedRef.current = true;
|
|
162
339
|
onCameraTamperingDetected?.();
|
|
163
340
|
}, [cameraTampered, onCameraTamperingDetected]);
|
|
164
|
-
return (_jsxs(_Fragment, { children: [_jsxs(CameraFeedWrapper, { className: classNames.cameraFeedWrapper, "$mode": resolvedFeedMode, "$x": guideRect?.x ?? 0, "$y": guideRect?.y ?? 0, "$w": guideRect?.width ?? 0, "$h": guideRect?.height ?? 0, children: [_jsx(CameraVideoTag, { ref: videoRef, className: classNames.cameraFeed, isRearFacing: state.camera.isRearFacing }), contentUrl && (_jsx(PreviewImage, { alt: "", src: contentUrl, className: classNames.previewImage }))] }), _jsxs(CaptureContainer, { className: classNames.captureContainer,
|
|
341
|
+
return (_jsxs(_Fragment, { children: [_jsxs(CameraFeedWrapper, { className: classNames.cameraFeedWrapper, "$mode": resolvedFeedMode, "$x": guideRect?.x ?? 0, "$y": guideRect?.y ?? 0, "$w": guideRect?.width ?? 0, "$h": guideRect?.height ?? 0, children: [_jsx(CameraVideoTag, { ref: videoRef, className: classNames.cameraFeed, isRearFacing: state.camera.isRearFacing }), contentUrl && !showReview && (_jsx(PreviewImage, { alt: "", src: contentUrl, className: classNames.previewImage }))] }), _jsxs(CaptureContainer, { className: classNames.captureContainer, "data-testid": "document-capture-surface", children: [autoCaptureGuiding ? (_jsxs(GuidedHeader, { "$maskColor": guidedMaskColor, className: classNames.headingRow, "data-testid": "document-capture-guided-header", children: [_jsx(GuidedHeading, { className: classNames.heading, children: verbiage.headingText }), resolvedInstructions && (_jsx(GuidedInstructions, { className: classNames.instructions, tabIndex: 0, role: "note", children: resolvedInstructions }))] })) : (_jsx(HeadingRow, { "$maskColor": maskColor, className: classNames.headingRow, children: _jsx(Heading, { className: classNames.heading, children: verbiage.headingText }) })), _jsx(DocumentCaptureGuideOverlay, { aspectRatio: resolvedAspectRatio, maskColor: autoCaptureGuiding ? guidedMaskColor : maskColor, cornerBrackets: autoCaptureGuiding,
|
|
342
|
+
// Breathing room, and not cosmetic: floating the header took it out
|
|
343
|
+
// of flow, so the overlay grew into the space the bar used to hold
|
|
344
|
+
// and the box ran flush to every edge. Brackets in the viewport's
|
|
345
|
+
// own corners stop reading as the document's corners, and the
|
|
346
|
+
// bottom pair collided with the guidance pill.
|
|
347
|
+
padding: autoCaptureGuiding ? GUIDED_GUIDE_PADDING : undefined, borderColor: autoCaptureGuiding
|
|
348
|
+
? satisfiedOnScreen
|
|
349
|
+
? bracketSatisfiedColor
|
|
350
|
+
: bracketColor
|
|
351
|
+
: undefined, borderWidth: autoCaptureGuiding ? 3 : undefined, classNames: classNames.guideOverlay }), debugMode && entry?.item.autoCapture && (_jsx(DocumentCaptureAutoCaptureDebugLayer, { state: state, getLog: controller.getAutoCaptureLog,
|
|
352
|
+
// Collapsed while the review card is up: the shared pane outranks
|
|
353
|
+
// it and would cover the captured image, which is the one thing
|
|
354
|
+
// the operator is there to look at.
|
|
355
|
+
compact: showReview })), autoCaptureGuiding && (_jsxs(GuidedBottomStack, { "$centreY": shutterCentreY, "$aboveShutter": manualShutterOnScreen, children: [manualShutterOnScreen && (_jsx(DocumentCaptureManualCaptureHint, { message: verbiage.manualCaptureHintText, className: classNames.manualCaptureHint })), _jsx(DocumentCaptureAutoCaptureGuidance, { code: state.autoCapture?.guidance.displayed ?? 'none', messages: verbiage, className: classNames.autoCaptureGuidance })] })), manualShutterOnScreen && (_jsx(GuidedShutterDock, { "$centreY": shutterCentreY, "data-testid": "document-capture-shutter-dock", children: _jsxs(GuidedShutterWell, { children: [_jsx(GuidedShutter, { type: "button", className: classNames.captureBtn, "aria-label": typeof verbiage.captureBtnText === 'string'
|
|
356
|
+
? verbiage.captureBtnText
|
|
357
|
+
: 'Capture', "data-testid": "document-capture-shutter", "$pending": manualBurstMs !== null, onClick: () => {
|
|
358
|
+
if (!state.camera.ready || state.capturing)
|
|
359
|
+
return;
|
|
360
|
+
void controller.actions.capture();
|
|
361
|
+
}, disabled: !state.camera.ready ||
|
|
362
|
+
state.capturing ||
|
|
363
|
+
manualBurstMs !== null }), manualBurstMs !== null && (_jsx(GuidedShutterSweep, { "$durationMs": manualBurstMs, viewBox: `0 0 ${SHUTTER_RING_BOX_PX} ${SHUTTER_RING_BOX_PX}`, "aria-hidden": "true", "data-testid": "document-capture-shutter-sweep", children: _jsx("circle", { cx: SHUTTER_RING_BOX_PX / 2, cy: SHUTTER_RING_BOX_PX / 2, r: SHUTTER_RING_RADIUS_PX }) }))] }) })), showReview && contentUrl && (_jsx(DocumentCaptureReviewScreen, { contentUrl: contentUrl, headingText: verbiage.reviewHeadingText, retryText: verbiage.retryCaptureBtnText, uploadText: verbiage.uploadBtnText, uploadingText: verbiage.uploadingBtnText, retryUploadText: verbiage.retryUploadBtnText, successText: verbiage.successBtnText, uploadState: uploadState, onRetry: () => controller.actions.retry(), onUpload: () => void controller.actions.upload(), classNames: classNames, alt: reviewImageAlt })), _jsxs(FooterRow, { "$maskColor": autoCaptureGuiding ? guidedMaskColor : maskColor, className: classNames.footerRow, "data-testid": "document-capture-footer", children: [resolvedInstructions && !autoCaptureGuiding && (_jsx(Instructions, { className: classNames.instructions, children: resolvedInstructions })), cameraTampered && (_jsx(Instructions, { className: classNames.tamperMessage, children: verbiage.tamperingText })), _jsx(StyledButtonsRow, { className: classNames.buttonsRow, children: cameraTampered ? (onExitAfterTamperSealPopped ? (_jsx(LoaderButton, { className: classNames.retryCameraAccessBtn, variant: "negative", finished: true, onClick: onExitAfterTamperSealPopped, children: verbiage.exitBtnText })) : null) : cameraAccessDenied ? (_jsx(LoaderButton, { className: classNames.retryCameraAccessBtn, variant: "negative", finished: true, onClick: () => void controller.actions.requestCamera(), children: verbiage.retryCameraAccessBtnText })) : showReview ? (
|
|
364
|
+
// The review card owns these controls now. Rendering them here
|
|
365
|
+
// too would put two "Retry capture" buttons on screen at once.
|
|
366
|
+
null) : contentUrl ? (uploadState === 'not_started' ? (_jsxs(_Fragment, { children: [_jsx(LoaderButton, { className: classNames.retryCaptureBtn, finished: true, variant: "warning", onClick: () => controller.actions.retry(), children: verbiage.retryCaptureBtnText }), _jsx(LoaderButton, { className: classNames.uploadBtn, finished: true, variant: "positive", onClick: () => void controller.actions.upload(), children: verbiage.uploadBtnText })] })) : (_jsx(LoaderButton, { className: classNames.uploadProgressBtn, finished: uploadState !== 'in_progress', variant: uploadState === 'failed' ? 'negative' : 'positive', onClick: () => void controller.actions.upload(), disabled: uploadState === 'in_progress' ||
|
|
165
367
|
uploadState === 'succeeded', children: uploadState === 'succeeded'
|
|
166
368
|
? verbiage.successBtnText
|
|
167
369
|
: uploadState === 'failed'
|
|
168
370
|
? verbiage.retryUploadBtnText
|
|
169
|
-
: verbiage.uploadingBtnText }))) : (_jsx(LoaderButton, { className: classNames.captureBtn, finished: state.camera.ready, variant: "primary",
|
|
371
|
+
: verbiage.uploadingBtnText }))) : autoCaptureGuiding ? null : (_jsx(LoaderButton, { className: classNames.captureBtn, finished: state.camera.ready, variant: "primary",
|
|
170
372
|
// Guarded rather than relying on `disabled` alone: with
|
|
171
373
|
// `finished` false, LoaderButton hands the element to ladda,
|
|
172
374
|
// which manipulates its disabled state imperatively
|
|
@@ -182,6 +384,20 @@ function DocumentCaptureSurface({ controller, lang = 'auto', sessionReady: sessi
|
|
|
182
384
|
? verbiage.capturingBtnText
|
|
183
385
|
: verbiage.captureBtnText })) })] })] })] }));
|
|
184
386
|
}
|
|
387
|
+
/**
|
|
388
|
+
* MUST STAY TRANSPARENT.
|
|
389
|
+
*
|
|
390
|
+
* This is a SIBLING of `CameraFeedWrapper`, not an ancestor — the <video> is
|
|
391
|
+
* in the preceding sibling, and this is `position: absolute` over the top of
|
|
392
|
+
* it. Any opaque background here is a solid sheet across the camera feed, and
|
|
393
|
+
* nothing downstream can punch back through it. Painting it is what broke the
|
|
394
|
+
* feed once already; `DocumentCaptureView.test.tsx` pins it.
|
|
395
|
+
*
|
|
396
|
+
* The guided surround is the guide overlay's job and is already covered: its
|
|
397
|
+
* `CanvasWrapper` is `flex-grow: 1` and `GuidedHeader` is absolutely
|
|
398
|
+
* positioned, so the canvas fills this container and paints `maskColor`
|
|
399
|
+
* everywhere except the hole it punches for the guide box.
|
|
400
|
+
*/
|
|
185
401
|
const CaptureContainer = styled.div `
|
|
186
402
|
display: flex;
|
|
187
403
|
flex-direction: column;
|
|
@@ -191,6 +407,273 @@ const CaptureContainer = styled.div `
|
|
|
191
407
|
width: 100%;
|
|
192
408
|
height: 100%;
|
|
193
409
|
`;
|
|
410
|
+
/**
|
|
411
|
+
* Inset of the guide box from the capture surface, on the guided screen.
|
|
412
|
+
*
|
|
413
|
+
* Has to clear the floated header above and the guidance pill below, both of
|
|
414
|
+
* which are absolutely positioned and therefore invisible to the flex layout
|
|
415
|
+
* the guide box is sized by.
|
|
416
|
+
*/
|
|
417
|
+
const GUIDED_GUIDE_PADDING = 16;
|
|
418
|
+
/** The shutter disc, and how far its ring extends past it. */
|
|
419
|
+
const GUIDED_SHUTTER_SIZE_PX = 62;
|
|
420
|
+
const GUIDED_SHUTTER_RING_PX = 7;
|
|
421
|
+
const GUIDED_SHUTTER_RING_WIDTH_PX = 2.5;
|
|
422
|
+
/** The square the ring is drawn in, and the circle inside it. */
|
|
423
|
+
const SHUTTER_RING_BOX_PX = GUIDED_SHUTTER_SIZE_PX + GUIDED_SHUTTER_RING_PX * 2;
|
|
424
|
+
const SHUTTER_RING_RADIUS_PX = (SHUTTER_RING_BOX_PX - GUIDED_SHUTTER_RING_WIDTH_PX) / 2;
|
|
425
|
+
const SHUTTER_RING_CIRCUMFERENCE_PX = 2 * Math.PI * SHUTTER_RING_RADIUS_PX;
|
|
426
|
+
/** Outermost radius of the shutter, ring included. */
|
|
427
|
+
const GUIDED_SHUTTER_RADIUS_PX = GUIDED_SHUTTER_SIZE_PX / 2 + GUIDED_SHUTTER_RING_PX;
|
|
428
|
+
/** Breathing room between the shutter's ring and the text above it. */
|
|
429
|
+
const GUIDED_STACK_GAP_PX = 12;
|
|
430
|
+
/**
|
|
431
|
+
* The guided screen's bottom band: caption, pill, and nothing else.
|
|
432
|
+
*
|
|
433
|
+
* IT ANCHORS OFF THE SHUTTER, not off the surface. The pill used to take a
|
|
434
|
+
* fixed lift sized for a button row, which was correct only while the button
|
|
435
|
+
* sat in a row at the bottom — once the shutter moved onto the guide box's
|
|
436
|
+
* bottom edge the two were computing different bottoms, and on a letterboxed
|
|
437
|
+
* desktop the disc landed squarely on the pill. Deriving both from the same
|
|
438
|
+
* `centreY` is what makes that unrepresentable rather than merely fixed.
|
|
439
|
+
*
|
|
440
|
+
* `pointer-events: none` because nothing in here is tappable and the shutter
|
|
441
|
+
* is centred directly below it.
|
|
442
|
+
*/
|
|
443
|
+
const GuidedBottomStack = styled.div `
|
|
444
|
+
position: absolute;
|
|
445
|
+
left: 0;
|
|
446
|
+
right: 0;
|
|
447
|
+
z-index: 10001;
|
|
448
|
+
display: flex;
|
|
449
|
+
flex-direction: column;
|
|
450
|
+
align-items: center;
|
|
451
|
+
gap: 8px;
|
|
452
|
+
pointer-events: none;
|
|
453
|
+
|
|
454
|
+
${({ $centreY, $aboveShutter }) => {
|
|
455
|
+
if (!$aboveShutter) {
|
|
456
|
+
// No shutter yet: the band is the applicant's alone, so sit where a
|
|
457
|
+
// caption belongs — just clear of the bottom edge.
|
|
458
|
+
return 'bottom: max(26px, env(safe-area-inset-bottom));';
|
|
459
|
+
}
|
|
460
|
+
if ($centreY === null) {
|
|
461
|
+
// No published guide rect, so the dock fell back to the surface bottom
|
|
462
|
+
// too. Clear it by the shutter's full height plus the gap.
|
|
463
|
+
return `bottom: calc(max(20px, env(safe-area-inset-bottom)) + ${GUIDED_SHUTTER_RADIUS_PX * 2 + GUIDED_STACK_GAP_PX}px);`;
|
|
464
|
+
}
|
|
465
|
+
// Sit the stack's BOTTOM edge just above the shutter's ring. Measuring
|
|
466
|
+
// down from the top and pulling back by its own height is what keeps this
|
|
467
|
+
// correct when the caption wraps to two lines on a narrow phone.
|
|
468
|
+
return `top: ${$centreY - GUIDED_SHUTTER_RADIUS_PX - GUIDED_STACK_GAP_PX}px; transform: translateY(-100%);`;
|
|
469
|
+
}}
|
|
470
|
+
`;
|
|
471
|
+
/**
|
|
472
|
+
* The handed-back shutter, floating over the bottom band.
|
|
473
|
+
*
|
|
474
|
+
* ABSOLUTE, and that is the whole point. In flow it grew the footer the moment
|
|
475
|
+
* it appeared, which stole height from the `flex-grow` guide canvas above it —
|
|
476
|
+
* so the button arriving visibly resized the guide box and the feed under the
|
|
477
|
+
* applicant. Floating, it costs the layout nothing and nothing moves.
|
|
478
|
+
*
|
|
479
|
+
* It carries no state of its own: no ready/not-ready, no gate ring. It exists
|
|
480
|
+
* only once auto-capture has conceded, so a progress ring would be reporting
|
|
481
|
+
* the mechanism that just gave up, and a disabled-looking disc would refuse a
|
|
482
|
+
* tap the applicant is entitled to make.
|
|
483
|
+
*/
|
|
484
|
+
const GuidedShutterDock = styled.div `
|
|
485
|
+
position: absolute;
|
|
486
|
+
left: 0;
|
|
487
|
+
right: 0;
|
|
488
|
+
z-index: 10001;
|
|
489
|
+
display: flex;
|
|
490
|
+
justify-content: center;
|
|
491
|
+
pointer-events: none;
|
|
492
|
+
|
|
493
|
+
/* Straddling the guide box's bottom edge EXACTLY, when we know where that
|
|
494
|
+
edge is. Anchoring to the surface bottom instead left it wherever the
|
|
495
|
+
letterboxing happened to put it — near the edge on a phone, floating well
|
|
496
|
+
below it on a desktop, and half-overlapping at sizes in between, which
|
|
497
|
+
reads as a mistake rather than a choice.
|
|
498
|
+
|
|
499
|
+
Centred on the edge is a decision the geometry can state: the disc sits
|
|
500
|
+
half on the frame and half on the surround, at every viewport. */
|
|
501
|
+
${({ $centreY }) => $centreY === null
|
|
502
|
+
? 'bottom: max(20px, env(safe-area-inset-bottom));'
|
|
503
|
+
: `top: ${$centreY}px; transform: translateY(-50%);`}
|
|
504
|
+
`;
|
|
505
|
+
const GuidedShutter = styled.button `
|
|
506
|
+
pointer-events: auto;
|
|
507
|
+
position: relative;
|
|
508
|
+
width: ${GUIDED_SHUTTER_SIZE_PX}px;
|
|
509
|
+
height: ${GUIDED_SHUTTER_SIZE_PX}px;
|
|
510
|
+
border: 0;
|
|
511
|
+
border-radius: 50%;
|
|
512
|
+
background: #fff;
|
|
513
|
+
cursor: pointer;
|
|
514
|
+
padding: 0;
|
|
515
|
+
|
|
516
|
+
/* The camera app's ring, drawn outside the disc so the tappable area is the
|
|
517
|
+
disc itself and the ring cannot swallow an edge tap. */
|
|
518
|
+
/* The camera app's ring, drawn outside the disc so the tappable area is the
|
|
519
|
+
disc itself and the ring cannot swallow an edge tap. It dims to a TRACK
|
|
520
|
+
while a tap is pending, so the sweep drawn over it reads as filling. */
|
|
521
|
+
&::after {
|
|
522
|
+
content: '';
|
|
523
|
+
position: absolute;
|
|
524
|
+
inset: -${GUIDED_SHUTTER_RING_PX}px;
|
|
525
|
+
border: ${GUIDED_SHUTTER_RING_WIDTH_PX}px solid
|
|
526
|
+
${({ $pending }) => $pending ? 'rgba(255, 255, 255, 0.25)' : 'rgba(255, 255, 255, 0.9)'};
|
|
527
|
+
border-radius: 50%;
|
|
528
|
+
}
|
|
529
|
+
|
|
530
|
+
&:active {
|
|
531
|
+
transform: scale(0.94);
|
|
532
|
+
}
|
|
533
|
+
|
|
534
|
+
/* Held down for the length of the burst window. A one-shot state change, not
|
|
535
|
+
an animation: a spinner or a pulse here would repaint every frame on top
|
|
536
|
+
of live video for the exact interval the applicant is holding still. */
|
|
537
|
+
${({ $pending }) => ($pending ? 'transform: scale(0.94);' : '')}
|
|
538
|
+
|
|
539
|
+
&:disabled {
|
|
540
|
+
cursor: default;
|
|
541
|
+
/* A pending shutter is working, not refusing. Only the not-yet-ready case
|
|
542
|
+
is dimmed far enough to read as unavailable. */
|
|
543
|
+
opacity: ${({ $pending }) => ($pending ? 0.8 : 0.4)};
|
|
544
|
+
}
|
|
545
|
+
`;
|
|
546
|
+
const shutterSweep = keyframes `
|
|
547
|
+
from { stroke-dashoffset: ${SHUTTER_RING_CIRCUMFERENCE_PX}; }
|
|
548
|
+
to { stroke-dashoffset: 0; }
|
|
549
|
+
`;
|
|
550
|
+
/** Holds the ring's square so the sweep can sit exactly on the disc. */
|
|
551
|
+
const GuidedShutterWell = styled.div `
|
|
552
|
+
position: relative;
|
|
553
|
+
width: ${SHUTTER_RING_BOX_PX}px;
|
|
554
|
+
height: ${SHUTTER_RING_BOX_PX}px;
|
|
555
|
+
display: grid;
|
|
556
|
+
place-items: center;
|
|
557
|
+
`;
|
|
558
|
+
/**
|
|
559
|
+
* The ring filling once, over exactly as long as the tap has to wait.
|
|
560
|
+
*
|
|
561
|
+
* DETERMINATE, and that is the point. An indeterminate spinner would be
|
|
562
|
+
* telling the applicant less than the SDK knows: the window's length is fixed
|
|
563
|
+
* the moment it opens, published as `manualBurstMs`, and a ring that arrives
|
|
564
|
+
* at full when the shutter fires says "this long" rather than "who knows".
|
|
565
|
+
*
|
|
566
|
+
* It is also the only animation on this screen, and it is bounded: ONE run of
|
|
567
|
+
* a few hundred milliseconds per tap, `forwards` so it holds rather than
|
|
568
|
+
* loops. A spinner here would repaint on top of live video for as long as it
|
|
569
|
+
* was on screen, which is the cost this whole flow has been avoiding.
|
|
570
|
+
*
|
|
571
|
+
* Reduced motion gets the finished ring immediately. The affordance is "the
|
|
572
|
+
* tap landed"; the sweep is how long, and someone who has asked for less
|
|
573
|
+
* motion can do without the second half.
|
|
574
|
+
*/
|
|
575
|
+
const GuidedShutterSweep = styled.svg `
|
|
576
|
+
position: absolute;
|
|
577
|
+
inset: 0;
|
|
578
|
+
width: 100%;
|
|
579
|
+
height: 100%;
|
|
580
|
+
pointer-events: none;
|
|
581
|
+
/* Start at twelve o'clock rather than three. */
|
|
582
|
+
transform: rotate(-90deg);
|
|
583
|
+
|
|
584
|
+
circle {
|
|
585
|
+
fill: none;
|
|
586
|
+
stroke: #fff;
|
|
587
|
+
stroke-width: ${GUIDED_SHUTTER_RING_WIDTH_PX}px;
|
|
588
|
+
stroke-linecap: round;
|
|
589
|
+
stroke-dasharray: ${SHUTTER_RING_CIRCUMFERENCE_PX};
|
|
590
|
+
stroke-dashoffset: ${SHUTTER_RING_CIRCUMFERENCE_PX};
|
|
591
|
+
animation: ${shutterSweep} ${({ $durationMs }) => $durationMs}ms linear
|
|
592
|
+
forwards;
|
|
593
|
+
}
|
|
594
|
+
|
|
595
|
+
@media (prefers-reduced-motion: reduce) {
|
|
596
|
+
circle {
|
|
597
|
+
animation: none;
|
|
598
|
+
stroke-dashoffset: 0;
|
|
599
|
+
}
|
|
600
|
+
}
|
|
601
|
+
`;
|
|
602
|
+
/**
|
|
603
|
+
* The guided screen's surround.
|
|
604
|
+
*
|
|
605
|
+
* Near-black rather than pure black so the guide box's white brackets and the
|
|
606
|
+
* page inside it still read as the brightest things on screen, and so an OLED
|
|
607
|
+
* panel does not show a hard seam where the surround meets a dark camera feed.
|
|
608
|
+
*/
|
|
609
|
+
const GUIDED_SURROUND_COLOR = '#0a0e13';
|
|
610
|
+
/**
|
|
611
|
+
* Title + instructions, floated over the feed instead of sitting in a bar.
|
|
612
|
+
*
|
|
613
|
+
* `pointer-events: none` so it can overlap the guide box without stealing a
|
|
614
|
+
* tap, and a top-down gradient rather than a solid fill so the feed reads as
|
|
615
|
+
* continuous behind it. No `backdrop-filter` — it repaints per frame over live
|
|
616
|
+
* video, which is exactly the GPU cost this screen cannot afford.
|
|
617
|
+
*/
|
|
618
|
+
/**
|
|
619
|
+
* A ruled bar the title OWNS, rather than a caption floating over the feed.
|
|
620
|
+
*
|
|
621
|
+
* The floating version needed a gradient behind it purely to stay legible
|
|
622
|
+
* against whatever the camera happened to be pointed at, which is a tell that
|
|
623
|
+
* it was in the wrong place. Under `snapToGuides` the feed is letterboxed to
|
|
624
|
+
* the guide box, so the band above it is dead space — this gives it a job.
|
|
625
|
+
*
|
|
626
|
+
* IN FLOW, deliberately. It is a fixed height that never changes, so it costs
|
|
627
|
+
* the guide box the same room on every frame; the thing that must never be in
|
|
628
|
+
* flow is the shutter, which appears mid-session. See `GuidedShutterDock`.
|
|
629
|
+
*/
|
|
630
|
+
const GuidedHeader = styled.div `
|
|
631
|
+
flex: none;
|
|
632
|
+
/* MUST BE PAINTED. Moving this into flow put it above the guide overlay's
|
|
633
|
+
canvas, and the mask only covers the canvas — so an unpainted header is a
|
|
634
|
+
transparent strip showing the HOST page through the top of the SDK. On a
|
|
635
|
+
white host that is white text on white.
|
|
636
|
+
|
|
637
|
+
Exactly the failure FooterRow had at the other end, recreated here the
|
|
638
|
+
moment the header stopped floating over the feed. Both strips now take the
|
|
639
|
+
surround colour from the same place the mask does.
|
|
640
|
+
|
|
641
|
+
No backticks in this comment: it is inside a styled-components template
|
|
642
|
+
literal, where one ends the template. That has now cost three debugging
|
|
643
|
+
rounds in this file. */
|
|
644
|
+
background: ${(props) => props.$maskColor};
|
|
645
|
+
padding: max(14px, env(safe-area-inset-top)) 20px 11px;
|
|
646
|
+
color: #fff;
|
|
647
|
+
border-bottom: 1px solid rgba(255, 255, 255, 0.08);
|
|
648
|
+
`;
|
|
649
|
+
const GuidedHeading = styled.h1 `
|
|
650
|
+
margin: 0;
|
|
651
|
+
font-size: 14px;
|
|
652
|
+
font-weight: 640;
|
|
653
|
+
letter-spacing: -0.01em;
|
|
654
|
+
`;
|
|
655
|
+
const GuidedInstructions = styled.div `
|
|
656
|
+
margin: 6px auto 0;
|
|
657
|
+
max-width: 34ch;
|
|
658
|
+
font-size: 12.5px;
|
|
659
|
+
line-height: 1.45;
|
|
660
|
+
color: rgba(255, 255, 255, 0.88);
|
|
661
|
+
text-shadow: 0 1px 6px rgba(0, 0, 0, 0.55);
|
|
662
|
+
/* Bounded like the bar version was: a long instruction must not grow until
|
|
663
|
+
it covers the guide box it is describing. */
|
|
664
|
+
max-height: 4.5rem;
|
|
665
|
+
overflow-y: auto;
|
|
666
|
+
/* The header is pointer-events:none so it cannot steal a tap over the guide
|
|
667
|
+
box — but that also kills touch and wheel scrolling on the one child that
|
|
668
|
+
can overflow. Re-enable it here only, and make the region focusable so the
|
|
669
|
+
overflow is reachable by keyboard too. */
|
|
670
|
+
pointer-events: auto;
|
|
671
|
+
overscroll-behavior: contain;
|
|
672
|
+
&:focus-visible {
|
|
673
|
+
outline: 2px solid rgba(255, 255, 255, 0.8);
|
|
674
|
+
outline-offset: 2px;
|
|
675
|
+
}
|
|
676
|
+
`;
|
|
194
677
|
const HeadingRow = styled.div `
|
|
195
678
|
background: ${(props) => props.$maskColor};
|
|
196
679
|
text-align: center;
|
|
@@ -84,5 +84,5 @@ export type FaceLivenessViewProps = Omit<SelfieCaptureViewProps, 'onCaptured'> &
|
|
|
84
84
|
classNames?: FaceLivenessViewClassNames;
|
|
85
85
|
assets?: FaceLivenessViewAssets;
|
|
86
86
|
};
|
|
87
|
-
export declare function FaceLivenessView(
|
|
87
|
+
export declare function FaceLivenessView(props: FaceLivenessViewProps): ReactElement;
|
|
88
88
|
//# sourceMappingURL=FaceLivenessView.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"FaceLivenessView.d.ts","sourceRoot":"","sources":["../src/FaceLivenessView.tsx"],"names":[],"mappings":"AAqDA,OAAO,EACL,YAAY,EAEZ,KAAK,SAAS,EAIf,MAAM,OAAO,CAAA;
|
|
1
|
+
{"version":3,"file":"FaceLivenessView.d.ts","sourceRoot":"","sources":["../src/FaceLivenessView.tsx"],"names":[],"mappings":"AAqDA,OAAO,EACL,YAAY,EAEZ,KAAK,SAAS,EAIf,MAAM,OAAO,CAAA;AAQd,OAAO,EAIL,KAAK,wBAAwB,EAC9B,MAAM,QAAQ,CAAA;AAUf,OAAO,EAEL,KAAK,uBAAuB,EAC5B,KAAK,uBAAuB,EAC5B,KAAK,2BAA2B,EAChC,KAAK,sBAAsB,EAC3B,KAAK,yBAAyB,EAC/B,MAAM,qBAAqB,CAAA;AAC5B,OAAO,EAEL,KAAK,6BAA6B,EAClC,KAAK,yBAAyB,EAC9B,KAAK,2BAA2B,EACjC,MAAM,gDAAgD,CAAA;AACvD,OAAO,EAEL,KAAK,yBAAyB,EAC9B,KAAK,6BAA6B,EAClC,KAAK,yBAAyB,EAC9B,KAAK,2BAA2B,EACjC,MAAM,gDAAgD,CAAA;AAOvD,MAAM,MAAM,4BAA4B,GAAG;IACzC,+BAA+B,CAAC,EAAE,wBAAwB,CAAA;IAC1D,8BAA8B,CAAC,EAAE,wBAAwB,CAAA;IACzD,8BAA8B,CAAC,EAAE,wBAAwB,CAAA;IACzD,+BAA+B,CAAC,EAAE,wBAAwB,CAAA;IAC1D,sBAAsB,CAAC,EAAE,wBAAwB,CAAA;IACjD,sBAAsB,CAAC,EAAE,wBAAwB,CAAA;IACjD,qBAAqB,CAAC,EAAE,wBAAwB,CAAA;IAChD,sBAAsB,CAAC,EAAE,wBAAwB,CAAA;IACjD,kBAAkB,CAAC,EAAE,wBAAwB,CAAA;IAC7C,uBAAuB,CAAC,EAAE,wBAAwB,CAAA;IAClD,2BAA2B,CAAC,EAAE,wBAAwB,CAAA;IACtD,oBAAoB,CAAC,EAAE,wBAAwB,CAAA;CAChD,CAAA;AAwED,MAAM,MAAM,wBAAwB,GAAG,yBAAyB,GAAG;IACjE,QAAQ,CAAC,EAAE,4BAA4B,CAAA;IACvC,OAAO,CAAC,EAAE,2BAA2B,CAAA;IACrC,OAAO,CAAC,EAAE,2BAA2B,CAAA;CACtC,CAAA;AAED,MAAM,MAAM,0BAA0B,GAAG,2BAA2B,GAAG;IACrE,OAAO,CAAC,EAAE,6BAA6B,CAAA;IACvC,OAAO,CAAC,EAAE,6BAA6B,CAAA;CACxC,CAAA;AAED,MAAM,MAAM,sBAAsB,GAAG,uBAAuB,GAAG;IAC7D,OAAO,CAAC,EAAE,yBAAyB,CAAA;CACpC,CAAA;AAED,oFAAoF;AACpF,MAAM,MAAM,sBAAsB,GAAG,uBAAuB,GAAG;IAC7D,OAAO,CAAC,EAAE,yBAAyB,CAAA;IACnC,OAAO,CAAC,EAAE,yBAAyB,CAAA;CACpC,CAAA;AAED,MAAM,MAAM,qBAAqB,GAAG,IAAI,CACtC,sBAAsB,EACtB,YAAY,CACb,GAAG;IACF;;yDAEqD;IACrD,MAAM,CAAC,EAAE,CAAC,QAAQ,EAAE,MAAM,KAAK,IAAI,CAAA;IACnC;sEACkE;IAClE,iBAAiB,CAAC,EAAE,OAAO,CAAA;IAC3B;;;;;;;OAOG;IACH,UAAU,CAAC,EAAE,MAAM,CAAA;IACnB,iFAAiF;IACjF,oBAAoB,CAAC,EAAE,OAAO,CAAA;IAC9B;;;;;;;;;;OAUG;IACH,kBAAkB,CAAC,EAAE,MAAM,IAAI,CAAA;IAC/B;;;;;;;;OAQG;IACH,OAAO,CAAC,EAAE,CAAC,OAAO,EAAE,MAAM,KAAK,IAAI,CAAA;IACnC,MAAM,CAAC,EAAE,sBAAsB,CAAA;IAC/B,iEAAiE;IACjE,QAAQ,CAAC,EAAE,SAAS,CAAC,gBAAgB,GAAG,IAAI,CAAC,CAAA;IAE7C,2EAA2E;IAC3E,gBAAgB,CAAC,EAAE,OAAO,CAAA;IAC1B,QAAQ,CAAC,EAAE,wBAAwB,CAAA;IACnC,UAAU,CAAC,EAAE,0BAA0B,CAAA;IACvC,MAAM,CAAC,EAAE,sBAAsB,CAAA;CAChC,CAAA;AAuBD,wBAAgB,gBAAgB,CAAC,KAAK,EAAE,qBAAqB,GAAG,YAAY,CAM3E"}
|