@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
|
@@ -14,8 +14,9 @@ import { jsx as _jsx } from "react/jsx-runtime";
|
|
|
14
14
|
// type-imports `FaceGuideStatus` from face_liveness/FaceCaptureGuideOverlay.tsx
|
|
15
15
|
// while this file value-imports back) — a type-only import erases at compile
|
|
16
16
|
// time, so this never becomes a real runtime circular dependency.
|
|
17
|
+
import { memo } from 'react';
|
|
17
18
|
import { styled } from 'styled-components';
|
|
18
|
-
import { SelfieCaptureAnimatedMaskWithStatus } from './SelfieCaptureAnimatedMask';
|
|
19
|
+
import { SelfieCaptureAnimatedMaskWithStatus, } from './SelfieCaptureAnimatedMask';
|
|
19
20
|
export const FaceCaptureGuideContainer = styled.div `
|
|
20
21
|
position: absolute;
|
|
21
22
|
z-index: 1000;
|
|
@@ -29,11 +30,16 @@ export const FaceCaptureGuideContainer = styled.div `
|
|
|
29
30
|
justify-content: center;
|
|
30
31
|
padding: 40px;
|
|
31
32
|
box-sizing: border-box;
|
|
33
|
+
/* Keeps the spotlight dim inside the capture surface when the view is
|
|
34
|
+
embedded rather than full-screen. */
|
|
35
|
+
${(props) => (props.$clip ? 'overflow: hidden;' : '')}
|
|
32
36
|
`;
|
|
33
37
|
const FaceCaptureGuideInner = styled.div `
|
|
34
38
|
position: relative;
|
|
35
39
|
height: 60%;
|
|
36
40
|
`;
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
}
|
|
41
|
+
// Memoized: the capture surfaces re-render on every analyzed frame, but the
|
|
42
|
+
// guide's props only change when the mask status does.
|
|
43
|
+
export const FaceCaptureGuideOverlay = memo(function FaceCaptureGuideOverlay({ classNames = {}, status = 'ready', guideStyle, borderWidth = 5, borderColor, borderOpacity = 0.8, }) {
|
|
44
|
+
return (_jsx(FaceCaptureGuideContainer, { className: classNames.container, "$clip": guideStyle === 'spotlight', children: _jsx(FaceCaptureGuideInner, { children: _jsx(SelfieCaptureAnimatedMaskWithStatus, { status: status, guideStyle: guideStyle, borderColor: borderColor, borderWidth: borderWidth, borderOpacity: borderOpacity, verticalAlign: "center" }) }) }));
|
|
45
|
+
});
|
|
@@ -1,5 +1,7 @@
|
|
|
1
1
|
import { type SVGProps } from 'react';
|
|
2
2
|
import type { FaceGuideStatus } from './FaceCaptureGuideOverlay';
|
|
3
|
+
/** How the selfie guide prompts the user to put their head in the oval. */
|
|
4
|
+
export type FaceGuideStyle = 'pulse' | 'spotlight';
|
|
3
5
|
export type SelfieCaptureAnimatedMaskProps = SVGProps<SVGSVGElement> & {
|
|
4
6
|
frame?: number;
|
|
5
7
|
borderWidth?: number;
|
|
@@ -7,8 +9,13 @@ export type SelfieCaptureAnimatedMaskProps = SVGProps<SVGSVGElement> & {
|
|
|
7
9
|
borderOpacity?: number;
|
|
8
10
|
verticalAlign?: 'center' | 'bottom';
|
|
9
11
|
status?: FaceGuideStatus;
|
|
12
|
+
/** 'pulse' (default) animates waves out of the oval until a face is framed;
|
|
13
|
+
* 'spotlight' dims everything outside the oval instead, with no animation.
|
|
14
|
+
* The dim reaches the nearest clipping ancestor, so render the mask inside
|
|
15
|
+
* an `overflow: hidden` container (FaceCaptureGuideOverlay provides one). */
|
|
16
|
+
guideStyle?: FaceGuideStyle;
|
|
10
17
|
};
|
|
11
|
-
export declare function SelfieCaptureAnimatedMask({ frame, borderWidth, borderColor, borderOpacity, verticalAlign, status, ...props }: SelfieCaptureAnimatedMaskProps): import("react/jsx-runtime").JSX.Element;
|
|
18
|
+
export declare function SelfieCaptureAnimatedMask({ frame, borderWidth, borderColor, borderOpacity, verticalAlign, status, guideStyle, ...props }: SelfieCaptureAnimatedMaskProps): import("react/jsx-runtime").JSX.Element;
|
|
12
19
|
export declare function SelfieCaptureAnimatedMaskWithStatus({ status, ...props }: SelfieCaptureAnimatedMaskProps & {
|
|
13
20
|
status?: FaceGuideStatus;
|
|
14
21
|
}): import("react/jsx-runtime").JSX.Element;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"SelfieCaptureAnimatedMask.d.ts","sourceRoot":"","sources":["../../../src/components/selfie/SelfieCaptureAnimatedMask.tsx"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"SelfieCaptureAnimatedMask.d.ts","sourceRoot":"","sources":["../../../src/components/selfie/SelfieCaptureAnimatedMask.tsx"],"names":[],"mappings":"AAmBA,OAAO,EAML,KAAK,QAAQ,EACd,MAAM,OAAO,CAAA;AAEd,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,2BAA2B,CAAA;AAWhE,2EAA2E;AAC3E,MAAM,MAAM,cAAc,GAAG,OAAO,GAAG,WAAW,CAAA;AAyNlD,MAAM,MAAM,8BAA8B,GAAG,QAAQ,CAAC,aAAa,CAAC,GAAG;IACrE,KAAK,CAAC,EAAE,MAAM,CAAA;IACd,WAAW,CAAC,EAAE,MAAM,CAAA;IACpB,WAAW,CAAC,EAAE,MAAM,CAAA;IACpB,aAAa,CAAC,EAAE,MAAM,CAAA;IACtB,aAAa,CAAC,EAAE,QAAQ,GAAG,QAAQ,CAAA;IACnC,MAAM,CAAC,EAAE,eAAe,CAAA;IACxB;;;iFAG6E;IAC7E,UAAU,CAAC,EAAE,cAAc,CAAA;CAC5B,CAAA;AAED,wBAAgB,yBAAyB,CAAC,EACxC,KAAS,EACT,WAAe,EACf,WAAW,EACX,aAAmB,EACnB,aAAwB,EACxB,MAAgB,EAChB,UAAU,EACV,GAAG,KAAK,EACT,EAAE,8BAA8B,2CA8MhC;AAED,wBAAgB,mCAAmC,CAAC,EAClD,MAAgB,EAChB,GAAG,KAAK,EACT,EAAE,8BAA8B,GAAG;IAClC,MAAM,CAAC,EAAE,eAAe,CAAA;CACzB,2CAoBA"}
|
|
@@ -3,14 +3,12 @@ import { jsx as _jsx, Fragment as _Fragment, jsxs as _jsxs } from "react/jsx-run
|
|
|
3
3
|
// lines 305-730: `HeadGuideSvg`, `HeadGuide`, `SelfieCaptureAnimatedMask`, and
|
|
4
4
|
// `SelfieCaptureAnimatedMaskWithStatus` (the file's other export, the
|
|
5
5
|
// `SelfieCaptureLoadingGraphic` avatar animation, lives in the sibling
|
|
6
|
-
// ./SelfieCaptureLoadingGraphic.tsx per the task-3 file split). SVG paths
|
|
7
|
-
//
|
|
8
|
-
//
|
|
6
|
+
// ./SelfieCaptureLoadingGraphic.tsx per the task-3 file split). SVG paths
|
|
7
|
+
// and the 250ms processing frame cycle are kept byte-identical; the ready-state
|
|
8
|
+
// waves deliberately diverge from sdk2 for GPU cost (see
|
|
9
|
+
// `headGuideWavesAnimation`). Otherwise only sanctioned transforms applied:
|
|
9
10
|
// - unused `React` default import dropped (new JSX transform);
|
|
10
11
|
// - `styled` repointed to a named import;
|
|
11
|
-
// - `wavesAnimation` repointed to this package's existing
|
|
12
|
-
// components/common/animation.ts (already ported in iteration 3 and used
|
|
13
|
-
// by components/guides/IdCaptureGuidesCommon.tsx's own waves stack);
|
|
14
12
|
// - `useResizeObserver` repointed to this package's layout/useResizeObserver;
|
|
15
13
|
// - `FaceGuideStatus` type-only-imported from the sibling
|
|
16
14
|
// ./FaceCaptureGuideOverlay.tsx (see that file's header comment for why
|
|
@@ -21,12 +19,34 @@ import { jsx as _jsx, Fragment as _Fragment, jsxs as _jsxs } from "react/jsx-run
|
|
|
21
19
|
// guide_images/defaults.ts uses for its own CDN asset URLs — the resolved
|
|
22
20
|
// URL string is unchanged.
|
|
23
21
|
import { forwardRef, useEffect, useMemo, useRef, useState, } from 'react';
|
|
24
|
-
import { styled, useTheme } from 'styled-components';
|
|
25
|
-
import { wavesAnimation } from '../common/animation';
|
|
22
|
+
import { keyframes, styled, useTheme } from 'styled-components';
|
|
26
23
|
import useResizeObserver from '../../layout/useResizeObserver';
|
|
27
24
|
import { DEFAULT_CDN_URL } from '../../utils/cdn';
|
|
28
|
-
const
|
|
25
|
+
const HEAD_GUIDE_OVAL_PATH = 'M565.5 295C565.5 350.583 549.016 400.803 522.488 437.067C495.958 473.332 459.517 495.5 419.5 495.5C379.483 495.5 343.042 473.332 316.512 437.067C289.984 400.803 273.5 350.583 273.5 295C273.5 239.417 289.984 189.197 316.512 152.933C343.042 116.668 379.483 94.5 419.5 94.5C459.517 94.5 495.958 116.668 522.488 152.933C549.016 189.197 565.5 239.417 565.5 295Z';
|
|
26
|
+
// A rectangle far larger than any screen with the oval cut out of it
|
|
27
|
+
// (evenodd), so one static path dims everything except the guide.
|
|
28
|
+
const SPOTLIGHT_PATH = `M-10000 -10000H10000V10000H-10000Z ${HEAD_GUIDE_OVAL_PATH}`;
|
|
29
|
+
const HeadGuideSvg = forwardRef(({ borderColor = 'white', borderOpacity = 0.8, borderWidth = 5, status = 'ready', ...props }, ref) => (_jsxs("svg", { ...props, ref: ref, viewBox: "271 92 297 406", fill: "none", xmlns: "http://www.w3.org/2000/svg", children: [_jsxs("g", { clipPath: "url(#clip0_428_1188)", children: [_jsx("path", { d: HEAD_GUIDE_OVAL_PATH, stroke: borderColor, strokeOpacity: borderOpacity, strokeWidth: borderWidth }), status === 'success' && (_jsxs(_Fragment, { children: [_jsx("circle", { cx: "518.5", cy: "438.5", r: "25.5", fill: borderColor }), _jsx("path", { d: "M504 440.5L512 448L531 427", stroke: "white", strokeWidth: "5", strokeLinecap: "round", strokeLinejoin: "round" })] })), status === 'failure' && (_jsxs(_Fragment, { children: [_jsx("circle", { cx: "518.5", cy: "438.5", r: "25.5", fill: borderColor }), _jsx("image", { href: `${DEFAULT_CDN_URL}/x.svg`, x: "507", y: "427", width: "24", height: "24" })] }))] }), _jsx("defs", { children: _jsx("clipPath", { id: "clip0_428_1188", children: _jsx("rect", { width: "840", height: "740", fill: "white" }) }) })] })));
|
|
29
30
|
HeadGuideSvg.displayName = 'HeadGuideSvg';
|
|
31
|
+
// One wave that grows to 1.3x and fades out, three times, then stops. sdk2
|
|
32
|
+
// stacked three copies growing to 2x on an infinite loop: three translucent
|
|
33
|
+
// layers up to 4x the guide's area, blended over the video at the display
|
|
34
|
+
// refresh rate for the whole capture, which low-end GPUs can't keep up with
|
|
35
|
+
// while also running the camera and face model. Waves only render while the
|
|
36
|
+
// status is 'ready', so the pulse replays each time the face leaves the guide.
|
|
37
|
+
const headGuideWavesAnimation = keyframes `
|
|
38
|
+
0% {
|
|
39
|
+
opacity: 0;
|
|
40
|
+
transform: scale(1);
|
|
41
|
+
}
|
|
42
|
+
60% {
|
|
43
|
+
opacity: 1;
|
|
44
|
+
}
|
|
45
|
+
100% {
|
|
46
|
+
opacity: 0;
|
|
47
|
+
transform: scale(1.3);
|
|
48
|
+
}
|
|
49
|
+
`;
|
|
30
50
|
const PulsingHeadGuideContainer = styled.div `
|
|
31
51
|
display: flex;
|
|
32
52
|
position: relative;
|
|
@@ -35,29 +55,36 @@ const PulsingHeadGuideContainer = styled.div `
|
|
|
35
55
|
|
|
36
56
|
& > .idmSdkWaves {
|
|
37
57
|
position: absolute;
|
|
38
|
-
|
|
39
|
-
|
|
58
|
+
opacity: 0;
|
|
59
|
+
animation: ${headGuideWavesAnimation} 2s ease-out 3;
|
|
40
60
|
|
|
41
|
-
|
|
42
|
-
|
|
61
|
+
@media (prefers-reduced-motion: reduce) {
|
|
62
|
+
display: none;
|
|
43
63
|
}
|
|
64
|
+
}
|
|
44
65
|
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
66
|
+
/* Paints far past its box; the nearest clipping ancestor bounds it
|
|
67
|
+
(FaceCaptureGuideOverlay clips to the capture surface). */
|
|
68
|
+
& > .idmSdkSpotlight {
|
|
69
|
+
position: absolute;
|
|
70
|
+
overflow: visible;
|
|
71
|
+
pointer-events: none;
|
|
48
72
|
}
|
|
49
73
|
|
|
50
74
|
& > .idmSdkWavesOrigin {
|
|
51
75
|
position: relative;
|
|
52
76
|
}
|
|
53
77
|
`;
|
|
54
|
-
function HeadGuide({ status = 'ready', ...props }) {
|
|
78
|
+
function HeadGuide({ status = 'ready', guideStyle = 'pulse', ...props }) {
|
|
55
79
|
const ref = useRef(null);
|
|
56
80
|
const { ref: parentRef, height: parentHeight } = useResizeObserver();
|
|
57
81
|
const [contentAspectRatio, setContentAspectRatio] = useState();
|
|
58
82
|
const theme = useTheme();
|
|
59
83
|
const wavesDisabled = theme.selfieCapture?.guides?.wavesDisabled ?? false;
|
|
60
84
|
const wavesColor = theme.selfieCapture?.guides?.wavesColor ?? '#287ec6';
|
|
85
|
+
const spotlightColor = guideStyle === 'spotlight'
|
|
86
|
+
? (theme.selfieCapture?.guides?.spotlightColor ?? 'rgba(0, 0, 0, 0.55)')
|
|
87
|
+
: undefined;
|
|
61
88
|
useEffect(() => {
|
|
62
89
|
if (!ref.current)
|
|
63
90
|
return;
|
|
@@ -65,7 +92,11 @@ function HeadGuide({ status = 'ready', ...props }) {
|
|
|
65
92
|
setContentAspectRatio((bbox.x + bbox.width + bbox.x) / (bbox.y + bbox.height + bbox.y));
|
|
66
93
|
}, []);
|
|
67
94
|
const scaledWidth = useMemo(() => contentAspectRatio && parentHeight && parentHeight / contentAspectRatio, [contentAspectRatio, parentHeight]);
|
|
68
|
-
return (_jsxs(PulsingHeadGuideContainer, { ref: parentRef, children: [
|
|
95
|
+
return (_jsxs(PulsingHeadGuideContainer, { ref: parentRef, children: [spotlightColor && (
|
|
96
|
+
// Its own svg, so the origin's getBBox() (which sizes the guide) never
|
|
97
|
+
// sees the huge rectangle. Painted before the origin so the outline
|
|
98
|
+
// and status badges stay on top.
|
|
99
|
+
_jsx("svg", { className: "idmSdkSpotlight", viewBox: "271 92 297 406", width: scaledWidth, height: parentHeight, "aria-hidden": true, children: _jsx("path", { d: SPOTLIGHT_PATH, fill: spotlightColor, fillRule: "evenodd" }) })), status === 'ready' && guideStyle === 'pulse' && !wavesDisabled && (_jsx(HeadGuideSvg, { ...props, className: "idmSdkWaves", borderOpacity: 0.25, borderColor: wavesColor, width: scaledWidth, height: parentHeight })), _jsx(HeadGuideSvg, { ...props, ref: ref, borderOpacity: 1, className: `idmSdkWavesOrigin ${props.className ?? ''}`, status: status, width: scaledWidth, height: parentHeight })] }));
|
|
69
100
|
}
|
|
70
101
|
const AbsoluteSvg = styled.svg `
|
|
71
102
|
position: absolute;
|
|
@@ -80,8 +111,11 @@ const RelativeSvgContainer = styled.div `
|
|
|
80
111
|
display: flex;
|
|
81
112
|
align-items: ${(props) => props.$verticalAlign === 'bottom' ? 'flex-end' : 'center'};
|
|
82
113
|
`;
|
|
83
|
-
export function SelfieCaptureAnimatedMask({ frame = 0, borderWidth = 5, borderColor
|
|
114
|
+
export function SelfieCaptureAnimatedMask({ frame = 0, borderWidth = 5, borderColor, borderOpacity = 0.8, verticalAlign = 'center', status = 'ready', guideStyle, ...props }) {
|
|
84
115
|
const theme = useTheme();
|
|
116
|
+
// The outline while no face is framed yet. An explicit `borderColor` wins,
|
|
117
|
+
// as the video-ID guides pass their own.
|
|
118
|
+
const unsatisfiedColor = borderColor ?? theme.selfieCapture?.guides?.unsatisfiedColor ?? 'white';
|
|
85
119
|
const satisfiedColor = theme.selfieCapture?.guides?.satisfiedColor ??
|
|
86
120
|
'var(--idm-color-positive-600)';
|
|
87
121
|
const negativeColor = theme.selfieCapture?.guides?.failureColor ?? 'var(--idm-color-negative-600)';
|
|
@@ -89,8 +123,8 @@ export function SelfieCaptureAnimatedMask({ frame = 0, borderWidth = 5, borderCo
|
|
|
89
123
|
? negativeColor
|
|
90
124
|
: status === 'success'
|
|
91
125
|
? satisfiedColor
|
|
92
|
-
:
|
|
93
|
-
return (_jsxs(RelativeSvgContainer, { "$verticalAlign": verticalAlign, children: [_jsx(HeadGuide, { borderOpacity: borderOpacity, borderWidth: borderWidth, borderColor: statusBorderColor, status: status, ...props }), status === 'processing' && (_jsxs(AbsoluteSvg, { ...props, viewBox: "271 92 297 406", fill: "none", xmlns: "http://www.w3.org/2000/svg", children: [_jsxs("g", { clipPath: "url(#clip0_428_1188)", children: [frame > 1 && (_jsxs(_Fragment, { children: [frame > 2 && (_jsxs(_Fragment, { children: [frame > 3 && (_jsxs(_Fragment, { children: [frame > 4 && (_jsxs(_Fragment, { children: [_jsx("path", { d: "M298.5 182.5L419 164.5L540 182", stroke: "white", strokeWidth: "2", strokeLinecap: "round", strokeLinejoin: "round" }), _jsx("circle", { cx: "419", cy: "165", r: "7", fill: "white" })] })), _jsx("path", { d: "M299.939 262.805L419 478.5L538.5 261.5", stroke: "white", strokeWidth: "2", strokeLinecap: "round", strokeLinejoin: "round" }), _jsx("path", { d: "M298.5 182.5L418.871 230.054L540 182", stroke: "white", strokeWidth: "2", strokeLinecap: "round", strokeLinejoin: "round" }), _jsx("path", { d: "M298.5 182.5L299.939 262.805", stroke: "white", strokeWidth: "2", strokeLinecap: "round", strokeLinejoin: "round" }), _jsx("path", { d: "M540.001 182L538.501 261.5", stroke: "white", strokeWidth: "2", strokeLinecap: "round", strokeLinejoin: "round" }), _jsx("circle", { cx: "299.914", cy: "182", r: "7", fill: "white" }), _jsx("circle", { cx: "540", cy: "182", r: "7", fill: "white" })] })), _jsx("path", { d: "M418.828 230L419 342.5", stroke: "white", strokeWidth: "2", strokeLinecap: "round", strokeLinejoin: "round", strokeOpacity: frame > 3 && frame < 6 ? 0.3 : 1 }), _jsx("path", { d: "M300 263.001L419 342.501", stroke: "white", strokeWidth: "2", strokeLinecap: "round", strokeLinejoin: "round", strokeOpacity: frame > 3 && frame < 6 ? 0.3 : 1 }), _jsx("path", { d: "M538.5 261.5L419 342.5", stroke: "white", strokeWidth: "2", strokeLinecap: "round", strokeLinejoin: "round", strokeOpacity: frame > 3 && frame < 6 ? 0.3 : 1 }), _jsx("path", { d: "M301.5 409L419 342.5", stroke: "white", strokeWidth: "2", strokeLinecap: "round", strokeLinejoin: "round", strokeOpacity: frame > 3 && frame < 6 ? 0.3 : 1 }), _jsx("path", { d: "M536.5 410L419 342.5", stroke: "white", strokeWidth: "2", strokeLinecap: "round", strokeLinejoin: "round", strokeOpacity: frame > 3 && frame < 6 ? 0.3 : 1 }), _jsx("path", { d: "M300 263L419 230", stroke: "white", strokeWidth: "2", strokeLinecap: "round", strokeLinejoin: "round", strokeOpacity: frame > 3 && frame < 6 ? 0.3 : 1 }), _jsx("path", { d: "M538.5 261.5L419 230", stroke: "white", strokeWidth: "2", strokeLinecap: "round", strokeLinejoin: "round", strokeOpacity: frame > 3 && frame < 6 ? 0.3 : 1 }), _jsx("circle", { cx: "419", cy: "229.971", r: "7", fill: "white" }), _jsx("circle", { cx: "419", cy: "342.4", r: "7", fill: "white" })] })), _jsx("path", { d: "M538.5 261.5L536.5 410", stroke: "white", strokeWidth: "2", strokeLinecap: "round", strokeLinejoin: "round", strokeOpacity: frame > 3 && frame < 7 ? 0.3 : 1 }), _jsx("path", { d: "M419 478.5L536.5 410", stroke: "white", strokeWidth: "2", strokeLinecap: "round", strokeLinejoin: "round", strokeOpacity: frame > 3 && frame < 7 ? 0.3 : 1 }), _jsx("circle", { cx: "537", cy: "263", r: "7", fill: "white" }), _jsx("circle", { cx: "537", cy: "409", r: "7", fill: "white" })] })), frame > 0 && (_jsxs(_Fragment, { children: [_jsx("path", { d: "M301.501 409L300.001 263", stroke: "white", strokeWidth: "2", strokeLinecap: "round", strokeLinejoin: "round", strokeOpacity: frame > 1 && frame < 6 ? 0.3 : 1 }), _jsx("path", { d: "M301.501 409L419.001 478.5", stroke: "white", strokeWidth: "2", strokeLinecap: "round", strokeLinejoin: "round", strokeOpacity: frame > 1 && frame < 6 ? 0.3 : 1 }), _jsx("circle", { cx: "419", cy: "477.576", r: "7", fill: "white" }), _jsx("circle", { cx: "301.914", cy: "263", r: "7", fill: "white" }), _jsx("circle", { cx: "301.444", cy: "409", r: "7", fill: "white" })] }))] }), _jsx("defs", { children: _jsx("clipPath", { id: "clip0_428_1188", children: _jsx("rect", { width: "840", height: "740", fill: "white" }) }) })] }))] }));
|
|
126
|
+
: unsatisfiedColor;
|
|
127
|
+
return (_jsxs(RelativeSvgContainer, { "$verticalAlign": verticalAlign, children: [_jsx(HeadGuide, { borderOpacity: borderOpacity, borderWidth: borderWidth, borderColor: statusBorderColor, status: status, guideStyle: guideStyle, ...props }), status === 'processing' && (_jsxs(AbsoluteSvg, { ...props, viewBox: "271 92 297 406", fill: "none", xmlns: "http://www.w3.org/2000/svg", children: [_jsxs("g", { clipPath: "url(#clip0_428_1188)", children: [frame > 1 && (_jsxs(_Fragment, { children: [frame > 2 && (_jsxs(_Fragment, { children: [frame > 3 && (_jsxs(_Fragment, { children: [frame > 4 && (_jsxs(_Fragment, { children: [_jsx("path", { d: "M298.5 182.5L419 164.5L540 182", stroke: "white", strokeWidth: "2", strokeLinecap: "round", strokeLinejoin: "round" }), _jsx("circle", { cx: "419", cy: "165", r: "7", fill: "white" })] })), _jsx("path", { d: "M299.939 262.805L419 478.5L538.5 261.5", stroke: "white", strokeWidth: "2", strokeLinecap: "round", strokeLinejoin: "round" }), _jsx("path", { d: "M298.5 182.5L418.871 230.054L540 182", stroke: "white", strokeWidth: "2", strokeLinecap: "round", strokeLinejoin: "round" }), _jsx("path", { d: "M298.5 182.5L299.939 262.805", stroke: "white", strokeWidth: "2", strokeLinecap: "round", strokeLinejoin: "round" }), _jsx("path", { d: "M540.001 182L538.501 261.5", stroke: "white", strokeWidth: "2", strokeLinecap: "round", strokeLinejoin: "round" }), _jsx("circle", { cx: "299.914", cy: "182", r: "7", fill: "white" }), _jsx("circle", { cx: "540", cy: "182", r: "7", fill: "white" })] })), _jsx("path", { d: "M418.828 230L419 342.5", stroke: "white", strokeWidth: "2", strokeLinecap: "round", strokeLinejoin: "round", strokeOpacity: frame > 3 && frame < 6 ? 0.3 : 1 }), _jsx("path", { d: "M300 263.001L419 342.501", stroke: "white", strokeWidth: "2", strokeLinecap: "round", strokeLinejoin: "round", strokeOpacity: frame > 3 && frame < 6 ? 0.3 : 1 }), _jsx("path", { d: "M538.5 261.5L419 342.5", stroke: "white", strokeWidth: "2", strokeLinecap: "round", strokeLinejoin: "round", strokeOpacity: frame > 3 && frame < 6 ? 0.3 : 1 }), _jsx("path", { d: "M301.5 409L419 342.5", stroke: "white", strokeWidth: "2", strokeLinecap: "round", strokeLinejoin: "round", strokeOpacity: frame > 3 && frame < 6 ? 0.3 : 1 }), _jsx("path", { d: "M536.5 410L419 342.5", stroke: "white", strokeWidth: "2", strokeLinecap: "round", strokeLinejoin: "round", strokeOpacity: frame > 3 && frame < 6 ? 0.3 : 1 }), _jsx("path", { d: "M300 263L419 230", stroke: "white", strokeWidth: "2", strokeLinecap: "round", strokeLinejoin: "round", strokeOpacity: frame > 3 && frame < 6 ? 0.3 : 1 }), _jsx("path", { d: "M538.5 261.5L419 230", stroke: "white", strokeWidth: "2", strokeLinecap: "round", strokeLinejoin: "round", strokeOpacity: frame > 3 && frame < 6 ? 0.3 : 1 }), _jsx("circle", { cx: "419", cy: "229.971", r: "7", fill: "white" }), _jsx("circle", { cx: "419", cy: "342.4", r: "7", fill: "white" })] })), _jsx("path", { d: "M538.5 261.5L536.5 410", stroke: "white", strokeWidth: "2", strokeLinecap: "round", strokeLinejoin: "round", strokeOpacity: frame > 3 && frame < 7 ? 0.3 : 1 }), _jsx("path", { d: "M419 478.5L536.5 410", stroke: "white", strokeWidth: "2", strokeLinecap: "round", strokeLinejoin: "round", strokeOpacity: frame > 3 && frame < 7 ? 0.3 : 1 }), _jsx("circle", { cx: "537", cy: "263", r: "7", fill: "white" }), _jsx("circle", { cx: "537", cy: "409", r: "7", fill: "white" })] })), frame > 0 && (_jsxs(_Fragment, { children: [_jsx("path", { d: "M301.501 409L300.001 263", stroke: "white", strokeWidth: "2", strokeLinecap: "round", strokeLinejoin: "round", strokeOpacity: frame > 1 && frame < 6 ? 0.3 : 1 }), _jsx("path", { d: "M301.501 409L419.001 478.5", stroke: "white", strokeWidth: "2", strokeLinecap: "round", strokeLinejoin: "round", strokeOpacity: frame > 1 && frame < 6 ? 0.3 : 1 }), _jsx("circle", { cx: "419", cy: "477.576", r: "7", fill: "white" }), _jsx("circle", { cx: "301.914", cy: "263", r: "7", fill: "white" }), _jsx("circle", { cx: "301.444", cy: "409", r: "7", fill: "white" })] }))] }), _jsx("defs", { children: _jsx("clipPath", { id: "clip0_428_1188", children: _jsx("rect", { width: "840", height: "740", fill: "white" }) }) })] }))] }));
|
|
94
128
|
}
|
|
95
129
|
export function SelfieCaptureAnimatedMaskWithStatus({ status = 'ready', ...props }) {
|
|
96
130
|
const [frame, setFrame] = useState(1);
|
|
@@ -1,9 +1,12 @@
|
|
|
1
1
|
import { ReactElement, ReactNode, type RefObject } from 'react';
|
|
2
|
-
import
|
|
2
|
+
import { FaceMessageCode } from '@idmission/websdk-core/selfieCapture';
|
|
3
|
+
import type { SelfieCaptureController, SelfieCaptureControllerState, SelfieGuidanceCode } from '@idmission/websdk-core/selfieCapture';
|
|
3
4
|
import { type FaceCaptureGuideOverlayClassNames, type FaceGuideStatus } from './FaceCaptureGuideOverlay';
|
|
5
|
+
import type { FaceGuideStyle } from './SelfieCaptureAnimatedMask';
|
|
4
6
|
import { type GuidanceMessageVariant } from '../GuidanceMessage';
|
|
5
7
|
import { type SelfieCaptureLoadingOverlayAssets, type SelfieCaptureLoadingOverlayClassNames, type SelfieCaptureLoadingOverlayColors, type SelfieCaptureLoadingOverlayMode, type SelfieCaptureLoadingOverlayVerbiage } from '../selfie_loading/SelfieCaptureLoadingOverlay';
|
|
6
8
|
import { type ErrorScreenClassNames, type ErrorScreenVerbiage } from '../error/ErrorScreen';
|
|
9
|
+
import type { CameraAccessDeniedReason } from '../error/CameraAccessDeniedOverlay';
|
|
7
10
|
import { type SelfieCaptureFallbackClassNames, type SelfieCaptureFallbackColors, type SelfieCaptureFallbackVerbiage } from '../fallback/SelfieCaptureFallback';
|
|
8
11
|
export type SelfieCaptureSurfaceClassNames = {
|
|
9
12
|
cameraFeed?: string;
|
|
@@ -49,7 +52,9 @@ export type SelfieCaptureSurfaceProps = {
|
|
|
49
52
|
onLoadingCompleted?: () => void;
|
|
50
53
|
onLoadingFailed?: (error?: Error) => void;
|
|
51
54
|
onLoadingOverlayDismissed?: () => void;
|
|
52
|
-
|
|
55
|
+
/** Fires once per camera failure, with whether permission was refused or
|
|
56
|
+
* the camera could not be started. */
|
|
57
|
+
onCameraAccessDenied?: (reason: CameraAccessDeniedReason) => void;
|
|
53
58
|
/** sdk2's `onModelError` / `onSelfieCaptureModelError`: fires once with the
|
|
54
59
|
* Error when a selfie model fails to load or times out. `onLoadingFailed`
|
|
55
60
|
* carries the same event but is the loading overlay's own lifecycle
|
|
@@ -81,12 +86,15 @@ export type SelfieCaptureSurfaceProps = {
|
|
|
81
86
|
silentFallback?: boolean;
|
|
82
87
|
manualCaptureText?: ReactNode;
|
|
83
88
|
manualCaptureButtonText?: ReactNode;
|
|
89
|
+
recoveryCaptureText?: ReactNode;
|
|
90
|
+
recoveryCaptureButtonText?: ReactNode;
|
|
84
91
|
/** An existing, persistently mounted video element owned by a parent flow. */
|
|
85
92
|
videoRef?: RefObject<HTMLVideoElement | null>;
|
|
86
93
|
/** False when a parent flow owns the shared camera feed element. */
|
|
87
94
|
renderCameraFeed?: boolean;
|
|
88
95
|
/** False when a parent flow owns the face-guide composition. */
|
|
89
96
|
renderFaceGuide?: boolean;
|
|
97
|
+
faceGuideStyle?: FaceGuideStyle;
|
|
90
98
|
/** Whether the mask/guidance-pill layer renders at all -- the calling
|
|
91
99
|
* view's own phase-set decision (plain vs. liveness disagree). */
|
|
92
100
|
showCaptureSurface: boolean;
|
|
@@ -94,6 +102,14 @@ export type SelfieCaptureSurfaceProps = {
|
|
|
94
102
|
showGuidancePill: boolean;
|
|
95
103
|
guidanceText: ReactNode;
|
|
96
104
|
guidanceVariant: GuidanceMessageVariant;
|
|
105
|
+
/**
|
|
106
|
+
* Stable identifier for the message currently in the pill, emitted as
|
|
107
|
+
* `data-guidance-code` so customers can target one message from their own
|
|
108
|
+
* stylesheet. `MANUAL_CAPTURE` is substituted here rather than by the callers
|
|
109
|
+
* because the manual-capture prompt REPLACES guidance in the same pill, so
|
|
110
|
+
* the code has to follow whichever text actually rendered.
|
|
111
|
+
*/
|
|
112
|
+
guidanceCode?: FaceMessageCode | SelfieGuidanceCode;
|
|
97
113
|
/** Renders sdk2's face-detection debug overlay (box + keypoints/mesh +
|
|
98
114
|
* sample points) and DebugStatsPane readout -- sdk2 SelfieCapture.tsx:
|
|
99
115
|
* 346-453. Default false; both SelfieCaptureView and FaceLivenessView
|
|
@@ -122,5 +138,5 @@ export type SelfieCaptureSurfaceProps = {
|
|
|
122
138
|
colors?: SelfieCaptureSurfaceColors;
|
|
123
139
|
assets?: SelfieCaptureSurfaceAssets;
|
|
124
140
|
};
|
|
125
|
-
export declare function SelfieCaptureSurface({ controller, state, loadingOverlayMode, sessionReady, autoContinueAfterLoading, showIntroScreen, transitionFromIdCapture, onExit, onLoadingStarted, onLoadingProgress, onLoadingCompleted, onLoadingFailed, onLoadingOverlayDismissed, onCameraAccessDenied, onModelError, onCameraTamperingDetected, onExitAfterTamperSealPopped, onUserCancel, customOverlayContent, allowManualSelfieCaptureOnLoadingError, fallbackCapture, silentFallback, manualCaptureText, manualCaptureButtonText, videoRef, renderCameraFeed, renderFaceGuide, showCaptureSurface, maskStatus, showGuidancePill, guidanceText, guidanceVariant, debugMode, showFaceLandmarks, debugShowSamplePoints, verbiage, classNames, colors, assets, }: SelfieCaptureSurfaceProps): ReactElement;
|
|
141
|
+
export declare function SelfieCaptureSurface({ controller, state, loadingOverlayMode, sessionReady, autoContinueAfterLoading, showIntroScreen, transitionFromIdCapture, onExit, onLoadingStarted, onLoadingProgress, onLoadingCompleted, onLoadingFailed, onLoadingOverlayDismissed, onCameraAccessDenied, onModelError, onCameraTamperingDetected, onExitAfterTamperSealPopped, onUserCancel, customOverlayContent, allowManualSelfieCaptureOnLoadingError, fallbackCapture, silentFallback, manualCaptureText, manualCaptureButtonText, recoveryCaptureText, recoveryCaptureButtonText, videoRef, renderCameraFeed, renderFaceGuide, faceGuideStyle, showCaptureSurface, maskStatus, showGuidancePill, guidanceText, guidanceVariant, guidanceCode, debugMode, showFaceLandmarks, debugShowSamplePoints, verbiage, classNames, colors, assets, }: SelfieCaptureSurfaceProps): ReactElement;
|
|
126
142
|
//# sourceMappingURL=SelfieCaptureSurface.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"SelfieCaptureSurface.d.ts","sourceRoot":"","sources":["../../../src/components/selfie/SelfieCaptureSurface.tsx"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"SelfieCaptureSurface.d.ts","sourceRoot":"","sources":["../../../src/components/selfie/SelfieCaptureSurface.tsx"],"names":[],"mappings":"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"}
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-runtime";
|
|
2
|
+
import { useCaptureProgressController, useDisplayedGuidance } from '../../flows/CaptureProgress';
|
|
2
3
|
// Internal shared render surface extracted from SelfieCaptureView (task-7)
|
|
3
4
|
// so FaceLivenessView (task-8) can compose the exact same
|
|
4
5
|
// feed/mask/pill/loading-overlay/error wiring without duplicating it. NOT
|
|
@@ -31,6 +32,8 @@ import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-run
|
|
|
31
32
|
// `state.capturedSelfie`/`state.liveness`.
|
|
32
33
|
import { useCallback, useEffect, useRef, useState, } from 'react';
|
|
33
34
|
import { styled } from 'styled-components';
|
|
35
|
+
import { EAR_CALIBRATION_MS, EYES_OPEN_WINDOW_MS, FaceMessageCode, } from '@idmission/websdk-core/selfieCapture';
|
|
36
|
+
import { BLINK_OPEN_FRACTION, computeEARPerEye, } from '@idmission/websdk-core/liveness';
|
|
34
37
|
import { SelfieCameraFeed } from './SelfieCameraFeed';
|
|
35
38
|
import { FaceCaptureGuideOverlay, } from './FaceCaptureGuideOverlay';
|
|
36
39
|
import { GuidanceMessage, GuidanceMessageContainer, } from '../GuidanceMessage';
|
|
@@ -38,9 +41,10 @@ import { ExitCaptureButton } from '../ExitCaptureButton';
|
|
|
38
41
|
import { LoaderButton } from '../common/LoaderButton';
|
|
39
42
|
import { SelfieCaptureLoadingOverlay, } from '../selfie_loading/SelfieCaptureLoadingOverlay';
|
|
40
43
|
import { ErrorScreen, } from '../error/ErrorScreen';
|
|
44
|
+
import { useCameraAccessDeniedReport } from '../error/useCameraAccessDeniedReport';
|
|
41
45
|
import { SelfieCaptureFallback, } from '../fallback/SelfieCaptureFallback';
|
|
42
|
-
import { DebugStatsPane, FaceDetectionKeypointMarker, ObjectDetectionDebugOverlayDiv, SelfieCaptureFaceDebugBox, useDebugScalingDetails, } from '../debug/debug';
|
|
43
|
-
export function SelfieCaptureSurface({ controller, state, loadingOverlayMode, sessionReady, autoContinueAfterLoading, showIntroScreen, transitionFromIdCapture, onExit, onLoadingStarted, onLoadingProgress, onLoadingCompleted, onLoadingFailed, onLoadingOverlayDismissed, onCameraAccessDenied, onModelError, onCameraTamperingDetected, onExitAfterTamperSealPopped, onUserCancel, customOverlayContent, allowManualSelfieCaptureOnLoadingError = false, fallbackCapture = true, silentFallback = false, manualCaptureText, manualCaptureButtonText, videoRef, renderCameraFeed = true, renderFaceGuide = true, showCaptureSurface, maskStatus, showGuidancePill, guidanceText, guidanceVariant, debugMode = false, showFaceLandmarks = false, debugShowSamplePoints = true, verbiage = {}, classNames = {}, colors = {}, assets = {}, }) {
|
|
46
|
+
import { CameraDebugStatus, DebugStatsPane, FaceDetectionKeypointMarker, ObjectDetectionDebugOverlayDiv, SelfieCaptureFaceDebugBox, useDebugScalingDetails, } from '../debug/debug';
|
|
47
|
+
export function SelfieCaptureSurface({ controller, state, loadingOverlayMode, sessionReady, autoContinueAfterLoading, showIntroScreen, transitionFromIdCapture, onExit, onLoadingStarted, onLoadingProgress, onLoadingCompleted, onLoadingFailed, onLoadingOverlayDismissed, onCameraAccessDenied, onModelError, onCameraTamperingDetected, onExitAfterTamperSealPopped, onUserCancel, customOverlayContent, allowManualSelfieCaptureOnLoadingError = false, fallbackCapture = true, silentFallback = false, manualCaptureText, manualCaptureButtonText, recoveryCaptureText, recoveryCaptureButtonText, videoRef, renderCameraFeed = true, renderFaceGuide = true, faceGuideStyle, showCaptureSurface, maskStatus, showGuidancePill, guidanceText, guidanceVariant, guidanceCode, debugMode = false, showFaceLandmarks = false, debugShowSamplePoints = true, verbiage = {}, classNames = {}, colors = {}, assets = {}, }) {
|
|
44
48
|
// Same ref-callback + effect-keyed-only-on-[controller] pattern as
|
|
45
49
|
// IdCaptureView/SelfieCaptureView (see SelfieCaptureView.tsx's header
|
|
46
50
|
// comment for the full rationale).
|
|
@@ -122,6 +126,7 @@ export function SelfieCaptureSurface({ controller, state, loadingOverlayMode, se
|
|
|
122
126
|
videoWidth: videoDims.videoWidth,
|
|
123
127
|
videoHeight: videoDims.videoHeight,
|
|
124
128
|
});
|
|
129
|
+
useCaptureProgressController(controller);
|
|
125
130
|
const manualFallbackAvailable = allowManualSelfieCaptureOnLoadingError &&
|
|
126
131
|
state.error?.code === 'MODEL_LOAD_FAILED';
|
|
127
132
|
// The two halves of sdk2's fork are mutually exclusive: with the flag set
|
|
@@ -132,6 +137,8 @@ export function SelfieCaptureSurface({ controller, state, loadingOverlayMode, se
|
|
|
132
137
|
const manualCaptureEnabled = allowManualSelfieCaptureOnLoadingError &&
|
|
133
138
|
state.phase === 'capturing' &&
|
|
134
139
|
state.models.loadState === 'error';
|
|
140
|
+
const showCaptureRecovery = showCaptureSurface && state.phase === 'capturing' &&
|
|
141
|
+
state.captureRecovery?.manualCaptureAvailable && !manualCaptureEnabled;
|
|
135
142
|
const showLoadingOverlay = state.phase === 'initializing' ||
|
|
136
143
|
state.phase === 'loading' ||
|
|
137
144
|
manualFallbackAvailable;
|
|
@@ -149,8 +156,15 @@ export function SelfieCaptureSurface({ controller, state, loadingOverlayMode, se
|
|
|
149
156
|
},
|
|
150
157
|
}
|
|
151
158
|
: state;
|
|
159
|
+
const displayedCode = manualCaptureEnabled ? FaceMessageCode.MANUAL_CAPTURE : guidanceCode;
|
|
160
|
+
const displayedText = manualCaptureEnabled ? manualCaptureText : guidanceText;
|
|
161
|
+
const isFaceMessageCode = (code) => Object.values(FaceMessageCode).some(value => value === code);
|
|
162
|
+
useDisplayedGuidance((showGuidancePill || manualCaptureEnabled) && displayedText && displayedCode && displayedCode !== 'NONE'
|
|
163
|
+
? isFaceMessageCode(displayedCode)
|
|
164
|
+
? { kind: 'displayed', message: { family: 'face', code: displayedCode } }
|
|
165
|
+
: { kind: 'displayed', message: { family: 'selfie', code: displayedCode } }
|
|
166
|
+
: { kind: 'no-prompt' });
|
|
152
167
|
const reportedModelErrorRef = useRef(null);
|
|
153
|
-
const cameraDeniedReportedRef = useRef(false);
|
|
154
168
|
const tamperReportedRef = useRef(false);
|
|
155
169
|
useEffect(() => {
|
|
156
170
|
const modelError = state.models.error;
|
|
@@ -161,13 +175,6 @@ export function SelfieCaptureSurface({ controller, state, loadingOverlayMode, se
|
|
|
161
175
|
}
|
|
162
176
|
if (!modelError)
|
|
163
177
|
reportedModelErrorRef.current = null;
|
|
164
|
-
const cameraDenied = state.error?.code === 'CAMERA_PERMISSION_DENIED';
|
|
165
|
-
if (cameraDenied && !cameraDeniedReportedRef.current) {
|
|
166
|
-
cameraDeniedReportedRef.current = true;
|
|
167
|
-
onCameraAccessDenied?.();
|
|
168
|
-
}
|
|
169
|
-
if (!cameraDenied)
|
|
170
|
-
cameraDeniedReportedRef.current = false;
|
|
171
178
|
// Same one-shot latch as IdCaptureView's: the host counts detections, not
|
|
172
179
|
// renders, and a cleared-then-re-detected tamper is a second detection.
|
|
173
180
|
const tampered = state.error?.code === 'CAMERA_TAMPERING_SUSPECTED';
|
|
@@ -178,17 +185,24 @@ export function SelfieCaptureSurface({ controller, state, loadingOverlayMode, se
|
|
|
178
185
|
if (!tampered)
|
|
179
186
|
tamperReportedRef.current = false;
|
|
180
187
|
}, [
|
|
181
|
-
onCameraAccessDenied,
|
|
182
188
|
onCameraTamperingDetected,
|
|
183
189
|
onLoadingFailed,
|
|
184
190
|
onModelError,
|
|
185
191
|
state.error?.code,
|
|
186
192
|
state.models.error,
|
|
187
193
|
]);
|
|
194
|
+
useCameraAccessDeniedReport(controller, state.error?.code, onCameraAccessDenied);
|
|
188
195
|
const handleLoadingContinue = useCallback(() => {
|
|
189
196
|
void controller.actions.start();
|
|
190
197
|
onLoadingOverlayDismissed?.();
|
|
191
198
|
}, [controller, onLoadingOverlayDismissed]);
|
|
199
|
+
// Back to the instructions BEFORE telling the host, as sdk2 did
|
|
200
|
+
// (FaceLivenessWizard.tsx:394): handing `onExit` to the button raw left the
|
|
201
|
+
// capture running behind a host that expected the loading screen.
|
|
202
|
+
const handleExit = useCallback(() => {
|
|
203
|
+
controller.actions.exitCapture();
|
|
204
|
+
onExit?.();
|
|
205
|
+
}, [controller, onExit]);
|
|
192
206
|
// plan-3 ruling: camera-acquisition errors recover via requestCamera()
|
|
193
207
|
// (retry() explicitly excludes them, controller.ts), everything else via
|
|
194
208
|
// retry(). Applies unconditionally across every loadingOverlayMode.
|
|
@@ -201,7 +215,9 @@ export function SelfieCaptureSurface({ controller, state, loadingOverlayMode, se
|
|
|
201
215
|
controller.actions.retry();
|
|
202
216
|
}
|
|
203
217
|
}, [controller, state.error]);
|
|
204
|
-
return (_jsxs(_Fragment, { children: [renderCameraFeed ? (_jsx(SelfieCameraFeed, { videoRef: setVideoRef, isRearFacing: state.camera.isRearFacing, className: classNames.cameraFeed })) : null, renderFaceGuide && showCaptureSurface && (_jsx(FaceCaptureGuideOverlay, { status: maskStatus, classNames: classNames.guides })), (showGuidancePill || manualCaptureEnabled) && (_jsx(GuidanceMessageContainer, { "$top": "12px", className: classNames.guidanceMessageContainer, children: _jsx(GuidanceMessage, { "$variant": guidanceVariant, className: classNames.guidanceMessage,
|
|
218
|
+
return (_jsxs(_Fragment, { children: [renderCameraFeed ? (_jsx(SelfieCameraFeed, { videoRef: setVideoRef, isRearFacing: state.camera.isRearFacing, className: classNames.cameraFeed })) : null, renderFaceGuide && showCaptureSurface && (_jsx(FaceCaptureGuideOverlay, { status: maskStatus, guideStyle: faceGuideStyle, classNames: classNames.guides })), (showGuidancePill || manualCaptureEnabled) && (_jsx(GuidanceMessageContainer, { "$top": "12px", className: classNames.guidanceMessageContainer, children: _jsx(GuidanceMessage, { "$variant": guidanceVariant, className: classNames.guidanceMessage, "data-guidance-code": manualCaptureEnabled
|
|
219
|
+
? FaceMessageCode.MANUAL_CAPTURE
|
|
220
|
+
: guidanceCode, children: manualCaptureEnabled ? manualCaptureText : guidanceText }) })), manualCaptureEnabled && (_jsx(ManualCaptureButtonContainer, { className: classNames.manualCaptureBtnContainer, children: _jsx(LoaderButton, { variant: "positive", finished: true, className: classNames.manualCaptureBtn, onClick: () => controller.actions.captureNow(), children: manualCaptureButtonText }) })), showCaptureRecovery && (_jsxs(CaptureRecoveryActions, { className: classNames.manualCaptureBtnContainer, children: [_jsx("p", { children: recoveryCaptureText }), _jsx(LoaderButton, { variant: "positive", finished: true, disabled: !state.captureRecovery?.manualCaptureReady, className: classNames.manualCaptureBtn, onClick: () => controller.actions.captureNow(), children: recoveryCaptureButtonText })] })), (debugMode || showFaceLandmarks) &&
|
|
205
221
|
showCaptureSurface &&
|
|
206
222
|
state.prediction?.face && (_jsxs(ObjectDetectionDebugOverlayDiv, { children: [_jsx(SelfieCaptureFaceDebugBox, { face: state.prediction.face, scaling: debugScaling, color: state.prediction.faceReady ? 'green' : 'red', showBoundingBox: debugMode, showLandmarks: debugMode || showFaceLandmarks }), debugMode &&
|
|
207
223
|
debugShowSamplePoints &&
|
|
@@ -216,14 +232,19 @@ export function SelfieCaptureSurface({ controller, state, loadingOverlayMode, se
|
|
|
216
232
|
? (pt.y / videoHeight) * pageHeight
|
|
217
233
|
: (pt.y / videoHeight) * scaledHeight - yOffset;
|
|
218
234
|
return (_jsx(FaceDetectionKeypointMarker, { style: { left: left - 2, top: top - 2 } }, i));
|
|
219
|
-
})] })), debugMode && showCaptureSurface && (_jsxs(DebugStatsPane, { children: [state.camera.ready
|
|
235
|
+
})] })), debugMode && showCaptureSurface && (_jsxs(DebugStatsPane, { children: [_jsx(CameraDebugStatus, { ready: state.camera.ready, width: videoDims.videoWidth, height: videoDims.videoHeight }), _jsx("br", {}), !state.prediction?.faceNotDetected ? '✅' : '❌', " Face Detected", _jsx("br", {}), !state.prediction?.faceNotCentered ? '✅' : '❌', " Face Centered", _jsx("br", {}), !state.prediction?.faceTooClose && !state.prediction?.faceTooFar
|
|
220
236
|
? '✅'
|
|
221
237
|
: '❌', ' ', "Face", ' ', state.prediction?.faceTooClose
|
|
222
238
|
? 'Too Close'
|
|
223
239
|
: state.prediction?.faceTooFar
|
|
224
240
|
? 'Too Far'
|
|
225
241
|
: 'Distance Correct', _jsx("br", {}), !state.prediction?.faceLookingAway ? '✅' : '❌', " Face Looking Forward", _jsx("br", {}), !state.prediction?.faceIsStable ? '✅' : '❌', " Face Is Stable", _jsx("br", {}), !state.prediction?.noseIsStable ? '✅' : '❌', " Nose Is Stable", _jsx("br", {}), state.prediction?.faceVisibilityTooLow ? '❌' : '✅', " Visibility", state.thresholds.minCaptureBrightnessThreshold !== undefined && (_jsxs(_Fragment, { children: [_jsx("br", {}), "\u00A0\u00A0Brightness:", ' ', state.prediction?.brightness?.toFixed(1) ?? '—', " (min:", ' ', state.thresholds.minCaptureBrightnessThreshold, ")"] })), state.thresholds.minCaptureRangeThreshold !== undefined && (_jsxs(_Fragment, { children: [_jsx("br", {}), "\u00A0\u00A0Range: ", state.prediction?.range?.toFixed(1) ??
|
|
226
|
-
'—', ' ', "(min: ", state.thresholds.minCaptureRangeThreshold, ")"] })), state.thresholds.minCaptureVarianceThreshold !== undefined && (_jsxs(_Fragment, { children: [_jsx("br", {}), "\u00A0\u00A0Variance:", ' ', state.prediction?.variance?.toFixed(1) ?? '—', " (min:", ' ', state.thresholds.minCaptureVarianceThreshold, ")"] }))
|
|
242
|
+
'—', ' ', "(min: ", state.thresholds.minCaptureRangeThreshold, ")"] })), state.thresholds.minCaptureVarianceThreshold !== undefined && (_jsxs(_Fragment, { children: [_jsx("br", {}), "\u00A0\u00A0Variance:", ' ', state.prediction?.variance?.toFixed(1) ?? '—', " (min:", ' ', state.thresholds.minCaptureVarianceThreshold, ")"] })), _jsx("br", {}), _jsx(EyesOpenDebugLines, { state: state }), state.handOverFace.status !== 'off' && (_jsxs(_Fragment, { children: [_jsx("br", {}), state.handOverFace.lastCheck
|
|
243
|
+
? state.handOverFace.lastCheck.handOverFace
|
|
244
|
+
? '❌'
|
|
245
|
+
: '✅'
|
|
246
|
+
: '➖', ' ', "Hand Off Face (", state.handOverFace.status, state.handOverFace.lastCheck &&
|
|
247
|
+
`, last check ${state.handOverFace.lastCheck.coverage.toFixed(2)} covered in ${Math.round(state.handOverFace.lastCheck.inferenceMs)} ms`, ")"] }))] })), onExit != null && (_jsx(ExitCaptureButton, { onClick: handleExit, className: classNames.exitBtn })), showLoadingOverlay && (_jsx(SelfieCaptureLoadingOverlay, { state: loadingOverlayState, mode: loadingOverlayMode, sessionReady: sessionReady, autoContinueAfterLoading: autoContinueAfterLoading, showIntroScreen: showIntroScreen, transitionFromIdCapture: transitionFromIdCapture, assets: assets.loadingOverlay, classNames: classNames.loadingOverlay, colors: colors.loadingOverlay, verbiage: verbiage.loadingOverlay, customOverlayContent: customOverlayContent, onContinue: handleLoadingContinue, onLoadingStarted: onLoadingStarted, onLoadingProgress: onLoadingProgress, onLoadingCompleted: onLoadingCompleted, onLoadingFailed: onLoadingFailed, onUserCancel: onUserCancel, onRequestCamera: () => controller.actions.requestCamera() })), showStockCameraFallback && (_jsx(SelfieCaptureFallback, { silentFallback: silentFallback, onFinished: (imageDataUrl) => controller.actions.captureManually(imageDataUrl), classNames: classNames.fallback, colors: colors.fallback, verbiage: verbiage.fallback })), state.phase === 'error' &&
|
|
227
248
|
state.error !== null &&
|
|
228
249
|
!manualFallbackAvailable &&
|
|
229
250
|
!showStockCameraFallback && (_jsx(ErrorScreen, { error: state.error, onRetry: handleRetry, onExit: state.error.code === 'CAMERA_TAMPERING_SUSPECTED'
|
|
@@ -239,6 +260,33 @@ export function SelfieCaptureSurface({ controller, state, loadingOverlayMode, se
|
|
|
239
260
|
verbiage: verbiage.loadingOverlay?.cameraAccessDenied,
|
|
240
261
|
} }))] }));
|
|
241
262
|
}
|
|
263
|
+
/**
|
|
264
|
+
* Debug readout for the eyes-open gate: each eye's EAR on this frame beside
|
|
265
|
+
* its calibrated open-eye baseline and the open threshold derived from it.
|
|
266
|
+
* Eyes are labelled by mesh landmark side, which is not necessarily the side
|
|
267
|
+
* of the screen they appear on.
|
|
268
|
+
*/
|
|
269
|
+
function EyesOpenDebugLines({ state, }) {
|
|
270
|
+
const ear = computeEARPerEye(state.prediction?.face?.meshLandmarks);
|
|
271
|
+
if (!ear)
|
|
272
|
+
return _jsx(_Fragment, { children: "\u2796 Eyes Open (no face mesh: gate off)" });
|
|
273
|
+
const { earBaseline, earCalibrationMs, eyeReadings } = state.tracking;
|
|
274
|
+
const calibration = (ms) => ms >= EAR_CALIBRATION_MS
|
|
275
|
+
? 'calibrated'
|
|
276
|
+
: `calibrating ${Math.round(ms)}/${EAR_CALIBRATION_MS} ms`;
|
|
277
|
+
const eye = (label, value, baseline, calibratedMs) => (_jsxs(_Fragment, { children: [_jsx("br", {}), "\u00A0\u00A0", label, ": ", value?.toFixed(3) ?? '—', ' ', baseline === null
|
|
278
|
+
? '(no baseline yet)'
|
|
279
|
+
: `(baseline ${baseline.toFixed(3)}, open > ${(baseline * BLINK_OPEN_FRACTION).toFixed(3)}, ${calibration(calibratedMs)})`] }));
|
|
280
|
+
const openReadings = eyeReadings.filter((r) => r.open).length;
|
|
281
|
+
const verdict = state.prediction?.eyesClosed
|
|
282
|
+
? '❌'
|
|
283
|
+
: state.prediction?.eyesCalibrating
|
|
284
|
+
? '⏳'
|
|
285
|
+
: '✅';
|
|
286
|
+
return (_jsxs(_Fragment, { children: [verdict, " Eyes Open", state.thresholds.requireEyesOpen
|
|
287
|
+
? ` (${openReadings}/${eyeReadings.length} frames open in the last ${EYES_OPEN_WINDOW_MS} ms)`
|
|
288
|
+
: ' (gate off)', eye('Mesh-left eye', ear.left, earBaseline.left, earCalibrationMs.left), eye('Mesh-right eye', ear.right, earBaseline.right, earCalibrationMs.right)] }));
|
|
289
|
+
}
|
|
242
290
|
const ManualCaptureButtonContainer = styled.div `
|
|
243
291
|
position: absolute;
|
|
244
292
|
z-index: 4;
|
|
@@ -246,3 +294,19 @@ const ManualCaptureButtonContainer = styled.div `
|
|
|
246
294
|
bottom: 24px;
|
|
247
295
|
transform: translateX(-50%);
|
|
248
296
|
`;
|
|
297
|
+
// A footer below the camera keeps the lighting guidance visible above it.
|
|
298
|
+
const CaptureRecoveryActions = styled.div `
|
|
299
|
+
position: absolute;
|
|
300
|
+
z-index: 10001;
|
|
301
|
+
inset: auto 0 0;
|
|
302
|
+
padding: 16px 24px max(16px, env(safe-area-inset-bottom));
|
|
303
|
+
background: white;
|
|
304
|
+
color: #333;
|
|
305
|
+
text-align: center;
|
|
306
|
+
display: grid;
|
|
307
|
+
justify-items: center;
|
|
308
|
+
gap: 12px;
|
|
309
|
+
|
|
310
|
+
p { margin: 0; font-size: 14px; line-height: 1.4; }
|
|
311
|
+
button { width: 100%; max-width: 320px; }
|
|
312
|
+
`;
|
|
@@ -1,3 +1,12 @@
|
|
|
1
|
+
import { type DefaultTheme } from 'styled-components';
|
|
1
2
|
import type { SelfieCaptureLoadingOverlayProps } from './SelfieCaptureLoadingOverlay';
|
|
2
3
|
export declare const SelfieCaptureLoadingOverlayDefault: ({ state, sessionReady, now, onContinue, onLoadingStarted, onLoadingProgress, onLoadingCompleted, onLoadingFailed, onUserCancel, customOverlayContent, autoContinueAfterLoading, assets, classNames, colors, verbiage: rawVerbiage, }: SelfieCaptureLoadingOverlayProps) => import("react/jsx-runtime").JSX.Element;
|
|
4
|
+
/** The overlay's background when the theme does not set one. */
|
|
5
|
+
export declare const SELFIE_LOADING_OVERLAY_BACKGROUND_DEFAULT = "#ecedf3";
|
|
6
|
+
/**
|
|
7
|
+
* The colour this overlay paints along the viewport's bottom edge, for
|
|
8
|
+
* `BrowserEdgeTint`. That edge is the progress row, not the background, and the
|
|
9
|
+
* bar is full once the models are ready.
|
|
10
|
+
*/
|
|
11
|
+
export declare function selfieLoadingOverlayBottomEdgeColor(theme: DefaultTheme, modelsReady: boolean): string;
|
|
3
12
|
//# sourceMappingURL=SelfieCaptureLoadingOverlayDefault.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"SelfieCaptureLoadingOverlayDefault.d.ts","sourceRoot":"","sources":["../../../src/components/selfie_loading/SelfieCaptureLoadingOverlayDefault.tsx"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"SelfieCaptureLoadingOverlayDefault.d.ts","sourceRoot":"","sources":["../../../src/components/selfie_loading/SelfieCaptureLoadingOverlayDefault.tsx"],"names":[],"mappings":"AA0CA,OAAO,EAAoB,KAAK,YAAY,EAAE,MAAM,mBAAmB,CAAA;AAwBvE,OAAO,KAAK,EAAE,gCAAgC,EAAE,MAAM,+BAA+B,CAAA;AAuBrF,eAAO,MAAM,kCAAkC,GAAI,sOAgBhD,gCAAgC,4CA6LlC,CAAA;AAqED,gEAAgE;AAChE,eAAO,MAAM,yCAAyC,YAAY,CAAA;AAKlE;;;;GAIG;AACH,wBAAgB,mCAAmC,CACjD,KAAK,EAAE,YAAY,EACnB,WAAW,EAAE,OAAO,GACnB,MAAM,CAWR"}
|
|
@@ -45,6 +45,7 @@ import { styled, useTheme } from 'styled-components';
|
|
|
45
45
|
import { LoadingOverlayButtonsRow, LoadingOverlayContinueButtonContainer, LoadingOverlayCustomLoadingGraphic, LoadingOverlayGuidanceMessage, LoadingOverlayHeader, LoadingOverlayImageContainer, LoadingOverlayInner, LoadingOverlayLoadingList, LoadingOverlayLoadingListContainer, LoadingOverlayLoadingListItem, LoadingOverlayProgressBar, LoadingOverlayProgressBarBackground, LoadingOverlayProgressContainer, LoadingOverlayProgressIndicator, OverlayContainer, } from '../common/overlay';
|
|
46
46
|
import { DEFAULT_CDN_URL } from '../../utils/cdn';
|
|
47
47
|
import { LoaderButton } from '../common/LoaderButton';
|
|
48
|
+
import { progressRowEdgeColor } from '../common/BrowserEdgeTint';
|
|
48
49
|
import { downloadingLabel } from '../common/downloadingLabel';
|
|
49
50
|
import { useTranslations } from '../../i18n';
|
|
50
51
|
import { ExitCaptureButton } from '../ExitCaptureButton';
|
|
@@ -132,7 +133,8 @@ export const SelfieCaptureLoadingOverlayDefault = ({ state, sessionReady = true,
|
|
|
132
133
|
?.displayDisabledContinueBtn) && (_jsx(ContinueButton, { autoFocus: true, finished: ready, disabled: !ready, className: classNames.continueBtn, variant: "positive", colors: colors.continueBtn, onClick: handleContinue, children: ready ? verbiage.continueText : verbiage.pleaseWaitText })) })] })] }) }));
|
|
133
134
|
};
|
|
134
135
|
const OverlayInner = styled(LoadingOverlayInner) `
|
|
135
|
-
background: ${(props) => props.theme?.selfieCapture?.loadingOverlay?.backgroundColor ??
|
|
136
|
+
background: ${(props) => props.theme?.selfieCapture?.loadingOverlay?.backgroundColor ??
|
|
137
|
+
SELFIE_LOADING_OVERLAY_BACKGROUND_DEFAULT};
|
|
136
138
|
color: ${(props) => props.theme?.selfieCapture?.loadingOverlay?.textColor ?? 'black'};
|
|
137
139
|
`;
|
|
138
140
|
const ButtonsRow = styled(LoadingOverlayButtonsRow) `
|
|
@@ -144,13 +146,13 @@ const ButtonsRow = styled(LoadingOverlayButtonsRow) `
|
|
|
144
146
|
`;
|
|
145
147
|
const ProgressBarBackground = styled(LoadingOverlayProgressBarBackground) `
|
|
146
148
|
background: ${(props) => props.theme?.selfieCapture?.loadingOverlay?.progressBarBackgroundColor ??
|
|
147
|
-
|
|
149
|
+
PROGRESS_TRACK_DEFAULT};
|
|
148
150
|
opacity: ${(props) => props.theme?.selfieCapture?.loadingOverlay?.progressBarBackgroundOpacity ??
|
|
149
|
-
|
|
151
|
+
PROGRESS_TRACK_OPACITY_DEFAULT};
|
|
150
152
|
`;
|
|
151
153
|
const ProgressIndicator = styled(LoadingOverlayProgressIndicator) `
|
|
152
154
|
background: ${(props) => props.theme?.selfieCapture?.loadingOverlay?.progressBarIndicatorColor ??
|
|
153
|
-
|
|
155
|
+
PROGRESS_INDICATOR_DEFAULT};
|
|
154
156
|
`;
|
|
155
157
|
const ContinueButton = styled(LoaderButton) `
|
|
156
158
|
margin: auto;
|
|
@@ -179,3 +181,23 @@ const ContinueButton = styled(LoaderButton) `
|
|
|
179
181
|
box-shadow: none;
|
|
180
182
|
}
|
|
181
183
|
`;
|
|
184
|
+
/** The overlay's background when the theme does not set one. */
|
|
185
|
+
export const SELFIE_LOADING_OVERLAY_BACKGROUND_DEFAULT = '#ecedf3';
|
|
186
|
+
const PROGRESS_TRACK_DEFAULT = 'var(--idm-color-positive-600)';
|
|
187
|
+
const PROGRESS_TRACK_OPACITY_DEFAULT = 0.75;
|
|
188
|
+
const PROGRESS_INDICATOR_DEFAULT = 'var(--idm-color-positive-600)';
|
|
189
|
+
/**
|
|
190
|
+
* The colour this overlay paints along the viewport's bottom edge, for
|
|
191
|
+
* `BrowserEdgeTint`. That edge is the progress row, not the background, and the
|
|
192
|
+
* bar is full once the models are ready.
|
|
193
|
+
*/
|
|
194
|
+
export function selfieLoadingOverlayBottomEdgeColor(theme, modelsReady) {
|
|
195
|
+
const overlay = theme.selfieCapture?.loadingOverlay;
|
|
196
|
+
return progressRowEdgeColor({
|
|
197
|
+
full: modelsReady,
|
|
198
|
+
indicator: overlay?.progressBarIndicatorColor ?? PROGRESS_INDICATOR_DEFAULT,
|
|
199
|
+
track: overlay?.progressBarBackgroundColor ?? PROGRESS_TRACK_DEFAULT,
|
|
200
|
+
trackOpacity: overlay?.progressBarBackgroundOpacity ?? PROGRESS_TRACK_OPACITY_DEFAULT,
|
|
201
|
+
background: overlay?.backgroundColor ?? SELFIE_LOADING_OVERLAY_BACKGROUND_DEFAULT,
|
|
202
|
+
});
|
|
203
|
+
}
|