@idmission/websdk-ui 0.2.0 → 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 +34 -1
- package/dist/DocumentCaptureView.d.ts +7 -5
- package/dist/DocumentCaptureView.d.ts.map +1 -1
- package/dist/DocumentCaptureView.js +30 -26
- package/dist/FaceLivenessView.d.ts +2 -2
- package/dist/FaceLivenessView.d.ts.map +1 -1
- package/dist/FaceLivenessView.js +47 -13
- package/dist/IdCaptureView.d.ts +27 -15
- package/dist/IdCaptureView.d.ts.map +1 -1
- package/dist/IdCaptureView.js +149 -26
- package/dist/SelfieCaptureView.d.ts +18 -1
- package/dist/SelfieCaptureView.d.ts.map +1 -1
- package/dist/SelfieCaptureView.js +13 -4
- package/dist/SignatureCaptureView.d.ts +18 -5
- package/dist/SignatureCaptureView.d.ts.map +1 -1
- package/dist/SignatureCaptureView.js +90 -15
- package/dist/VideoIdCaptureView.d.ts +14 -2
- package/dist/VideoIdCaptureView.d.ts.map +1 -1
- package/dist/VideoIdCaptureView.js +13 -6
- 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/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 +6 -0
- 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.map +1 -1
- package/dist/components/document/DocumentCaptureAutoCaptureDebugLayer.js +4 -5
- package/dist/components/document/DocumentCaptureAutoCaptureGuidance.d.ts.map +1 -1
- package/dist/components/document/DocumentCaptureAutoCaptureGuidance.js +40 -13
- 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 +22 -7
- 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 +5 -1
- package/dist/components/review/SignatureCaptureDiagnostics.d.ts.map +1 -1
- package/dist/components/review/SignatureCaptureDiagnostics.js +4 -2
- 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 +9 -2
- package/dist/components/selfie/SelfieCaptureSurface.d.ts.map +1 -1
- package/dist/components/selfie/SelfieCaptureSurface.js +77 -16
- 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/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.map +1 -1
- package/dist/flows/CompositeWizard.js +4 -0
- 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 +1 -1
- package/dist/flows/DocumentCaptureFlow.d.ts.map +1 -1
- 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 +8 -1
- 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 +1 -14
- package/dist/flows/approval.d.ts.map +1 -1
- package/dist/flows/approval.js +1 -19
- 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/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 -0
- package/dist/flows/ringScreens.d.ts.map +1 -1
- package/dist/flows/ringScreens.js +17 -2
- package/dist/flows/types.d.ts +17 -3
- package/dist/flows/types.d.ts.map +1 -1
- package/dist/guidance/selfieStrings.d.ts.map +1 -1
- package/dist/guidance/selfieStrings.js +8 -4
- 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.js +1 -1
- package/dist/i18n/locales/threeOh.d.ts.map +1 -1
- package/dist/i18n/locales/threeOh.js +56 -2
- package/dist/index.d.ts +9 -6
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +3 -0
- package/dist/testing/autoCaptureFrames.d.ts.map +1 -1
- package/dist/testing/autoCaptureFrames.js +10 -4
- 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/fakeSelfieController.d.ts.map +1 -1
- package/dist/testing/fakeSelfieController.js +7 -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/version.d.ts +1 -1
- package/dist/version.js +1 -1
- package/package.json +8 -7
|
@@ -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
|
import { useCallback, useEffect, useRef, useState, } from "react";
|
|
3
4
|
import SignaturePad from "signature_pad";
|
|
4
5
|
import { styled } from "styled-components";
|
|
@@ -6,8 +7,10 @@ import { SignatureCaptureGuidanceCode, } from "@idmission/websdk-core/signatureC
|
|
|
6
7
|
import { useSignatureCapture } from "./bindings/useSignatureCapture";
|
|
7
8
|
import { CameraVideoTag } from "./components/CameraFeed";
|
|
8
9
|
import { ButtonsRow } from "./components/common/ButtonsRow";
|
|
9
|
-
import { LoaderButton } from "./components/common/LoaderButton";
|
|
10
|
+
import { LoaderButton, } from "./components/common/LoaderButton";
|
|
10
11
|
import { ExitCaptureButton } from "./components/ExitCaptureButton";
|
|
12
|
+
import { GuidanceMessage } from "./components/GuidanceMessage";
|
|
13
|
+
import { CameraDebugStatus } from "./components/debug/debug";
|
|
11
14
|
import { SignatureCaptureDiagnostics } from "./components/review/SignatureCaptureDiagnostics";
|
|
12
15
|
import { FaceCaptureGuideOverlay, } from "./components/selfie/FaceCaptureGuideOverlay";
|
|
13
16
|
import { SelfieCaptureAnimatedMaskWithStatus } from "./components/selfie/SelfieCaptureAnimatedMask";
|
|
@@ -53,10 +56,11 @@ function handledByState(action) {
|
|
|
53
56
|
export function SignatureCaptureView(props) {
|
|
54
57
|
return (_jsx(SdkLanguageProvider, { lang: props.lang ?? "auto", children: _jsx(SignatureCaptureViewContent, { ...props }) }));
|
|
55
58
|
}
|
|
56
|
-
function SignatureCaptureViewContent({ controller, sessionReady = true, lang = "auto", autoStart = true, skipSuccessScreen = false, onExit, onCompleted, verbiage, classNames = {}, assets = {}, videoRef: providedVideoRef, onVideoElementChange, forceCameraFeed = false, headTrackingSatisfied = true, showFaceGuideThenSignaturePad = false, legacyVideoLayout = false, showCaptureDiagnostics = false, faceGuideStatus = "ready", onRestartRequested, recordingInterruptedComponent: RecordingInterruptedScreen, }) {
|
|
59
|
+
function SignatureCaptureViewContent({ controller, sessionReady = true, lang = "auto", autoStart = true, skipSuccessScreen = false, onExit, onCompleted, verbiage, classNames = {}, colors = {}, assets = {}, videoRef: providedVideoRef, onVideoElementChange, forceCameraFeed = false, headTrackingSatisfied = true, headTrackingStatus = "off", showFaceGuideThenSignaturePad = false, legacyVideoLayout = false, showCaptureDiagnostics = false, faceGuideStatus = "ready", onRestartRequested, recordingInterruptedComponent: RecordingInterruptedScreen, }) {
|
|
57
60
|
useLanguage(lang);
|
|
58
61
|
const text = useTranslations(verbiage, FALLBACKS);
|
|
59
62
|
const state = useSignatureCapture(controller);
|
|
63
|
+
useCaptureProgressController(controller);
|
|
60
64
|
const micDenied = state.error?.code === "MICROPHONE_PERMISSION_DENIED";
|
|
61
65
|
const recordingInterrupted = state.error?.code === "RECORDING_INTERRUPTED";
|
|
62
66
|
/**
|
|
@@ -73,6 +77,22 @@ function SignatureCaptureViewContent({ controller, sessionReady = true, lang = "
|
|
|
73
77
|
const internalVideoRef = useRef(null);
|
|
74
78
|
const videoRef = providedVideoRef ?? internalVideoRef;
|
|
75
79
|
const [videoNode, setVideoNode] = useState(null);
|
|
80
|
+
const [cameraResolution, setCameraResolution] = useState({ width: 0, height: 0 });
|
|
81
|
+
useEffect(() => {
|
|
82
|
+
if (!showCaptureDiagnostics || !videoNode)
|
|
83
|
+
return;
|
|
84
|
+
const update = () => setCameraResolution({
|
|
85
|
+
width: videoNode.videoWidth,
|
|
86
|
+
height: videoNode.videoHeight,
|
|
87
|
+
});
|
|
88
|
+
update();
|
|
89
|
+
videoNode.addEventListener("loadedmetadata", update);
|
|
90
|
+
videoNode.addEventListener("resize", update);
|
|
91
|
+
return () => {
|
|
92
|
+
videoNode.removeEventListener("loadedmetadata", update);
|
|
93
|
+
videoNode.removeEventListener("resize", update);
|
|
94
|
+
};
|
|
95
|
+
}, [showCaptureDiagnostics, videoNode]);
|
|
76
96
|
const setVideoRef = useCallback((node) => {
|
|
77
97
|
updateVideoRef(videoRef, node);
|
|
78
98
|
setVideoNode(node);
|
|
@@ -223,12 +243,22 @@ function SignatureCaptureViewContent({ controller, sessionReady = true, lang = "
|
|
|
223
243
|
? text.capturedSignatureAltText
|
|
224
244
|
: FALLBACKS.capturedSignatureAltText;
|
|
225
245
|
const signatureDisabled = legacyVideoLayout && (!sessionReady || state.phase !== "capturing");
|
|
246
|
+
const showLiveDiagnostics = showCaptureDiagnostics &&
|
|
247
|
+
sessionReady &&
|
|
248
|
+
state.captureMode === "video" &&
|
|
249
|
+
(state.phase === "capturing" || state.phase === "processing");
|
|
226
250
|
const displayEmptyState = !signatureDisabled &&
|
|
227
251
|
state.pointCount === 0 &&
|
|
228
252
|
!emptyContentDismissed &&
|
|
229
253
|
Boolean(text.signaturePadEmptyText);
|
|
230
254
|
const showLegacyFaceGuide = legacyVideoLayout && (!showFaceGuideThenSignaturePad || !sessionReady);
|
|
231
255
|
const showLegacySignaturePad = !legacyVideoLayout || !showFaceGuideThenSignaturePad || sessionReady;
|
|
256
|
+
const signaturePromptVisible = !legacyVideoLayout
|
|
257
|
+
? (state.phase === "capturing" || state.phase === "processing") && (!showFaceGuideThenSignaturePad || headTrackingSatisfied) && Boolean(guidance)
|
|
258
|
+
: state.phase === "capturing" && !signatureDisabled && showLegacySignaturePad && ((!text.signaturePadEmptyText && headTrackingSatisfied) || emptyContentDismissed) && Boolean(text.signHereText);
|
|
259
|
+
useDisplayedGuidance(signaturePromptVisible
|
|
260
|
+
? { kind: 'displayed', message: { family: 'signature', code: legacyVideoLayout ? SignatureCaptureGuidanceCode.SIGN_HERE : guidanceCode } }
|
|
261
|
+
: { kind: 'no-prompt' });
|
|
232
262
|
const handleDone = useCallback(() => {
|
|
233
263
|
controller.actions.done();
|
|
234
264
|
}, [controller]);
|
|
@@ -277,20 +307,28 @@ function SignatureCaptureViewContent({ controller, sessionReady = true, lang = "
|
|
|
277
307
|
!headTrackingSatisfied ||
|
|
278
308
|
!state.guidance.satisfied ||
|
|
279
309
|
state.phase !== "capturing", onClick: () => handledByState(controller.actions.accept()), children: text.acceptBtnText })] }));
|
|
280
|
-
return (_jsxs(Root, { className: classNames.container, children: [onExit && state.phase !== "reviewing" && state.phase !== "completed" ? (_jsx(ExitCaptureButton, { onClick: onExit, className: classNames.exitBtn })) : null, _jsx(CameraLayer, { "$visible": forceCameraFeed || state.captureMode === "video", children: _jsx(CameraVideoTag, { ref: setVideoRef, isRearFacing: state.camera.isRearFacing, className: classNames.cameraFeed }) }), _jsxs(
|
|
310
|
+
return (_jsxs(Root, { className: classNames.container, children: [onExit && state.phase !== "reviewing" && state.phase !== "completed" ? (_jsx(ExitCaptureButton, { onClick: onExit, className: classNames.exitBtn })) : null, _jsx(CameraLayer, { "$visible": forceCameraFeed || state.captureMode === "video", children: _jsx(CameraVideoTag, { ref: setVideoRef, isRearFacing: state.camera.isRearFacing, className: classNames.cameraFeed }) }), showLiveDiagnostics ? (_jsxs(LiveDiagnostics, { "data-testid": "signature-live-diagnostics", children: [_jsx("span", { children: _jsx(CameraDebugStatus, { ready: state.camera.ready, width: cameraResolution.width, height: cameraResolution.height }) }), _jsxs("span", { children: ["Recording:", " ", state.recording.active
|
|
311
|
+
? state.recording.firstChunkReceived
|
|
312
|
+
? "active"
|
|
313
|
+
: "starting"
|
|
314
|
+
: "stopped"] }), _jsxs("span", { children: ["Head tracking:", " ", headTrackingStatus === "satisfied"
|
|
315
|
+
? "OK"
|
|
316
|
+
: headTrackingStatus === "unsatisfied"
|
|
317
|
+
? "outside"
|
|
318
|
+
: headTrackingStatus] })] })) : null, _jsxs(CaptureContent, { "$visible": (legacyVideoLayout && !sessionReady) ||
|
|
281
319
|
state.phase === "capturing" ||
|
|
282
|
-
state.phase === "processing", "$legacyVideoLayout": legacyVideoLayout, children: [!legacyVideoLayout &&
|
|
320
|
+
state.phase === "processing", "$legacyVideoLayout": legacyVideoLayout, "$reserveDebugSpace": showLiveDiagnostics, children: [!legacyVideoLayout &&
|
|
283
321
|
showFaceGuideThenSignaturePad &&
|
|
284
322
|
!headTrackingSatisfied ? (_jsx(FaceCaptureGuideOverlay, { status: faceGuideStatus })) : null, _jsxs(SignatureControls, { "$visible": legacyVideoLayout ||
|
|
285
323
|
!showFaceGuideThenSignaturePad ||
|
|
286
|
-
headTrackingSatisfied, "$legacyVideoLayout": legacyVideoLayout, className: classNames.guidesContainer, children: [text.headingText ? (_jsx(SignatureHeading, { className: classNames.heading, "$legacyVideoLayout": legacyVideoLayout, children: text.headingText })) : null, !legacyVideoLayout ? (_jsx(Guidance, { role: "status", "aria-live": "polite", className: classNames.guidance, "data-guidance-code": guidanceCode, children: guidance })) : null, legacyVideoLayout ? (_jsxs(LegacyGuidesInner, { className: classNames.guidesInner, children: [_jsx(LegacyFaceGuideContainer, { className: classNames.faceGuideContainer, "$visible": showLegacyFaceGuide, children: _jsx(LegacyFaceGuide, { className: classNames.faceGuide, status: sessionReady ? "success" : faceGuideStatus, verticalAlign: "bottom" }) }), _jsx(LegacySignaturePadContainer, { className: classNames.signaturePadContainer, "$visible": showLegacySignaturePad, children: _jsxs(LegacySignatureCanvasContainer, { className: `${classNames.signatureCanvasContainer ?? ""}${signatureDisabled &&
|
|
324
|
+
headTrackingSatisfied, "$legacyVideoLayout": legacyVideoLayout, className: classNames.guidesContainer, children: [text.headingText && (!legacyVideoLayout || sessionReady) ? (_jsx(SignatureHeading, { as: "h1", className: classNames.heading, "$background": colors.headingBackgroundColor, "$textColor": colors.headingTextColor, "$legacyVideoLayout": legacyVideoLayout, children: text.headingText })) : null, !legacyVideoLayout ? (_jsx(Guidance, { role: "status", "aria-live": "polite", className: classNames.guidance, "data-guidance-code": guidanceCode, children: guidance })) : null, legacyVideoLayout ? (_jsxs(LegacyGuidesInner, { className: classNames.guidesInner, children: [_jsx(LegacyFaceGuideContainer, { className: classNames.faceGuideContainer, "$visible": showLegacyFaceGuide, children: _jsx(LegacyFaceGuide, { className: classNames.faceGuide, status: sessionReady ? "success" : faceGuideStatus, verticalAlign: "bottom" }) }), _jsx(LegacySignaturePadContainer, { className: classNames.signaturePadContainer, "$visible": showLegacySignaturePad, children: _jsxs(LegacySignatureCanvasContainer, { className: `${classNames.signatureCanvasContainer ?? ""}${signatureDisabled &&
|
|
287
325
|
classNames.signatureCanvasContainerDisabled
|
|
288
326
|
? ` ${classNames.signatureCanvasContainerDisabled}`
|
|
289
327
|
: ""}`, "$disabled": signatureDisabled, "$headTrackingSatisfied": headTrackingSatisfied, children: [signaturePanel, signatureButtons] }) })] })) : (_jsxs(_Fragment, { children: [signaturePanel, signatureButtons] }))] })] }), (state.phase === "reviewing" || state.phase === "completed") &&
|
|
290
|
-
showSuccessScreen ? (_jsxs(Review, { className: classNames.review, children: [assets.successIcon ? _jsx("img", { src: assets.successIcon, alt: "" }) : null, _jsx("h1", { className: classNames.successHeading, children: text.successHeadingText }), previewUrl ? (_jsx("video", { src: previewUrl, className: classNames.reviewMedia, controls: true, playsInline: true })) : null, !previewUrl && state.artifact ? (_jsx("img", { src: state.artifact.imageDataUrl, alt: capturedSignatureAltText, className: classNames.reviewMedia })) : null, showCaptureDiagnostics && state.artifact ? (_jsx(SignatureCaptureDiagnostics, { artifact: state.artifact, className: classNames.captureDiagnostics })) : null, state.phase === "reviewing" ? (_jsxs(ButtonsRow, { className: classNames.buttonsRow, children: [_jsx(LoaderButton, { variant: "warning", finished: true, className: classNames.retryBtn, onClick: () => {
|
|
328
|
+
showSuccessScreen ? (_jsxs(Review, { className: classNames.review, children: [assets.successIcon ? _jsx("img", { src: assets.successIcon, alt: "" }) : null, _jsx("h1", { className: classNames.successHeading, children: text.successHeadingText }), previewUrl ? (_jsx("video", { src: previewUrl, className: classNames.reviewMedia, controls: true, playsInline: true })) : null, !previewUrl && state.artifact ? (_jsx("img", { src: state.artifact.imageDataUrl, alt: capturedSignatureAltText, className: classNames.reviewMedia })) : null, showCaptureDiagnostics && state.artifact ? (_jsx(SignatureCaptureDiagnostics, { artifact: state.artifact, cameraResolution: cameraResolution, className: classNames.captureDiagnostics })) : null, state.phase === "reviewing" ? (_jsxs(ButtonsRow, { className: classNames.buttonsRow, children: [_jsx(LoaderButton, { variant: "warning", finished: true, className: classNames.retryBtn, colors: colors.retryBtn, onClick: () => {
|
|
291
329
|
padRef.current?.clear();
|
|
292
330
|
handledByState(controller.actions.retry());
|
|
293
|
-
}, children: text.retryBtnText }), _jsx(LoaderButton, { variant: "positive", finished: true, className: classNames.doneBtn, onClick: handleDone, children: text.doneBtnText })] })) : null] })) : null, micDenied ? (_jsx(MicrophoneAccessDeniedOverlay, { onRetry: () => handledByState(controller.actions.retry()), classNames: classNames.microphoneAccessDenied, verbiage: verbiage?.microphoneAccessDenied })) : null, state.phase === "error" &&
|
|
331
|
+
}, children: text.retryBtnText }), _jsx(LoaderButton, { variant: "positive", finished: true, className: classNames.doneBtn, colors: colors.doneBtn, onClick: handleDone, children: text.doneBtnText })] })) : null] })) : null, micDenied ? (_jsx(MicrophoneAccessDeniedOverlay, { onRetry: () => handledByState(controller.actions.retry()), classNames: classNames.microphoneAccessDenied, colors: colors.microphoneAccessDenied, verbiage: verbiage?.microphoneAccessDenied })) : null, state.phase === "error" &&
|
|
294
332
|
!micDenied &&
|
|
295
333
|
recordingInterrupted &&
|
|
296
334
|
!restarting &&
|
|
@@ -306,15 +344,51 @@ const Root = styled.div `
|
|
|
306
344
|
height: 100%;
|
|
307
345
|
min-height: 420px;
|
|
308
346
|
overflow: hidden;
|
|
347
|
+
container: signature-capture / inline-size;
|
|
309
348
|
background: ${(props) => props.theme.background ?? "#fff"};
|
|
310
349
|
color: ${(props) => props.theme.textColor ?? "#26332e"};
|
|
311
350
|
`;
|
|
351
|
+
/** Sits below the pad's stacking context and never receives signing input. */
|
|
352
|
+
const LiveDiagnostics = styled.div `
|
|
353
|
+
position: absolute;
|
|
354
|
+
z-index: 0;
|
|
355
|
+
top: 64px;
|
|
356
|
+
left: 20px;
|
|
357
|
+
display: grid;
|
|
358
|
+
padding: 8px;
|
|
359
|
+
color: limegreen;
|
|
360
|
+
background: rgba(0, 0, 0, 0.65);
|
|
361
|
+
font: 14px/20px monospace;
|
|
362
|
+
pointer-events: none;
|
|
363
|
+
|
|
364
|
+
@container signature-capture (max-width: 1024px) {
|
|
365
|
+
top: 12px;
|
|
366
|
+
left: 12px;
|
|
367
|
+
right: 12px;
|
|
368
|
+
grid-template-columns: repeat(2, max-content);
|
|
369
|
+
column-gap: 12px;
|
|
370
|
+
font-size: clamp(11px, 3cqw, 12px);
|
|
371
|
+
line-height: 18px;
|
|
372
|
+
|
|
373
|
+
> :first-child {
|
|
374
|
+
grid-column: 1 / -1;
|
|
375
|
+
}
|
|
376
|
+
}
|
|
377
|
+
`;
|
|
378
|
+
/**
|
|
379
|
+
* Black behind the feed. WebKit snaps the mirrored front-camera video's layer
|
|
380
|
+
* to device pixels and can leave one column uncovered along an edge, which
|
|
381
|
+
* showed the view's white background as a hairline. Black reads as the
|
|
382
|
+
* screen's bezel and matches the letterbox bars the KYC flow shows while the
|
|
383
|
+
* camera is up.
|
|
384
|
+
*/
|
|
312
385
|
const CameraLayer = styled.div `
|
|
313
386
|
position: absolute;
|
|
314
387
|
inset: 0;
|
|
315
388
|
display: ${(props) => (props.$visible ? "flex" : "none")};
|
|
316
389
|
isolation: isolate;
|
|
317
390
|
overflow: hidden;
|
|
391
|
+
background: #000;
|
|
318
392
|
`;
|
|
319
393
|
const CaptureContent = styled.div `
|
|
320
394
|
position: absolute;
|
|
@@ -329,13 +403,11 @@ const CaptureContent = styled.div `
|
|
|
329
403
|
background: ${(props) => props.$legacyVideoLayout ? "transparent" : "rgba(0, 0, 0, 0.2)"};
|
|
330
404
|
box-sizing: border-box;
|
|
331
405
|
|
|
332
|
-
|
|
333
|
-
|
|
334
|
-
|
|
335
|
-
border-radius: 8px;
|
|
336
|
-
background: rgba(255, 255, 255, 0.92);
|
|
337
|
-
font-size: 1.25rem;
|
|
406
|
+
/* Reserve a band above the face guide on phones and narrow embeds. */
|
|
407
|
+
@container signature-capture (max-width: 1024px) {
|
|
408
|
+
top: ${(props) => (props.$reserveDebugSpace ? "76px" : "0")};
|
|
338
409
|
}
|
|
410
|
+
|
|
339
411
|
`;
|
|
340
412
|
const Guidance = styled.div `
|
|
341
413
|
padding: 8px 16px;
|
|
@@ -343,14 +415,17 @@ const Guidance = styled.div `
|
|
|
343
415
|
background: rgba(255, 255, 255, 0.92);
|
|
344
416
|
font-weight: 600;
|
|
345
417
|
`;
|
|
346
|
-
const SignatureHeading = styled
|
|
418
|
+
const SignatureHeading = styled(GuidanceMessage) `
|
|
419
|
+
margin: 0;
|
|
347
420
|
${(props) => props.$legacyVideoLayout
|
|
348
421
|
? `
|
|
349
422
|
position: absolute;
|
|
350
|
-
z-index: 1001;
|
|
351
423
|
top: 12px;
|
|
352
424
|
left: 50%;
|
|
353
425
|
transform: translateX(-50%);
|
|
426
|
+
width: max-content;
|
|
427
|
+
max-width: 80%;
|
|
428
|
+
box-sizing: border-box;
|
|
354
429
|
`
|
|
355
430
|
: ""}
|
|
356
431
|
`;
|
|
@@ -1,8 +1,9 @@
|
|
|
1
1
|
import { type RefObject } from 'react';
|
|
2
2
|
import { type VideoIdCaptureController } from '@idmission/websdk-core/videoIdCapture';
|
|
3
3
|
import type { SubmissionArtifacts } from '@idmission/websdk-core/client';
|
|
4
|
-
import { type
|
|
5
|
-
import { type
|
|
4
|
+
import { type LoaderButtonColors } from './components/common/LoaderButton';
|
|
5
|
+
import { type FlowOverlayClassNames, type FlowOverlayColors, type FlowOverlayVerbiage } from './flows/overlays';
|
|
6
|
+
import { type IdCaptureLoadingOverlayAssets, type IdCaptureLoadingOverlayClassNames, type IdCaptureLoadingOverlayColors, type IdCaptureLoadingOverlayMode, type IdCaptureLoadingOverlayVerbiage } from './components/loading/IdCaptureLoadingOverlay';
|
|
6
7
|
import { type IdCaptureGuideImages } from './components/guide_images';
|
|
7
8
|
import type { FlipIdPromptClassNames } from './components/guides/FlipIdPrompt';
|
|
8
9
|
import { type CustomerSuppliedVerbiage, type LangOption } from './i18n';
|
|
@@ -63,6 +64,16 @@ export type VideoIdCaptureViewClassNames = {
|
|
|
63
64
|
loadingOverlay?: IdCaptureLoadingOverlayClassNames;
|
|
64
65
|
microphoneAccessDenied?: FlowOverlayClassNames;
|
|
65
66
|
};
|
|
67
|
+
/** Button and overlay colours, keyed like `classNames`. The guides take theirs
|
|
68
|
+
* from `theme.idVideoCapture`. */
|
|
69
|
+
export type VideoIdCaptureViewColors = {
|
|
70
|
+
readTextDoneBtn?: LoaderButtonColors;
|
|
71
|
+
/** The review screen's buttons. */
|
|
72
|
+
retryBtn?: LoaderButtonColors;
|
|
73
|
+
doneBtn?: LoaderButtonColors;
|
|
74
|
+
loadingOverlay?: IdCaptureLoadingOverlayColors;
|
|
75
|
+
microphoneAccessDenied?: FlowOverlayColors;
|
|
76
|
+
};
|
|
66
77
|
export type VideoIdCaptureViewProps = {
|
|
67
78
|
controller: VideoIdCaptureController;
|
|
68
79
|
sessionReady?: boolean;
|
|
@@ -76,6 +87,7 @@ export type VideoIdCaptureViewProps = {
|
|
|
76
87
|
onCompleted?: (artifacts: SubmissionArtifacts) => void;
|
|
77
88
|
verbiage?: VideoIdCaptureViewVerbiage;
|
|
78
89
|
classNames?: VideoIdCaptureViewClassNames;
|
|
90
|
+
colors?: VideoIdCaptureViewColors;
|
|
79
91
|
guideImages?: IdCaptureGuideImages;
|
|
80
92
|
loadingOverlayAssets?: IdCaptureLoadingOverlayAssets;
|
|
81
93
|
videoRef?: RefObject<HTMLVideoElement | null>;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"VideoIdCaptureView.d.ts","sourceRoot":"","sources":["../src/VideoIdCaptureView.tsx"],"names":[],"mappings":"AAAA,OAAO,EACL,KAAK,SAAS,EAKf,MAAM,OAAO,CAAA;AAEd,OAAO,EAEL,KAAK,wBAAwB,EAE9B,MAAM,uCAAuC,CAAA;AAC9C,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,+BAA+B,CAAA;
|
|
1
|
+
{"version":3,"file":"VideoIdCaptureView.d.ts","sourceRoot":"","sources":["../src/VideoIdCaptureView.tsx"],"names":[],"mappings":"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"}
|
|
@@ -6,20 +6,20 @@ import { useVideoIdCapture } from './bindings/useVideoIdCapture';
|
|
|
6
6
|
import { CameraVideoTag } from './components/CameraFeed';
|
|
7
7
|
import { ExitCaptureButton } from './components/ExitCaptureButton';
|
|
8
8
|
import { ButtonsRow } from './components/common/ButtonsRow';
|
|
9
|
-
import { LoaderButton } from './components/common/LoaderButton';
|
|
9
|
+
import { LoaderButton, } from './components/common/LoaderButton';
|
|
10
10
|
import { MicrophoneAccessDeniedOverlay, } from './flows/overlays';
|
|
11
11
|
import { IdCaptureLoadingOverlay, } from './components/loading/IdCaptureLoadingOverlay';
|
|
12
12
|
import { defaultIdCaptureGuideImages, } from './components/guide_images';
|
|
13
13
|
import { VideoIdCaptureGuides } from './components/videoId/VideoIdCaptureGuides';
|
|
14
14
|
import { SdkLanguageProvider, useLanguage, useTranslations, useVerbiage, } from './i18n';
|
|
15
15
|
import { VIDEO_ID_FALLBACKS } from './guidance/videoIdStrings';
|
|
16
|
-
import { DebugBoundingBoxOverlay, DebugStatsPane, IdCaptureDetectedObjectDebugBox, useDebugScalingDetails, } from './components/debug/debug';
|
|
16
|
+
import { DebugBoundingBoxOverlay, CameraDebugStatus, DebugStatsPane, IdCaptureDetectedObjectDebugBox, useDebugScalingDetails, } from './components/debug/debug';
|
|
17
17
|
import useResizeObserver from './layout/useResizeObserver';
|
|
18
18
|
import { useSessionReady } from './flows/AuthStateContext';
|
|
19
19
|
export function VideoIdCaptureView(props) {
|
|
20
20
|
return (_jsx(SdkLanguageProvider, { lang: props.lang ?? 'auto', children: _jsx(VideoIdCaptureViewContent, { ...props }) }));
|
|
21
21
|
}
|
|
22
|
-
function VideoIdCaptureViewContent({ controller, sessionReady: sessionReadyProp, autoStart = true, loadingOverlayMode = 'default', autoContinueAfterLoading = false, showIntroScreen = false, transitionFromFaceCapture = false, lang = 'auto', onExit, onCompleted, readTextPrompt, onReadingFinished, onMicrophoneAccessDenied, verbiage, classNames = {}, guideImages = defaultIdCaptureGuideImages, loadingOverlayAssets, videoRef: providedVideoRef, debugMode = false, }) {
|
|
22
|
+
function VideoIdCaptureViewContent({ controller, sessionReady: sessionReadyProp, autoStart = true, loadingOverlayMode = 'default', autoContinueAfterLoading = false, showIntroScreen = false, transitionFromFaceCapture = false, lang = 'auto', onExit, onCompleted, readTextPrompt, onReadingFinished, onMicrophoneAccessDenied, verbiage, classNames = {}, colors = {}, guideImages = defaultIdCaptureGuideImages, loadingOverlayAssets, videoRef: providedVideoRef, debugMode = false, }) {
|
|
23
23
|
// Omitted means "follow the session": mounted inside a flow this view now
|
|
24
24
|
// renders during session validation, so its own loading overlay is the one
|
|
25
25
|
// loading surface (2.x behaviour — see useSessionReady). An explicit prop
|
|
@@ -163,10 +163,17 @@ function VideoIdCaptureViewContent({ controller, sessionReady: sessionReadyProp,
|
|
|
163
163
|
idCardGuideImageContainer: classNames.idCardGuideImageContainer,
|
|
164
164
|
idCardGuideImage: classNames.idCardGuideImage,
|
|
165
165
|
flipIdPrompt: classNames.flipIdPrompt,
|
|
166
|
-
}, images: guideImages, requestedAction: guideAction, idDocumentType: state.documentType, instruction: instruction, guidanceCode: state.guidance, isMirrored: !state.camera.isRearFacing, satisfied: state.guidance === VideoIdCaptureGuidanceCode.HOLD_STEADY, idCardGuideStatus: state.countdownRemaining === null ? 'ready' : 'capturing', idCardCaptureProgress: state.countdownRemaining === null ? 0 : 1 })) : null, state.countdownRemaining !== null ? (_jsx(Countdown, { "aria-live": "assertive", className: classNames.countdown, children: state.countdownRemaining })) : null, state.reading.active ? (_jsxs(ReadTextPrompt, { role: "status", "aria-live": "polite", className: classNames.readTextPrompt, children: [_jsx(ReadTextHeading, { className: classNames.readTextHeading, children: readTextHeading }), _jsx(ReadTextSentence, { className: classNames.readTextSentence, children: readTextPromptText }), _jsx(LoaderButton, { variant: "positive", finished: true, disabled: !state.reading.canFinish, className: classNames.readTextDoneBtn, onClick: () => {
|
|
166
|
+
}, images: guideImages, requestedAction: guideAction, idDocumentType: state.documentType, instruction: instruction, guidanceCode: state.guidance, isMirrored: !state.camera.isRearFacing, satisfied: state.guidance === VideoIdCaptureGuidanceCode.HOLD_STEADY, idCardGuideStatus: state.countdownRemaining === null ? 'ready' : 'capturing', idCardCaptureProgress: state.countdownRemaining === null ? 0 : 1 })) : null, state.countdownRemaining !== null ? (_jsx(Countdown, { "aria-live": "assertive", className: classNames.countdown, children: state.countdownRemaining })) : null, state.reading.active ? (_jsxs(ReadTextPrompt, { role: "status", "aria-live": "polite", className: classNames.readTextPrompt, children: [_jsx(ReadTextHeading, { className: classNames.readTextHeading, children: readTextHeading }), _jsx(ReadTextSentence, { className: classNames.readTextSentence, children: readTextPromptText }), _jsx(LoaderButton, { variant: "positive", finished: true, disabled: !state.reading.canFinish, className: classNames.readTextDoneBtn, colors: colors.readTextDoneBtn, onClick: () => {
|
|
167
167
|
onReadingFinished?.();
|
|
168
168
|
void controller.actions.finishReading();
|
|
169
|
-
}, children: doneReadingText })] })) : null, debugMode && capturing ? (_jsx(VideoIdCaptureDebugLayer, { state: state, pageWidth: rootWidth, pageHeight: rootHeight })) : null, showLoadingOverlay ? (_jsx(IdCaptureLoadingOverlay, { state: state, mode: loadingOverlayMode, sessionReady: sessionReady, autoContinueAfterLoading: autoContinueAfterLoading, showIntroScreen: showIntroScreen, transitionFromPreviousStage: transitionFromFaceCapture, assets: loadingOverlayAssets, classNames: classNames.loadingOverlay, verbiage: loadingOverlayVerbiage, onDismissed: () => setOverlayDismissed(true), onUserCancel: onExit, onRequestCamera: () => controller.actions.requestCamera() })) : null, state.phase === 'reviewing' || state.phase === 'completed' ? (_jsxs(Review, { className: classNames.review, children: [_jsx("h1", { className: classNames.reviewHeading, children: text.headingText }), previewUrl ? (_jsx("video", { src: previewUrl, className: classNames.video, controls: true, playsInline: true, preload: "metadata" })) : null, _jsxs(CapturedFrames, { children: [state.artifact ? (_jsx("img", { src: state.artifact.frontImage, alt: frontImageAlt, className: classNames.frontImage })) : null, state.artifact?.backImage ? (_jsx("img", { src: state.artifact.backImage, alt: backImageAlt, className: classNames.backImage })) : null] }), state.phase === 'reviewing' ? (_jsxs(ButtonsRow, { className: classNames.buttonsRow, children: [_jsx(LoaderButton, { finished: true, variant: "warning", className: classNames.retryBtn, onClick: () => void controller.actions.retry(), children: text.retryBtnText }), _jsx(LoaderButton, { finished: true, variant: "positive", className: classNames.doneBtn, onClick: controller.actions.done, children: text.doneBtnText })] })) : null] })) : null, micDenied ? (_jsx(MicrophoneAccessDeniedOverlay, { onRetry: () => void controller.actions.retry(), classNames: classNames.microphoneAccessDenied, verbiage: verbiage?.microphoneAccessDenied })) : null, state.phase === 'error' && !micDenied ? (_jsxs(ErrorPanel, { role: "alert", className: classNames.error, children: [_jsx("h1", { children: text.errorHeadingText }), _jsx("p", { children: state.error?.message }), state.error?.recoverable ? (_jsx(LoaderButton, { finished: true,
|
|
169
|
+
}, children: doneReadingText })] })) : null, debugMode && capturing ? (_jsx(VideoIdCaptureDebugLayer, { state: state, pageWidth: rootWidth, pageHeight: rootHeight })) : null, showLoadingOverlay ? (_jsx(IdCaptureLoadingOverlay, { state: state, mode: loadingOverlayMode, sessionReady: sessionReady, autoContinueAfterLoading: autoContinueAfterLoading, showIntroScreen: showIntroScreen, transitionFromPreviousStage: transitionFromFaceCapture, assets: loadingOverlayAssets, classNames: classNames.loadingOverlay, colors: colors.loadingOverlay, verbiage: loadingOverlayVerbiage, onDismissed: () => setOverlayDismissed(true), onUserCancel: onExit, onRequestCamera: () => controller.actions.requestCamera() })) : null, state.phase === 'reviewing' || state.phase === 'completed' ? (_jsxs(Review, { className: classNames.review, children: [_jsx("h1", { className: classNames.reviewHeading, children: text.headingText }), previewUrl ? (_jsx("video", { src: previewUrl, className: classNames.video, controls: true, playsInline: true, preload: "metadata" })) : null, _jsxs(CapturedFrames, { children: [state.artifact ? (_jsx("img", { src: state.artifact.frontImage, alt: frontImageAlt, className: classNames.frontImage })) : null, state.artifact?.backImage ? (_jsx("img", { src: state.artifact.backImage, alt: backImageAlt, className: classNames.backImage })) : null] }), state.phase === 'reviewing' ? (_jsxs(ButtonsRow, { className: classNames.buttonsRow, children: [_jsx(LoaderButton, { finished: true, variant: "warning", className: classNames.retryBtn, colors: colors.retryBtn, onClick: () => void controller.actions.retry(), children: text.retryBtnText }), _jsx(LoaderButton, { finished: true, variant: "positive", className: classNames.doneBtn, colors: colors.doneBtn, onClick: controller.actions.done, children: text.doneBtnText })] })) : null] })) : null, micDenied ? (_jsx(MicrophoneAccessDeniedOverlay, { onRetry: () => void controller.actions.retry(), classNames: classNames.microphoneAccessDenied, colors: colors.microphoneAccessDenied, verbiage: verbiage?.microphoneAccessDenied })) : null, state.phase === 'error' && !micDenied ? (_jsxs(ErrorPanel, { role: "alert", className: classNames.error, children: [_jsx("h1", { children: text.errorHeadingText }), _jsx("p", { children: state.error?.message }), state.error?.recoverable ? (_jsx(LoaderButton, { finished: true,
|
|
170
|
+
// This panel is the video-ID stage's camera-denied screen too;
|
|
171
|
+
// sdk2 coloured that screen's retry from the loading overlay bag.
|
|
172
|
+
// An unavailable camera was the same 2.x screen (see ErrorScreen).
|
|
173
|
+
colors: state.error.code === 'CAMERA_PERMISSION_DENIED' ||
|
|
174
|
+
state.error.code === 'CAMERA_UNAVAILABLE'
|
|
175
|
+
? colors.loadingOverlay?.cameraAccessDenied?.retryBtn
|
|
176
|
+
: undefined, onClick: () => void controller.actions.retry(), children: text.retryBtnText })) : null] })) : null] }));
|
|
170
177
|
}
|
|
171
178
|
function VideoIdCaptureDebugLayer({ state, pageWidth, pageHeight, }) {
|
|
172
179
|
const isRearFacing = state.camera.isRearFacing;
|
|
@@ -188,7 +195,7 @@ function VideoIdCaptureDebugLayer({ state, pageWidth, pageHeight, }) {
|
|
|
188
195
|
const waitingForDwell = state.stage !== 'back' &&
|
|
189
196
|
state.goodFramesCount >= state.goodFramesThreshold &&
|
|
190
197
|
state.countdownRemaining === null;
|
|
191
|
-
return (_jsxs(_Fragment, { children: [_jsx(DebugBoundingBoxOverlay, { "$flipX": !isRearFacing, scaling: scaling, children: state.detectedObjects.map((object, index) => (_jsx(IdCaptureDetectedObjectDebugBox, { obj: object, scaling: scaling, flipX: !isRearFacing }, `${object.label}-${index}`))) }), _jsxs(DebugStatsPane, { children: [_jsx("strong", { children: "Video ID Debug" }), _jsx("br", {}), "Phase: ", state.phase, _jsx("br", {}), "Stage: ", state.stage, _jsx("br", {}), "Guidance: ", state.guidance, _jsx("br", {}), state.models.ready ? '✅' : '❌', " Models ready", _jsx("br", {}), state.recording.active ? '✅' : '❌', " Recording active", _jsx("br", {}),
|
|
198
|
+
return (_jsxs(_Fragment, { children: [_jsx(DebugBoundingBoxOverlay, { "$flipX": !isRearFacing, scaling: scaling, children: state.detectedObjects.map((object, index) => (_jsx(IdCaptureDetectedObjectDebugBox, { obj: object, scaling: scaling, flipX: !isRearFacing }, `${object.label}-${index}`))) }), _jsxs(DebugStatsPane, { children: [_jsx("strong", { children: "Video ID Debug" }), _jsx("br", {}), _jsx(CameraDebugStatus, { ready: state.camera.ready, width: state.frameWidth, height: state.frameHeight }), _jsx("br", {}), "Phase: ", state.phase, _jsx("br", {}), "Stage: ", state.stage, _jsx("br", {}), "Guidance: ", state.guidance, _jsx("br", {}), state.models.ready ? '✅' : '❌', " Models ready", _jsx("br", {}), state.recording.active ? '✅' : '❌', " Recording active", _jsx("br", {}), stageDocumentDetected ? '✅' : '❌', " Stage document detected:", ' ', state.detectedDocumentType, _jsx("br", {}), "Detection Score: ", state.detectionScore.toFixed(3), _jsx("br", {}), "Recent Stage Peak (2s): ", state.recentPeakDetectionScore.toFixed(3), _jsx("br", {}), "ID Front Score: ", state.idCardFrontDetectionScore.toFixed(3), _jsx("br", {}), "ID Back Score: ", state.idCardBackDetectionScore.toFixed(3), _jsx("br", {}), "Focus Score: ", state.focusScore.toFixed(3), _jsx("br", {}), state.documentInBounds ? '✅' : '❌', " Document in bounds", _jsx("br", {}), state.documentTooClose ? '❌' : '✅', " Document not too close", _jsx("br", {}), state.documentIsStable ? '✅' : '❌', " Document stable", _jsx("br", {}), state.focusThresholdMet ? '✅' : '❌', " Focus gate passed", _jsx("br", {}), qualifyingFrame ? '✅' : '❌', " Qualifying Frames:", ' ', state.goodFramesCount, "/", state.goodFramesThreshold, _jsx("br", {}), "Controller Progress: ", Math.round(state.progress * 100), "%", _jsx("br", {}), "Timing Gate:", ' ', waitingForDwell ? 'waiting for dwell' : 'ready or inactive', _jsx("br", {}), "Countdown: ", state.countdownRemaining ?? 'not started'] })] }));
|
|
192
199
|
}
|
|
193
200
|
const Root = styled.div `
|
|
194
201
|
position: absolute;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"useDocumentCapture.d.ts","sourceRoot":"","sources":["../../src/bindings/useDocumentCapture.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"useDocumentCapture.d.ts","sourceRoot":"","sources":["../../src/bindings/useDocumentCapture.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EACV,yBAAyB,EACzB,8BAA8B,EAC/B,MAAM,wCAAwC,CAAA;AAG/C,wBAAgB,kBAAkB,CAChC,UAAU,EAAE,yBAAyB,GACpC,8BAA8B,CAUhC"}
|
|
@@ -1,4 +1,5 @@
|
|
|
1
|
-
import { useCallback
|
|
1
|
+
import { useCallback } from 'react';
|
|
2
|
+
import { useSyncExternalStore } from 'use-sync-external-store/shim';
|
|
2
3
|
import { guard } from './useSelfieCapture';
|
|
3
4
|
export function useDocumentCapture(controller) {
|
|
4
5
|
const subscribe = useCallback((onStoreChange) => controller.subscribe(guard(onStoreChange)), [controller]);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"useIdCapture.d.ts","sourceRoot":"","sources":["../../src/bindings/useIdCapture.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"useIdCapture.d.ts","sourceRoot":"","sources":["../../src/bindings/useIdCapture.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EACV,mBAAmB,EACnB,wBAAwB,EACzB,MAAM,kCAAkC,CAAA;AAgBzC,wBAAgB,KAAK,CAAC,EAAE,EAAE,MAAM,IAAI,GAAG,MAAM,IAAI,CAUhD;AAED,wBAAgB,YAAY,CAAC,UAAU,EAAE,mBAAmB,GAAG,wBAAwB,CAMtF;AAED,wBAAgB,oBAAoB,CAAC,CAAC,EACpC,UAAU,EAAE,mBAAmB,EAC/B,QAAQ,EAAE,CAAC,CAAC,EAAE,wBAAwB,KAAK,CAAC,EAC5C,OAAO,GAAE,CAAC,CAAC,EAAE,CAAC,EAAE,CAAC,EAAE,CAAC,KAAK,OAAmB,GAC3C,CAAC,CAuBH"}
|
|
@@ -1,4 +1,5 @@
|
|
|
1
|
-
import { useCallback, useRef
|
|
1
|
+
import { useCallback, useRef } from 'react';
|
|
2
|
+
import { useSyncExternalStore } from 'use-sync-external-store/shim';
|
|
2
3
|
// A listener that throws would propagate into core's frame loop and kill
|
|
3
4
|
// detection (plan-3 carry-note). Rethrow asynchronously instead: the error
|
|
4
5
|
// still surfaces (uncaughtException / window.onerror) without unwinding the
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"useSelfieCapture.d.ts","sourceRoot":"","sources":["../../src/bindings/useSelfieCapture.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"useSelfieCapture.d.ts","sourceRoot":"","sources":["../../src/bindings/useSelfieCapture.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EACV,uBAAuB,EACvB,4BAA4B,EAC7B,MAAM,sCAAsC,CAAA;AAgB7C,wBAAgB,KAAK,CAAC,EAAE,EAAE,MAAM,IAAI,GAAG,MAAM,IAAI,CAUhD;AAED,wBAAgB,gBAAgB,CAC9B,UAAU,EAAE,uBAAuB,GAClC,4BAA4B,CAM9B;AAED,wBAAgB,wBAAwB,CAAC,CAAC,EACxC,UAAU,EAAE,uBAAuB,EACnC,QAAQ,EAAE,CAAC,CAAC,EAAE,4BAA4B,KAAK,CAAC,EAChD,OAAO,GAAE,CAAC,CAAC,EAAE,CAAC,EAAE,CAAC,EAAE,CAAC,KAAK,OAAmB,GAC3C,CAAC,CAyBH"}
|
|
@@ -1,4 +1,5 @@
|
|
|
1
|
-
import { useCallback, useRef
|
|
1
|
+
import { useCallback, useRef } from 'react';
|
|
2
|
+
import { useSyncExternalStore } from 'use-sync-external-store/shim';
|
|
2
3
|
// A listener that throws would propagate into core's frame loop and kill
|
|
3
4
|
// detection (plan-3 carry-note). Rethrow asynchronously instead: the error
|
|
4
5
|
// still surfaces (uncaughtException / window.onerror) without unwinding the
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"useSignatureCapture.d.ts","sourceRoot":"","sources":["../../src/bindings/useSignatureCapture.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"useSignatureCapture.d.ts","sourceRoot":"","sources":["../../src/bindings/useSignatureCapture.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EACV,0BAA0B,EAC1B,+BAA+B,EAChC,MAAM,yCAAyC,CAAA;AAGhD,wBAAgB,mBAAmB,CACjC,UAAU,EAAE,0BAA0B,GACrC,+BAA+B,CAUjC"}
|
|
@@ -1,4 +1,5 @@
|
|
|
1
|
-
import { useCallback
|
|
1
|
+
import { useCallback } from 'react';
|
|
2
|
+
import { useSyncExternalStore } from 'use-sync-external-store/shim';
|
|
2
3
|
import { guard } from './useSelfieCapture';
|
|
3
4
|
export function useSignatureCapture(controller) {
|
|
4
5
|
const subscribe = useCallback((onStoreChange) => controller.subscribe(guard(onStoreChange)), [controller]);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"useVideoIdCapture.d.ts","sourceRoot":"","sources":["../../src/bindings/useVideoIdCapture.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"useVideoIdCapture.d.ts","sourceRoot":"","sources":["../../src/bindings/useVideoIdCapture.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EACV,wBAAwB,EACxB,6BAA6B,EAC9B,MAAM,uCAAuC,CAAA;AAG9C,wBAAgB,iBAAiB,CAC/B,UAAU,EAAE,wBAAwB,GACnC,6BAA6B,CAU/B"}
|
|
@@ -1,4 +1,5 @@
|
|
|
1
|
-
import { useCallback
|
|
1
|
+
import { useCallback } from 'react';
|
|
2
|
+
import { useSyncExternalStore } from 'use-sync-external-store/shim';
|
|
2
3
|
import { guard } from './useSelfieCapture';
|
|
3
4
|
export function useVideoIdCapture(controller) {
|
|
4
5
|
const subscribe = useCallback((onStoreChange) => controller.subscribe(guard(onStoreChange)), [controller]);
|
|
@@ -0,0 +1,63 @@
|
|
|
1
|
+
import { type ReactElement } from 'react';
|
|
2
|
+
/**
|
|
3
|
+
* `color` with its alpha dropped, or null when it is fully transparent.
|
|
4
|
+
*
|
|
5
|
+
* The strips have to be OPAQUE. Safari reads their `background-color`, and a
|
|
6
|
+
* translucent one blends with whatever is behind it — the host page, or on a
|
|
7
|
+
* `fullscreen` feed the camera — so the bars would stop matching the surface
|
|
8
|
+
* the strip stands for. The guided surround is translucent in exactly those
|
|
9
|
+
* cases: `fullscreen` mode's default scrim, and any translucent
|
|
10
|
+
* `guideBox.maskColor` a theme supplies. Keeping the RGB keeps the hue the
|
|
11
|
+
* theme asked for.
|
|
12
|
+
*
|
|
13
|
+
* Formats this does not parse — named colours, `var()` — pass through, since a
|
|
14
|
+
* named colour is already opaque and a custom property cannot be read here.
|
|
15
|
+
*/
|
|
16
|
+
export declare function opaqueColor(color: string): string | null;
|
|
17
|
+
/**
|
|
18
|
+
* The colour a loading overlay's progress row shows along the viewport's
|
|
19
|
+
* bottom edge: the indicator once the bar is full, and before that the
|
|
20
|
+
* translucent track composited over the overlay background. `color-mix`
|
|
21
|
+
* composites the way the browser does, and still resolves a `var()` colour.
|
|
22
|
+
*/
|
|
23
|
+
export declare function progressRowEdgeColor(row: {
|
|
24
|
+
full: boolean;
|
|
25
|
+
indicator: string;
|
|
26
|
+
track: string;
|
|
27
|
+
trackOpacity: number;
|
|
28
|
+
background: string;
|
|
29
|
+
}): string;
|
|
30
|
+
export type BrowserEdgeTintProps = {
|
|
31
|
+
/** The colour of the surface currently touching both viewport edges. */
|
|
32
|
+
color: string;
|
|
33
|
+
/**
|
|
34
|
+
* For a surface whose bottom edge is not one flat colour — a default loading
|
|
35
|
+
* overlay's progress row, part filled while it loads — the colour that edge
|
|
36
|
+
* shows. That strip is drawn fully transparent, because any flat strip over
|
|
37
|
+
* the row shows as a band across it. WebKit skips elements under 0.1
|
|
38
|
+
* opacity, so Safari most likely ignores it and keeps its last bottom
|
|
39
|
+
* colour (not yet confirmed on a device); the page is unobstructed either
|
|
40
|
+
* way.
|
|
41
|
+
*/
|
|
42
|
+
hiddenBottomColor?: string;
|
|
43
|
+
};
|
|
44
|
+
/**
|
|
45
|
+
* Pins a thin strip of `color` to the top and bottom of the viewport.
|
|
46
|
+
*
|
|
47
|
+
* Portaled to `document.body` rather than rendered in place: `position: fixed`
|
|
48
|
+
* is only viewport-relative when no ancestor has a `transform` or `filter`, and
|
|
49
|
+
* an SDK cannot promise that about a host's layout. The portal target is
|
|
50
|
+
* resolved in an effect, so a server render emits nothing instead of reaching
|
|
51
|
+
* for a `document` that does not exist.
|
|
52
|
+
*
|
|
53
|
+
* Mounted only while a full-bleed surface is actually on screen. Unmounting is
|
|
54
|
+
* what hands the bars back to the host — hiding the strips with `opacity: 0`
|
|
55
|
+
* would not: Safari skips a nearly transparent strip, finds only the
|
|
56
|
+
* full-viewport surface behind it, and keeps its last colour.
|
|
57
|
+
*
|
|
58
|
+
* Each strip is keyed on its own colour, so a new colour mounts a new strip
|
|
59
|
+
* rather than restyling the old one. Safari remembers a colour per strip
|
|
60
|
+
* element, so a fresh element is what guarantees it takes the new one.
|
|
61
|
+
*/
|
|
62
|
+
export declare function BrowserEdgeTint({ color, hiddenBottomColor, }: BrowserEdgeTintProps): ReactElement | null;
|
|
63
|
+
//# sourceMappingURL=BrowserEdgeTint.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"BrowserEdgeTint.d.ts","sourceRoot":"","sources":["../../../src/components/common/BrowserEdgeTint.tsx"],"names":[],"mappings":"AAeA,OAAO,EAAuB,KAAK,YAAY,EAAE,MAAM,OAAO,CAAA;AAc9D;;;;;;;;;;;;;GAaG;AACH,wBAAgB,WAAW,CAAC,KAAK,EAAE,MAAM,GAAG,MAAM,GAAG,IAAI,CAwBxD;AAED;;;;;GAKG;AACH,wBAAgB,oBAAoB,CAAC,GAAG,EAAE;IACxC,IAAI,EAAE,OAAO,CAAA;IACb,SAAS,EAAE,MAAM,CAAA;IACjB,KAAK,EAAE,MAAM,CAAA;IACb,YAAY,EAAE,MAAM,CAAA;IACpB,UAAU,EAAE,MAAM,CAAA;CACnB,GAAG,MAAM,CAGT;AAED,MAAM,MAAM,oBAAoB,GAAG;IACjC,wEAAwE;IACxE,KAAK,EAAE,MAAM,CAAA;IACb;;;;;;;;OAQG;IACH,iBAAiB,CAAC,EAAE,MAAM,CAAA;CAC3B,CAAA;AAED;;;;;;;;;;;;;;;;;GAiBG;AACH,wBAAgB,eAAe,CAAC,EAC9B,KAAK,EACL,iBAAiB,GAClB,EAAE,oBAAoB,GAAG,YAAY,GAAG,IAAI,CAyB5C"}
|
|
@@ -0,0 +1,111 @@
|
|
|
1
|
+
import { jsx as _jsx, Fragment as _Fragment, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
// Makes the browser's own chrome match a full-screen surface.
|
|
3
|
+
//
|
|
4
|
+
// iOS 26 Safari ignores `<meta name="theme-color">` and tints its top and
|
|
5
|
+
// bottom bars from the page itself: first from the `background-color` of a
|
|
6
|
+
// `position: fixed` or `sticky` element sitting on that edge (within ~4px of
|
|
7
|
+
// the top or ~3px of the bottom, at least 80% of the width, at least 3px tall),
|
|
8
|
+
// and otherwise from the `html`/`body` background.
|
|
9
|
+
//
|
|
10
|
+
// That fallback is the HOST's, and the host has no way to know which of our
|
|
11
|
+
// screens is showing. On the guided POA screen it produced a white toolbar
|
|
12
|
+
// under a near-black camera surface; after capture, the light review screen
|
|
13
|
+
// kept the camera screen's near-black top bar. Two strips pinned to the edges
|
|
14
|
+
// in the current surface's colour give Safari something unambiguous to read,
|
|
15
|
+
// and it re-tints as they appear, change and disappear.
|
|
16
|
+
import { useEffect, useState } from 'react';
|
|
17
|
+
import { createPortal } from 'react-dom';
|
|
18
|
+
import { styled } from 'styled-components';
|
|
19
|
+
/**
|
|
20
|
+
* Over WebKit's 10px "thin border" cutoff (`LocalFrameView::fixedContainerEdges`).
|
|
21
|
+
* At or under it, Safari never reads the strip's `background-color`: it samples
|
|
22
|
+
* the pixels once and keeps that colour for as long as the same element holds
|
|
23
|
+
* the edge. At 6px, ID capture's strips first sampled the white loading overlay
|
|
24
|
+
* and kept the top bar white through the dark camera screen. Still short
|
|
25
|
+
* enough to disappear against a surface painted the same colour.
|
|
26
|
+
*/
|
|
27
|
+
const EDGE_STRIP_PX = 12;
|
|
28
|
+
/**
|
|
29
|
+
* `color` with its alpha dropped, or null when it is fully transparent.
|
|
30
|
+
*
|
|
31
|
+
* The strips have to be OPAQUE. Safari reads their `background-color`, and a
|
|
32
|
+
* translucent one blends with whatever is behind it — the host page, or on a
|
|
33
|
+
* `fullscreen` feed the camera — so the bars would stop matching the surface
|
|
34
|
+
* the strip stands for. The guided surround is translucent in exactly those
|
|
35
|
+
* cases: `fullscreen` mode's default scrim, and any translucent
|
|
36
|
+
* `guideBox.maskColor` a theme supplies. Keeping the RGB keeps the hue the
|
|
37
|
+
* theme asked for.
|
|
38
|
+
*
|
|
39
|
+
* Formats this does not parse — named colours, `var()` — pass through, since a
|
|
40
|
+
* named colour is already opaque and a custom property cannot be read here.
|
|
41
|
+
*/
|
|
42
|
+
export function opaqueColor(color) {
|
|
43
|
+
const value = color.trim();
|
|
44
|
+
if (value.toLowerCase() === 'transparent')
|
|
45
|
+
return null;
|
|
46
|
+
const hex = /^#([0-9a-f]{3,4}|[0-9a-f]{6}|[0-9a-f]{8})$/i.exec(value);
|
|
47
|
+
if (hex) {
|
|
48
|
+
const digits = hex[1];
|
|
49
|
+
if (digits.length === 4)
|
|
50
|
+
return `#${digits.slice(0, 3)}`;
|
|
51
|
+
if (digits.length === 8)
|
|
52
|
+
return `#${digits.slice(0, 6)}`;
|
|
53
|
+
return value;
|
|
54
|
+
}
|
|
55
|
+
// rgb/rgba/hsl/hsla, in both the comma and the space-and-slash syntax.
|
|
56
|
+
const fn = /^(rgb|hsl)a?\(\s*([^,/\s)]+)[\s,]+([^,/\s)]+)[\s,]+([^,/\s)]+)\s*(?:[,/]\s*([^\s)]+))?\s*\)$/i.exec(value);
|
|
57
|
+
if (fn) {
|
|
58
|
+
const [, space, a, b, c, alpha] = fn;
|
|
59
|
+
if (alpha !== undefined && parseFloat(alpha) === 0)
|
|
60
|
+
return null;
|
|
61
|
+
return `${space.toLowerCase()}(${a}, ${b}, ${c})`;
|
|
62
|
+
}
|
|
63
|
+
return value;
|
|
64
|
+
}
|
|
65
|
+
/**
|
|
66
|
+
* The colour a loading overlay's progress row shows along the viewport's
|
|
67
|
+
* bottom edge: the indicator once the bar is full, and before that the
|
|
68
|
+
* translucent track composited over the overlay background. `color-mix`
|
|
69
|
+
* composites the way the browser does, and still resolves a `var()` colour.
|
|
70
|
+
*/
|
|
71
|
+
export function progressRowEdgeColor(row) {
|
|
72
|
+
if (row.full)
|
|
73
|
+
return row.indicator;
|
|
74
|
+
return `color-mix(in srgb, ${row.track} ${row.trackOpacity * 100}%, ${row.background})`;
|
|
75
|
+
}
|
|
76
|
+
/**
|
|
77
|
+
* Pins a thin strip of `color` to the top and bottom of the viewport.
|
|
78
|
+
*
|
|
79
|
+
* Portaled to `document.body` rather than rendered in place: `position: fixed`
|
|
80
|
+
* is only viewport-relative when no ancestor has a `transform` or `filter`, and
|
|
81
|
+
* an SDK cannot promise that about a host's layout. The portal target is
|
|
82
|
+
* resolved in an effect, so a server render emits nothing instead of reaching
|
|
83
|
+
* for a `document` that does not exist.
|
|
84
|
+
*
|
|
85
|
+
* Mounted only while a full-bleed surface is actually on screen. Unmounting is
|
|
86
|
+
* what hands the bars back to the host — hiding the strips with `opacity: 0`
|
|
87
|
+
* would not: Safari skips a nearly transparent strip, finds only the
|
|
88
|
+
* full-viewport surface behind it, and keeps its last colour.
|
|
89
|
+
*
|
|
90
|
+
* Each strip is keyed on its own colour, so a new colour mounts a new strip
|
|
91
|
+
* rather than restyling the old one. Safari remembers a colour per strip
|
|
92
|
+
* element, so a fresh element is what guarantees it takes the new one.
|
|
93
|
+
*/
|
|
94
|
+
export function BrowserEdgeTint({ color, hiddenBottomColor, }) {
|
|
95
|
+
const [target, setTarget] = useState(null);
|
|
96
|
+
useEffect(() => setTarget(document.body), []);
|
|
97
|
+
if (!target)
|
|
98
|
+
return null;
|
|
99
|
+
const bottomColor = hiddenBottomColor ?? color;
|
|
100
|
+
return createPortal(_jsxs(_Fragment, { children: [_jsx(EdgeStrip, { "$edge": "top", "$color": color, "aria-hidden": "true", "data-testid": "browser-edge-tint-top" }, `top:${color}`), _jsx(EdgeStrip, { "$edge": "bottom", "$color": bottomColor, "$hidden": hiddenBottomColor !== undefined, "aria-hidden": "true", "data-testid": "browser-edge-tint-bottom" }, `bottom:${bottomColor}`)] }), target);
|
|
101
|
+
}
|
|
102
|
+
const EdgeStrip = styled.div `
|
|
103
|
+
position: fixed;
|
|
104
|
+
left: 0;
|
|
105
|
+
right: 0;
|
|
106
|
+
${({ $edge }) => $edge}: 0;
|
|
107
|
+
height: ${EDGE_STRIP_PX}px;
|
|
108
|
+
background: ${({ $color }) => $color};
|
|
109
|
+
${({ $hidden }) => ($hidden ? 'opacity: 0;' : '')}
|
|
110
|
+
pointer-events: none;
|
|
111
|
+
`;
|
|
@@ -12,16 +12,25 @@ export type LoaderButtonProps = ButtonHTMLAttributes<HTMLButtonElement> & {
|
|
|
12
12
|
children?: ReactNode;
|
|
13
13
|
className?: string;
|
|
14
14
|
disabled?: boolean;
|
|
15
|
+
/** False while the action is in progress: the button is disabled, marked
|
|
16
|
+
* `aria-busy`, and a bar glides along its bottom edge. */
|
|
15
17
|
finished?: boolean;
|
|
16
18
|
colors?: LoaderButtonColors;
|
|
17
19
|
onClick?: () => void;
|
|
18
20
|
style?: CSSProperties;
|
|
19
21
|
variant?: LoaderButtonVariant;
|
|
20
22
|
};
|
|
23
|
+
/**
|
|
24
|
+
* The SDK's action button. `ladda-button` / `ladda-label` are kept as class
|
|
25
|
+
* hooks from when Ladda drew the loading state, since 2.x customer CSS may
|
|
26
|
+
* target them.
|
|
27
|
+
*/
|
|
21
28
|
export declare const LoaderButton: import("react").ForwardRefExoticComponent<ButtonHTMLAttributes<HTMLButtonElement> & {
|
|
22
29
|
children?: ReactNode;
|
|
23
30
|
className?: string;
|
|
24
31
|
disabled?: boolean;
|
|
32
|
+
/** False while the action is in progress: the button is disabled, marked
|
|
33
|
+
* `aria-busy`, and a bar glides along its bottom edge. */
|
|
25
34
|
finished?: boolean;
|
|
26
35
|
colors?: LoaderButtonColors;
|
|
27
36
|
onClick?: () => void;
|