@smileid/web-components 11.3.0 → 11.4.1
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-wvJcTVkA.js +4147 -0
- package/dist/esm/DocumentCaptureScreens-wvJcTVkA.js.map +1 -0
- package/dist/esm/{EndUserConsent-BgKCCMMn.js → EndUserConsent-BXvS7t8z.js} +4 -4
- package/dist/esm/{EndUserConsent-BgKCCMMn.js.map → EndUserConsent-BXvS7t8z.js.map} +1 -1
- package/dist/esm/Navigation-BRFmg7s1.js +138 -0
- package/dist/esm/Navigation-BRFmg7s1.js.map +1 -0
- package/dist/esm/{SelfieCaptureScreens-DKd0f7K8.js → SelfieCaptureScreens-BkJBfzHv.js} +2651 -3086
- package/dist/esm/SelfieCaptureScreens-BkJBfzHv.js.map +1 -0
- package/dist/esm/{TotpConsent-BQm8j4-u.js → TotpConsent-Cn2DkVza.js} +2 -2
- package/dist/esm/{TotpConsent-BQm8j4-u.js.map → TotpConsent-Cn2DkVza.js.map} +1 -1
- package/dist/esm/combobox.js +14 -16
- package/dist/esm/combobox.js.map +1 -1
- package/dist/esm/document.js +1 -1
- package/dist/esm/end-user-consent.js +1 -1
- package/dist/esm/{index-Cjzs1eA_.js → index-DBUdxnp9.js} +91 -91
- package/dist/esm/{index-Cjzs1eA_.js.map → index-DBUdxnp9.js.map} +1 -1
- package/dist/esm/localisation.js +1 -1
- package/dist/esm/main.js +6 -6
- package/dist/esm/navigation.js +1 -1
- package/dist/esm/package-Dax8ezDK.js +565 -0
- package/dist/esm/package-Dax8ezDK.js.map +1 -0
- package/dist/esm/selfie.js +1 -1
- package/dist/esm/smart-camera-web.js +16 -11
- package/dist/esm/smart-camera-web.js.map +1 -1
- package/dist/esm/{styles-BOEZtbuc.js → styles-BTEClL7R.js} +2 -2
- package/dist/esm/{styles-BOEZtbuc.js.map → styles-BTEClL7R.js.map} +1 -1
- package/dist/esm/totp-consent.js +1 -1
- package/dist/smart-camera-web.js +446 -179
- package/dist/smart-camera-web.js.map +1 -1
- package/dist/types/main.d.ts +183 -33
- package/lib/components/combobox/src/Combobox.js +14 -12
- package/lib/components/document/src/DocumentCaptureScreens.js +15 -5
- package/lib/components/document/src/assets/icons/guidelines/greenbook/good.svg +77 -0
- package/lib/components/document/src/assets/icons/guidelines/greenbook/not-blurry.svg +84 -0
- package/lib/components/document/src/assets/icons/guidelines/greenbook/not-cropped.svg +83 -0
- package/lib/components/document/src/assets/icons/guidelines/greenbook/not-reflective.svg +89 -0
- package/lib/components/document/src/assets/icons/guidelines/id-card/good.svg +87 -0
- package/lib/components/document/src/assets/icons/guidelines/id-card/not-blurry.svg +100 -0
- package/lib/components/document/src/assets/icons/guidelines/id-card/not-cropped.svg +93 -0
- package/lib/components/document/src/assets/icons/guidelines/id-card/not-reflective.svg +98 -0
- package/lib/components/document/src/assets/icons/guidelines/passport/good.svg +91 -0
- package/lib/components/document/src/assets/icons/guidelines/passport/not-blurry.svg +109 -0
- package/lib/components/document/src/assets/icons/guidelines/passport/not-cropped.svg +102 -0
- package/lib/components/document/src/assets/icons/guidelines/passport/not-reflective.svg +207 -0
- package/lib/components/document/src/assets/lottie/taking photo of ID FLIP 2D.lottie +0 -0
- package/lib/components/document/src/assets/lottie/taking photo of ID.lottie +0 -0
- package/lib/components/document/src/assets/lottie/taking photo of green book passport.lottie +0 -0
- package/lib/components/document/src/assets/lottie/taking photo of passport 2.lottie +0 -0
- package/lib/components/document/src/document-capture-instructions/DocumentCaptureInstructions.stories.js +123 -12
- package/lib/components/document/src/document-capture-instructions/DocumentCaptureInstructions.tsx +808 -0
- package/lib/components/document/src/document-capture-instructions/index.js +1 -0
- package/lib/components/navigation/src/Navigation.js +57 -56
- package/lib/components/navigation/src/Navigation.stories.js +7 -0
- package/lib/components/selfie/src/smartselfie-capture/SmartSelfieCapture.tsx +3 -15
- package/lib/components/selfie/src/smartselfie-capture/components/CameraPreview.tsx +6 -10
- package/lib/components/selfie/src/smartselfie-capture/components/CaptureControls.tsx +7 -1
- package/lib/components/selfie/src/smartselfie-capture/hooks/useFaceCapture.ts +33 -19
- package/lib/components/selfie/src/smartselfie-capture/utils/alertMessages.ts +0 -1
- package/lib/components/selfie/src/smartselfie-capture/utils/mediapipeManager.ts +127 -30
- package/lib/components/signature-pad/package-lock.json +24 -19
- package/lib/components/signature-pad/package.json +1 -1
- package/lib/components/smart-camera-web/src/SmartCameraWeb.js +7 -1
- package/lib/styles/src/styles.js +1 -1
- package/package.json +5 -3
- package/dist/README.md +0 -15
- package/dist/components/README.md +0 -14
- package/dist/components/document/src/README.md +0 -111
- package/dist/components/document/src/document-capture/README.md +0 -90
- package/dist/components/document/src/document-capture-instructions/README.md +0 -56
- package/dist/components/document/src/document-capture-review/README.md +0 -79
- package/dist/components/selfie/README.md +0 -225
- package/dist/components/smart-camera-web/src/README.md +0 -206
- package/dist/domain/camera/src/README.md +0 -38
- package/dist/domain/file-upload/README.md +0 -35
- package/dist/esm/DocumentCaptureScreens-N-0o7eE5.js +0 -1580
- package/dist/esm/DocumentCaptureScreens-N-0o7eE5.js.map +0 -1
- package/dist/esm/Navigation-DOFYqTZt.js +0 -144
- package/dist/esm/Navigation-DOFYqTZt.js.map +0 -1
- package/dist/esm/SelfieCaptureScreens-DKd0f7K8.js.map +0 -1
- package/dist/esm/package-KQ2l43v1.js +0 -90
- package/dist/esm/package-KQ2l43v1.js.map +0 -1
- package/dist/package-lock.json +0 -4948
- package/dist/package.json +0 -59
- package/dist/smart-camera-web.js.gz +0 -0
- package/dist/src/components/combobox/src/index.js +0 -425
- package/dist/src/components/combobox/src/index.js.map +0 -7
- package/dist/src/components/document/src/index.js +0 -1423
- package/dist/src/components/document/src/index.js.map +0 -7
- package/dist/src/components/end-user-consent/src/index.js +0 -1586
- package/dist/src/components/end-user-consent/src/index.js.map +0 -7
- package/dist/src/components/selfie/src/index.js +0 -1221
- package/dist/src/components/selfie/src/index.js.map +0 -7
- package/dist/src/components/signature-pad/src/index.js +0 -796
- package/dist/src/components/signature-pad/src/index.js.map +0 -7
- package/dist/src/components/smart-camera-web/src/SmartCameraWeb.js +0 -2754
- package/dist/src/components/smart-camera-web/src/SmartCameraWeb.js.map +0 -7
- package/dist/src/components/totp-consent/src/index.js +0 -1305
- package/dist/src/components/totp-consent/src/index.js.map +0 -7
- package/dist/src/index.js.map +0 -7
- package/dist/styles/README.md +0 -3
- package/dist/types/locale.d.ts +0 -19
|
@@ -1,7 +1,65 @@
|
|
|
1
1
|
import { FaceLandmarker, FilesetResolver } from '@mediapipe/tasks-vision';
|
|
2
2
|
|
|
3
|
-
|
|
4
|
-
|
|
3
|
+
const EXCLUDED_GPUS = [
|
|
4
|
+
'adreno-830',
|
|
5
|
+
'adreno-8xx',
|
|
6
|
+
'adreno-9xx',
|
|
7
|
+
'adreno-840',
|
|
8
|
+
'adreno-810',
|
|
9
|
+
];
|
|
10
|
+
|
|
11
|
+
const normalizeGpuText = (value: string): string =>
|
|
12
|
+
value
|
|
13
|
+
.toLowerCase()
|
|
14
|
+
.replace(/\(tm\)|\btm\b/g, '')
|
|
15
|
+
.replace(/[^a-z0-9]/g, '');
|
|
16
|
+
|
|
17
|
+
const matchesExcludedGpu = (value: string): boolean => {
|
|
18
|
+
const normalizedValue = normalizeGpuText(value);
|
|
19
|
+
|
|
20
|
+
return EXCLUDED_GPUS.some((gpuPattern) => {
|
|
21
|
+
const normalizedPattern = normalizeGpuText(gpuPattern);
|
|
22
|
+
|
|
23
|
+
if (normalizedPattern.endsWith('xx')) {
|
|
24
|
+
const familyPrefix = normalizedPattern.slice(0, -2);
|
|
25
|
+
return new RegExp(`${familyPrefix}\\d{2}`).test(normalizedValue);
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
return normalizedValue.includes(normalizedPattern);
|
|
29
|
+
});
|
|
30
|
+
};
|
|
31
|
+
|
|
32
|
+
/**
|
|
33
|
+
* @description Gets the GPU renderer string using WebGL debug info extension.
|
|
34
|
+
* @returns {string | null} The GPU renderer string or null if unavailable.
|
|
35
|
+
*/
|
|
36
|
+
const getGpuRenderer = (): string | null => {
|
|
37
|
+
try {
|
|
38
|
+
const canvas = document.createElement('canvas');
|
|
39
|
+
const gl =
|
|
40
|
+
canvas.getContext('webgl') || canvas.getContext('experimental-webgl');
|
|
41
|
+
if (!gl || !(gl instanceof WebGLRenderingContext)) return null;
|
|
42
|
+
|
|
43
|
+
const ext = gl.getExtension('WEBGL_debug_renderer_info');
|
|
44
|
+
if (!ext) return null;
|
|
45
|
+
|
|
46
|
+
return gl.getParameter(ext.UNMASKED_RENDERER_WEBGL) as string | null;
|
|
47
|
+
} catch {
|
|
48
|
+
return null;
|
|
49
|
+
}
|
|
50
|
+
};
|
|
51
|
+
|
|
52
|
+
/**
|
|
53
|
+
* @description Checks if the GPU renderer matches any excluded GPU.
|
|
54
|
+
* @param {string | null} [renderer] Optional GPU renderer string to use. If not provided, it will be fetched via WebGL.
|
|
55
|
+
* @returns {boolean} True if the GPU is excluded.
|
|
56
|
+
*/
|
|
57
|
+
const isExcludedGpuFromWebGL = (renderer?: string | null): boolean => {
|
|
58
|
+
const rendererString = (renderer ?? getGpuRenderer())?.toLowerCase() ?? '';
|
|
59
|
+
if (!rendererString) return false;
|
|
60
|
+
|
|
61
|
+
return matchesExcludedGpu(rendererString);
|
|
62
|
+
};
|
|
5
63
|
|
|
6
64
|
declare global {
|
|
7
65
|
interface Window {
|
|
@@ -14,38 +72,70 @@ declare global {
|
|
|
14
72
|
}
|
|
15
73
|
|
|
16
74
|
/**
|
|
17
|
-
* @description
|
|
18
|
-
*
|
|
19
|
-
* @returns {Promise<boolean>} - True if the device model is in the exclusion list.
|
|
75
|
+
* @description Reads system architecture hints from User-Agent Client Hints.
|
|
76
|
+
* @returns {Promise<string | null>} Lower-cased hint string or null when hints are unavailable.
|
|
20
77
|
*/
|
|
21
|
-
const
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
// Request the 'model' high-entropy value and destructure it directly
|
|
26
|
-
const { model } = await navigator.userAgentData.getHighEntropyValues([
|
|
27
|
-
'model',
|
|
28
|
-
]);
|
|
78
|
+
const getSystemArchitectureHints = async (): Promise<string | null> => {
|
|
79
|
+
if (typeof navigator === 'undefined' || !(navigator as any).userAgentData) {
|
|
80
|
+
return null;
|
|
81
|
+
}
|
|
29
82
|
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
83
|
+
try {
|
|
84
|
+
const hints = await (navigator as any).userAgentData.getHighEntropyValues([
|
|
85
|
+
'architecture',
|
|
86
|
+
'model',
|
|
87
|
+
'platform',
|
|
88
|
+
'platformVersion',
|
|
89
|
+
'fullVersionList',
|
|
90
|
+
]);
|
|
91
|
+
|
|
92
|
+
return JSON.stringify(hints).toLowerCase();
|
|
93
|
+
} catch (error) {
|
|
94
|
+
console.warn('UA-CH architecture hints fetch failed.', error);
|
|
95
|
+
return null;
|
|
96
|
+
}
|
|
97
|
+
};
|
|
98
|
+
|
|
99
|
+
/**
|
|
100
|
+
* @description Determines the MediaPipe delegate based on WebGL renderer info and UA-CH hints.
|
|
101
|
+
* Uses WebGL renderer as primary detection, UA-CH hints as secondary.
|
|
102
|
+
* @returns {Promise<'CPU' | 'GPU'>} CPU when excluded GPU is detected; otherwise GPU.
|
|
103
|
+
*/
|
|
104
|
+
const getDelegateFromGpuDetection = async (): Promise<'CPU' | 'GPU'> => {
|
|
105
|
+
const renderer = getGpuRenderer();
|
|
106
|
+
const hasWebGlRendererInfo = !!renderer;
|
|
107
|
+
|
|
108
|
+
// Primary check: WebGL renderer info (most reliable for GPU detection)
|
|
109
|
+
if (isExcludedGpuFromWebGL(renderer)) {
|
|
110
|
+
console.info(`[SmileID] Excluded GPU via WebGL: ${renderer}. Using CPU.`);
|
|
111
|
+
return 'CPU';
|
|
112
|
+
}
|
|
33
113
|
|
|
34
|
-
|
|
114
|
+
// Secondary check: UA-CH hints (may contain GPU info in some browsers)
|
|
115
|
+
const hintString = await getSystemArchitectureHints();
|
|
116
|
+
const hasUaHints = !!hintString;
|
|
35
117
|
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
console.
|
|
41
|
-
|
|
42
|
-
error,
|
|
43
|
-
);
|
|
44
|
-
return false;
|
|
118
|
+
if (hintString) {
|
|
119
|
+
const hasExcludedGpuInHints = matchesExcludedGpu(hintString);
|
|
120
|
+
|
|
121
|
+
if (hasExcludedGpuInHints) {
|
|
122
|
+
console.info(`[SmileID] Excluded GPU via UA-CH hints. Using CPU.`);
|
|
123
|
+
return 'CPU';
|
|
45
124
|
}
|
|
46
125
|
}
|
|
47
|
-
|
|
48
|
-
|
|
126
|
+
|
|
127
|
+
if (!hasWebGlRendererInfo && !hasUaHints) {
|
|
128
|
+
console.info(
|
|
129
|
+
'[SmileID] No WebGL renderer or UA-CH hints available. Using CPU.',
|
|
130
|
+
);
|
|
131
|
+
return 'CPU';
|
|
132
|
+
}
|
|
133
|
+
|
|
134
|
+
// Default to GPU when no exclusion is detected
|
|
135
|
+
console.info(
|
|
136
|
+
`[SmileID] No excluded GPU detected. WebGL renderer: ${renderer ?? 'unavailable'}. Using GPU.`,
|
|
137
|
+
);
|
|
138
|
+
return 'GPU';
|
|
49
139
|
};
|
|
50
140
|
|
|
51
141
|
// this was added because devices (mostly older) that do not support FP16 will fail to load the model.
|
|
@@ -91,12 +181,14 @@ export const getMediapipeInstance = async (): Promise<FaceLandmarker> => {
|
|
|
91
181
|
'https://web-models.smileidentity.com/mediapipe-tasks-vision-wasm',
|
|
92
182
|
);
|
|
93
183
|
|
|
94
|
-
const
|
|
184
|
+
const gpuDelegate = await getDelegateFromGpuDetection();
|
|
185
|
+
const delegate =
|
|
186
|
+
gpuDelegate === 'CPU' || !hasFP16Support() ? 'CPU' : 'GPU';
|
|
95
187
|
|
|
96
188
|
const faceLandmarker = await FaceLandmarker.createFromOptions(vision, {
|
|
97
189
|
baseOptions: {
|
|
98
190
|
modelAssetPath: `https://web-models.smileidentity.com/face_landmarker/face_landmarker.task`,
|
|
99
|
-
delegate
|
|
191
|
+
delegate,
|
|
100
192
|
},
|
|
101
193
|
outputFaceBlendshapes: true,
|
|
102
194
|
runningMode: 'VIDEO',
|
|
@@ -116,3 +208,8 @@ export const getMediapipeInstance = async (): Promise<FaceLandmarker> => {
|
|
|
116
208
|
|
|
117
209
|
return mediapipeGlobal.loading;
|
|
118
210
|
};
|
|
211
|
+
|
|
212
|
+
export const __testUtils = {
|
|
213
|
+
matchesExcludedGpu,
|
|
214
|
+
getDelegateFromGpuDetection,
|
|
215
|
+
};
|
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@smileid/signature-pad",
|
|
3
|
-
"version": "11.0
|
|
3
|
+
"version": "11.4.0",
|
|
4
4
|
"lockfileVersion": 3,
|
|
5
5
|
"requires": true,
|
|
6
6
|
"packages": {
|
|
7
7
|
"": {
|
|
8
8
|
"name": "@smileid/signature-pad",
|
|
9
|
-
"version": "11.0
|
|
9
|
+
"version": "11.4.0",
|
|
10
10
|
"dependencies": {
|
|
11
11
|
"signature_pad": "^5.0.2"
|
|
12
12
|
},
|
|
@@ -224,21 +224,23 @@
|
|
|
224
224
|
}
|
|
225
225
|
},
|
|
226
226
|
"node_modules/@typescript-eslint/typescript-estree/node_modules/brace-expansion": {
|
|
227
|
-
"version": "2.0.
|
|
228
|
-
"resolved": "https://registry.npmjs.org/brace-expansion/-/brace-expansion-2.0.
|
|
229
|
-
"integrity": "sha512-
|
|
227
|
+
"version": "2.0.2",
|
|
228
|
+
"resolved": "https://registry.npmjs.org/brace-expansion/-/brace-expansion-2.0.2.tgz",
|
|
229
|
+
"integrity": "sha512-Jt0vHyM+jmUBqojB7E1NIYadt0vI0Qxjxd2TErW94wDz+E2LAm5vKMXXwg6ZZBTHPuUlDgQHKXvjGBdfcF1ZDQ==",
|
|
230
230
|
"dev": true,
|
|
231
|
+
"license": "MIT",
|
|
231
232
|
"dependencies": {
|
|
232
233
|
"balanced-match": "^1.0.0"
|
|
233
234
|
}
|
|
234
235
|
},
|
|
235
236
|
"node_modules/@typescript-eslint/typescript-estree/node_modules/minimatch": {
|
|
236
|
-
"version": "9.0.
|
|
237
|
-
"resolved": "https://registry.npmjs.org/minimatch/-/minimatch-9.0.
|
|
238
|
-
"integrity": "sha512-
|
|
237
|
+
"version": "9.0.9",
|
|
238
|
+
"resolved": "https://registry.npmjs.org/minimatch/-/minimatch-9.0.9.tgz",
|
|
239
|
+
"integrity": "sha512-OBwBN9AL4dqmETlpS2zasx+vTeWclWzkblfZk7KTA5j3jeOONz/tRCnZomUyvNg83wL5Zv9Ss6HMJXAgL8R2Yg==",
|
|
239
240
|
"dev": true,
|
|
241
|
+
"license": "ISC",
|
|
240
242
|
"dependencies": {
|
|
241
|
-
"brace-expansion": "^2.0.
|
|
243
|
+
"brace-expansion": "^2.0.2"
|
|
242
244
|
},
|
|
243
245
|
"engines": {
|
|
244
246
|
"node": ">=16 || 14 >=14.17"
|
|
@@ -1357,10 +1359,11 @@
|
|
|
1357
1359
|
}
|
|
1358
1360
|
},
|
|
1359
1361
|
"node_modules/flatted": {
|
|
1360
|
-
"version": "3.
|
|
1361
|
-
"resolved": "https://registry.npmjs.org/flatted/-/flatted-3.
|
|
1362
|
-
"integrity": "sha512-
|
|
1363
|
-
"dev": true
|
|
1362
|
+
"version": "3.4.2",
|
|
1363
|
+
"resolved": "https://registry.npmjs.org/flatted/-/flatted-3.4.2.tgz",
|
|
1364
|
+
"integrity": "sha512-PjDse7RzhcPkIJwy5t7KPWQSZ9cAbzQXcafsetQoD7sOJRQlGikNbx7yZp2OotDnJyrDcbyRq3Ttb18iYOqkxA==",
|
|
1365
|
+
"dev": true,
|
|
1366
|
+
"license": "ISC"
|
|
1364
1367
|
},
|
|
1365
1368
|
"node_modules/for-each": {
|
|
1366
1369
|
"version": "0.3.3",
|
|
@@ -2073,10 +2076,11 @@
|
|
|
2073
2076
|
}
|
|
2074
2077
|
},
|
|
2075
2078
|
"node_modules/minimatch": {
|
|
2076
|
-
"version": "3.1.
|
|
2077
|
-
"resolved": "https://registry.npmjs.org/minimatch/-/minimatch-3.1.
|
|
2078
|
-
"integrity": "sha512-
|
|
2079
|
+
"version": "3.1.5",
|
|
2080
|
+
"resolved": "https://registry.npmjs.org/minimatch/-/minimatch-3.1.5.tgz",
|
|
2081
|
+
"integrity": "sha512-VgjWUsnnT6n+NUk6eZq77zeFdpW2LWDzP6zFGrCbHXiYNul5Dzqk2HHQ5uFH2DNW5Xbp8+jVzaeNt94ssEEl4w==",
|
|
2079
2082
|
"dev": true,
|
|
2083
|
+
"license": "ISC",
|
|
2080
2084
|
"dependencies": {
|
|
2081
2085
|
"brace-expansion": "^1.1.7"
|
|
2082
2086
|
},
|
|
@@ -2318,10 +2322,11 @@
|
|
|
2318
2322
|
}
|
|
2319
2323
|
},
|
|
2320
2324
|
"node_modules/picomatch": {
|
|
2321
|
-
"version": "2.3.
|
|
2322
|
-
"resolved": "https://registry.npmjs.org/picomatch/-/picomatch-2.3.
|
|
2323
|
-
"integrity": "sha512-
|
|
2325
|
+
"version": "2.3.2",
|
|
2326
|
+
"resolved": "https://registry.npmjs.org/picomatch/-/picomatch-2.3.2.tgz",
|
|
2327
|
+
"integrity": "sha512-V7+vQEJ06Z+c5tSye8S+nHUfI51xoXIXjHQ99cQtKUkQqqO1kO/KCJUfZXuB47h/YBlDhah2H3hdUGXn8ie0oA==",
|
|
2324
2328
|
"dev": true,
|
|
2329
|
+
"license": "MIT",
|
|
2325
2330
|
"engines": {
|
|
2326
2331
|
"node": ">=8.6"
|
|
2327
2332
|
},
|
|
@@ -23,7 +23,7 @@ function scwTemplateString() {
|
|
|
23
23
|
${this.hideBackToHost} ${this.allowAgentMode} ${this.allowAgentModeTests} ${this.allowLegacySelfieFallback}
|
|
24
24
|
></selfie-capture-screens>
|
|
25
25
|
<document-capture-screens ${this.applyComponentThemeColor} document-type=${this.documentType} ${this.title} ${this.documentCaptureModes} ${this.showNavigation} ${this.hideAttribution}
|
|
26
|
-
${this.hideBackOfId} ${this.applyComponentThemeColor} hidden></document-capture-screens>
|
|
26
|
+
${this.hideBackOfId} ${this.newInstructions} ${this.applyComponentThemeColor} hidden></document-capture-screens>
|
|
27
27
|
</div>
|
|
28
28
|
`;
|
|
29
29
|
}
|
|
@@ -78,6 +78,7 @@ class SmartCameraWeb extends HTMLElement {
|
|
|
78
78
|
'hide-back-to-host',
|
|
79
79
|
'show-navigation',
|
|
80
80
|
'theme-color',
|
|
81
|
+
'new-instructions',
|
|
81
82
|
];
|
|
82
83
|
}
|
|
83
84
|
|
|
@@ -93,6 +94,7 @@ class SmartCameraWeb extends HTMLElement {
|
|
|
93
94
|
case 'hide-back-to-host':
|
|
94
95
|
case 'show-navigation':
|
|
95
96
|
case 'theme-color':
|
|
97
|
+
case 'new-instructions':
|
|
96
98
|
this.disconnectedCallback();
|
|
97
99
|
this.shadowRoot.innerHTML = this.render();
|
|
98
100
|
this.setUpEventListeners();
|
|
@@ -227,6 +229,10 @@ class SmartCameraWeb extends HTMLElement {
|
|
|
227
229
|
return this.hasAttribute('hide-back-of-id') ? 'hide-back-of-id' : '';
|
|
228
230
|
}
|
|
229
231
|
|
|
232
|
+
get newInstructions() {
|
|
233
|
+
return this.hasAttribute('new-instructions') ? 'new-instructions' : '';
|
|
234
|
+
}
|
|
235
|
+
|
|
230
236
|
get showNavigation() {
|
|
231
237
|
return this.hasAttribute('show-navigation') ? 'show-navigation' : '';
|
|
232
238
|
}
|
package/lib/styles/src/styles.js
CHANGED
|
@@ -290,7 +290,7 @@ ${typography}
|
|
|
290
290
|
padding-bottom: 2rem;
|
|
291
291
|
}
|
|
292
292
|
|
|
293
|
-
smart-camera-web, selfie-capture-screens, selfie-capture-instructions, document-capture-screens, document-capture-instructions {
|
|
293
|
+
smart-camera-web, selfie-capture-screens, selfie-capture-instructions, document-capture-screens, document-capture-instructions, document-capture-instructions-v2 {
|
|
294
294
|
height: 100%;
|
|
295
295
|
display: block;
|
|
296
296
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@smileid/web-components",
|
|
3
|
-
"version": "11.
|
|
3
|
+
"version": "11.4.1",
|
|
4
|
+
"private": false,
|
|
4
5
|
"main": "dist/esm/main.js",
|
|
5
6
|
"module": "dist/esm/main.js",
|
|
6
7
|
"types": "dist/types/main.d.ts",
|
|
@@ -76,10 +77,11 @@
|
|
|
76
77
|
"type": "module",
|
|
77
78
|
"author": "SmileID <support@usesmileid.com> (https://usesmileid.com)",
|
|
78
79
|
"dependencies": {
|
|
80
|
+
"@lottiefiles/dotlottie-web": "^0.71.0",
|
|
79
81
|
"@mediapipe/tasks-vision": "^0.10.22-rc.20250304",
|
|
80
82
|
"@preact/signals": "^2.1.1",
|
|
81
83
|
"@tabler/icons-preact": "^3.34.0",
|
|
82
|
-
"lodash": "^4.
|
|
84
|
+
"lodash": "^4.18.1",
|
|
83
85
|
"preact": "^10.27.3",
|
|
84
86
|
"preact-custom-element": "^4.3.0",
|
|
85
87
|
"preact-router": "^4.1.2",
|
|
@@ -107,7 +109,7 @@
|
|
|
107
109
|
"prettier": "^3.6.2",
|
|
108
110
|
"rollup-plugin-visualizer": "^6.0.3",
|
|
109
111
|
"typescript": "^5.8.3",
|
|
110
|
-
"vite": "^7.
|
|
112
|
+
"vite": "^7.3.2",
|
|
111
113
|
"vite-plugin-dts": "^4.5.4",
|
|
112
114
|
"vite-plugin-tsconfig-paths": "^1.4.1"
|
|
113
115
|
},
|
package/dist/README.md
DELETED
|
@@ -1,15 +0,0 @@
|
|
|
1
|
-
# Instructions
|
|
2
|
-
|
|
3
|
-
These components can be used to capture id document or liveness images
|
|
4
|
-
|
|
5
|
-
1. [`smart-camera-web`](./components/smart-camera-web/src/)
|
|
6
|
-
2. [`document-capture-screens`](./components/document/src/README.md)
|
|
7
|
-
3. [`selfie-capture-screens`](./components/selfie/README.md)
|
|
8
|
-
|
|
9
|
-
## Orchestration
|
|
10
|
-
|
|
11
|
-
To build your own flow, we have several components that can be used together
|
|
12
|
-
|
|
13
|
-
### document-capture-instructions
|
|
14
|
-
|
|
15
|
-
This is the screen used to instruct the user how to capture document using both the camera and/or upload.
|
|
@@ -1,14 +0,0 @@
|
|
|
1
|
-
# Instructions
|
|
2
|
-
|
|
3
|
-
These components can be used to capture id document or liveness images
|
|
4
|
-
|
|
5
|
-
1. [`document-capture-screens`](./document/src/README.md)
|
|
6
|
-
2. [`selfie-capture-screens`](./selfie/README.md)
|
|
7
|
-
|
|
8
|
-
## Orchestration
|
|
9
|
-
|
|
10
|
-
To build your own flow, we have several components that can be used together
|
|
11
|
-
|
|
12
|
-
### document-capture-instructions
|
|
13
|
-
|
|
14
|
-
This is the screen used to instruct the user how to capture document using both the camera and/or upload.
|
|
@@ -1,111 +0,0 @@
|
|
|
1
|
-
# DocumentCapture Web Component
|
|
2
|
-
|
|
3
|
-
## Overview
|
|
4
|
-
|
|
5
|
-
The `DocumentCaptureScreens` is a bespoke web component designed for capturing document images using a camera. It leverages the `SmartCamera` module for camera interaction and permission management.
|
|
6
|
-
This component contains the flow for capturing both front and the back of id documents.
|
|
7
|
-
|
|
8
|
-
### Importing the Component
|
|
9
|
-
|
|
10
|
-
To utilize the `DocumentCaptureScreens` component within your project, import it into your JavaScript file as follows:
|
|
11
|
-
|
|
12
|
-
```js
|
|
13
|
-
import '@smileid/components/document-capture';
|
|
14
|
-
```
|
|
15
|
-
|
|
16
|
-
### Using the Component
|
|
17
|
-
|
|
18
|
-
The DocumentCapture component can be embedded in your HTML similarly to any standard HTML element:
|
|
19
|
-
|
|
20
|
-
```html
|
|
21
|
-
<document-capture-screens></document-capture-screens>
|
|
22
|
-
```
|
|
23
|
-
|
|
24
|
-
### Attributes
|
|
25
|
-
|
|
26
|
-
Customize the component's behavior with the following attributes:
|
|
27
|
-
|
|
28
|
-
#### `hide-instructions`
|
|
29
|
-
|
|
30
|
-
Omits the capture instructions. This attribute is boolean and does not require a value.
|
|
31
|
-
|
|
32
|
-
```html
|
|
33
|
-
<document-capture-screens hide-instructions></document-capture-screens>
|
|
34
|
-
```
|
|
35
|
-
|
|
36
|
-
#### `hide-back-of-id`
|
|
37
|
-
|
|
38
|
-
Excludes the option to capture the ID's back side. This attribute is boolean.
|
|
39
|
-
|
|
40
|
-
```html
|
|
41
|
-
<document-capture-screens hide-back-of-id></document-capture-screens>
|
|
42
|
-
```
|
|
43
|
-
|
|
44
|
-
#### `show-navigation`
|
|
45
|
-
|
|
46
|
-
Displays navigation controls for the capture process. This attribute is boolean.
|
|
47
|
-
|
|
48
|
-
```html
|
|
49
|
-
<document-capture-screens show-navigation></document-capture-screens>
|
|
50
|
-
```
|
|
51
|
-
|
|
52
|
-
#### `document-capture-modes`
|
|
53
|
-
|
|
54
|
-
Specifies the capture modes, accepting `camera`, `upload`, or both. Value required.
|
|
55
|
-
|
|
56
|
-
```html
|
|
57
|
-
<document-capture-screens
|
|
58
|
-
document-capture-modes="camera,upload"
|
|
59
|
-
></document-capture-screens>
|
|
60
|
-
```
|
|
61
|
-
|
|
62
|
-
### Permissions
|
|
63
|
-
|
|
64
|
-
Camera permissions are essential for functionality. The component requests permissions automatically. Upon granting, `data-camera-ready` is set to true, and `data-camera-error` is removed. Denied permissions result in `data-camera-error` being set with an error message.
|
|
65
|
-
|
|
66
|
-
For manual permission handling, appropriately set `data-camera-ready` and `data-camera-error`.
|
|
67
|
-
|
|
68
|
-
### Error Handling
|
|
69
|
-
|
|
70
|
-
Errors during permission requests or document capture are managed by the component, setting `data-camera-error` with the respective error message.
|
|
71
|
-
|
|
72
|
-
### Event Handlers
|
|
73
|
-
|
|
74
|
-
Capture events emit `document-capture-screens.publish`, providing captured images and metadata:
|
|
75
|
-
|
|
76
|
-
```json
|
|
77
|
-
{
|
|
78
|
-
"detail": {
|
|
79
|
-
"images": [{ "image": "base64-encoded image", "image_type_id": "" }],
|
|
80
|
-
"meta": {
|
|
81
|
-
"version": "library version"
|
|
82
|
-
}
|
|
83
|
-
}
|
|
84
|
-
}
|
|
85
|
-
```
|
|
86
|
-
|
|
87
|
-
To handle this event:
|
|
88
|
-
|
|
89
|
-
```js
|
|
90
|
-
document
|
|
91
|
-
.querySelector('document-capture-screens')
|
|
92
|
-
.addEventListener('document-capture-screens.publish', function (event) {
|
|
93
|
-
console.log(event.detail);
|
|
94
|
-
});
|
|
95
|
-
```
|
|
96
|
-
|
|
97
|
-
### Dependencies
|
|
98
|
-
|
|
99
|
-
`DocumentCaptureScreens` relies on the following modules:
|
|
100
|
-
|
|
101
|
-
- [document-capture-instructions](./document-capture-instructions/README.md)
|
|
102
|
-
- [document-capture](./document-capture/README.md)
|
|
103
|
-
- [document-capture-review](./document-capture-review/README.md)
|
|
104
|
-
- [SmartCamera](../../../domain/camera/src/README.md)
|
|
105
|
-
- [FileUpload](../../../domain/file-upload/README.md)
|
|
106
|
-
|
|
107
|
-
These dependencies are automatically imported with the component.
|
|
108
|
-
|
|
109
|
-
### Compatibility
|
|
110
|
-
|
|
111
|
-
Designed for modern browsers supporting custom web components, with specific enhancements for multi-camera Samsung devices to prevent blurry image edges. Report compatibility issues with other devices to our support team.
|
|
@@ -1,90 +0,0 @@
|
|
|
1
|
-
# IdCapture Web Component
|
|
2
|
-
|
|
3
|
-
## Overview
|
|
4
|
-
|
|
5
|
-
The `IdCapture` is a custom web component designed to capture documents using a camera. It uses the `SmartCamera` module to interact with the device's camera and handle permissions.
|
|
6
|
-
|
|
7
|
-
### Importing the Component
|
|
8
|
-
|
|
9
|
-
To use the IdCapture component, you need to import it into your JavaScript file:
|
|
10
|
-
|
|
11
|
-
```js
|
|
12
|
-
import '@smileid/components/document-capture';
|
|
13
|
-
```
|
|
14
|
-
|
|
15
|
-
### Using the Component
|
|
16
|
-
|
|
17
|
-
You can use the IdCapture component in your HTML like any other HTML element:
|
|
18
|
-
|
|
19
|
-
```html
|
|
20
|
-
<document-capture></document-capture>
|
|
21
|
-
```
|
|
22
|
-
|
|
23
|
-
### IdCapture Web Component Attributes
|
|
24
|
-
|
|
25
|
-
You can use a mixture of the following attributes to configure the behavior of the component.
|
|
26
|
-
|
|
27
|
-
#### hide-back-of-id
|
|
28
|
-
|
|
29
|
-
This attribute, when present, hides the option to capture the back of the ID. It does not require a value.
|
|
30
|
-
|
|
31
|
-
Usage:
|
|
32
|
-
|
|
33
|
-
```html
|
|
34
|
-
<document-capture hide-back-of-id></document-capture>
|
|
35
|
-
```
|
|
36
|
-
|
|
37
|
-
#### show-navigation
|
|
38
|
-
|
|
39
|
-
This attribute, when present, shows the navigation controls for the document capture process. It does not require a value.
|
|
40
|
-
|
|
41
|
-
Usage:
|
|
42
|
-
|
|
43
|
-
```html
|
|
44
|
-
<document-capture show-navigation></document-capture>
|
|
45
|
-
```
|
|
46
|
-
|
|
47
|
-
### Permissions
|
|
48
|
-
|
|
49
|
-
The `IdCapture` component requires camera permissions to function. It will automatically request these permissions when used. If the permissions are granted, it will remove the `data-camera-error` attribute from the capture screen and set the `data-camera-ready` attribute to true. If the permissions are denied, it will remove the `data-camera-ready` attribute and set the `data-camera-error` attribute with the error message.
|
|
50
|
-
|
|
51
|
-
If you handle the permissions yourself, make sure to set `data-camera-ready` and `data-camera-error` appropriately.
|
|
52
|
-
|
|
53
|
-
### Error Handling
|
|
54
|
-
|
|
55
|
-
If there is an error while requesting permissions or capturing the document, the `IdCapture` component will handle it and set the `data-camera-error` attribute with the error message.
|
|
56
|
-
|
|
57
|
-
### Event Handlers
|
|
58
|
-
|
|
59
|
-
To receive the images after they have been captured, you can listen to the custom event `document-capture.publish`. The data posted to this event has the structure:
|
|
60
|
-
|
|
61
|
-
```json
|
|
62
|
-
{
|
|
63
|
-
"detail": {
|
|
64
|
-
"image": "base64 image",
|
|
65
|
-
"previewImage": "base64 image"
|
|
66
|
-
}
|
|
67
|
-
}
|
|
68
|
-
```
|
|
69
|
-
|
|
70
|
-
Usage:
|
|
71
|
-
|
|
72
|
-
```js
|
|
73
|
-
document
|
|
74
|
-
.querySelector('document-capture')
|
|
75
|
-
.addEventListener('document-capture.publish', function (event) {
|
|
76
|
-
console.log(event.detail);
|
|
77
|
-
});
|
|
78
|
-
```
|
|
79
|
-
|
|
80
|
-
### Dependencies
|
|
81
|
-
|
|
82
|
-
The `DocumentCapture` component depends on the following module:
|
|
83
|
-
|
|
84
|
-
- [SmartCamera](../../../../domain/camera/src/README.md)
|
|
85
|
-
|
|
86
|
-
This module is imported when you use the `DocumentCapture` component in your projects.
|
|
87
|
-
|
|
88
|
-
### Compatibility
|
|
89
|
-
|
|
90
|
-
The IdCapture component is designed to work on all modern browsers that support custom web components. However, it includes a special case for multi-camera Samsung devices to mitigate blurry images at the edges. Please report any issues found on other devices to our support team.
|
|
@@ -1,56 +0,0 @@
|
|
|
1
|
-
# Document Instruction Web Component Guide
|
|
2
|
-
|
|
3
|
-
## Importing the Component
|
|
4
|
-
|
|
5
|
-
To incorporate the DocumentInstruction component into your project, import it into your JavaScript file as follows:
|
|
6
|
-
|
|
7
|
-
```js
|
|
8
|
-
import '@smileid/document-capture/document-capture-instructions';
|
|
9
|
-
```
|
|
10
|
-
|
|
11
|
-
## Using the Component
|
|
12
|
-
|
|
13
|
-
The `DocumentInstruction` component is designed to provide users with guidance for capturing document images. It can be integrated into your web page as a custom HTML element:
|
|
14
|
-
|
|
15
|
-
```html
|
|
16
|
-
<document-capture-instructions></document-capture-instructions>
|
|
17
|
-
```
|
|
18
|
-
|
|
19
|
-
### Customizing the Component
|
|
20
|
-
|
|
21
|
-
Adjust the component's behavior and appearance using the following attributes:
|
|
22
|
-
|
|
23
|
-
#### `show-navigation`
|
|
24
|
-
|
|
25
|
-
Displays navigation controls, facilitating user interaction during the document capture process. This attribute is boolean and does not require a value.
|
|
26
|
-
|
|
27
|
-
```html
|
|
28
|
-
<document-capture-instructions show-navigation></document-capture-instructions>
|
|
29
|
-
```
|
|
30
|
-
|
|
31
|
-
#### `document-capture-modes`
|
|
32
|
-
|
|
33
|
-
Determines the available modes for document capture. This attribute accepts a comma-separated string specifying the modes:
|
|
34
|
-
|
|
35
|
-
- `camera`: Enables capturing document images using the camera.
|
|
36
|
-
- `upload`: Allows uploading document images from the device.
|
|
37
|
-
- `camera,upload`: Offers users a choice between capturing images using the camera or uploading from the device.
|
|
38
|
-
|
|
39
|
-
```html
|
|
40
|
-
<document-capture-instructions
|
|
41
|
-
document-capture-modes="camera,upload"
|
|
42
|
-
></document-capture-instructions>
|
|
43
|
-
```
|
|
44
|
-
|
|
45
|
-
## Example
|
|
46
|
-
|
|
47
|
-
Here is a complete example demonstrating how to embed the `DocumentInstruction` component with navigation controls and both capture modes enabled:
|
|
48
|
-
|
|
49
|
-
```html
|
|
50
|
-
<document-capture-instructions
|
|
51
|
-
show-navigation
|
|
52
|
-
document-capture-modes="camera,upload"
|
|
53
|
-
></document-capture-instructions>
|
|
54
|
-
```
|
|
55
|
-
|
|
56
|
-
This setup provides an intuitive interface for users, enabling them to receive instructions, navigate through the capture process, and choose their preferred method of document image submission.
|