@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
package/dist/IdCaptureView.js
CHANGED
|
@@ -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
|
// Task 12: the phase-switched assembly. Everything Tasks 2-11 built (the
|
|
3
4
|
// headless controller + bindings, layout contexts, camera feed, guidance
|
|
4
5
|
// pills, guide router, loading overlay family, review/error screens) is
|
|
@@ -33,24 +34,33 @@ import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-run
|
|
|
33
34
|
// (core's own `flipConfirmation: 'manual'` config knob is the
|
|
34
35
|
// controller-side equivalent — see controller.ts). ExitCaptureButton only
|
|
35
36
|
// renders when the host passes `onExit`; an inert X button would be worse
|
|
36
|
-
// than none.
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
37
|
+
// than none. It is otherwise gated exactly as sdk2 gated it
|
|
38
|
+
// (`!customOverlayContent || overlayDismissed`) and, like sdk2's, its
|
|
39
|
+
// click tears the capture down before notifying the host — see
|
|
40
|
+
// `handleExit`. Both of those were dropped in the first port and are
|
|
41
|
+
// restored; the bind gate is the only intended divergence.
|
|
42
|
+
import { useCallback, useEffect, useMemo, useRef, useState, } from 'react';
|
|
43
|
+
import { styled, useTheme } from 'styled-components';
|
|
40
44
|
import { useIdCapture } from './bindings/useIdCapture';
|
|
41
|
-
import { useLanguage } from './i18n';
|
|
45
|
+
import { SdkLanguageProvider, useLanguage, useVerbiage, } from './i18n';
|
|
42
46
|
import { GuideLayoutProvider, useGuideLayout } from './layout/GuideLayoutContext';
|
|
43
47
|
import GuideOrientationContextProvider from './layout/GuideOrientationContext';
|
|
44
|
-
import { ScalingCameraFeed } from './components/CameraFeed';
|
|
45
|
-
import { DebugBoundingBoxOverlay, DebugStatsPane, IdCaptureDetectedObjectDebugBox, useDebugScalingDetails, } from './components/debug/debug';
|
|
48
|
+
import { isCameraFeedHidden, ScalingCameraFeed, } from './components/CameraFeed';
|
|
49
|
+
import { DebugBoundingBoxOverlay, CameraDebugStatus, DebugStatsPane, IdCaptureDetectedObjectDebugBox, useDebugScalingDetails, } from './components/debug/debug';
|
|
50
|
+
import { BrowserEdgeTint, opaqueColor, } from './components/common/BrowserEdgeTint';
|
|
51
|
+
import { GRAY_OVERLAY_BACKGROUND } from './components/common/overlay';
|
|
52
|
+
import { FIT_GUIDE_MASK_DEFAULT } from './components/guides/IdCaptureFitGuide';
|
|
53
|
+
import { OVERLAY_GUIDE_MASK_DEFAULT } from './components/guides/IdCaptureGuideOverlay';
|
|
54
|
+
import { LOADING_OVERLAY_BACKGROUND_DEFAULT, loadingOverlayBottomEdgeColor, } from './components/loading/IdCaptureLoadingOverlayDefault';
|
|
46
55
|
import { IdCaptureGuides, } from './components/guides/IdCaptureGuides';
|
|
47
56
|
import { PlacedGuidanceMessageContainer, GuidanceMessage, } from './components/GuidanceMessage';
|
|
48
|
-
import { guidanceMessageKey } from './guidance/strings';
|
|
57
|
+
import { guidanceMessageKey, guidanceVerbiage, } from './guidance/strings';
|
|
49
58
|
import { ExitCaptureButton } from './components/ExitCaptureButton';
|
|
50
59
|
import { OverrideWrongDocumentTypeDialog, } from './components/OverrideWrongDocumentTypeDialog';
|
|
51
60
|
import { IdCaptureLoadingOverlay, } from './components/loading/IdCaptureLoadingOverlay';
|
|
52
61
|
import { ReviewScreen, } from './components/review/ReviewScreen';
|
|
53
62
|
import { ErrorScreen, } from './components/error/ErrorScreen';
|
|
63
|
+
import { useCameraAccessDeniedReport } from './components/error/useCameraAccessDeniedReport';
|
|
54
64
|
import { IdCaptureFallback, } from './components/fallback/IdCaptureFallback';
|
|
55
65
|
import { IdCaptureOrUploadScreen, } from './components/fallback/IdCaptureOrUploadScreen';
|
|
56
66
|
import { useShowSuccessScreen, } from './flows/useShowSuccessScreen';
|
|
@@ -86,7 +96,10 @@ const REVIEW_PHASES = new Set([
|
|
|
86
96
|
'uploading',
|
|
87
97
|
'complete',
|
|
88
98
|
]);
|
|
89
|
-
export function IdCaptureView(
|
|
99
|
+
export function IdCaptureView(props) {
|
|
100
|
+
return (_jsx(SdkLanguageProvider, { lang: props.lang ?? 'auto', children: _jsx(IdCaptureViewContent, { ...props }) }));
|
|
101
|
+
}
|
|
102
|
+
function IdCaptureViewContent({ controller, guideType = 'fit', loadingOverlayMode = 'default', cameraFeedMode = 'snapToGuides', guideBoxDisabled = false, forceFallbackMode = false, silentFallback = false, allowUploadingDocumentsFromStorage = false, portraitGuidesOnMobile = true, rotateLoadingOverlayImageWhenPortrait = true, guideBoxFollowsMask = false, guideBoxBorderRadius, guideBoxMaxWidth, guideBoxMaxHeight, guidanceMessagePlacement = 'viewport', guidanceMessageGap = 8, flipReview = false, showBarcodeImage = true, sessionReady: sessionReadyProp, skipSuccessScreen = false, lang = 'auto', autoContinueAfterLoading = false, showIntroScreen = false, debugMode = false, onExit, onUserCancel, onLoadingStarted, onLoadingProgress, onLoadingCompleted, onLoadingFailed, onLoadingOverlayDismissed, customOverlayContent, instructions, onCameraTamperingDetected, onCameraAccessDenied, onModelError, onExitAfterTamperSealPopped, onDocumentStored, onRetry, onSubmitted, onCollected, verbiage = {}, classNames = {}, colors = {}, assets = {}, }) {
|
|
90
103
|
// Omitted means "follow the session": mounted inside a flow this view now
|
|
91
104
|
// renders during session validation, so its own loading overlay is the one
|
|
92
105
|
// loading surface (2.x behaviour — see useSessionReady). An explicit prop
|
|
@@ -94,8 +107,9 @@ export function IdCaptureView({ controller, guideType = 'fit', loadingOverlayMod
|
|
|
94
107
|
const sessionFromContext = useSessionReady();
|
|
95
108
|
const sessionReady = sessionReadyProp ?? sessionFromContext;
|
|
96
109
|
useLanguage(lang);
|
|
97
|
-
const { t } = useTranslation();
|
|
98
110
|
const state = useIdCapture(controller);
|
|
111
|
+
useCaptureProgressController(controller);
|
|
112
|
+
const theme = useTheme();
|
|
99
113
|
// Ref-callback + an effect keyed only on [controller]: the ref callback
|
|
100
114
|
// (fired during React's commit phase, before effects) populates
|
|
101
115
|
// `videoElRef` synchronously; by the time this effect body runs the video
|
|
@@ -122,6 +136,34 @@ export function IdCaptureView({ controller, guideType = 'fit', loadingOverlayMod
|
|
|
122
136
|
controller.detach();
|
|
123
137
|
};
|
|
124
138
|
}, [controller]);
|
|
139
|
+
// The phases that hide the feed hide it with `display: none`, which pauses
|
|
140
|
+
// the element — playback stops, and with it requestVideoFrameCallback.
|
|
141
|
+
// Chromium resumes a frame or two after the un-hide, but that is its own
|
|
142
|
+
// suspend/resume optimization, not something the markup guarantees: the
|
|
143
|
+
// autoplay flag is spent on the first playback. So ask, on the way back.
|
|
144
|
+
// A browser that did not auto-resume would show a retaken capture screen a
|
|
145
|
+
// frozen frame under a running pipeline — the bug the mounted element is
|
|
146
|
+
// there to prevent, in a form that only appears on a device. The element
|
|
147
|
+
// belongs to this view (it is the one attach() was called with), so the
|
|
148
|
+
// resume belongs here rather than in the presentational feed component.
|
|
149
|
+
const feedHidden = isCameraFeedHidden(state.phase);
|
|
150
|
+
useEffect(() => {
|
|
151
|
+
if (feedHidden)
|
|
152
|
+
return;
|
|
153
|
+
const el = videoElRef.current;
|
|
154
|
+
// Only an element holding a stream has playback to resume. Without this
|
|
155
|
+
// the effect's mount run — phase 'initializing', before attach() has
|
|
156
|
+
// wired anything — calls play() on an empty element and always rejects
|
|
157
|
+
// with AbortError, as does every phase where no camera is ever acquired
|
|
158
|
+
// (a denial, fallback mode, the upload-choice screen). Harmless, but a
|
|
159
|
+
// guaranteed-failing call is not what belongs in the resume path.
|
|
160
|
+
if (!el?.srcObject)
|
|
161
|
+
return;
|
|
162
|
+
// Promise.resolve(): play() returns a promise in every browser this SDK
|
|
163
|
+
// supports, but not in jsdom or pre-2016 Safari, and an effect that threw
|
|
164
|
+
// would take the view down over a resume hint.
|
|
165
|
+
void Promise.resolve(el.play()).catch(() => { });
|
|
166
|
+
}, [feedHidden]);
|
|
125
167
|
// sdk2 wizard pattern (:1446-1450, :1527-1552): the loading overlay is
|
|
126
168
|
// view-local state, not derived from controller phase — it stays up until
|
|
127
169
|
// BOTH models+camera are ready (IdCaptureLoadingOverlay's own `ready`
|
|
@@ -137,6 +179,46 @@ export function IdCaptureView({ controller, guideType = 'fit', loadingOverlayMod
|
|
|
137
179
|
controller.actions.start();
|
|
138
180
|
onLoadingOverlayDismissed?.();
|
|
139
181
|
}, [controller, onLoadingOverlayDismissed]);
|
|
182
|
+
/** Bumped on every exit to remount the loading overlay; see `handleExit`. */
|
|
183
|
+
const [exitAttempt, setExitAttempt] = useState(0);
|
|
184
|
+
/**
|
|
185
|
+
* Exit has to TEAR THE CAPTURE DOWN before it tells the host, which the port
|
|
186
|
+
* dropped: `onExit` was handed to ExitCaptureButton raw, so the X notified
|
|
187
|
+
* the host and left the session exactly as it was — camera live, pipeline
|
|
188
|
+
* running, overlay still dismissed. Hosts that reset their own chrome and
|
|
189
|
+
* expect to land back on the instructions (portal-2's `onExitCapture` is
|
|
190
|
+
* one) got a host reset behind a capture that never stopped, and the
|
|
191
|
+
* applicant could not get out.
|
|
192
|
+
*
|
|
193
|
+
* sdk2 did the teardown inside the wizard (IdCaptureWizard.tsx:1130-1137):
|
|
194
|
+
* reset the wizard, put the loading overlay back up, then call the host.
|
|
195
|
+
* Same three steps here, with `retake()` standing in for sdk2's bare
|
|
196
|
+
* `dispatchIdCaptureAction({ type: 'resetWizard' })` — it is that dispatch
|
|
197
|
+
* plus `pipeline.resetBestFrame()`, which is what stops a half-captured
|
|
198
|
+
* frame surviving the exit.
|
|
199
|
+
*
|
|
200
|
+
* sdk2's `key={`loading${attempt}`}` remount IS needed, and `exitAttempt`
|
|
201
|
+
* is it. Clearing this component's `overlayDismissed` is not enough on its
|
|
202
|
+
* own: the overlay variants keep their OWN `dismissed` state and self-hide
|
|
203
|
+
* on it (IdCaptureLoadingOverlayDefault.tsx:186), and `showLoadingOverlay`
|
|
204
|
+
* does not necessarily go false in between — while `state.phase` is still
|
|
205
|
+
* 'initializing' it stays true and the overlay is never unmounted, so its
|
|
206
|
+
* internal flag survives and it renders empty forever. Remounting is what
|
|
207
|
+
* resets that flag, and the auto-continue guard along with it.
|
|
208
|
+
*
|
|
209
|
+
* sdk2's camera cycle (`releaseCameraAccess()` / `requestCameraAccess()`)
|
|
210
|
+
* is the one step not ported: that was wizard-owned camera management the
|
|
211
|
+
* controller now owns, and re-acquiring here risks a second permission
|
|
212
|
+
* prompt.
|
|
213
|
+
*/
|
|
214
|
+
const handleExit = useCallback(() => {
|
|
215
|
+
if (onExit == null)
|
|
216
|
+
return;
|
|
217
|
+
controller.actions.retake();
|
|
218
|
+
setOverlayDismissed(false);
|
|
219
|
+
setExitAttempt((n) => n + 1);
|
|
220
|
+
onExit();
|
|
221
|
+
}, [controller, onExit]);
|
|
140
222
|
// Per-document progress, ported from sdk2's onDocumentStored effect
|
|
141
223
|
// (IdCaptureWizard.tsx:342-372). Diffs capturedDocuments against what has
|
|
142
224
|
// already been announced, comparing by IDENTITY rather than presence: a
|
|
@@ -152,7 +234,6 @@ export function IdCaptureView({ controller, guideType = 'fit', loadingOverlayMod
|
|
|
152
234
|
const pendingPrecapturedRef = useRef(new Set());
|
|
153
235
|
const seenPrecapturedRef = useRef(new Set());
|
|
154
236
|
const tamperReportedRef = useRef(false);
|
|
155
|
-
const cameraDeniedReportedRef = useRef(false);
|
|
156
237
|
const reportedModelErrorRef = useRef(null);
|
|
157
238
|
// A new controller is a new session, so every notification latch below has
|
|
158
239
|
// to start over — the same reasoning as the attach and overlay-dismissal
|
|
@@ -170,7 +251,6 @@ export function IdCaptureView({ controller, guideType = 'fit', loadingOverlayMod
|
|
|
170
251
|
pendingPrecapturedRef.current = new Set();
|
|
171
252
|
seenPrecapturedRef.current = new Set();
|
|
172
253
|
tamperReportedRef.current = false;
|
|
173
|
-
cameraDeniedReportedRef.current = false;
|
|
174
254
|
reportedModelErrorRef.current = null;
|
|
175
255
|
}, [controller]);
|
|
176
256
|
useEffect(() => {
|
|
@@ -230,17 +310,7 @@ export function IdCaptureView({ controller, guideType = 'fit', loadingOverlayMod
|
|
|
230
310
|
// controller's typed error, which is where core lands a denied camera and a
|
|
231
311
|
// failed model load alike (dual-truth contract: the same failure is already
|
|
232
312
|
// on screen, so these are notifications, not the error UI).
|
|
233
|
-
|
|
234
|
-
useEffect(() => {
|
|
235
|
-
if (!cameraDenied) {
|
|
236
|
-
cameraDeniedReportedRef.current = false;
|
|
237
|
-
return;
|
|
238
|
-
}
|
|
239
|
-
if (cameraDeniedReportedRef.current)
|
|
240
|
-
return;
|
|
241
|
-
cameraDeniedReportedRef.current = true;
|
|
242
|
-
onCameraAccessDenied?.();
|
|
243
|
-
}, [controller, cameraDenied, onCameraAccessDenied]);
|
|
313
|
+
useCameraAccessDeniedReport(controller, state.error?.code, onCameraAccessDenied);
|
|
244
314
|
// Keyed on the ERROR OBJECT's identity, not on its cause: a MODEL_LOAD_FAILED
|
|
245
315
|
// with no cause attached is still a model failure the host asked to hear
|
|
246
316
|
// about, and keying on the cause skipped those entirely. A second, different
|
|
@@ -306,8 +376,18 @@ export function IdCaptureView({ controller, guideType = 'fit', loadingOverlayMod
|
|
|
306
376
|
// '' (guidanceMessageKey maps the held NONE code to ''). Text and variant
|
|
307
377
|
// both read the same held event, so the pill's background always describes
|
|
308
378
|
// the message it is showing.
|
|
379
|
+
//
|
|
380
|
+
// The per-document bag is chosen the way sdk2's wizard chose it
|
|
381
|
+
// (IdCaptureWizard.tsx:1183-1190): the requested document, except during
|
|
382
|
+
// barcode recapture, which is always the back of the card.
|
|
383
|
+
const documentVerbiage = documentVerbiageFor(verbiage, state.phase === 'requestingBetterBarcode'
|
|
384
|
+
? 'idCardBack'
|
|
385
|
+
: state.requestedDocumentType);
|
|
309
386
|
const guidanceKey = guidanceMessageKey(state.guidance);
|
|
310
|
-
const
|
|
387
|
+
const guidanceText = useVerbiage(guidanceKey === '' ? undefined : guidanceVerbiage(documentVerbiage, state.guidance.code), guidanceKey);
|
|
388
|
+
const showGuidancePill = overlayDismissed && state.phase === 'capturing' && guidanceText !== '';
|
|
389
|
+
useDisplayedGuidance(showGuidancePill && !screenTakeover && state.guidance.code !== 'NONE' ? { kind: 'displayed', message: { family: 'id', code: state.guidance.code } } : { kind: 'no-prompt' });
|
|
390
|
+
const guidesVerbiage = useMemo(() => withDocumentInstructions(verbiage.guides, documentVerbiage), [verbiage.guides, documentVerbiage]);
|
|
311
391
|
// The overlay stacks on top of the capture/guide screen exactly like
|
|
312
392
|
// sdk2's wizard (never simultaneously with review/error) — plus phase
|
|
313
393
|
// 'initializing' forces it regardless (nothing to dismiss into yet).
|
|
@@ -337,15 +417,73 @@ export function IdCaptureView({ controller, guideType = 'fit', loadingOverlayMod
|
|
|
337
417
|
const showReview = !screenTakeover &&
|
|
338
418
|
(isFlipInterstitial ||
|
|
339
419
|
(REVIEW_PHASES.has(state.phase) && showSuccessScreen));
|
|
420
|
+
/**
|
|
421
|
+
* The colours touching the viewport edges, for iOS Safari to tint its own
|
|
422
|
+
* bars with — see `BrowserEdgeTint`. The camera surround, the loading
|
|
423
|
+
* overlay and the review are different colours on one route to the host, so
|
|
424
|
+
* only this view knows which is up.
|
|
425
|
+
*
|
|
426
|
+
* It follows EVERY screen while the view owns the viewport, not just the
|
|
427
|
+
* camera: Safari keeps the last strip colour when the strips leave while a
|
|
428
|
+
* full-viewport surface stays up, so dropping them on exit would leave the
|
|
429
|
+
* camera's dark bars over the light loading overlay. Null when embedded
|
|
430
|
+
* (`isFullscreen: false`), so a host's page chrome stays the host's, and for
|
|
431
|
+
* the ring overlay, whose gradient no single colour matches.
|
|
432
|
+
*
|
|
433
|
+
* The default loading overlay is the one screen whose edges differ: it ends
|
|
434
|
+
* in its progress row, part filled while it loads, so no flat strip can sit
|
|
435
|
+
* on it unseen. Its bottom strip carries the row's colour for Safari but is
|
|
436
|
+
* drawn invisibly — opaque, it covered the bottom 12px of the bar.
|
|
437
|
+
*/
|
|
438
|
+
const browserEdge = (() => {
|
|
439
|
+
if (theme.isFullscreen === false)
|
|
440
|
+
return null;
|
|
441
|
+
if (screenTakeover)
|
|
442
|
+
return { color: theme.background ?? '#fff' };
|
|
443
|
+
if (showReview || (state.phase === 'error' && state.error !== null)) {
|
|
444
|
+
return { color: GRAY_OVERLAY_BACKGROUND };
|
|
445
|
+
}
|
|
446
|
+
if (showLoadingOverlay) {
|
|
447
|
+
if (loadingOverlayMode === 'ring')
|
|
448
|
+
return null;
|
|
449
|
+
return {
|
|
450
|
+
color: theme.idCapture?.loadingOverlay?.backgroundColor ??
|
|
451
|
+
LOADING_OVERLAY_BACKGROUND_DEFAULT,
|
|
452
|
+
hiddenBottomColor: loadingOverlayMode === 'default'
|
|
453
|
+
? loadingOverlayBottomEdgeColor(theme, state.models.ready)
|
|
454
|
+
: undefined,
|
|
455
|
+
};
|
|
456
|
+
}
|
|
457
|
+
if (showGuides) {
|
|
458
|
+
// The mask can be translucent (the overlay guide's default scrim) and
|
|
459
|
+
// the strips must not be. Same hue, alpha dropped.
|
|
460
|
+
const color = opaqueColor(theme.idCapture?.guideOverlay?.backgroundColor ??
|
|
461
|
+
(guideType === 'fit'
|
|
462
|
+
? FIT_GUIDE_MASK_DEFAULT
|
|
463
|
+
: OVERLAY_GUIDE_MASK_DEFAULT));
|
|
464
|
+
return color ? { color } : null;
|
|
465
|
+
}
|
|
466
|
+
return null;
|
|
467
|
+
})();
|
|
340
468
|
const handleConfirmFlip = useCallback(() => {
|
|
341
469
|
controller.actions.confirmFlip();
|
|
342
470
|
}, [controller]);
|
|
343
|
-
//
|
|
344
|
-
//
|
|
471
|
+
// ReviewScreen's Retry is a RETAKE, not an error recovery: the user is
|
|
472
|
+
// looking at captured documents and no error is in play, and the
|
|
473
|
+
// controller's `retry()` returns immediately when `state.error` is null
|
|
474
|
+
// (controller.ts, "if (!error) return"). Routing the review's Retry there
|
|
475
|
+
// left the button dead — sdk2's onRetryClick dispatched `resetWizard`
|
|
476
|
+
// (IdCaptureWizard.tsx:1124-1127), and `actions.retake()` IS that dispatch
|
|
477
|
+
// (plus the resetBestFrame sdk2's post-reset canvas remount gave it).
|
|
345
478
|
//
|
|
346
|
-
// Notify BEFORE resetting, matching sdk2
|
|
347
|
-
//
|
|
348
|
-
|
|
479
|
+
// Notify BEFORE resetting, matching that same sdk2 handler: the host sees
|
|
480
|
+
// the retry against the state that prompted it, not the freshly-cleared one.
|
|
481
|
+
const handleRetake = useCallback(() => {
|
|
482
|
+
onRetry?.();
|
|
483
|
+
controller.actions.retake();
|
|
484
|
+
}, [controller, onRetry]);
|
|
485
|
+
// ErrorScreen's Retry, on a recoverable error. Feeds the same `onRetry`, so
|
|
486
|
+
// a host counting retries counts both restarts.
|
|
349
487
|
//
|
|
350
488
|
// `.catch(() => {})` for the same reason the attach effect above does it:
|
|
351
489
|
// `retry()` runs `doAttach()`, whose catch writes the failure to the store
|
|
@@ -373,7 +511,11 @@ export function IdCaptureView({ controller, guideType = 'fit', loadingOverlayMod
|
|
|
373
511
|
return (_jsx(FontCarrier, { children: _jsx(GuideOrientationContextProvider, { children: _jsxs(GuideLayoutProvider, { children: [_jsx(ScalingCameraFeed, { videoRef: setVideoRef, phase: state.phase, isRearFacing: state.camera.isRearFacing, cameraFeedMode: cameraFeedMode, className: classNames.cameraFeed }), inFallbackMode && (_jsx(IdCaptureFallback, { captureRequirement: state.captureRequirement, idCardBackCaptureRequired: state.idCardBackCaptureRequired, silentFallback: silentFallback, onCapture: handleManualImages('Manual'), onFinished: () => setFallbackFinished(true), classNames: classNames.fallback, colors: colors.fallback, verbiage: verbiage.fallback })), showUploadChoice && (_jsx(IdCaptureOrUploadScreen, { captureRequirement: state.captureRequirement, idCardBackCaptureRequired: state.idCardBackCaptureRequired, onCaptureWithCamera: () => {
|
|
374
512
|
setUploadChoiceMade(true);
|
|
375
513
|
void controller.actions.requestCamera().catch(() => { });
|
|
376
|
-
}, onUpload: handleManualImages('Upload'), onFinished: () => setUploadChoiceMade(true), classNames: classNames.uploadOrCaptureScreen, colors: colors.uploadOrCaptureScreen, verbiage: verbiage.uploadOrCaptureScreen })), showGuides && (_jsx(IdCaptureGuides, { state: state, isRearFacing: state.camera.isRearFacing, guideType: guideType, guideBoxDisabled: guideBoxDisabled, portraitGuidesOnMobile: portraitGuidesOnMobile, guideBoxFollowsMask: guideBoxFollowsMask, guideBoxBorderRadius: guideBoxBorderRadius, guideBoxMaxWidth: guideBoxMaxWidth, guideBoxMaxHeight: guideBoxMaxHeight, cameraFeedMode: cameraFeedMode, images: assets.guideImages, classNames: classNames.guides, verbiage:
|
|
514
|
+
}, onUpload: handleManualImages('Upload'), onFinished: () => setUploadChoiceMade(true), classNames: classNames.uploadOrCaptureScreen, colors: colors.uploadOrCaptureScreen, verbiage: verbiage.uploadOrCaptureScreen })), showGuides && (_jsx(IdCaptureGuides, { state: state, isRearFacing: state.camera.isRearFacing, guideType: guideType, guideBoxDisabled: guideBoxDisabled, portraitGuidesOnMobile: portraitGuidesOnMobile, guideBoxFollowsMask: guideBoxFollowsMask, guideBoxBorderRadius: guideBoxBorderRadius, guideBoxMaxWidth: guideBoxMaxWidth, guideBoxMaxHeight: guideBoxMaxHeight, cameraFeedMode: cameraFeedMode, images: assets.guideImages, classNames: classNames.guides, verbiage: guidesVerbiage, status: !overlayDismissed ? 'disabled' : undefined })), showGuidancePill && (_jsx(PlacedGuidanceMessageContainer, { placement: guidanceMessagePlacement, gap: guidanceMessageGap, className: classNames.guidanceMessageContainer, children: _jsx(GuidanceMessage, { "$variant": state.guidance.satisfied ? 'positive' : 'default', className: classNames.guidanceMessage, "data-guidance-code": state.guidance.code, children: guidanceText }) })), state.phase !== 'complete' && _jsx("div", { id: "idmission-above-guides-content" }), debugMode && overlayDismissed && showGuides && (_jsx(IdCaptureDebugLayer, { state: state })), onExit != null && (!customOverlayContent || overlayDismissed) && (_jsx(ExitCaptureButton, { onClick: handleExit, className: classNames.exitBtn })), showLoadingOverlay && (_jsx(IdCaptureLoadingOverlay
|
|
515
|
+
// sdk2's `key={`loading${attempt}`}` (IdCaptureWizard.tsx:1625):
|
|
516
|
+
// forces a fresh overlay after an exit so its internal
|
|
517
|
+
// `dismissed` flag cannot survive into the new attempt.
|
|
518
|
+
, { state: state, mode: loadingOverlayMode, sessionReady: sessionReady, autoContinueAfterLoading: autoContinueAfterLoading, showIntroScreen: showIntroScreen, assets: assets.loadingOverlay, classNames: classNames.loadingOverlay, colors: colors.loadingOverlay, verbiage: verbiage.loadingOverlay, rotateImage: rotateOverlayImage, onUserCancel: onUserCancel, onLoadingStarted: onLoadingStarted, onLoadingProgress: onLoadingProgress, onLoadingCompleted: onLoadingCompleted, onLoadingFailed: onLoadingFailed, onDismissed: handleLoadingOverlayDismissed, customOverlayContent: customOverlayContent, instructions: instructions, onRequestCamera: () => controller.actions.requestCamera() }, `loading${exitAttempt}`)), _jsx(OverrideWrongDocumentTypeDialog, { visible: state.allowOverrideWrongDocumentTypeGuidance, onOverride: handleOverride, classNames: classNames.overrideWrongDocumentType, verbiage: verbiage.overrideWrongDocumentType }), showReview && (_jsx(ReviewScreen, { capturedDocuments: state.capturedDocuments, showBarcodeImage: showBarcodeImage, submission: isFlipInterstitial ? 'idle' : state.submission, sessionReady: sessionReady, diagnostics: debugMode && !isFlipInterstitial
|
|
377
519
|
? {
|
|
378
520
|
initialBarcodeScore: state.recaptureBarcodeScore !== null
|
|
379
521
|
? state.initialBarcodeScore
|
|
@@ -388,7 +530,7 @@ export function IdCaptureView({ controller, guideType = 'fit', loadingOverlayMod
|
|
|
388
530
|
pdf417LowScoreCount: state.pdf417LowScoreCount,
|
|
389
531
|
zxingParseAttemptCount: state.zxingParseAttemptCount,
|
|
390
532
|
}
|
|
391
|
-
: undefined, onSubmit: isFlipInterstitial ? handleConfirmFlip : handleSubmit, onRetry:
|
|
533
|
+
: undefined, onSubmit: isFlipInterstitial ? handleConfirmFlip : handleSubmit, onRetry: handleRetake, verbiage: isFlipInterstitial ? reviewFlipVerbiage : verbiage.review, classNames: classNames.review, colors: colors.review })), !screenTakeover && state.phase === 'error' && state.error !== null && (_jsx(ErrorScreen, { error: state.error, onRetry: handleRetry, onExit: state.error.code === 'CAMERA_TAMPERING_SUSPECTED'
|
|
392
534
|
? onExitAfterTamperSealPopped
|
|
393
535
|
: undefined, verbiage: verbiage.error, classNames: classNames.error,
|
|
394
536
|
// 2.x styled/translated the camera-denied screen through the
|
|
@@ -399,7 +541,28 @@ export function IdCaptureView({ controller, guideType = 'fit', loadingOverlayMod
|
|
|
399
541
|
classNames: classNames.loadingOverlay?.cameraAccessDenied,
|
|
400
542
|
colors: colors.loadingOverlay?.cameraAccessDenied,
|
|
401
543
|
verbiage: verbiage.loadingOverlay?.cameraAccessDenied,
|
|
402
|
-
} }))] }) }) }));
|
|
544
|
+
} })), browserEdge && _jsx(BrowserEdgeTint, { ...browserEdge })] }) }) }));
|
|
545
|
+
}
|
|
546
|
+
function documentVerbiageFor(verbiage, documentType) {
|
|
547
|
+
if (documentType === 'idCardFront')
|
|
548
|
+
return verbiage.idCardFront;
|
|
549
|
+
if (documentType === 'idCardBack')
|
|
550
|
+
return verbiage.idCardBack;
|
|
551
|
+
if (documentType === 'passport')
|
|
552
|
+
return verbiage.passport;
|
|
553
|
+
return undefined;
|
|
554
|
+
}
|
|
555
|
+
/** The guides' bag with the document's instruction copy laid over it. A key
|
|
556
|
+
* the document leaves unset keeps whatever `guides` says. */
|
|
557
|
+
function withDocumentInstructions(guides, document) {
|
|
558
|
+
if (!document)
|
|
559
|
+
return guides;
|
|
560
|
+
const merged = { ...guides };
|
|
561
|
+
for (const key of ['instructionText', 'capturingText', 'captureFailedText']) {
|
|
562
|
+
if (document[key] !== undefined)
|
|
563
|
+
merged[key] = document[key];
|
|
564
|
+
}
|
|
565
|
+
return merged;
|
|
403
566
|
}
|
|
404
567
|
// Debug overlay + stats pane, sourced from sdk2 IdCapture.tsx:333-353
|
|
405
568
|
// (per-detected-object boxes, anchored to the guide rect via
|
|
@@ -440,7 +603,7 @@ function IdCaptureDebugLayer({ state, }) {
|
|
|
440
603
|
const isBarcode = obj.label === 'PDF417';
|
|
441
604
|
const color = isBarcodeRecapture && isBarcode ? 'green' : undefined;
|
|
442
605
|
return (_jsx(IdCaptureDetectedObjectDebugBox, { obj: obj, scaling: scaling, flipX: !isRearFacing, color: color }, i));
|
|
443
|
-
}) }), _jsxs(DebugStatsPane, { children: [
|
|
606
|
+
}) }), _jsxs(DebugStatsPane, { children: [_jsx(CameraDebugStatus, { ready: state.camera.ready, width: state.videoWidth, height: state.videoHeight }), _jsx("br", {}), state.frameCaptureRate > 0.75 ? '✅' : '👎', " Frame Rate:", ' ', Math.round((state.frameCaptureRate + Number.EPSILON) * 1000) / 1000, " fps", _jsx("br", {}), state.models.ready ? (_jsxs(_Fragment, { children: [state.detectionThresholdMet ? '✅' : '❌', " Detected Document Type:", ' ', state.detectedDocumentType, _jsx("br", {}), state.idCardFrontDetectionThresholdMet ? '✅' : '❌', " ID Card Front Score: ", state.idCardFrontDetectionScore.toFixed(3), _jsx("br", {}), state.idCardBackDetectionThresholdMet ? '✅' : '❌', " ID Card Back Score: ", state.idCardBackDetectionScore.toFixed(3), _jsx("br", {}), state.passportDetectionThresholdMet ? '✅' : '❌', " Passport Score:", ' ', state.passportDetectionScore.toFixed(3), _jsx("br", {}), state.singlePageDetectionThresholdMet ? '✅' : '❌', " Single Page Score: ", state.singlePageDetectionScore.toFixed(3), _jsx("br", {}), state.focusThresholdMet ? '✅' : '❌', " Focus Score:", ' ', state.focusScore.toFixed(3), _jsx("br", {}), state.enableFingerOcclusionGuidance && (_jsxs(_Fragment, { children: [state.fingersOccludingDocument ? '❌' : '✅', " Max Finger Score:", ' ', Math.max(0, ...state.detectedObjects
|
|
444
607
|
.filter((o) => o.label === 'Finger')
|
|
445
608
|
.map((o) => o.score)).toFixed(3), _jsx("br", {})] })), state.enableGlareOcclusionGuidance && (_jsxs(_Fragment, { children: [state.glareOccludingDocument ? '❌' : '✅', " Max Glare Score:", ' ', Math.max(0, ...state.detectedObjects
|
|
446
609
|
.filter((o) => o.label === 'Glare')
|
|
@@ -3,11 +3,16 @@ import { SelfieGuidanceCode, type SelfieCaptureController } from '@idmission/web
|
|
|
3
3
|
import { type CustomerSuppliedVerbiage, type LangOption } from './i18n';
|
|
4
4
|
import { type SelfieCaptureSurfaceColors } from './components/selfie/SelfieCaptureSurface';
|
|
5
5
|
import { type FaceCaptureGuideOverlayClassNames } from './components/selfie/FaceCaptureGuideOverlay';
|
|
6
|
+
import type { FaceGuideStyle } from './components/selfie/SelfieCaptureAnimatedMask';
|
|
6
7
|
import { type SelfieCaptureLoadingOverlayAssets, type SelfieCaptureLoadingOverlayClassNames, type SelfieCaptureLoadingOverlayMode, type SelfieCaptureLoadingOverlayVerbiage } from './components/selfie_loading/SelfieCaptureLoadingOverlay';
|
|
7
8
|
import { type ErrorScreenClassNames, type ErrorScreenVerbiage } from './components/error/ErrorScreen';
|
|
9
|
+
import type { CameraAccessDeniedReason } from './components/error/CameraAccessDeniedOverlay';
|
|
10
|
+
import type { SelfieCaptureFallbackClassNames } from './components/fallback/SelfieCaptureFallback';
|
|
8
11
|
export type SelfieGuidanceVerbiage = {
|
|
9
12
|
guidanceHoldStillText?: CustomerSuppliedVerbiage;
|
|
13
|
+
guidanceHandOverFaceText?: CustomerSuppliedVerbiage;
|
|
10
14
|
guidanceLookStraightText?: CustomerSuppliedVerbiage;
|
|
15
|
+
guidanceEyesClosedText?: CustomerSuppliedVerbiage;
|
|
11
16
|
guidanceMoveBackText?: CustomerSuppliedVerbiage;
|
|
12
17
|
guidanceMoveForwardText?: CustomerSuppliedVerbiage;
|
|
13
18
|
guidanceMoveToCenterText?: CustomerSuppliedVerbiage;
|
|
@@ -16,6 +21,8 @@ export type SelfieGuidanceVerbiage = {
|
|
|
16
21
|
guidanceNotStableText?: CustomerSuppliedVerbiage;
|
|
17
22
|
guidanceManualCaptureText?: CustomerSuppliedVerbiage;
|
|
18
23
|
manualCaptureBtnText?: CustomerSuppliedVerbiage;
|
|
24
|
+
guidanceRecoveryCaptureText?: CustomerSuppliedVerbiage;
|
|
25
|
+
recoveryCaptureBtnText?: CustomerSuppliedVerbiage;
|
|
19
26
|
};
|
|
20
27
|
export declare const GUIDANCE_VERBIAGE_FIELD: Record<Exclude<SelfieGuidanceCode, 'NONE'>, keyof SelfieGuidanceVerbiage>;
|
|
21
28
|
export type SelfieCaptureViewVerbiage = {
|
|
@@ -34,6 +41,8 @@ export type SelfieCaptureViewClassNames = {
|
|
|
34
41
|
exitBtn?: string;
|
|
35
42
|
manualCaptureBtnContainer?: string;
|
|
36
43
|
manualCaptureBtn?: string;
|
|
44
|
+
/** The stock-camera fallback screen, shown when guidance fails to load. */
|
|
45
|
+
fallback?: SelfieCaptureFallbackClassNames;
|
|
37
46
|
};
|
|
38
47
|
export type SelfieCaptureViewColors = SelfieCaptureSurfaceColors;
|
|
39
48
|
export type SelfieCaptureViewAssets = {
|
|
@@ -79,7 +88,9 @@ export type SelfieCaptureViewProps = {
|
|
|
79
88
|
onLoadingCompleted?: () => void;
|
|
80
89
|
onLoadingFailed?: (error?: Error) => void;
|
|
81
90
|
onLoadingOverlayDismissed?: () => void;
|
|
82
|
-
|
|
91
|
+
/** Fires once per camera failure, with whether permission was refused or
|
|
92
|
+
* the camera could not be started. */
|
|
93
|
+
onCameraAccessDenied?: (reason: CameraAccessDeniedReason) => void;
|
|
83
94
|
/** sdk2's `onModelError` / `onSelfieCaptureModelError`: fires once with the
|
|
84
95
|
* Error when a selfie model fails to load or times out. */
|
|
85
96
|
onModelError?: (error: Error) => void;
|
|
@@ -105,6 +116,12 @@ export type SelfieCaptureViewProps = {
|
|
|
105
116
|
renderCameraFeed?: boolean;
|
|
106
117
|
/** False when a parent multi-stage flow renders the shared face guide. */
|
|
107
118
|
renderFaceGuide?: boolean;
|
|
119
|
+
/** How the face guide prompts the user to put their head in the oval:
|
|
120
|
+
* 'pulse' (default) animates a wave out of the oval until a face is framed;
|
|
121
|
+
* 'spotlight' dims everything outside the oval instead, with no animation,
|
|
122
|
+
* which is much cheaper on low-end phones. Dim color:
|
|
123
|
+
* `theme.selfieCapture.guides.spotlightColor`. */
|
|
124
|
+
faceGuideStyle?: FaceGuideStyle;
|
|
108
125
|
onExit?: () => void;
|
|
109
126
|
/** Fires once per new `state.capturedSelfie` (compared by `capturedAt`),
|
|
110
127
|
* passing its `dataUrl`. The selfie controller has no submit() action —
|
|
@@ -115,5 +132,5 @@ export type SelfieCaptureViewProps = {
|
|
|
115
132
|
colors?: SelfieCaptureViewColors;
|
|
116
133
|
assets?: SelfieCaptureViewAssets;
|
|
117
134
|
};
|
|
118
|
-
export declare function SelfieCaptureView(
|
|
135
|
+
export declare function SelfieCaptureView(props: SelfieCaptureViewProps): ReactElement;
|
|
119
136
|
//# sourceMappingURL=SelfieCaptureView.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"SelfieCaptureView.d.ts","sourceRoot":"","sources":["../src/SelfieCaptureView.tsx"],"names":[],"mappings":"AAgDA,OAAO,EACL,YAAY,EACZ,KAAK,SAAS,EACd,KAAK,SAAS,EAGf,MAAM,OAAO,CAAA;AAEd,OAAO,EACL,kBAAkB,EAClB,KAAK,uBAAuB,EAE7B,MAAM,sCAAsC,CAAA;AAE7C,OAAO,
|
|
1
|
+
{"version":3,"file":"SelfieCaptureView.d.ts","sourceRoot":"","sources":["../src/SelfieCaptureView.tsx"],"names":[],"mappings":"AAgDA,OAAO,EACL,YAAY,EACZ,KAAK,SAAS,EACd,KAAK,SAAS,EAGf,MAAM,OAAO,CAAA;AAEd,OAAO,EACL,kBAAkB,EAClB,KAAK,uBAAuB,EAE7B,MAAM,sCAAsC,CAAA;AAE7C,OAAO,EAIL,KAAK,wBAAwB,EAC7B,KAAK,UAAU,EAChB,MAAM,QAAQ,CAA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;IACtC,QAAQ,CAAC,EAAE,yBAAyB,CAAA;IACpC,UAAU,CAAC,EAAE,2BAA2B,CAAA;IACxC,MAAM,CAAC,EAAE,uBAAuB,CAAA;IAChC,MAAM,CAAC,EAAE,uBAAuB,CAAA;CACjC,CAAA;AAeD,wBAAgB,iBAAiB,CAAC,KAAK,EAAE,sBAAsB,GAAG,YAAY,CAM7E"}
|
|
@@ -51,7 +51,7 @@ import { useEffect, useRef, } from 'react';
|
|
|
51
51
|
import { styled } from 'styled-components';
|
|
52
52
|
import { SelfieGuidanceCode, } from '@idmission/websdk-core/selfieCapture';
|
|
53
53
|
import { useSelfieCapture } from './bindings/useSelfieCapture';
|
|
54
|
-
import { useLanguage, useVerbiage, } from './i18n';
|
|
54
|
+
import { SdkLanguageProvider, useLanguage, useVerbiage, } from './i18n';
|
|
55
55
|
import { SelfieCaptureSurface, } from './components/selfie/SelfieCaptureSurface';
|
|
56
56
|
import { selfieGuidanceMessageKey, selfieGuidanceVariant, } from './guidance/selfieStrings';
|
|
57
57
|
import { useSessionReady } from './flows/AuthStateContext';
|
|
@@ -63,7 +63,9 @@ import { useSessionReady } from './flows/AuthStateContext';
|
|
|
63
63
|
// this exact map rather than duplicating it.
|
|
64
64
|
export const GUIDANCE_VERBIAGE_FIELD = {
|
|
65
65
|
[SelfieGuidanceCode.HOLD_STILL]: 'guidanceHoldStillText',
|
|
66
|
+
[SelfieGuidanceCode.HAND_OVER_FACE]: 'guidanceHandOverFaceText',
|
|
66
67
|
[SelfieGuidanceCode.LOOK_STRAIGHT]: 'guidanceLookStraightText',
|
|
68
|
+
[SelfieGuidanceCode.EYES_CLOSED]: 'guidanceEyesClosedText',
|
|
67
69
|
[SelfieGuidanceCode.MOVE_BACK]: 'guidanceMoveBackText',
|
|
68
70
|
[SelfieGuidanceCode.MOVE_FORWARD]: 'guidanceMoveForwardText',
|
|
69
71
|
[SelfieGuidanceCode.MOVE_TO_CENTER]: 'guidanceMoveToCenterText',
|
|
@@ -99,7 +101,10 @@ const Container = styled.div `
|
|
|
99
101
|
instead. */
|
|
100
102
|
${(props) => props.theme?.fontFamily ? `font-family: ${props.theme.fontFamily};` : ''}
|
|
101
103
|
`;
|
|
102
|
-
export function SelfieCaptureView(
|
|
104
|
+
export function SelfieCaptureView(props) {
|
|
105
|
+
return (_jsx(SdkLanguageProvider, { lang: props.lang ?? 'auto', children: _jsx(SelfieCaptureViewContent, { ...props }) }));
|
|
106
|
+
}
|
|
107
|
+
function SelfieCaptureViewContent({ controller, loadingOverlayMode = 'default', sessionReady: sessionReadyProp, lang = 'auto', autoContinueAfterLoading = false, showIntroScreen = false, transitionFromIdCapture = false, debugMode = false, showFaceLandmarks = false, debugShowSamplePoints, onLoadingStarted, onLoadingProgress, onLoadingCompleted, onLoadingFailed, onLoadingOverlayDismissed, onCameraAccessDenied, onModelError, onCameraTamperingDetected, onExitAfterTamperSealPopped, onUserCancel, customOverlayContent, allowManualSelfieCaptureOnLoadingError = false, fallbackCapture = true, silentFallback = false, videoRef, renderCameraFeed = true, renderFaceGuide = true, faceGuideStyle, onExit, onCaptured, verbiage = {}, classNames = {}, colors = {}, assets = {}, }) {
|
|
103
108
|
// Omitted means "follow the session": mounted inside a flow this view now
|
|
104
109
|
// renders during session validation, so its own loading overlay is the one
|
|
105
110
|
// loading surface (2.x behaviour — see useSessionReady). An explicit prop
|
|
@@ -124,7 +129,12 @@ export function SelfieCaptureView({ controller, loadingOverlayMode = 'default',
|
|
|
124
129
|
// request, making a working flow look frozen. FaceLivenessView has always
|
|
125
130
|
// had this via its own CAPTURED/IN_PROGRESS mapping; the plain view needs
|
|
126
131
|
// the phase instead, having no liveness machine to read.
|
|
127
|
-
|
|
132
|
+
// The hand-over-face check holds the shutter at fire time, on one frame,
|
|
133
|
+
// without touching `faceReady` — so the pill and the guides have to read
|
|
134
|
+
// its hold as well, or a held capture still reads as satisfied.
|
|
135
|
+
const handOverFace = state.guidance.code === SelfieGuidanceCode.HAND_OVER_FACE;
|
|
136
|
+
const maskStatus = (state.phase === 'processing' || state.prediction?.faceReady) &&
|
|
137
|
+
!handOverFace
|
|
128
138
|
? 'processing'
|
|
129
139
|
: 'ready';
|
|
130
140
|
const guidanceKey = selfieGuidanceMessageKey(state.guidance.code);
|
|
@@ -139,9 +149,11 @@ export function SelfieCaptureView({ controller, loadingOverlayMode = 'default',
|
|
|
139
149
|
const guidanceText = useVerbiage(guidanceOverride, guidanceKey);
|
|
140
150
|
const manualCaptureText = useVerbiage(verbiage.guidance?.guidanceManualCaptureText, 'Position your face in the circle and click to capture.');
|
|
141
151
|
const manualCaptureButtonText = useVerbiage(verbiage.guidance?.manualCaptureBtnText, 'Capture');
|
|
152
|
+
const recoveryCaptureText = useVerbiage(verbiage.guidance?.guidanceRecoveryCaptureText, 'We’re having trouble checking the lighting. Keep your face centered and hold still—we’ll still check your positioning.');
|
|
153
|
+
const recoveryCaptureButtonText = useVerbiage(verbiage.guidance?.recoveryCaptureBtnText, 'Continue with current lighting');
|
|
142
154
|
const showGuidancePill = showCaptureSurface && guidanceKey !== '';
|
|
143
155
|
const guidanceVariant = selfieGuidanceVariant({
|
|
144
|
-
satisfied: Boolean(state.prediction?.faceReady),
|
|
156
|
+
satisfied: Boolean(state.prediction?.faceReady) && !handOverFace,
|
|
145
157
|
negative: false,
|
|
146
158
|
});
|
|
147
159
|
// Fires onCaptured once per new capturedSelfie, identified by `capturedAt`
|
|
@@ -164,5 +176,5 @@ export function SelfieCaptureView({ controller, loadingOverlayMode = 'default',
|
|
|
164
176
|
lastCapturedAtRef.current = capturedAtMs;
|
|
165
177
|
onCaptured?.(captured.dataUrl);
|
|
166
178
|
}, [state.capturedSelfie, onCaptured]);
|
|
167
|
-
return (_jsx(Container, { className: classNames.container, children: _jsx(SelfieCaptureSurface, { controller: controller, state: state, loadingOverlayMode: loadingOverlayMode, sessionReady: sessionReady, autoContinueAfterLoading: autoContinueAfterLoading, showIntroScreen: showIntroScreen, transitionFromIdCapture: transitionFromIdCapture, onExit: onExit, onLoadingStarted: onLoadingStarted, onLoadingProgress: onLoadingProgress, onLoadingCompleted: onLoadingCompleted, onLoadingFailed: onLoadingFailed, onLoadingOverlayDismissed: onLoadingOverlayDismissed, onCameraAccessDenied: onCameraAccessDenied, onModelError: onModelError, onCameraTamperingDetected: onCameraTamperingDetected, onExitAfterTamperSealPopped: onExitAfterTamperSealPopped, onUserCancel: onUserCancel, customOverlayContent: customOverlayContent, allowManualSelfieCaptureOnLoadingError: allowManualSelfieCaptureOnLoadingError, fallbackCapture: fallbackCapture, silentFallback: silentFallback, manualCaptureText: manualCaptureText, manualCaptureButtonText: manualCaptureButtonText, videoRef: videoRef, renderCameraFeed: renderCameraFeed, renderFaceGuide: renderFaceGuide, showCaptureSurface: showCaptureSurface, maskStatus: maskStatus, showGuidancePill: showGuidancePill, guidanceText: guidanceText, guidanceVariant: guidanceVariant, debugMode: debugMode, showFaceLandmarks: showFaceLandmarks, debugShowSamplePoints: debugShowSamplePoints, verbiage: verbiage, classNames: classNames, colors: colors, assets: assets }) }));
|
|
179
|
+
return (_jsx(Container, { className: classNames.container, children: _jsx(SelfieCaptureSurface, { controller: controller, state: state, loadingOverlayMode: loadingOverlayMode, sessionReady: sessionReady, autoContinueAfterLoading: autoContinueAfterLoading, showIntroScreen: showIntroScreen, transitionFromIdCapture: transitionFromIdCapture, onExit: onExit, onLoadingStarted: onLoadingStarted, onLoadingProgress: onLoadingProgress, onLoadingCompleted: onLoadingCompleted, onLoadingFailed: onLoadingFailed, onLoadingOverlayDismissed: onLoadingOverlayDismissed, onCameraAccessDenied: onCameraAccessDenied, onModelError: onModelError, onCameraTamperingDetected: onCameraTamperingDetected, onExitAfterTamperSealPopped: onExitAfterTamperSealPopped, onUserCancel: onUserCancel, customOverlayContent: customOverlayContent, allowManualSelfieCaptureOnLoadingError: allowManualSelfieCaptureOnLoadingError, fallbackCapture: fallbackCapture, silentFallback: silentFallback, manualCaptureText: manualCaptureText, manualCaptureButtonText: manualCaptureButtonText, recoveryCaptureText: recoveryCaptureText, recoveryCaptureButtonText: recoveryCaptureButtonText, videoRef: videoRef, renderCameraFeed: renderCameraFeed, renderFaceGuide: renderFaceGuide, faceGuideStyle: faceGuideStyle, showCaptureSurface: showCaptureSurface, maskStatus: maskStatus, showGuidancePill: showGuidancePill, guidanceText: guidanceText, guidanceVariant: guidanceVariant, guidanceCode: state.guidance.code, debugMode: debugMode, showFaceLandmarks: showFaceLandmarks, debugShowSamplePoints: debugShowSamplePoints, verbiage: verbiage, classNames: classNames, colors: colors, assets: assets }) }));
|
|
168
180
|
}
|
|
@@ -1,9 +1,10 @@
|
|
|
1
1
|
import { type ComponentType, type RefObject } from "react";
|
|
2
2
|
import { type SignatureCaptureController } from "@idmission/websdk-core/signatureCapture";
|
|
3
|
+
import { type LoaderButtonColors } from "./components/common/LoaderButton";
|
|
3
4
|
import { type FaceGuideStatus } from "./components/selfie/FaceCaptureGuideOverlay";
|
|
4
5
|
import { type CustomerSuppliedVerbiage, type LangOption } from "./i18n";
|
|
5
6
|
import { type SkipSuccessScreen } from "./flows/useShowSuccessScreen";
|
|
6
|
-
import { type FlowOverlayClassNames, type FlowOverlayVerbiage } from "./flows/overlays";
|
|
7
|
+
import { type FlowOverlayClassNames, type FlowOverlayColors, type FlowOverlayVerbiage } from "./flows/overlays";
|
|
7
8
|
export type SignatureCaptureViewVerbiage = {
|
|
8
9
|
headingText?: CustomerSuppliedVerbiage;
|
|
9
10
|
signHereText?: CustomerSuppliedVerbiage;
|
|
@@ -54,6 +55,7 @@ export type SignatureCaptureViewClassNames = {
|
|
|
54
55
|
successHeading?: string;
|
|
55
56
|
/** The captured signature on the review screen — a video, or a still. */
|
|
56
57
|
reviewMedia?: string;
|
|
58
|
+
captureDiagnostics?: string;
|
|
57
59
|
retryBtn?: string;
|
|
58
60
|
doneBtn?: string;
|
|
59
61
|
error?: string;
|
|
@@ -88,6 +90,16 @@ export type RecordingInterruptedScreenProps = {
|
|
|
88
90
|
export type SignatureCaptureViewAssets = {
|
|
89
91
|
successIcon?: string;
|
|
90
92
|
};
|
|
93
|
+
/** Colours for this view's own elements, keyed like its `classNames`. */
|
|
94
|
+
export type SignatureCaptureViewColors = {
|
|
95
|
+
/** The heading over the pad. Defaults to the theme's guidance message. */
|
|
96
|
+
headingBackgroundColor?: string;
|
|
97
|
+
headingTextColor?: string;
|
|
98
|
+
/** The review screen's buttons. */
|
|
99
|
+
retryBtn?: LoaderButtonColors;
|
|
100
|
+
doneBtn?: LoaderButtonColors;
|
|
101
|
+
microphoneAccessDenied?: FlowOverlayColors;
|
|
102
|
+
};
|
|
91
103
|
export type SignatureCaptureViewProps = {
|
|
92
104
|
controller: SignatureCaptureController;
|
|
93
105
|
sessionReady?: boolean;
|
|
@@ -99,6 +111,7 @@ export type SignatureCaptureViewProps = {
|
|
|
99
111
|
onCompleted?: (artifacts: ReturnType<SignatureCaptureController["collectArtifacts"]>) => void;
|
|
100
112
|
verbiage?: SignatureCaptureViewVerbiage;
|
|
101
113
|
classNames?: SignatureCaptureViewClassNames;
|
|
114
|
+
colors?: SignatureCaptureViewColors;
|
|
102
115
|
assets?: SignatureCaptureViewAssets;
|
|
103
116
|
/** Reuses a video element across consecutive capture stages. */
|
|
104
117
|
videoRef?: RefObject<HTMLVideoElement | null>;
|
|
@@ -108,10 +121,18 @@ export type SignatureCaptureViewProps = {
|
|
|
108
121
|
forceCameraFeed?: boolean;
|
|
109
122
|
/** Whether the live face is inside the legacy signature-stage boundary. */
|
|
110
123
|
headTrackingSatisfied?: boolean;
|
|
124
|
+
/** Debug status only; signing eligibility remains `headTrackingSatisfied`. */
|
|
125
|
+
headTrackingStatus?: "off" | "pending" | "satisfied" | "unsatisfied";
|
|
111
126
|
/** Shows the face guide first, then reveals the signature pad. */
|
|
112
127
|
showFaceGuideThenSignaturePad?: boolean;
|
|
113
128
|
/** Uses the sdk2 video-signature guide geometry and theme contract. */
|
|
114
129
|
legacyVideoLayout?: boolean;
|
|
130
|
+
/**
|
|
131
|
+
* Shows live camera, recording, and head-tracking status during video signing,
|
|
132
|
+
* plus timing marks, the trim window, and recording diagnostics under the
|
|
133
|
+
* review video. Debug affordance: off by default.
|
|
134
|
+
*/
|
|
135
|
+
showCaptureDiagnostics?: boolean;
|
|
115
136
|
/** Live status for the sdk2-compatible face guide. */
|
|
116
137
|
faceGuideStatus?: FaceGuideStatus;
|
|
117
138
|
/**
|
|
@@ -136,5 +157,5 @@ export type SignatureCaptureViewProps = {
|
|
|
136
157
|
*/
|
|
137
158
|
recordingInterruptedComponent?: ComponentType<RecordingInterruptedScreenProps>;
|
|
138
159
|
};
|
|
139
|
-
export declare function SignatureCaptureView(
|
|
160
|
+
export declare function SignatureCaptureView(props: SignatureCaptureViewProps): import("react/jsx-runtime").JSX.Element;
|
|
140
161
|
//# sourceMappingURL=SignatureCaptureView.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"SignatureCaptureView.d.ts","sourceRoot":"","sources":["../src/SignatureCaptureView.tsx"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"SignatureCaptureView.d.ts","sourceRoot":"","sources":["../src/SignatureCaptureView.tsx"],"names":[],"mappings":"AACA,OAAO,EACL,KAAK,aAAa,EAElB,KAAK,SAAS,EAKf,MAAM,OAAO,CAAC;AAGf,OAAO,EAEL,KAAK,0BAA0B,EAEhC,MAAM,yCAAyC,CAAC;AAIjD,OAAO,EAEL,KAAK,kBAAkB,EACxB,MAAM,kCAAkC,CAAC;AAK1C,OAAO,EAEL,KAAK,eAAe,EACrB,MAAM,6CAA6C,CAAC;AAErD,OAAO,EAIL,KAAK,wBAAwB,EAC7B,KAAK,UAAU,EAChB,MAAM,QAAQ,CAAC;AAEhB,OAAO,EACL,KAAK,iBAAiB,EAEvB,MAAM,8BAA8B,CAAC;AACtC,OAAO,EAEL,KAAK,qBAAqB,EAC1B,KAAK,iBAAiB,EACtB,KAAK,mBAAmB,EACzB,MAAM,kBAAkB,CAAC;AAE1B,MAAM,MAAM,4BAA4B,GAAG;IACzC,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