@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
|
@@ -12,7 +12,8 @@ import { jsx as _jsx } from "react/jsx-runtime";
|
|
|
12
12
|
// divergence 4 — those fields never crossed the core port); captureState
|
|
13
13
|
// becomes a `phase: CapturePhase` prop, and the sdk2 `captureState ===
|
|
14
14
|
// 'complete'` null-check becomes phase-in-{'reviewing','uploading',
|
|
15
|
-
// 'complete'} (the CapturePhase values that mean capture is over)
|
|
15
|
+
// 'complete'} (the CapturePhase values that mean capture is over) — as a
|
|
16
|
+
// `display: none`, not an unmount; see PHASES_WITH_NO_CAMERA_FEED below.
|
|
16
17
|
import { forwardRef } from 'react';
|
|
17
18
|
import { styled } from 'styled-components';
|
|
18
19
|
import { useGuideLayout } from '../layout/GuideLayoutContext';
|
|
@@ -55,20 +56,39 @@ export const CameraFeedWrapper = styled.div `
|
|
|
55
56
|
width: 100%;
|
|
56
57
|
height: 100%;
|
|
57
58
|
overflow: hidden;`}
|
|
59
|
+
|
|
60
|
+
/* Last, so it wins over both branches' display. */
|
|
61
|
+
${(props) => (props.$hidden ? 'display: none;' : '')}
|
|
58
62
|
`;
|
|
59
63
|
// sdk2's ScalingCameraFeed hides itself once captureState === 'complete'.
|
|
60
64
|
// The core port's CapturePhase spreads that one boolean across three
|
|
61
65
|
// phases — 'reviewing' (post-capture, pre-submit), 'uploading' (submitting),
|
|
62
66
|
// and 'complete' (submitted) — all of which mean "camera feed no longer
|
|
63
67
|
// needed".
|
|
68
|
+
//
|
|
69
|
+
// HIDDEN, never unmounted. sdk2 could drop the <video>: its camera store held
|
|
70
|
+
// the stream and re-assigned `srcObject` to whatever element mounted next. In
|
|
71
|
+
// 3.0 the element IS the attachment — `controller.attach(el)` keeps that exact
|
|
72
|
+
// node (controller.ts, `const el = videoEl`) and only a camera acquisition
|
|
73
|
+
// wires a stream into it — so unmounting here orphaned the stream on a
|
|
74
|
+
// detached node. The view attaches once per controller, so nothing re-wired
|
|
75
|
+
// the fresh element React mounted on the way back to capturing: a retake
|
|
76
|
+
// returned to the capture screen with guides, border and a live pipeline over
|
|
77
|
+
// a blank feed. The element outlives every phase; only its visibility changes.
|
|
64
78
|
const PHASES_WITH_NO_CAMERA_FEED = new Set([
|
|
65
79
|
'reviewing',
|
|
66
80
|
'uploading',
|
|
67
81
|
'complete',
|
|
68
82
|
]);
|
|
83
|
+
/**
|
|
84
|
+
* Whether the feed is hidden in this phase. Hiding pauses the element, so the
|
|
85
|
+
* owner of the <video> — the one holding the ref it attached with — has to ask
|
|
86
|
+
* it to play again on the way back; `IdCaptureView` does, keyed on this.
|
|
87
|
+
*/
|
|
88
|
+
export function isCameraFeedHidden(phase) {
|
|
89
|
+
return PHASES_WITH_NO_CAMERA_FEED.has(phase);
|
|
90
|
+
}
|
|
69
91
|
export function ScalingCameraFeed({ videoRef, phase, isRearFacing, cameraFeedMode = 'snapToGuides', className, }) {
|
|
70
92
|
const { guideRect } = useGuideLayout();
|
|
71
|
-
|
|
72
|
-
return null;
|
|
73
|
-
return (_jsx(CameraFeedWrapper, { "$x": guideRect?.x ?? 0, "$y": guideRect?.y ?? 0, "$w": guideRect?.width ?? 0, "$h": guideRect?.height ?? 0, "$radius": guideRect?.radius, "$mode": cameraFeedMode, children: _jsx(CameraVideoTag, { ref: videoRef, isRearFacing: isRearFacing, className: className }) }));
|
|
93
|
+
return (_jsx(CameraFeedWrapper, { "$x": guideRect?.x ?? 0, "$y": guideRect?.y ?? 0, "$w": guideRect?.width ?? 0, "$h": guideRect?.height ?? 0, "$radius": guideRect?.radius, "$mode": cameraFeedMode, "$hidden": isCameraFeedHidden(phase), children: _jsx(CameraVideoTag, { ref: videoRef, isRearFacing: isRearFacing, className: className }) }));
|
|
74
94
|
}
|
|
@@ -15,9 +15,15 @@ export type BarcodeGuideOverlayProps = {
|
|
|
15
15
|
borderRadius?: number;
|
|
16
16
|
headerText?: string | ReactElement;
|
|
17
17
|
instructionText?: string | ReactElement;
|
|
18
|
+
/**
|
|
19
|
+
* Stable identifier for `instructionText`, emitted as `data-guidance-code` so
|
|
20
|
+
* a stylesheet can target this specific message. Optional because the
|
|
21
|
+
* component keeps a standalone default for its own text.
|
|
22
|
+
*/
|
|
23
|
+
instructionCode?: string;
|
|
18
24
|
isSuccess?: boolean;
|
|
19
25
|
successColor?: string;
|
|
20
26
|
classNames?: BarcodeGuideOverlayClassNames;
|
|
21
27
|
};
|
|
22
|
-
export declare function BarcodeGuideOverlay({ aspectRatio, maskColor, cornerColor, cornerLength, cornerWidth, padding, borderRadius, headerText, instructionText, isSuccess, successColor, classNames, }: BarcodeGuideOverlayProps): import("react/jsx-runtime").JSX.Element;
|
|
28
|
+
export declare function BarcodeGuideOverlay({ aspectRatio, maskColor, cornerColor, cornerLength, cornerWidth, padding, borderRadius, headerText, instructionText, instructionCode, isSuccess, successColor, classNames, }: BarcodeGuideOverlayProps): import("react/jsx-runtime").JSX.Element;
|
|
23
29
|
//# sourceMappingURL=BarcodeGuideOverlay.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"BarcodeGuideOverlay.d.ts","sourceRoot":"","sources":["../../../src/components/barcode/BarcodeGuideOverlay.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAqB,MAAM,OAAO,CAAA;AAQvD,MAAM,MAAM,6BAA6B,GAAG;IAC1C,OAAO,CAAC,EAAE,MAAM,CAAA;IAChB,MAAM,CAAC,EAAE,MAAM,CAAA;IACf,MAAM,CAAC,EAAE,MAAM,CAAA;IACf,WAAW,CAAC,EAAE,MAAM,CAAA;CACrB,CAAA;AAED,MAAM,MAAM,wBAAwB,GAAG;IACrC,WAAW,CAAC,EAAE,MAAM,CAAA;IACpB,SAAS,CAAC,EAAE,MAAM,CAAA;IAClB,WAAW,CAAC,EAAE,MAAM,CAAA;IACpB,YAAY,CAAC,EAAE,MAAM,CAAA;IACrB,WAAW,CAAC,EAAE,MAAM,CAAA;IACpB,OAAO,CAAC,EAAE,MAAM,CAAA;IAChB,YAAY,CAAC,EAAE,MAAM,CAAA;IACrB,UAAU,CAAC,EAAE,MAAM,GAAG,YAAY,CAAA;IAClC,eAAe,CAAC,EAAE,MAAM,GAAG,YAAY,CAAA;IACvC,SAAS,CAAC,EAAE,OAAO,CAAA;IACnB,YAAY,CAAC,EAAE,MAAM,CAAA;IACrB,UAAU,CAAC,EAAE,6BAA6B,CAAA;CAC3C,CAAA;AAED,wBAAgB,mBAAmB,CAAC,EAClC,WAAiC,EACjC,SAAS,EACT,WAAqB,EACrB,YAAiB,EACjB,WAAe,EACf,OAAO,EACP,YAAgB,EAChB,UAA+B,EAC/B,eAAoF,EACpF,SAAiB,EACjB,YAAwB,EACxB,UAAe,GAChB,EAAE,wBAAwB,
|
|
1
|
+
{"version":3,"file":"BarcodeGuideOverlay.d.ts","sourceRoot":"","sources":["../../../src/components/barcode/BarcodeGuideOverlay.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAqB,MAAM,OAAO,CAAA;AAQvD,MAAM,MAAM,6BAA6B,GAAG;IAC1C,OAAO,CAAC,EAAE,MAAM,CAAA;IAChB,MAAM,CAAC,EAAE,MAAM,CAAA;IACf,MAAM,CAAC,EAAE,MAAM,CAAA;IACf,WAAW,CAAC,EAAE,MAAM,CAAA;CACrB,CAAA;AAED,MAAM,MAAM,wBAAwB,GAAG;IACrC,WAAW,CAAC,EAAE,MAAM,CAAA;IACpB,SAAS,CAAC,EAAE,MAAM,CAAA;IAClB,WAAW,CAAC,EAAE,MAAM,CAAA;IACpB,YAAY,CAAC,EAAE,MAAM,CAAA;IACrB,WAAW,CAAC,EAAE,MAAM,CAAA;IACpB,OAAO,CAAC,EAAE,MAAM,CAAA;IAChB,YAAY,CAAC,EAAE,MAAM,CAAA;IACrB,UAAU,CAAC,EAAE,MAAM,GAAG,YAAY,CAAA;IAClC,eAAe,CAAC,EAAE,MAAM,GAAG,YAAY,CAAA;IACvC;;;;OAIG;IACH,eAAe,CAAC,EAAE,MAAM,CAAA;IACxB,SAAS,CAAC,EAAE,OAAO,CAAA;IACnB,YAAY,CAAC,EAAE,MAAM,CAAA;IACrB,UAAU,CAAC,EAAE,6BAA6B,CAAA;CAC3C,CAAA;AAED,wBAAgB,mBAAmB,CAAC,EAClC,WAAiC,EACjC,SAAS,EACT,WAAqB,EACrB,YAAiB,EACjB,WAAe,EACf,OAAO,EACP,YAAgB,EAChB,UAA+B,EAC/B,eAAoF,EACpF,eAAe,EACf,SAAiB,EACjB,YAAwB,EACxB,UAAe,GAChB,EAAE,wBAAwB,2CA4J1B"}
|
|
@@ -5,7 +5,7 @@ import { resetCanvasDimensions, setCanvasDimensions } from '../../utils/canvas';
|
|
|
5
5
|
import { isMobile } from '../../utils/isMobile';
|
|
6
6
|
import useResizeObserver from '../../layout/useResizeObserver';
|
|
7
7
|
const PDF417_ASPECT_RATIO = 3 / 1;
|
|
8
|
-
export function BarcodeGuideOverlay({ aspectRatio = PDF417_ASPECT_RATIO, maskColor, cornerColor = 'white', cornerLength = 40, cornerWidth = 4, padding, borderRadius = 8, headerText = 'SCAN THE BARCODE', instructionText = 'Bring camera closer until the barcode fills the rectangular box.', isSuccess = false, successColor = '#22c55e', classNames = {}, }) {
|
|
8
|
+
export function BarcodeGuideOverlay({ aspectRatio = PDF417_ASPECT_RATIO, maskColor, cornerColor = 'white', cornerLength = 40, cornerWidth = 4, padding, borderRadius = 8, headerText = 'SCAN THE BARCODE', instructionText = 'Bring camera closer until the barcode fills the rectangular box.', instructionCode, isSuccess = false, successColor = '#22c55e', classNames = {}, }) {
|
|
9
9
|
const canvasRef = useRef(null);
|
|
10
10
|
const { ref: wrapperRef, width: wrapperWidth = 1, height: wrapperHeight = 1, } = useResizeObserver();
|
|
11
11
|
const theme = useTheme();
|
|
@@ -102,7 +102,7 @@ export function BarcodeGuideOverlay({ aspectRatio = PDF417_ASPECT_RATIO, maskCol
|
|
|
102
102
|
wrapperHeight,
|
|
103
103
|
wrapperWidth,
|
|
104
104
|
]);
|
|
105
|
-
return (_jsxs(Wrapper, { ref: wrapperRef, className: classNames.wrapper, children: [_jsx(Canvas, { ref: canvasRef, className: classNames.canvas }), _jsxs(TextOverlay, { children: [_jsx(HeaderText, { className: classNames.header, children: headerText }), _jsx(InstructionText, { className: classNames.instruction, children: instructionText })] })] }));
|
|
105
|
+
return (_jsxs(Wrapper, { ref: wrapperRef, className: classNames.wrapper, children: [_jsx(Canvas, { ref: canvasRef, className: classNames.canvas }), _jsxs(TextOverlay, { children: [_jsx(HeaderText, { className: classNames.header, children: headerText }), _jsx(InstructionText, { className: classNames.instruction, "data-guidance-code": instructionCode, children: instructionText })] })] }));
|
|
106
106
|
}
|
|
107
107
|
const Wrapper = styled.div `
|
|
108
108
|
position: absolute;
|
|
@@ -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;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"LoaderButton.d.ts","sourceRoot":"","sources":["../../../src/components/common/LoaderButton.tsx"],"names":[],"mappings":"AAAA,OAAO,
|
|
1
|
+
{"version":3,"file":"LoaderButton.d.ts","sourceRoot":"","sources":["../../../src/components/common/LoaderButton.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,oBAAoB,EAAE,aAAa,EAAE,SAAS,EAAc,MAAM,OAAO,CAAA;AAGlF,MAAM,MAAM,mBAAmB,GAC3B,SAAS,GACT,WAAW,GACX,UAAU,GACV,UAAU,GACV,SAAS,GACT,SAAS,CAAA;AAEb,MAAM,MAAM,kBAAkB,GAAG;IAC/B,eAAe,CAAC,EAAE,MAAM,CAAA;IACxB,WAAW,CAAC,EAAE,MAAM,CAAA;IACpB,SAAS,CAAC,EAAE,MAAM,CAAA;IAClB,sBAAsB,CAAC,EAAE,MAAM,CAAA;IAC/B,kBAAkB,CAAC,EAAE,MAAM,CAAA;IAC3B,gBAAgB,CAAC,EAAE,MAAM,CAAA;CAC1B,CAAA;AAED,MAAM,MAAM,iBAAiB,GAC3B,oBAAoB,CAAC,iBAAiB,CAAC,GAAG;IACxC,QAAQ,CAAC,EAAE,SAAS,CAAA;IACpB,SAAS,CAAC,EAAE,MAAM,CAAA;IAClB,QAAQ,CAAC,EAAE,OAAO,CAAA;IAClB;8DAC0D;IAC1D,QAAQ,CAAC,EAAE,OAAO,CAAA;IAClB,MAAM,CAAC,EAAE,kBAAkB,CAAA;IAC3B,OAAO,CAAC,EAAE,MAAM,IAAI,CAAA;IACpB,KAAK,CAAC,EAAE,aAAa,CAAA;IACrB,OAAO,CAAC,EAAE,mBAAmB,CAAA;CAC9B,CAAA;AAEH;;;;GAIG;AACH,eAAO,MAAM,YAAY;eAjBV,SAAS;gBACR,MAAM;eACP,OAAO;IAClB;8DAC0D;eAC/C,OAAO;aACT,kBAAkB;cACjB,MAAM,IAAI;YACZ,aAAa;cACX,mBAAmB;qDAyChC,CAAA"}
|