@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,40 @@
|
|
|
1
|
+
// Local theme palette/tokens used by the auto-capture screen.
|
|
2
|
+
export const theme = {
|
|
3
|
+
colors: {
|
|
4
|
+
background: '#F8FAFC',
|
|
5
|
+
surface: '#FFFFFF',
|
|
6
|
+
text: '#1A1A1A',
|
|
7
|
+
textSecondary: '#667085',
|
|
8
|
+
primary: '#151F72',
|
|
9
|
+
primaryText: '#FFFFFF',
|
|
10
|
+
secondary: '#F2F4F7',
|
|
11
|
+
secondaryText: '#344054',
|
|
12
|
+
success: '#2CC05C',
|
|
13
|
+
warning: '#F79009',
|
|
14
|
+
error: '#F04438',
|
|
15
|
+
border: '#E4E7EC',
|
|
16
|
+
overlay: 'rgba(0, 0, 0, 0.55)',
|
|
17
|
+
},
|
|
18
|
+
spacing: {
|
|
19
|
+
xs: '4px',
|
|
20
|
+
sm: '8px',
|
|
21
|
+
md: '16px',
|
|
22
|
+
lg: '24px',
|
|
23
|
+
xl: '32px',
|
|
24
|
+
xxl: '48px',
|
|
25
|
+
},
|
|
26
|
+
radii: {
|
|
27
|
+
sm: '4px',
|
|
28
|
+
md: '8px',
|
|
29
|
+
lg: '16px',
|
|
30
|
+
xl: '24px',
|
|
31
|
+
},
|
|
32
|
+
fonts: {
|
|
33
|
+
base: "'DM Sans', system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif",
|
|
34
|
+
},
|
|
35
|
+
shadows: {
|
|
36
|
+
sm: '0 1px 2px rgba(16, 24, 40, 0.05)',
|
|
37
|
+
md: '0 4px 8px -2px rgba(16, 24, 40, 0.1), 0 2px 4px -2px rgba(16, 24, 40, 0.06)',
|
|
38
|
+
lg: '0 12px 16px -4px rgba(16, 24, 40, 0.08), 0 4px 6px -2px rgba(16, 24, 40, 0.03)',
|
|
39
|
+
},
|
|
40
|
+
};
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
// Debug switch for the document auto-capture tooling (TuningPanel, ROI overlay,
|
|
2
|
+
// verbose console logs). Two conditions must BOTH hold:
|
|
3
|
+
//
|
|
4
|
+
// 1. Build-time gate `__SMILE_DEBUG__` — injected by the web-components Vite
|
|
5
|
+
// `define` (see vite.config.ts): true for dev + preview builds, false for
|
|
6
|
+
// production / npm-publish builds. This makes debug impossible to enable in
|
|
7
|
+
// production no matter what.
|
|
8
|
+
// 2. Runtime `?debug` URL param — the explicit per-session opt-in. The embed
|
|
9
|
+
// forwards the host page's `?debug` into the capture iframe
|
|
10
|
+
// (embed/src/js/script.js), so it reaches the component there too.
|
|
11
|
+
//
|
|
12
|
+
// Result: `?debug` toggles the tooling in dev + preview, and is inert in prod.
|
|
13
|
+
//
|
|
14
|
+
// `__SMILE_DEBUG__` is declared globally (lib/types.d.ts); the `typeof` guard
|
|
15
|
+
// avoids a ReferenceError under any bundler/test runner that doesn't inject the
|
|
16
|
+
// define (→ disabled).
|
|
17
|
+
export const isDebugEnabled = (): boolean => {
|
|
18
|
+
if (typeof __SMILE_DEBUG__ === 'undefined' || __SMILE_DEBUG__ !== true) {
|
|
19
|
+
return false;
|
|
20
|
+
}
|
|
21
|
+
return (
|
|
22
|
+
typeof window !== 'undefined' &&
|
|
23
|
+
new URLSearchParams(window.location.search).has('debug')
|
|
24
|
+
);
|
|
25
|
+
};
|
|
@@ -0,0 +1,86 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Lazy-load the OpenCV.js runtime exactly once. Resolves when `cv.Mat` is
|
|
3
|
+
* available (the runtime initialises asynchronously after the script loads).
|
|
4
|
+
*
|
|
5
|
+
* Hosts that already include opencv.js via a <script> tag will short-circuit
|
|
6
|
+
* — calling this function is a no-op once `window.cv.Mat` is defined.
|
|
7
|
+
*/
|
|
8
|
+
const OPENCV_SRC =
|
|
9
|
+
'https://web-models.smileidentity.com/open-cv/4.8.0-opencv.min.js';
|
|
10
|
+
|
|
11
|
+
declare global {
|
|
12
|
+
interface Window {
|
|
13
|
+
cv?: { Mat?: unknown } & Record<string, unknown>;
|
|
14
|
+
}
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
let inflight: Promise<void> | null = null;
|
|
18
|
+
|
|
19
|
+
// `typeof window === 'undefined'` covers server-side rendering hosts
|
|
20
|
+
// (React + Next.js, Remix, Astro, etc.) that import the bundle on the
|
|
21
|
+
// server during page generation. There's nothing to load there — the
|
|
22
|
+
// browser will run this again on hydration.
|
|
23
|
+
function isReady(): boolean {
|
|
24
|
+
return typeof window !== 'undefined' && !!window.cv && !!window.cv.Mat;
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
export function ensureOpenCv(): Promise<void> {
|
|
28
|
+
// SSR no-op (see isReady above).
|
|
29
|
+
if (typeof window === 'undefined') return Promise.resolve();
|
|
30
|
+
if (isReady()) return Promise.resolve();
|
|
31
|
+
if (inflight) return inflight;
|
|
32
|
+
|
|
33
|
+
const pending = new Promise<void>((resolve, reject) => {
|
|
34
|
+
const existing = document.querySelector(
|
|
35
|
+
`script[data-opencv-loader], script[src="${OPENCV_SRC}"]`,
|
|
36
|
+
);
|
|
37
|
+
|
|
38
|
+
const waitForRuntime = () => {
|
|
39
|
+
if (isReady()) {
|
|
40
|
+
resolve();
|
|
41
|
+
return;
|
|
42
|
+
}
|
|
43
|
+
// opencv.js sets a `Module.onRuntimeInitialized` hook; fall back to polling
|
|
44
|
+
// because some hosts replace the global Module object before we can patch it.
|
|
45
|
+
const start = Date.now();
|
|
46
|
+
const poll = () => {
|
|
47
|
+
if (isReady()) {
|
|
48
|
+
resolve();
|
|
49
|
+
return;
|
|
50
|
+
}
|
|
51
|
+
// Matches the 20s readiness window in useCardDetection (cvLoadFailed)
|
|
52
|
+
// and the documented behaviour — past this point the component has
|
|
53
|
+
// already surfaced the manual-capture fallback, so waiting longer is
|
|
54
|
+
// pointless.
|
|
55
|
+
if (Date.now() - start > 20_000) {
|
|
56
|
+
reject(new Error('OpenCV runtime did not initialise within 20s'));
|
|
57
|
+
return;
|
|
58
|
+
}
|
|
59
|
+
setTimeout(poll, 100);
|
|
60
|
+
};
|
|
61
|
+
poll();
|
|
62
|
+
};
|
|
63
|
+
|
|
64
|
+
if (existing) {
|
|
65
|
+
waitForRuntime();
|
|
66
|
+
return;
|
|
67
|
+
}
|
|
68
|
+
|
|
69
|
+
const script = document.createElement('script');
|
|
70
|
+
script.src = OPENCV_SRC;
|
|
71
|
+
script.async = true;
|
|
72
|
+
script.dataset.opencvLoader = 'document-auto-capture';
|
|
73
|
+
script.onload = waitForRuntime;
|
|
74
|
+
script.onerror = () => reject(new Error('Failed to load opencv.js'));
|
|
75
|
+
document.head.appendChild(script);
|
|
76
|
+
});
|
|
77
|
+
|
|
78
|
+
// Clear the cached promise on failure (load error / init timeout) so a later
|
|
79
|
+
// call can retry instead of getting the same rejected promise forever.
|
|
80
|
+
pending.catch(() => {
|
|
81
|
+
if (inflight === pending) inflight = null;
|
|
82
|
+
});
|
|
83
|
+
|
|
84
|
+
inflight = pending;
|
|
85
|
+
return pending;
|
|
86
|
+
}
|