@smileid/web-components 11.0.0 → 11.0.2
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 +15 -15
- package/dist/README.md +15 -0
- package/dist/components/README.md +14 -0
- package/dist/components/document/src/README.md +111 -0
- package/dist/components/document/src/document-capture/README.md +90 -0
- package/dist/components/document/src/document-capture-instructions/README.md +56 -0
- package/dist/components/document/src/document-capture-review/README.md +79 -0
- package/dist/components/selfie/README.md +225 -0
- package/dist/components/smart-camera-web/src/README.md +207 -0
- package/dist/domain/camera/src/README.md +38 -0
- package/dist/domain/file-upload/README.md +35 -0
- package/dist/esm/{DocumentCaptureScreens-RECPb0wH.js → DocumentCaptureScreens-CRx5ymqY.js} +2 -2
- package/dist/esm/DocumentCaptureScreens-CRx5ymqY.js.map +1 -0
- package/dist/esm/EndUserConsent-D4fd1ovG.js.map +1 -1
- package/dist/esm/Navigation-CTjK6tLU.js.map +1 -1
- package/dist/esm/PoweredBySmileId-CxbaihMu.js.map +1 -1
- package/dist/esm/{SelfieCaptureScreens-CqBVGEJk.js → SelfieCaptureScreens-DuQjKt_K.js} +274 -257
- package/dist/esm/SelfieCaptureScreens-DuQjKt_K.js.map +1 -0
- package/dist/esm/SignaturePad-C7MtmT8m.js.map +1 -1
- package/dist/esm/TotpConsent-CQU5jQi4.js.map +1 -1
- package/dist/esm/combobox.js.map +1 -1
- package/dist/esm/document.js +1 -1
- package/dist/esm/main.js +2 -2
- package/dist/esm/{package-BDJnoIAU.js → package-C_cKNrUu.js} +2 -2
- package/dist/esm/package-C_cKNrUu.js.map +1 -0
- package/dist/esm/selfie.js +1 -1
- package/dist/esm/smart-camera-web.js +3 -3
- package/dist/esm/smart-camera-web.js.map +1 -1
- package/dist/esm/styles-BOEZtbuc.js.map +1 -1
- package/dist/package-lock.json +4948 -0
- package/dist/package.json +59 -0
- package/dist/smart-camera-web.js +23 -23
- package/dist/smart-camera-web.js.gz +0 -0
- package/dist/smart-camera-web.js.map +1 -1
- package/dist/src/components/combobox/src/index.js +2 -0
- package/dist/src/components/combobox/src/index.js.map +7 -0
- package/dist/src/components/document/src/index.js +2 -0
- package/dist/src/components/document/src/index.js.map +7 -0
- package/dist/src/components/end-user-consent/src/index.js +14 -0
- package/dist/src/components/end-user-consent/src/index.js.map +7 -0
- package/dist/src/components/selfie/src/index.js +2 -0
- package/dist/src/components/selfie/src/index.js.map +7 -0
- package/dist/src/components/signature-pad/src/index.js +10 -0
- package/dist/src/components/signature-pad/src/index.js.map +7 -0
- package/dist/src/components/smart-camera-web/src/SmartCameraWeb.js +2 -0
- package/dist/src/components/smart-camera-web/src/SmartCameraWeb.js.map +7 -0
- package/dist/src/components/totp-consent/src/index.js +14 -0
- package/dist/src/components/totp-consent/src/index.js.map +7 -0
- package/dist/src/index.js.map +7 -0
- package/dist/styles/README.md +3 -0
- package/dist/types/combobox.d.ts +19 -19
- package/dist/types/document.d.ts +19 -19
- package/dist/types/end-user-consent.d.ts +19 -19
- package/dist/types/main.d.ts +24 -20
- package/dist/types/navigation.d.ts +19 -19
- package/dist/types/selfie.d.ts +19 -19
- package/dist/types/signature-pad.d.ts +19 -19
- package/dist/types/smart-camera-web.d.ts +19 -19
- package/dist/types/totp-consent.d.ts +19 -19
- package/lib/components/README.md +14 -14
- package/lib/components/attribution/PoweredBySmileId.js +42 -42
- package/lib/components/camera-permission/CameraPermission.js +139 -139
- package/lib/components/camera-permission/CameraPermission.stories.js +27 -27
- package/lib/components/combobox/src/Combobox.js +589 -589
- package/lib/components/combobox/src/index.js +1 -1
- package/lib/components/document/src/DocumentCaptureScreens.js +410 -410
- package/lib/components/document/src/DocumentCaptureScreens.stories.js +57 -57
- package/lib/components/document/src/README.md +111 -111
- package/lib/components/document/src/document-capture/DocumentCapture.js +760 -760
- package/lib/components/document/src/document-capture/DocumentCapture.stories.js +78 -78
- package/lib/components/document/src/document-capture/README.md +90 -90
- package/lib/components/document/src/document-capture/index.js +3 -3
- package/lib/components/document/src/document-capture-instructions/DocumentCaptureInstructions.js +545 -545
- package/lib/components/document/src/document-capture-instructions/DocumentCaptureInstructions.stories.js +24 -24
- package/lib/components/document/src/document-capture-instructions/README.md +56 -56
- package/lib/components/document/src/document-capture-instructions/index.js +3 -3
- package/lib/components/document/src/document-capture-review/DocumentCaptureReview.js +360 -360
- package/lib/components/document/src/document-capture-review/DocumentCaptureReview.stories.js +24 -24
- package/lib/components/document/src/document-capture-review/README.md +79 -79
- package/lib/components/document/src/document-capture-review/index.js +3 -3
- package/lib/components/document/src/index.js +3 -3
- package/lib/components/end-user-consent/src/EndUserConsent.js +795 -795
- package/lib/components/end-user-consent/src/EndUserConsent.stories.js +29 -29
- package/lib/components/end-user-consent/src/index.js +4 -4
- package/lib/components/navigation/src/Navigation.js +171 -171
- package/lib/components/navigation/src/Navigation.stories.js +24 -24
- package/lib/components/navigation/src/index.js +3 -3
- package/lib/components/selfie/README.md +225 -225
- package/lib/components/selfie/src/SelfieCaptureScreens.js +420 -420
- package/lib/components/selfie/src/SelfieCaptureScreens.stories.js +29 -29
- package/lib/components/selfie/src/index.js +3 -3
- package/lib/components/selfie/src/selfie-capture/SelfieCapture.js +1099 -1099
- package/lib/components/selfie/src/selfie-capture/SelfieCapture.stories.js +36 -36
- package/lib/components/selfie/src/selfie-capture/index.js +3 -3
- package/lib/components/selfie/src/selfie-capture-instructions/SelfieCaptureInstructions.js +689 -689
- package/lib/components/selfie/src/selfie-capture-instructions/SelfieCaptureInstructions.stories.js +23 -23
- package/lib/components/selfie/src/selfie-capture-instructions/index.js +3 -3
- package/lib/components/selfie/src/selfie-capture-review/SelfieCaptureReview.js +209 -209
- package/lib/components/selfie/src/selfie-capture-review/SelfieCaptureReview.stories.js +24 -24
- package/lib/components/selfie/src/selfie-capture-review/index.js +3 -3
- package/lib/components/selfie/src/selfie-capture-wrapper/SelfieCaptureWrapper.tsx +281 -256
- package/lib/components/selfie/src/selfie-capture-wrapper/index.ts +1 -1
- package/lib/components/selfie/src/smartselfie-capture/OvalProgress.tsx +81 -81
- package/lib/components/selfie/src/smartselfie-capture/SmartSelfieCapture.tsx +265 -265
- package/lib/components/selfie/src/smartselfie-capture/components/AlertDisplay.tsx +34 -34
- package/lib/components/selfie/src/smartselfie-capture/components/CameraPreview.tsx +97 -97
- package/lib/components/selfie/src/smartselfie-capture/components/CaptureControls.tsx +78 -78
- package/lib/components/selfie/src/smartselfie-capture/components/index.ts +3 -3
- package/lib/components/selfie/src/smartselfie-capture/constants.ts +23 -23
- package/lib/components/selfie/src/smartselfie-capture/hooks/index.ts +2 -2
- package/lib/components/selfie/src/smartselfie-capture/hooks/useCamera.ts +238 -238
- package/lib/components/selfie/src/smartselfie-capture/hooks/useFaceCapture.ts +618 -618
- package/lib/components/selfie/src/smartselfie-capture/index.ts +1 -1
- package/lib/components/selfie/src/smartselfie-capture/utils/alertMessages.ts +13 -13
- package/lib/components/selfie/src/smartselfie-capture/utils/canvas.ts +105 -105
- package/lib/components/selfie/src/smartselfie-capture/utils/faceDetection.ts +129 -129
- package/lib/components/selfie/src/smartselfie-capture/utils/imageCapture.ts +64 -64
- package/lib/components/selfie/src/smartselfie-capture/utils/index.ts +4 -4
- package/lib/components/selfie/src/smartselfie-capture/utils/mediapipeManager.ts +118 -77
- package/lib/components/signature-pad/package-lock.json +3009 -3009
- package/lib/components/signature-pad/package.json +30 -30
- package/lib/components/signature-pad/src/SignaturePad.js +484 -484
- package/lib/components/signature-pad/src/SignaturePad.stories.js +32 -32
- package/lib/components/signature-pad/src/index.js +3 -3
- package/lib/components/smart-camera-web/src/README.md +206 -206
- package/lib/components/smart-camera-web/src/SmartCameraWeb.js +305 -305
- package/lib/components/smart-camera-web/src/SmartCameraWeb.stories.js +57 -57
- package/lib/components/totp-consent/src/TotpConsent.js +949 -949
- package/lib/components/totp-consent/src/index.js +4 -4
- package/lib/domain/camera/src/README.md +38 -38
- package/lib/domain/camera/src/SmartCamera.js +109 -109
- package/lib/domain/constants/src/Constants.js +27 -27
- package/lib/domain/file-upload/README.md +35 -35
- package/lib/domain/file-upload/src/SmartFileUpload.js +65 -65
- package/lib/styles/README.md +3 -3
- package/lib/styles/src/styles.js +372 -372
- package/lib/styles/src/typography.js +52 -52
- package/package.json +111 -112
- package/dist/esm/DocumentCaptureScreens-RECPb0wH.js.map +0 -1
- package/dist/esm/SelfieCaptureScreens-CqBVGEJk.js.map +0 -1
- package/dist/esm/package-BDJnoIAU.js.map +0 -1
|
@@ -1,225 +1,225 @@
|
|
|
1
|
-
# SelfieCaptureScreens Web Component
|
|
2
|
-
|
|
3
|
-
## Overview
|
|
4
|
-
|
|
5
|
-
The `SelfieCaptureScreens` is a custom web component designed to capture selfies and liveness images 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 SelfieCaptureScreens component, you need to import it into your JavaScript file:
|
|
10
|
-
|
|
11
|
-
```js
|
|
12
|
-
import '@smileid/web-components/selfie-capture-screens';
|
|
13
|
-
```
|
|
14
|
-
|
|
15
|
-
### Using the Component
|
|
16
|
-
|
|
17
|
-
You can use the SelfieCaptureScreens component in your HTML like any other HTML element:
|
|
18
|
-
|
|
19
|
-
```html
|
|
20
|
-
<selfie-capture-screens></selfie-capture-screens>
|
|
21
|
-
```
|
|
22
|
-
|
|
23
|
-
### SelfieCaptureScreens Web Component Attributes
|
|
24
|
-
|
|
25
|
-
You can use a mixture of the following attributes to configure the behavior of the component.
|
|
26
|
-
|
|
27
|
-
#### hide-instructions
|
|
28
|
-
|
|
29
|
-
This attribute, when present, hides the instructions for the liveness capture process. It does not require a value.
|
|
30
|
-
|
|
31
|
-
Usage:
|
|
32
|
-
|
|
33
|
-
```html
|
|
34
|
-
<selfie-capture-screens hide-instructions></selfie-capture-screens>
|
|
35
|
-
```
|
|
36
|
-
|
|
37
|
-
#### show-navigation
|
|
38
|
-
|
|
39
|
-
This attribute, when present, shows the navigation controls for the liveness capture process. It does not require a value.
|
|
40
|
-
|
|
41
|
-
Usage:
|
|
42
|
-
|
|
43
|
-
```html
|
|
44
|
-
<selfie-capture-screens show-navigation></selfie-capture-screens>
|
|
45
|
-
```
|
|
46
|
-
|
|
47
|
-
### Permissions
|
|
48
|
-
|
|
49
|
-
The `SelfieCaptureScreens` 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 images, the `SelfieCaptureScreens` 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 `selfie-capture-screens.publish`. The data posted to this event has the structure:
|
|
60
|
-
|
|
61
|
-
```json
|
|
62
|
-
{
|
|
63
|
-
"detail": {
|
|
64
|
-
"images": [{ "image": "base64 image", "image_type_id": "" }],
|
|
65
|
-
"meta": {
|
|
66
|
-
"version": "version of the library in use"
|
|
67
|
-
}
|
|
68
|
-
}
|
|
69
|
-
}
|
|
70
|
-
```
|
|
71
|
-
|
|
72
|
-
Usage:
|
|
73
|
-
|
|
74
|
-
```js
|
|
75
|
-
document
|
|
76
|
-
.querySelector('selfie-capture-screens')
|
|
77
|
-
.addEventListener('selfie-capture-screens.publish', function (event) {
|
|
78
|
-
console.log(event.detail);
|
|
79
|
-
});
|
|
80
|
-
```
|
|
81
|
-
|
|
82
|
-
### Dependencies
|
|
83
|
-
|
|
84
|
-
The `SelfieCaptureScreens` component depends on the following modules:
|
|
85
|
-
|
|
86
|
-
- [selfie-capture](#selfiecapture-web-component)
|
|
87
|
-
- [selfie-capture-review](#selfiecapturereview-web-component)
|
|
88
|
-
- [Selfie-instructions](#selfiecaptureinstructions-web-component)
|
|
89
|
-
- [SmartCamera](../../domain/camera/src/README.md)
|
|
90
|
-
|
|
91
|
-
These modules are imported when you use the `SelfieCaptureScreens` component in your projects.
|
|
92
|
-
|
|
93
|
-
### SelfieCaptureInstructions Web Component
|
|
94
|
-
|
|
95
|
-
#### Overview
|
|
96
|
-
|
|
97
|
-
The `SelfieCaptureInstructions` is a custom web component designed to show an instruction on how to capture a clear selfie image.
|
|
98
|
-
|
|
99
|
-
#### Importing the SelfieCaptureInstructions Component
|
|
100
|
-
|
|
101
|
-
To use the SelfieCaptureInstructions component, you need to import it into your JavaScript file:
|
|
102
|
-
|
|
103
|
-
```js
|
|
104
|
-
import '@smileid/web-components/selfie-capture-instructions';
|
|
105
|
-
```
|
|
106
|
-
|
|
107
|
-
#### show-navigation
|
|
108
|
-
|
|
109
|
-
This attribute, when present, shows the navigation controls for the document capture process. It does not require a value.
|
|
110
|
-
|
|
111
|
-
Usage:
|
|
112
|
-
|
|
113
|
-
```html
|
|
114
|
-
<selfie-capture-instructions show-navigation></selfie-capture-instructions>
|
|
115
|
-
```
|
|
116
|
-
|
|
117
|
-
### SelfieCapture Web Component
|
|
118
|
-
|
|
119
|
-
#### Overview
|
|
120
|
-
|
|
121
|
-
The `SelfieCapture` is a custom web component designed to capture selfies and liveness images using a camera. It uses the `SmartCamera` module to interact with the device's camera and handle permissions.
|
|
122
|
-
|
|
123
|
-
#### Importing the SelfieCapture Component
|
|
124
|
-
|
|
125
|
-
To use the SelfieCapture component, you need to import it into your JavaScript file:
|
|
126
|
-
|
|
127
|
-
```js
|
|
128
|
-
import '@smileid/web-components/selfie-capture';
|
|
129
|
-
```
|
|
130
|
-
|
|
131
|
-
### Using the SelfieCapture Component
|
|
132
|
-
|
|
133
|
-
You can use the SelfieCapture component in your HTML like any other HTML element:
|
|
134
|
-
|
|
135
|
-
```html
|
|
136
|
-
<selfie-capture></selfie-capture>
|
|
137
|
-
```
|
|
138
|
-
|
|
139
|
-
### SelfieCapture Web Component Attributes
|
|
140
|
-
|
|
141
|
-
You can use a mixture of the following attributes to configure the behavior of the component.
|
|
142
|
-
|
|
143
|
-
#### show-navigation
|
|
144
|
-
|
|
145
|
-
This attribute, when present, shows the navigation controls for the document capture process. It does not require a value.
|
|
146
|
-
|
|
147
|
-
Usage:
|
|
148
|
-
|
|
149
|
-
```html
|
|
150
|
-
<selfie-capture show-navigation></selfie-capture>
|
|
151
|
-
```
|
|
152
|
-
|
|
153
|
-
### Permissions
|
|
154
|
-
|
|
155
|
-
The `SelfieCapture` 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.
|
|
156
|
-
|
|
157
|
-
If you handle the permissions yourself, make sure to set `data-camera-ready` and `data-camera-error` appropriately.
|
|
158
|
-
|
|
159
|
-
### Error Handling
|
|
160
|
-
|
|
161
|
-
If there is an error while requesting permissions or capturing the images, the `SelfieCapture` component will handle it and set the `data-camera-error` attribute with the error message.
|
|
162
|
-
|
|
163
|
-
### Event Handlers
|
|
164
|
-
|
|
165
|
-
To receive the images after they have been captured, you can listen to the custom event `selfie-capture.publish`. The data posted to this event has the structure:
|
|
166
|
-
|
|
167
|
-
```json
|
|
168
|
-
{
|
|
169
|
-
"detail": {
|
|
170
|
-
"images": [
|
|
171
|
-
{"image": "
|
|
172
|
-
|
|
173
|
-
base64 image", "image_type_id": ""}
|
|
174
|
-
],
|
|
175
|
-
"meta": {
|
|
176
|
-
"version": "version of the library in use"
|
|
177
|
-
}
|
|
178
|
-
}
|
|
179
|
-
}
|
|
180
|
-
```
|
|
181
|
-
|
|
182
|
-
Usage:
|
|
183
|
-
|
|
184
|
-
```js
|
|
185
|
-
document
|
|
186
|
-
.querySelector('selfie-capture')
|
|
187
|
-
.addEventListener('selfie-capture.publish', function (event) {
|
|
188
|
-
console.log(event.detail);
|
|
189
|
-
});
|
|
190
|
-
```
|
|
191
|
-
|
|
192
|
-
### SelfieCaptureReview Web Component
|
|
193
|
-
|
|
194
|
-
This component is used to allow the user to verify the accuracy of the capture.
|
|
195
|
-
The user can choose to use the captured image or recapture a new selfie.
|
|
196
|
-
|
|
197
|
-
Usage:
|
|
198
|
-
|
|
199
|
-
```html
|
|
200
|
-
<selfie-capture-review
|
|
201
|
-
data-image="base64 image"
|
|
202
|
-
show-navigation
|
|
203
|
-
hide-back-to-host
|
|
204
|
-
></selfie-capture-review>
|
|
205
|
-
```
|
|
206
|
-
|
|
207
|
-
When a user accepts an image, an event is triggered as shown below:
|
|
208
|
-
|
|
209
|
-
```js
|
|
210
|
-
document
|
|
211
|
-
.querySelector('selfie-capture-review')
|
|
212
|
-
.addEventListener('selfie-capture-review.accepted', function (event) {});
|
|
213
|
-
```
|
|
214
|
-
|
|
215
|
-
When a user wants to recapture a selfie, an event is triggered as shown below:
|
|
216
|
-
|
|
217
|
-
```js
|
|
218
|
-
document
|
|
219
|
-
.querySelector('selfie-capture-review')
|
|
220
|
-
.addEventListener('selfie-capture-review.rejected', function (event) {});
|
|
221
|
-
```
|
|
222
|
-
|
|
223
|
-
### Compatibility
|
|
224
|
-
|
|
225
|
-
The SelfieCaptureScreens 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
|
+
# SelfieCaptureScreens Web Component
|
|
2
|
+
|
|
3
|
+
## Overview
|
|
4
|
+
|
|
5
|
+
The `SelfieCaptureScreens` is a custom web component designed to capture selfies and liveness images 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 SelfieCaptureScreens component, you need to import it into your JavaScript file:
|
|
10
|
+
|
|
11
|
+
```js
|
|
12
|
+
import '@smileid/web-components/selfie-capture-screens';
|
|
13
|
+
```
|
|
14
|
+
|
|
15
|
+
### Using the Component
|
|
16
|
+
|
|
17
|
+
You can use the SelfieCaptureScreens component in your HTML like any other HTML element:
|
|
18
|
+
|
|
19
|
+
```html
|
|
20
|
+
<selfie-capture-screens></selfie-capture-screens>
|
|
21
|
+
```
|
|
22
|
+
|
|
23
|
+
### SelfieCaptureScreens Web Component Attributes
|
|
24
|
+
|
|
25
|
+
You can use a mixture of the following attributes to configure the behavior of the component.
|
|
26
|
+
|
|
27
|
+
#### hide-instructions
|
|
28
|
+
|
|
29
|
+
This attribute, when present, hides the instructions for the liveness capture process. It does not require a value.
|
|
30
|
+
|
|
31
|
+
Usage:
|
|
32
|
+
|
|
33
|
+
```html
|
|
34
|
+
<selfie-capture-screens hide-instructions></selfie-capture-screens>
|
|
35
|
+
```
|
|
36
|
+
|
|
37
|
+
#### show-navigation
|
|
38
|
+
|
|
39
|
+
This attribute, when present, shows the navigation controls for the liveness capture process. It does not require a value.
|
|
40
|
+
|
|
41
|
+
Usage:
|
|
42
|
+
|
|
43
|
+
```html
|
|
44
|
+
<selfie-capture-screens show-navigation></selfie-capture-screens>
|
|
45
|
+
```
|
|
46
|
+
|
|
47
|
+
### Permissions
|
|
48
|
+
|
|
49
|
+
The `SelfieCaptureScreens` 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 images, the `SelfieCaptureScreens` 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 `selfie-capture-screens.publish`. The data posted to this event has the structure:
|
|
60
|
+
|
|
61
|
+
```json
|
|
62
|
+
{
|
|
63
|
+
"detail": {
|
|
64
|
+
"images": [{ "image": "base64 image", "image_type_id": "" }],
|
|
65
|
+
"meta": {
|
|
66
|
+
"version": "version of the library in use"
|
|
67
|
+
}
|
|
68
|
+
}
|
|
69
|
+
}
|
|
70
|
+
```
|
|
71
|
+
|
|
72
|
+
Usage:
|
|
73
|
+
|
|
74
|
+
```js
|
|
75
|
+
document
|
|
76
|
+
.querySelector('selfie-capture-screens')
|
|
77
|
+
.addEventListener('selfie-capture-screens.publish', function (event) {
|
|
78
|
+
console.log(event.detail);
|
|
79
|
+
});
|
|
80
|
+
```
|
|
81
|
+
|
|
82
|
+
### Dependencies
|
|
83
|
+
|
|
84
|
+
The `SelfieCaptureScreens` component depends on the following modules:
|
|
85
|
+
|
|
86
|
+
- [selfie-capture](#selfiecapture-web-component)
|
|
87
|
+
- [selfie-capture-review](#selfiecapturereview-web-component)
|
|
88
|
+
- [Selfie-instructions](#selfiecaptureinstructions-web-component)
|
|
89
|
+
- [SmartCamera](../../domain/camera/src/README.md)
|
|
90
|
+
|
|
91
|
+
These modules are imported when you use the `SelfieCaptureScreens` component in your projects.
|
|
92
|
+
|
|
93
|
+
### SelfieCaptureInstructions Web Component
|
|
94
|
+
|
|
95
|
+
#### Overview
|
|
96
|
+
|
|
97
|
+
The `SelfieCaptureInstructions` is a custom web component designed to show an instruction on how to capture a clear selfie image.
|
|
98
|
+
|
|
99
|
+
#### Importing the SelfieCaptureInstructions Component
|
|
100
|
+
|
|
101
|
+
To use the SelfieCaptureInstructions component, you need to import it into your JavaScript file:
|
|
102
|
+
|
|
103
|
+
```js
|
|
104
|
+
import '@smileid/web-components/selfie-capture-instructions';
|
|
105
|
+
```
|
|
106
|
+
|
|
107
|
+
#### show-navigation
|
|
108
|
+
|
|
109
|
+
This attribute, when present, shows the navigation controls for the document capture process. It does not require a value.
|
|
110
|
+
|
|
111
|
+
Usage:
|
|
112
|
+
|
|
113
|
+
```html
|
|
114
|
+
<selfie-capture-instructions show-navigation></selfie-capture-instructions>
|
|
115
|
+
```
|
|
116
|
+
|
|
117
|
+
### SelfieCapture Web Component
|
|
118
|
+
|
|
119
|
+
#### Overview
|
|
120
|
+
|
|
121
|
+
The `SelfieCapture` is a custom web component designed to capture selfies and liveness images using a camera. It uses the `SmartCamera` module to interact with the device's camera and handle permissions.
|
|
122
|
+
|
|
123
|
+
#### Importing the SelfieCapture Component
|
|
124
|
+
|
|
125
|
+
To use the SelfieCapture component, you need to import it into your JavaScript file:
|
|
126
|
+
|
|
127
|
+
```js
|
|
128
|
+
import '@smileid/web-components/selfie-capture';
|
|
129
|
+
```
|
|
130
|
+
|
|
131
|
+
### Using the SelfieCapture Component
|
|
132
|
+
|
|
133
|
+
You can use the SelfieCapture component in your HTML like any other HTML element:
|
|
134
|
+
|
|
135
|
+
```html
|
|
136
|
+
<selfie-capture></selfie-capture>
|
|
137
|
+
```
|
|
138
|
+
|
|
139
|
+
### SelfieCapture Web Component Attributes
|
|
140
|
+
|
|
141
|
+
You can use a mixture of the following attributes to configure the behavior of the component.
|
|
142
|
+
|
|
143
|
+
#### show-navigation
|
|
144
|
+
|
|
145
|
+
This attribute, when present, shows the navigation controls for the document capture process. It does not require a value.
|
|
146
|
+
|
|
147
|
+
Usage:
|
|
148
|
+
|
|
149
|
+
```html
|
|
150
|
+
<selfie-capture show-navigation></selfie-capture>
|
|
151
|
+
```
|
|
152
|
+
|
|
153
|
+
### Permissions
|
|
154
|
+
|
|
155
|
+
The `SelfieCapture` 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.
|
|
156
|
+
|
|
157
|
+
If you handle the permissions yourself, make sure to set `data-camera-ready` and `data-camera-error` appropriately.
|
|
158
|
+
|
|
159
|
+
### Error Handling
|
|
160
|
+
|
|
161
|
+
If there is an error while requesting permissions or capturing the images, the `SelfieCapture` component will handle it and set the `data-camera-error` attribute with the error message.
|
|
162
|
+
|
|
163
|
+
### Event Handlers
|
|
164
|
+
|
|
165
|
+
To receive the images after they have been captured, you can listen to the custom event `selfie-capture.publish`. The data posted to this event has the structure:
|
|
166
|
+
|
|
167
|
+
```json
|
|
168
|
+
{
|
|
169
|
+
"detail": {
|
|
170
|
+
"images": [
|
|
171
|
+
{"image": "
|
|
172
|
+
|
|
173
|
+
base64 image", "image_type_id": ""}
|
|
174
|
+
],
|
|
175
|
+
"meta": {
|
|
176
|
+
"version": "version of the library in use"
|
|
177
|
+
}
|
|
178
|
+
}
|
|
179
|
+
}
|
|
180
|
+
```
|
|
181
|
+
|
|
182
|
+
Usage:
|
|
183
|
+
|
|
184
|
+
```js
|
|
185
|
+
document
|
|
186
|
+
.querySelector('selfie-capture')
|
|
187
|
+
.addEventListener('selfie-capture.publish', function (event) {
|
|
188
|
+
console.log(event.detail);
|
|
189
|
+
});
|
|
190
|
+
```
|
|
191
|
+
|
|
192
|
+
### SelfieCaptureReview Web Component
|
|
193
|
+
|
|
194
|
+
This component is used to allow the user to verify the accuracy of the capture.
|
|
195
|
+
The user can choose to use the captured image or recapture a new selfie.
|
|
196
|
+
|
|
197
|
+
Usage:
|
|
198
|
+
|
|
199
|
+
```html
|
|
200
|
+
<selfie-capture-review
|
|
201
|
+
data-image="base64 image"
|
|
202
|
+
show-navigation
|
|
203
|
+
hide-back-to-host
|
|
204
|
+
></selfie-capture-review>
|
|
205
|
+
```
|
|
206
|
+
|
|
207
|
+
When a user accepts an image, an event is triggered as shown below:
|
|
208
|
+
|
|
209
|
+
```js
|
|
210
|
+
document
|
|
211
|
+
.querySelector('selfie-capture-review')
|
|
212
|
+
.addEventListener('selfie-capture-review.accepted', function (event) {});
|
|
213
|
+
```
|
|
214
|
+
|
|
215
|
+
When a user wants to recapture a selfie, an event is triggered as shown below:
|
|
216
|
+
|
|
217
|
+
```js
|
|
218
|
+
document
|
|
219
|
+
.querySelector('selfie-capture-review')
|
|
220
|
+
.addEventListener('selfie-capture-review.rejected', function (event) {});
|
|
221
|
+
```
|
|
222
|
+
|
|
223
|
+
### Compatibility
|
|
224
|
+
|
|
225
|
+
The SelfieCaptureScreens 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.
|