@smileid/web-components 2.0.1 → 2.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/package.json +58 -58
- package/src/components/README.md +14 -14
- package/src/components/attribution/PoweredBySmileId.js +42 -42
- package/src/components/camera-permission/CameraPermission.js +140 -140
- package/src/components/camera-permission/CameraPermission.stories.js +27 -27
- package/src/components/combobox/src/Combobox.js +589 -589
- package/src/components/combobox/src/index.js +1 -1
- package/src/components/document/src/DocumentCaptureScreens.js +409 -409
- package/src/components/document/src/DocumentCaptureScreens.stories.js +57 -57
- package/src/components/document/src/README.md +111 -111
- package/src/components/document/src/document-capture/DocumentCapture.js +760 -760
- package/src/components/document/src/document-capture/DocumentCapture.stories.js +78 -78
- package/src/components/document/src/document-capture/README.md +90 -90
- package/src/components/document/src/document-capture/index.js +3 -3
- package/src/components/document/src/document-capture-instructions/DocumentCaptureInstructions.js +499 -499
- package/src/components/document/src/document-capture-instructions/DocumentCaptureInstructions.stories.js +24 -24
- package/src/components/document/src/document-capture-instructions/README.md +56 -56
- package/src/components/document/src/document-capture-instructions/index.js +3 -3
- package/src/components/document/src/document-capture-review/DocumentCaptureReview.js +362 -362
- package/src/components/document/src/document-capture-review/DocumentCaptureReview.stories.js +24 -24
- package/src/components/document/src/document-capture-review/README.md +79 -79
- package/src/components/document/src/document-capture-review/index.js +3 -3
- package/src/components/document/src/index.js +3 -3
- package/src/components/end-user-consent/src/EndUserConsent.js +795 -795
- package/src/components/end-user-consent/src/EndUserConsent.stories.js +29 -29
- package/src/components/end-user-consent/src/index.js +4 -4
- package/src/components/navigation/src/Navigation.js +171 -171
- package/src/components/navigation/src/Navigation.stories.js +24 -24
- package/src/components/navigation/src/index.js +3 -3
- package/src/components/selfie/README.md +225 -225
- package/src/components/selfie/src/SelfieCaptureScreens.js +282 -282
- package/src/components/selfie/src/SelfieCaptureScreens.stories.js +29 -29
- package/src/components/selfie/src/index.js +5 -5
- package/src/components/selfie/src/selfie-capture/SelfieCapture.js +1041 -1010
- package/src/components/selfie/src/selfie-capture/SelfieCapture.stories.js +36 -36
- package/src/components/selfie/src/selfie-capture/index.js +3 -3
- package/src/components/selfie/src/selfie-capture-instructions/SelfieCaptureInstructions.js +657 -648
- package/src/components/selfie/src/selfie-capture-instructions/SelfieCaptureInstructions.stories.js +23 -23
- package/src/components/selfie/src/selfie-capture-instructions/index.js +3 -3
- package/src/components/selfie/src/selfie-capture-review/SelfieCaptureReview.js +347 -347
- package/src/components/selfie/src/selfie-capture-review/SelfieCaptureReview.stories.js +24 -24
- package/src/components/selfie/src/selfie-capture-review/index.js +3 -3
- package/src/components/signature-pad/package-lock.json +3009 -3009
- package/src/components/signature-pad/package.json +30 -30
- package/src/components/signature-pad/src/SignaturePad.js +484 -484
- package/src/components/signature-pad/src/SignaturePad.stories.js +32 -32
- package/src/components/signature-pad/src/index.js +3 -3
- package/src/components/smart-camera-web/src/README.md +207 -207
- package/src/components/smart-camera-web/src/SmartCameraWeb.js +299 -299
- package/src/components/smart-camera-web/src/SmartCameraWeb.stories.js +57 -57
- package/src/components/totp-consent/src/TotpConsent.js +949 -949
- package/src/components/totp-consent/src/index.js +4 -4
- package/src/domain/camera/src/README.md +38 -38
- package/src/domain/camera/src/SmartCamera.js +109 -109
- package/src/domain/constants/src/Constants.js +27 -27
- package/src/domain/file-upload/README.md +35 -35
- package/src/domain/file-upload/src/SmartFileUpload.js +65 -65
- package/src/index.js +5 -5
- package/src/styles/README.md +3 -3
- package/src/styles/src/styles.js +359 -359
- package/src/styles/src/typography.js +52 -52
|
@@ -1,57 +1,57 @@
|
|
|
1
|
-
import './index';
|
|
2
|
-
|
|
3
|
-
const meta = {
|
|
4
|
-
args: {
|
|
5
|
-
'hide-attribution': false,
|
|
6
|
-
'theme-color': '#001096',
|
|
7
|
-
},
|
|
8
|
-
argTypes: {
|
|
9
|
-
'hide-attribution': { control: 'boolean' },
|
|
10
|
-
'theme-color': { control: 'color' },
|
|
11
|
-
},
|
|
12
|
-
component: 'document-capture-screens',
|
|
13
|
-
};
|
|
14
|
-
|
|
15
|
-
export default meta;
|
|
16
|
-
|
|
17
|
-
export const DocumentCapture = {
|
|
18
|
-
render: (args) => `
|
|
19
|
-
<document-capture-screens theme-color='${args['theme-color']}' ${args['hide-attribution'] ? 'hide-attribution' : ''}>
|
|
20
|
-
</document-capture-screens>
|
|
21
|
-
`,
|
|
22
|
-
};
|
|
23
|
-
|
|
24
|
-
export const DocumentCaptureHiddenInstructions = {
|
|
25
|
-
render: (args) => `
|
|
26
|
-
<document-capture-screens hide-instructions theme-color='${args['theme-color']}' ${args['hide-attribution'] ? 'hide-attribution' : ''}>
|
|
27
|
-
</document-capture-screens>
|
|
28
|
-
`,
|
|
29
|
-
};
|
|
30
|
-
|
|
31
|
-
export const DocumentCaptureHideBackOfId = {
|
|
32
|
-
render: (args) => `
|
|
33
|
-
<document-capture-screens hide-back-of-id theme-color='${args['theme-color']}' ${args['hide-attribution'] ? 'hide-attribution' : ''}>
|
|
34
|
-
</document-capture-screens>
|
|
35
|
-
`,
|
|
36
|
-
};
|
|
37
|
-
|
|
38
|
-
export const DocumentCaptureAllowAttributes = {
|
|
39
|
-
render: (args) => `
|
|
40
|
-
<document-capture-screens document-capture-screens-modes='camera,upload' theme-color='${args['theme-color']}' ${args['hide-attribution'] ? 'hide-attribution' : ''}>
|
|
41
|
-
</document-capture-screens>
|
|
42
|
-
`,
|
|
43
|
-
};
|
|
44
|
-
|
|
45
|
-
export const DocumentCaptureHideInstructionNBackOfId = {
|
|
46
|
-
render: (args) => `
|
|
47
|
-
<document-capture-screens hide-back-of-id hide-instructions theme-color='${args['theme-color']}' ${args['hide-attribution'] ? 'hide-attribution' : ''}>
|
|
48
|
-
</document-capture-screens>
|
|
49
|
-
`,
|
|
50
|
-
};
|
|
51
|
-
|
|
52
|
-
export const DocumentCapturePortraitMode = {
|
|
53
|
-
render: () => `
|
|
54
|
-
<document-capture-screens hide-back-of-id hide-instructions document-type="GREEN_BOOK">
|
|
55
|
-
</document-capture-screens>
|
|
56
|
-
`,
|
|
57
|
-
};
|
|
1
|
+
import './index';
|
|
2
|
+
|
|
3
|
+
const meta = {
|
|
4
|
+
args: {
|
|
5
|
+
'hide-attribution': false,
|
|
6
|
+
'theme-color': '#001096',
|
|
7
|
+
},
|
|
8
|
+
argTypes: {
|
|
9
|
+
'hide-attribution': { control: 'boolean' },
|
|
10
|
+
'theme-color': { control: 'color' },
|
|
11
|
+
},
|
|
12
|
+
component: 'document-capture-screens',
|
|
13
|
+
};
|
|
14
|
+
|
|
15
|
+
export default meta;
|
|
16
|
+
|
|
17
|
+
export const DocumentCapture = {
|
|
18
|
+
render: (args) => `
|
|
19
|
+
<document-capture-screens theme-color='${args['theme-color']}' ${args['hide-attribution'] ? 'hide-attribution' : ''}>
|
|
20
|
+
</document-capture-screens>
|
|
21
|
+
`,
|
|
22
|
+
};
|
|
23
|
+
|
|
24
|
+
export const DocumentCaptureHiddenInstructions = {
|
|
25
|
+
render: (args) => `
|
|
26
|
+
<document-capture-screens hide-instructions theme-color='${args['theme-color']}' ${args['hide-attribution'] ? 'hide-attribution' : ''}>
|
|
27
|
+
</document-capture-screens>
|
|
28
|
+
`,
|
|
29
|
+
};
|
|
30
|
+
|
|
31
|
+
export const DocumentCaptureHideBackOfId = {
|
|
32
|
+
render: (args) => `
|
|
33
|
+
<document-capture-screens hide-back-of-id theme-color='${args['theme-color']}' ${args['hide-attribution'] ? 'hide-attribution' : ''}>
|
|
34
|
+
</document-capture-screens>
|
|
35
|
+
`,
|
|
36
|
+
};
|
|
37
|
+
|
|
38
|
+
export const DocumentCaptureAllowAttributes = {
|
|
39
|
+
render: (args) => `
|
|
40
|
+
<document-capture-screens document-capture-screens-modes='camera,upload' theme-color='${args['theme-color']}' ${args['hide-attribution'] ? 'hide-attribution' : ''}>
|
|
41
|
+
</document-capture-screens>
|
|
42
|
+
`,
|
|
43
|
+
};
|
|
44
|
+
|
|
45
|
+
export const DocumentCaptureHideInstructionNBackOfId = {
|
|
46
|
+
render: (args) => `
|
|
47
|
+
<document-capture-screens hide-back-of-id hide-instructions theme-color='${args['theme-color']}' ${args['hide-attribution'] ? 'hide-attribution' : ''}>
|
|
48
|
+
</document-capture-screens>
|
|
49
|
+
`,
|
|
50
|
+
};
|
|
51
|
+
|
|
52
|
+
export const DocumentCapturePortraitMode = {
|
|
53
|
+
render: () => `
|
|
54
|
+
<document-capture-screens hide-back-of-id hide-instructions document-type="GREEN_BOOK">
|
|
55
|
+
</document-capture-screens>
|
|
56
|
+
`,
|
|
57
|
+
};
|
|
@@ -1,111 +1,111 @@
|
|
|
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
|
+
# 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.
|