@smileid/web-components 11.4.5 → 11.6.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/dist/esm/DocumentCaptureScreens-DjSTdVP-.js +5398 -0
- package/dist/esm/DocumentCaptureScreens-DjSTdVP-.js.map +1 -0
- package/dist/esm/{Navigation-Bb7MPLE8.js → Navigation-6DH3vF4-.js} +28 -22
- package/dist/esm/Navigation-6DH3vF4-.js.map +1 -0
- package/dist/esm/{PoweredBySmileId-CxbaihMu.js → PoweredBySmileId-DoKwoPUd.js} +424 -6
- package/dist/esm/PoweredBySmileId-DoKwoPUd.js.map +1 -0
- package/dist/esm/SelfieCaptureScreens-CtX-4Tco.js +11470 -0
- package/dist/esm/SelfieCaptureScreens-CtX-4Tco.js.map +1 -0
- package/dist/esm/combobox.js +1 -1
- package/dist/esm/document.js +1 -1
- package/dist/esm/end-user-consent.js +713 -2
- package/dist/esm/end-user-consent.js.map +1 -1
- package/dist/esm/index-BqyuTk9f.js +1366 -0
- package/dist/esm/{index-C4RTMbgw.js.map → index-BqyuTk9f.js.map} +1 -1
- package/dist/esm/localisation.js +1 -1
- package/dist/esm/main.js +14 -14
- package/dist/esm/navigation.js +1 -1
- package/dist/esm/package-CjZI-cNQ.js +2540 -0
- package/dist/esm/package-CjZI-cNQ.js.map +1 -0
- package/dist/esm/selfie.js +1 -1
- package/dist/esm/smart-camera-web.js +81 -37
- package/dist/esm/smart-camera-web.js.map +1 -1
- package/dist/esm/totp-consent.js +731 -2
- package/dist/esm/totp-consent.js.map +1 -1
- package/dist/esm/validate.js +31 -0
- package/dist/esm/validate.js.map +1 -0
- package/dist/smart-camera-web.js +1513 -383
- package/dist/smart-camera-web.js.map +1 -1
- package/dist/types/main.d.ts +18 -1
- package/dist/types/validate.d.ts +21 -0
- package/lib/components/document/src/DocumentCaptureScreens.js +97 -18
- package/lib/components/document/src/assets/lottie.d.ts +12 -0
- package/lib/components/document/src/assets/svg-inline.d.ts +8 -0
- package/lib/components/document/src/document-auto-capture/DocumentAutoCapture.stories.js +75 -0
- package/lib/components/document/src/document-auto-capture/DocumentAutoCapture.tsx +1458 -0
- package/lib/components/document/src/document-auto-capture/README.md +73 -0
- package/lib/components/document/src/document-auto-capture/assets/Greenbook_Shimmer.svg +42 -0
- package/lib/components/document/src/document-auto-capture/assets/ID_Back_Shimmer.svg +8 -0
- package/lib/components/document/src/document-auto-capture/assets/ID_Front_Shimmer.svg +20 -0
- package/lib/components/document/src/document-auto-capture/assets/Passport-Shimmer.svg +143 -0
- package/lib/components/document/src/document-auto-capture/assets/shimmers.ts +21 -0
- package/lib/components/document/src/document-auto-capture/assets/svg-raw.d.ts +4 -0
- package/lib/components/document/src/document-auto-capture/components/CaptureButton.tsx +122 -0
- package/lib/components/document/src/document-auto-capture/components/Overlay.tsx +167 -0
- package/lib/components/document/src/document-auto-capture/components/TuningPanel.tsx +856 -0
- package/lib/components/document/src/document-auto-capture/constants/captureLayout.ts +58 -0
- package/lib/components/document/src/document-auto-capture/detection/cvErrorRecovery.ts +40 -0
- package/lib/components/document/src/document-auto-capture/detection/documentAspect.ts +20 -0
- package/lib/components/document/src/document-auto-capture/detection/qualityScoring.ts +35 -0
- package/lib/components/document/src/document-auto-capture/detection/seamRejection.ts +209 -0
- package/lib/components/document/src/document-auto-capture/detection/synthesisTiming.ts +10 -0
- package/lib/components/document/src/document-auto-capture/hooks/useCamera.ts +117 -0
- package/lib/components/document/src/document-auto-capture/hooks/useCardDetection.ts +3059 -0
- package/lib/components/document/src/document-auto-capture/index.ts +4 -0
- package/lib/components/document/src/document-auto-capture/theme.ts +40 -0
- package/lib/components/document/src/document-auto-capture/utils/debug.ts +25 -0
- package/lib/components/document/src/document-auto-capture/utils/opencvLoader.ts +86 -0
- package/lib/components/document/src/document-capture-instructions/DocumentCaptureInstructions.tsx +327 -244
- package/lib/components/document/src/document-capture-review/DocumentCaptureReview.js +153 -189
- package/lib/components/document/src/document-capture-submission/DocumentCaptureSubmission.tsx +432 -0
- package/lib/components/document/src/document-capture-submission/index.js +3 -0
- package/lib/components/navigation/src/Navigation.js +27 -8
- package/lib/components/selfie/README.md +13 -0
- package/lib/components/selfie/src/SelfieCaptureScreens.js +56 -8
- package/lib/components/selfie/src/enhanced-smartselfie-capture/EnhancedSmartSelfieCapture.tsx +684 -0
- package/lib/components/selfie/src/enhanced-smartselfie-capture/EnhancedSmartSelfieConsent.tsx +71 -0
- package/lib/components/selfie/src/enhanced-smartselfie-capture/EnhancedSmartSelfieSubmission.tsx +181 -0
- package/lib/components/selfie/src/enhanced-smartselfie-capture/OvalProgress.tsx +87 -0
- package/lib/components/selfie/src/enhanced-smartselfie-capture/assets/Icon.svg +8 -0
- package/lib/components/selfie/src/enhanced-smartselfie-capture/assets/accessories.svg +77 -0
- package/lib/components/selfie/src/enhanced-smartselfie-capture/assets/active_liveness_animation.lottie +0 -0
- package/lib/components/selfie/src/enhanced-smartselfie-capture/assets/device.svg +12 -0
- package/lib/components/selfie/src/enhanced-smartselfie-capture/assets/device_orientation.lottie +0 -0
- package/lib/components/selfie/src/enhanced-smartselfie-capture/assets/good.svg +52 -0
- package/lib/components/selfie/src/enhanced-smartselfie-capture/assets/id-card.svg +9 -0
- package/lib/components/selfie/src/enhanced-smartselfie-capture/assets/illustrations.tsx +852 -0
- package/lib/components/selfie/src/enhanced-smartselfie-capture/assets/instructions-img.svg +3 -0
- package/lib/components/selfie/src/enhanced-smartselfie-capture/assets/multiple-faces.svg +69 -0
- package/lib/components/selfie/src/enhanced-smartselfie-capture/assets/person.svg +6 -0
- package/lib/components/selfie/src/enhanced-smartselfie-capture/assets/phone.svg +8 -0
- package/lib/components/selfie/src/enhanced-smartselfie-capture/assets/poor-lighting.svg +53 -0
- package/lib/components/selfie/src/enhanced-smartselfie-capture/assets/too_dark_animation.lottie +0 -0
- package/lib/components/selfie/src/enhanced-smartselfie-capture/components/ActiveLivenessOverlay.tsx +226 -0
- package/lib/components/selfie/src/enhanced-smartselfie-capture/components/AlertDisplay.tsx +38 -0
- package/lib/components/selfie/src/enhanced-smartselfie-capture/components/BackNavigation.tsx +45 -0
- package/lib/components/selfie/src/enhanced-smartselfie-capture/components/CameraPreview.tsx +96 -0
- package/lib/components/selfie/src/enhanced-smartselfie-capture/components/CaptureControls.tsx +97 -0
- package/lib/components/selfie/src/enhanced-smartselfie-capture/components/CaptureGuidelines.tsx +374 -0
- package/lib/components/selfie/src/enhanced-smartselfie-capture/components/ConsentView.tsx +460 -0
- package/lib/components/selfie/src/enhanced-smartselfie-capture/components/SubmissionView.tsx +426 -0
- package/lib/components/selfie/src/enhanced-smartselfie-capture/components/index.ts +3 -0
- package/lib/components/selfie/src/enhanced-smartselfie-capture/constants.ts +23 -0
- package/lib/components/selfie/src/enhanced-smartselfie-capture/hooks/index.ts +2 -0
- package/lib/components/selfie/src/enhanced-smartselfie-capture/hooks/useCamera.ts +238 -0
- package/lib/components/selfie/src/enhanced-smartselfie-capture/hooks/useFaceCapture.ts +1075 -0
- package/lib/components/selfie/src/enhanced-smartselfie-capture/index.ts +1 -0
- package/lib/components/selfie/src/enhanced-smartselfie-capture/utils/alertMessages.ts +20 -0
- package/lib/components/selfie/src/enhanced-smartselfie-capture/utils/canvas.ts +108 -0
- package/lib/components/selfie/src/enhanced-smartselfie-capture/utils/faceDetection.ts +545 -0
- package/lib/components/selfie/src/enhanced-smartselfie-capture/utils/imageCapture.ts +66 -0
- package/lib/components/selfie/src/enhanced-smartselfie-capture/utils/imageQuality.ts +151 -0
- package/lib/components/selfie/src/enhanced-smartselfie-capture/utils/index.ts +5 -0
- package/lib/components/selfie/src/enhanced-smartselfie-capture/utils/mediapipeManager.ts +215 -0
- package/lib/components/selfie/src/selfie-capture-wrapper/SelfieCaptureWrapper.tsx +24 -1
- package/lib/components/selfie/src/smartselfie-capture/SmartSelfieCapture.tsx +2 -2
- package/lib/components/selfie/src/smartselfie-capture/hooks/useFaceCapture.ts +15 -7
- package/lib/components/selfie/src/smartselfie-capture/utils/canvas.ts +4 -6
- package/lib/components/signature-pad/package.json +1 -1
- package/lib/components/smart-camera-web/src/README.md +11 -0
- package/lib/components/smart-camera-web/src/SmartCameraWeb.js +89 -8
- package/lib/components/totp-consent/src/TotpConsent.js +1 -1
- package/lib/domain/localisation/index.js +2 -2
- package/package.json +9 -5
- package/dist/esm/DocumentCaptureScreens-D2G0NOQr.js +0 -4147
- package/dist/esm/DocumentCaptureScreens-D2G0NOQr.js.map +0 -1
- package/dist/esm/EndUserConsent-uHfA3txP.js +0 -717
- package/dist/esm/EndUserConsent-uHfA3txP.js.map +0 -1
- package/dist/esm/Navigation-Bb7MPLE8.js.map +0 -1
- package/dist/esm/PoweredBySmileId-CxbaihMu.js.map +0 -1
- package/dist/esm/SelfieCaptureScreens-Dr7VzON7.js +0 -7651
- package/dist/esm/SelfieCaptureScreens-Dr7VzON7.js.map +0 -1
- package/dist/esm/TotpConsent-Depzg0ti.js +0 -734
- package/dist/esm/TotpConsent-Depzg0ti.js.map +0 -1
- package/dist/esm/index-C4RTMbgw.js +0 -1360
- package/dist/esm/package-D6YrpMcO.js +0 -565
- package/dist/esm/package-D6YrpMcO.js.map +0 -1
- package/dist/esm/styles-BTEClL7R.js +0 -419
- package/dist/esm/styles-BTEClL7R.js.map +0 -1
- /package/lib/components/document/src/assets/lottie/{taking photo of green book passport.lottie → greenbook.lottie} +0 -0
- /package/lib/components/document/src/assets/lottie/{taking photo of ID FLIP 2D.lottie → id-card-flip.lottie} +0 -0
- /package/lib/components/document/src/assets/lottie/{taking photo of ID.lottie → id-card.lottie} +0 -0
- /package/lib/components/document/src/assets/lottie/{taking photo of passport 2.lottie → passport.lottie} +0 -0
|
@@ -0,0 +1,167 @@
|
|
|
1
|
+
import { useRef, useEffect } from 'preact/hooks';
|
|
2
|
+
import type { FunctionComponent } from 'preact';
|
|
3
|
+
import { COMPLIANCE_STATES } from '../hooks/useCardDetection';
|
|
4
|
+
import { getShimmerSvg, type ShimmerDocType } from '../assets/shimmers';
|
|
5
|
+
|
|
6
|
+
type ComplianceState =
|
|
7
|
+
(typeof COMPLIANCE_STATES)[keyof typeof COMPLIANCE_STATES];
|
|
8
|
+
|
|
9
|
+
type DebugPathPoint = { x: number; y: number };
|
|
10
|
+
type DebugPath = DebugPathPoint[] & { roiWidth?: number; roiHeight?: number };
|
|
11
|
+
|
|
12
|
+
interface OverlayProps {
|
|
13
|
+
complianceState: ComplianceState;
|
|
14
|
+
debugPath?: DebugPath | null;
|
|
15
|
+
showDebug?: boolean;
|
|
16
|
+
guideAspectRatio?: number;
|
|
17
|
+
detectedDocType?: ShimmerDocType;
|
|
18
|
+
sideOfId?: string;
|
|
19
|
+
isRotated?: boolean;
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
export const Overlay: FunctionComponent<OverlayProps> = ({
|
|
23
|
+
complianceState,
|
|
24
|
+
debugPath,
|
|
25
|
+
showDebug = false,
|
|
26
|
+
guideAspectRatio = 1.585,
|
|
27
|
+
detectedDocType = null,
|
|
28
|
+
sideOfId = 'Front',
|
|
29
|
+
isRotated = false,
|
|
30
|
+
}) => {
|
|
31
|
+
const canvasRef = useRef<HTMLCanvasElement | null>(null);
|
|
32
|
+
const guideBoxRef = useRef<HTMLDivElement | null>(null);
|
|
33
|
+
|
|
34
|
+
useEffect(() => {
|
|
35
|
+
const canvas = canvasRef.current;
|
|
36
|
+
if (!canvas) return;
|
|
37
|
+
|
|
38
|
+
const ctx = canvas.getContext('2d');
|
|
39
|
+
if (!ctx) return;
|
|
40
|
+
ctx.clearRect(0, 0, canvas.width, canvas.height);
|
|
41
|
+
|
|
42
|
+
// Only draw the detected card polygon in debug mode
|
|
43
|
+
if (showDebug && debugPath && debugPath.length > 0) {
|
|
44
|
+
// Points are in ROI (video native) coords — scale to canvas (CSS guide box) size
|
|
45
|
+
const scaleX = canvas.width / (debugPath.roiWidth || 1);
|
|
46
|
+
const scaleY = canvas.height / (debugPath.roiHeight || 1);
|
|
47
|
+
|
|
48
|
+
ctx.beginPath();
|
|
49
|
+
ctx.moveTo(debugPath[0].x * scaleX, debugPath[0].y * scaleY);
|
|
50
|
+
for (let i = 1; i < debugPath.length; i++) {
|
|
51
|
+
ctx.lineTo(debugPath[i].x * scaleX, debugPath[i].y * scaleY);
|
|
52
|
+
}
|
|
53
|
+
ctx.closePath();
|
|
54
|
+
|
|
55
|
+
ctx.lineWidth = 2;
|
|
56
|
+
ctx.strokeStyle = '#00FF00';
|
|
57
|
+
ctx.stroke();
|
|
58
|
+
|
|
59
|
+
ctx.fillStyle = 'rgba(0, 255, 0, 0.15)';
|
|
60
|
+
ctx.fill();
|
|
61
|
+
}
|
|
62
|
+
}, [debugPath, showDebug]);
|
|
63
|
+
|
|
64
|
+
// Resize debug canvas to match guide box
|
|
65
|
+
useEffect(() => {
|
|
66
|
+
const resizeCanvas = () => {
|
|
67
|
+
if (canvasRef.current && guideBoxRef.current) {
|
|
68
|
+
const rect = guideBoxRef.current.getBoundingClientRect();
|
|
69
|
+
canvasRef.current.width = rect.width;
|
|
70
|
+
canvasRef.current.height = rect.height;
|
|
71
|
+
}
|
|
72
|
+
};
|
|
73
|
+
resizeCanvas();
|
|
74
|
+
// ResizeObserver is missing on older browsers; the debug canvas is
|
|
75
|
+
// optional, so fall back to the initial size rather than throwing.
|
|
76
|
+
if (typeof ResizeObserver === 'undefined') return undefined;
|
|
77
|
+
const observer = new ResizeObserver(resizeCanvas);
|
|
78
|
+
if (guideBoxRef.current) observer.observe(guideBoxRef.current);
|
|
79
|
+
return () => observer.disconnect();
|
|
80
|
+
}, []);
|
|
81
|
+
|
|
82
|
+
// Keep the guide visible across all states (including STABLE / CAPTURING /
|
|
83
|
+
// SUCCESS) so users see the green outline confirm the lock-in. Only hide
|
|
84
|
+
// it if compliance state is missing.
|
|
85
|
+
const shimmerVisible = Boolean(complianceState);
|
|
86
|
+
const shimmerSvg = getShimmerSvg(detectedDocType, sideOfId);
|
|
87
|
+
|
|
88
|
+
let shimmerColor: string;
|
|
89
|
+
if (
|
|
90
|
+
complianceState === COMPLIANCE_STATES.STABLE ||
|
|
91
|
+
complianceState === COMPLIANCE_STATES.SUCCESS ||
|
|
92
|
+
complianceState === COMPLIANCE_STATES.CAPTURING
|
|
93
|
+
) {
|
|
94
|
+
shimmerColor = '#2CC05C';
|
|
95
|
+
} else if (complianceState === COMPLIANCE_STATES.DETECTING) {
|
|
96
|
+
shimmerColor = '#F59E0B';
|
|
97
|
+
} else {
|
|
98
|
+
shimmerColor = '#FFFFFF';
|
|
99
|
+
}
|
|
100
|
+
|
|
101
|
+
// Inject sizing + swap ONLY the first stroke="white" to currentColor.
|
|
102
|
+
// The first <path> in each shimmer SVG is the outer card outline; later
|
|
103
|
+
// paths are interior decoration (face, text lines) and stay white.
|
|
104
|
+
const shimmerHtml = shimmerSvg
|
|
105
|
+
.replace(
|
|
106
|
+
/<svg([^>]*)>/,
|
|
107
|
+
'<svg$1 style="width:100%;height:100%;display:block;" preserveAspectRatio="xMidYMid meet">',
|
|
108
|
+
)
|
|
109
|
+
.replace('stroke="white"', 'stroke="currentColor"');
|
|
110
|
+
|
|
111
|
+
return (
|
|
112
|
+
<div
|
|
113
|
+
style={{
|
|
114
|
+
position: 'absolute',
|
|
115
|
+
top: 0,
|
|
116
|
+
left: 0,
|
|
117
|
+
right: 0,
|
|
118
|
+
bottom: 0,
|
|
119
|
+
pointerEvents: 'none',
|
|
120
|
+
display: 'flex',
|
|
121
|
+
flexDirection: 'column',
|
|
122
|
+
alignItems: 'center',
|
|
123
|
+
justifyContent: 'center',
|
|
124
|
+
}}
|
|
125
|
+
>
|
|
126
|
+
{/* Shimmer SVG is the guide — replaces the bordered guide box entirely. */}
|
|
127
|
+
<div
|
|
128
|
+
ref={guideBoxRef}
|
|
129
|
+
className="guide-box"
|
|
130
|
+
style={{
|
|
131
|
+
width: isRotated ? 'calc(100% - 16rem)' : 'calc(100% - 4rem)',
|
|
132
|
+
maxWidth: '480px',
|
|
133
|
+
aspectRatio: `${guideAspectRatio} / 1`,
|
|
134
|
+
position: 'relative',
|
|
135
|
+
opacity: shimmerVisible ? 1 : 0,
|
|
136
|
+
color: shimmerColor,
|
|
137
|
+
transition: 'opacity 0.3s ease, color 0.3s ease',
|
|
138
|
+
}}
|
|
139
|
+
>
|
|
140
|
+
<div
|
|
141
|
+
aria-hidden="true"
|
|
142
|
+
style={{
|
|
143
|
+
position: 'absolute',
|
|
144
|
+
inset: 0,
|
|
145
|
+
pointerEvents: 'none',
|
|
146
|
+
}}
|
|
147
|
+
dangerouslySetInnerHTML={{ __html: shimmerHtml }}
|
|
148
|
+
/>
|
|
149
|
+
|
|
150
|
+
{/* Debug contour canvas — only visible in debug mode */}
|
|
151
|
+
{showDebug && (
|
|
152
|
+
<canvas
|
|
153
|
+
ref={canvasRef}
|
|
154
|
+
style={{
|
|
155
|
+
position: 'absolute',
|
|
156
|
+
top: 0,
|
|
157
|
+
left: 0,
|
|
158
|
+
width: '100%',
|
|
159
|
+
height: '100%',
|
|
160
|
+
pointerEvents: 'none',
|
|
161
|
+
}}
|
|
162
|
+
/>
|
|
163
|
+
)}
|
|
164
|
+
</div>
|
|
165
|
+
</div>
|
|
166
|
+
);
|
|
167
|
+
};
|