@smileid/web-components 11.4.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.
Files changed (96) hide show
  1. package/dist/esm/DocumentCaptureScreens-wvJcTVkA.js +4147 -0
  2. package/dist/esm/DocumentCaptureScreens-wvJcTVkA.js.map +1 -0
  3. package/dist/esm/{EndUserConsent-BGO3oZ-m.js → EndUserConsent-BXvS7t8z.js} +4 -4
  4. package/dist/esm/{EndUserConsent-BGO3oZ-m.js.map → EndUserConsent-BXvS7t8z.js.map} +1 -1
  5. package/dist/esm/Navigation-BRFmg7s1.js +138 -0
  6. package/dist/esm/Navigation-BRFmg7s1.js.map +1 -0
  7. package/dist/esm/{SelfieCaptureScreens-bmwnmeS9.js → SelfieCaptureScreens-BkJBfzHv.js} +2498 -2960
  8. package/dist/esm/SelfieCaptureScreens-BkJBfzHv.js.map +1 -0
  9. package/dist/esm/{TotpConsent-V3_Ip2Kw.js → TotpConsent-Cn2DkVza.js} +2 -2
  10. package/dist/esm/{TotpConsent-V3_Ip2Kw.js.map → TotpConsent-Cn2DkVza.js.map} +1 -1
  11. package/dist/esm/combobox.js +14 -16
  12. package/dist/esm/combobox.js.map +1 -1
  13. package/dist/esm/document.js +1 -1
  14. package/dist/esm/end-user-consent.js +1 -1
  15. package/dist/esm/{index-Dnpp-kwk.js → index-DBUdxnp9.js} +57 -57
  16. package/dist/esm/{index-Dnpp-kwk.js.map → index-DBUdxnp9.js.map} +1 -1
  17. package/dist/esm/localisation.js +1 -1
  18. package/dist/esm/main.js +6 -6
  19. package/dist/esm/navigation.js +1 -1
  20. package/dist/esm/package-Dax8ezDK.js +565 -0
  21. package/dist/esm/package-Dax8ezDK.js.map +1 -0
  22. package/dist/esm/selfie.js +1 -1
  23. package/dist/esm/smart-camera-web.js +16 -11
  24. package/dist/esm/smart-camera-web.js.map +1 -1
  25. package/dist/esm/{styles-BOEZtbuc.js → styles-BTEClL7R.js} +2 -2
  26. package/dist/esm/{styles-BOEZtbuc.js.map → styles-BTEClL7R.js.map} +1 -1
  27. package/dist/esm/totp-consent.js +1 -1
  28. package/dist/smart-camera-web.js +445 -178
  29. package/dist/smart-camera-web.js.map +1 -1
  30. package/dist/types/main.d.ts +183 -33
  31. package/lib/components/combobox/src/Combobox.js +14 -12
  32. package/lib/components/document/src/DocumentCaptureScreens.js +15 -5
  33. package/lib/components/document/src/assets/icons/guidelines/greenbook/good.svg +77 -0
  34. package/lib/components/document/src/assets/icons/guidelines/greenbook/not-blurry.svg +84 -0
  35. package/lib/components/document/src/assets/icons/guidelines/greenbook/not-cropped.svg +83 -0
  36. package/lib/components/document/src/assets/icons/guidelines/greenbook/not-reflective.svg +89 -0
  37. package/lib/components/document/src/assets/icons/guidelines/id-card/good.svg +87 -0
  38. package/lib/components/document/src/assets/icons/guidelines/id-card/not-blurry.svg +100 -0
  39. package/lib/components/document/src/assets/icons/guidelines/id-card/not-cropped.svg +93 -0
  40. package/lib/components/document/src/assets/icons/guidelines/id-card/not-reflective.svg +98 -0
  41. package/lib/components/document/src/assets/icons/guidelines/passport/good.svg +91 -0
  42. package/lib/components/document/src/assets/icons/guidelines/passport/not-blurry.svg +109 -0
  43. package/lib/components/document/src/assets/icons/guidelines/passport/not-cropped.svg +102 -0
  44. package/lib/components/document/src/assets/icons/guidelines/passport/not-reflective.svg +207 -0
  45. package/lib/components/document/src/assets/lottie/taking photo of ID FLIP 2D.lottie +0 -0
  46. package/lib/components/document/src/assets/lottie/taking photo of ID.lottie +0 -0
  47. package/lib/components/document/src/assets/lottie/taking photo of green book passport.lottie +0 -0
  48. package/lib/components/document/src/assets/lottie/taking photo of passport 2.lottie +0 -0
  49. package/lib/components/document/src/document-capture-instructions/DocumentCaptureInstructions.stories.js +123 -12
  50. package/lib/components/document/src/document-capture-instructions/DocumentCaptureInstructions.tsx +808 -0
  51. package/lib/components/document/src/document-capture-instructions/index.js +1 -0
  52. package/lib/components/navigation/src/Navigation.js +57 -56
  53. package/lib/components/navigation/src/Navigation.stories.js +7 -0
  54. package/lib/components/signature-pad/package-lock.json +11 -9
  55. package/lib/components/signature-pad/package.json +1 -1
  56. package/lib/components/smart-camera-web/src/SmartCameraWeb.js +7 -1
  57. package/lib/styles/src/styles.js +1 -1
  58. package/package.json +4 -3
  59. package/dist/README.md +0 -15
  60. package/dist/components/README.md +0 -14
  61. package/dist/components/document/src/README.md +0 -111
  62. package/dist/components/document/src/document-capture/README.md +0 -90
  63. package/dist/components/document/src/document-capture-instructions/README.md +0 -56
  64. package/dist/components/document/src/document-capture-review/README.md +0 -79
  65. package/dist/components/selfie/README.md +0 -225
  66. package/dist/components/smart-camera-web/src/README.md +0 -206
  67. package/dist/domain/camera/src/README.md +0 -38
  68. package/dist/domain/file-upload/README.md +0 -35
  69. package/dist/esm/DocumentCaptureScreens-DbU8ZxMx.js +0 -1580
  70. package/dist/esm/DocumentCaptureScreens-DbU8ZxMx.js.map +0 -1
  71. package/dist/esm/Navigation-DH44dkMT.js +0 -144
  72. package/dist/esm/Navigation-DH44dkMT.js.map +0 -1
  73. package/dist/esm/SelfieCaptureScreens-bmwnmeS9.js.map +0 -1
  74. package/dist/esm/package-7J5h4EOW.js +0 -90
  75. package/dist/esm/package-7J5h4EOW.js.map +0 -1
  76. package/dist/package-lock.json +0 -4948
  77. package/dist/package.json +0 -59
  78. package/dist/smart-camera-web.js.gz +0 -0
  79. package/dist/src/components/combobox/src/index.js +0 -425
  80. package/dist/src/components/combobox/src/index.js.map +0 -7
  81. package/dist/src/components/document/src/index.js +0 -1423
  82. package/dist/src/components/document/src/index.js.map +0 -7
  83. package/dist/src/components/end-user-consent/src/index.js +0 -1586
  84. package/dist/src/components/end-user-consent/src/index.js.map +0 -7
  85. package/dist/src/components/selfie/src/index.js +0 -1221
  86. package/dist/src/components/selfie/src/index.js.map +0 -7
  87. package/dist/src/components/signature-pad/src/index.js +0 -796
  88. package/dist/src/components/signature-pad/src/index.js.map +0 -7
  89. package/dist/src/components/smart-camera-web/src/SmartCameraWeb.js +0 -2754
  90. package/dist/src/components/smart-camera-web/src/SmartCameraWeb.js.map +0 -7
  91. package/dist/src/components/totp-consent/src/index.js +0 -1305
  92. package/dist/src/components/totp-consent/src/index.js.map +0 -7
  93. package/dist/src/index.js.map +0 -7
  94. package/dist/styles/README.md +0 -3
  95. package/dist/types/document-auto-capture.d.ts +0 -34
  96. package/dist/types/locale.d.ts +0 -19
@@ -1,3 +1,4 @@
1
1
  import DocumentInstruction from './DocumentCaptureInstructions';
2
+ import './DocumentCaptureInstructions.tsx';
2
3
 
3
4
  export default DocumentInstruction;
@@ -4,6 +4,13 @@ class Navigation extends HTMLElement {
4
4
  connectedCallback() {
5
5
  const shadow = this.attachShadow({ mode: 'open' });
6
6
  const direction = getDirection();
7
+ const hostPadding = '0px';
8
+ const buttonSize = '40px';
9
+ const buttonBackground = 'rgba(132, 130, 130, 0.9)';
10
+ const buttonBorder = '1px solid rgba(255, 255, 255, 0.1)';
11
+ const iconSize = '20px';
12
+ const iconColor = this.hasThemeColor ? this.themeColor : '#FFFFFF';
13
+ const focusColor = '#FFFFFF';
7
14
 
8
15
  const style = document.createElement('style');
9
16
  style.textContent = `
@@ -12,6 +19,8 @@ class Navigation extends HTMLElement {
12
19
  max-inline-size: 100%;
13
20
  justify-content: ${this.showBackButton ? 'space-between' : 'flex-end'};
14
21
  direction: ${direction};
22
+ padding: var(--smileid-navigation-padding, ${hostPadding});
23
+ gap: 1rem;
15
24
  }
16
25
 
17
26
  :host([dir="rtl"]) .back-button svg,
@@ -20,50 +29,48 @@ class Navigation extends HTMLElement {
20
29
  }
21
30
 
22
31
  button {
23
- --button-color: var(--color-default);
24
- --flow-space: 3rem;
25
32
  -webkit-appearance: none;
26
33
  -moz-appearance: none;
27
- align-items: center;
28
34
  appearance: none;
29
- background-color: transparent;
30
- border-radius: 2.5rem;
31
- border: none;
32
- color: #ffffff;
33
- cursor: pointer;
34
- display: inline-flex;
35
- font-size: 1rem;
36
- font-weight: 500;
37
- inline-size: 100%;
38
- justify-content: center;
39
- letter-spacing: 0.05ch;
40
- line-height: 1;
41
- padding: 1rem 2.5rem;
42
- text-align: center;
43
- text-decoration: none;
44
- }
45
-
46
- button[data-type="icon"] {
35
+ width: ${buttonSize};
36
+ height: ${buttonSize};
37
+ border-radius: 50%;
38
+ background: var(--smileid-navigation-button-bg, ${buttonBackground});
39
+ border: ${buttonBorder};
40
+ display: flex;
47
41
  align-items: center;
48
- background-color: transparent;
49
- border: 0;
42
+ justify-content: center;
43
+ color: var(--smileid-navigation-icon-color, ${iconColor});
50
44
  cursor: pointer;
51
- display: flex;
52
45
  padding: 0;
53
- width: auto;
46
+ flex-shrink: 0;
47
+ transition: box-shadow 0.15s ease;
48
+ }
49
+
50
+ button:hover {
51
+ box-shadow: inset 0 0 0 999px rgba(0, 0, 0, 0.15);
52
+ }
53
+
54
+ button:focus-visible {
55
+ outline: 2px solid var(--smileid-navigation-focus-color, ${focusColor});
56
+ outline-offset: 3px;
57
+ }
58
+
59
+ button svg {
60
+ width: ${iconSize};
61
+ height: ${iconSize};
54
62
  }
55
63
 
56
64
  :host::part(back-button) {
57
65
  display: flex;
58
66
  align-items: center;
59
- }
60
-
61
- :host::part(back-button-text) {
62
- line-height: 1;
63
- color: ${this.hasThemeColor ? this.themeColor : 'rgb(21, 31, 114)'} !important;
67
+ justify-content: center;
64
68
  }
65
69
 
66
70
  :host::part(close-button) {
71
+ display: flex;
72
+ align-items: center;
73
+ justify-content: center;
67
74
  }
68
75
 
69
76
  .visually-hidden {
@@ -79,57 +86,51 @@ button[data-type="icon"] {
79
86
 
80
87
  const backButton = document.createElement('button');
81
88
  backButton.setAttribute('class', 'back-button');
82
- backButton.setAttribute('data-type', 'icon');
83
89
  backButton.setAttribute('part', 'back-button');
84
90
  backButton.setAttribute('type', 'button');
91
+ backButton.setAttribute('aria-label', t('navigation.back'));
85
92
  backButton.innerHTML = `
86
93
  <svg
87
- xmlns="http://www.w3.org/2000/svg"
88
- width="24"
89
- height="24"
94
+ aria-hidden="true"
90
95
  viewBox="0 0 24 24"
91
96
  fill="none"
97
+ xmlns="http://www.w3.org/2000/svg"
92
98
  data-rtl="${direction === 'rtl'}"
93
99
  >
94
100
  <path
95
- fill="#DBDBC4"
96
- d="M12 22c5.523 0 10-4.477 10-10S17.523 2 12 2 2 6.477 2 12s4.477 10 10 10Z"
97
- opacity=".4"
98
- />
99
- <path
100
- fill="${this.themeColor}"
101
- d="M15.5 11.25h-5.19l1.72-1.72c.29-.29.29-.77 0-1.06a.754.754 0 0 0-1.06 0l-3 3c-.29.29-.29.77 0 1.06l3 3c.15.15.34.22.53.22s.38-.07.53-.22c.29-.29.29-.77 0-1.06l-1.72-1.72h5.19c.41 0 .75-.34.75-.75s-.34-.75-.75-.75Z"
101
+ d="M19 12H5M5 12L12 19M5 12L12 5"
102
+ stroke="currentColor"
103
+ stroke-width="2"
104
+ stroke-linecap="round"
105
+ stroke-linejoin="round"
102
106
  />
103
107
  </svg>
104
- <span part="back-button-text">${t('navigation.back')}</span>
108
+ <span part="back-button-text" class="visually-hidden">${t('navigation.back')}</span>
105
109
  `;
106
110
 
107
111
  const closeButton = document.createElement('button');
108
112
  closeButton.setAttribute('class', 'close-button');
109
- closeButton.setAttribute('data-type', 'icon');
110
113
  closeButton.setAttribute('part', 'close-button');
111
114
  closeButton.setAttribute('type', 'button');
115
+ closeButton.setAttribute(
116
+ 'aria-label',
117
+ t('navigation.closeVerificationFrame'),
118
+ );
112
119
  closeButton.innerHTML = `
113
120
  <svg
114
- xmlns="http://www.w3.org/2000/svg"
121
+ aria-hidden="true"
115
122
  viewBox="0 0 24 24"
116
- width="24"
117
- height="24"
118
123
  fill="none"
124
+ xmlns="http://www.w3.org/2000/svg"
119
125
  >
120
126
  <path
121
- fill="#DBDBC4"
122
- d="M12 22c5.523 0 10-4.477 10-10S17.523 2 12 2 2 6.477 2 12s4.477 10 10 10Z"
123
- opacity=".4"
124
- />
125
- <path
126
- fill="#91190F"
127
- d="m13.06 12 2.3-2.3c.29-.29.29-.77 0-1.06a.754.754 0 0 0-1.06 0l-2.3 2.3-2.3-2.3a.754.754 0 0 0-1.06 0c-.29.29-.29.77 0 1.06l2.3 2.3-2.3 2.3c-.29.29-.29.77 0 1.06.15.15.34.22.53.22s.38-.07.53-.22l2.3-2.3 2.3 2.3c.15.15.34.22.53.22s.38-.07.53-.22c.29-.29.29-.77 0-1.06l-2.3-2.3Z"
127
+ d="M18 6L6 18M6 6L18 18"
128
+ stroke="currentColor"
129
+ stroke-width="2"
130
+ stroke-linecap="round"
131
+ stroke-linejoin="round"
128
132
  />
129
133
  </svg>
130
- <span class="visually-hidden"
131
- >${t('navigation.closeVerificationFrame')}</span
132
- >
133
134
  `;
134
135
 
135
136
  shadow.appendChild(style);
@@ -12,6 +12,13 @@ const meta = {
12
12
  },
13
13
  },
14
14
  component: 'smileid-navigation',
15
+ decorators: [
16
+ (story) => `
17
+ <div style="background: #1a1a2e; padding: 24px; min-height: 100px;">
18
+ ${story()}
19
+ </div>
20
+ `,
21
+ ],
15
22
  };
16
23
 
17
24
  export default meta;
@@ -1,12 +1,12 @@
1
1
  {
2
2
  "name": "@smileid/signature-pad",
3
- "version": "11.3.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.3.0",
9
+ "version": "11.4.0",
10
10
  "dependencies": {
11
11
  "signature_pad": "^5.0.2"
12
12
  },
@@ -1359,10 +1359,11 @@
1359
1359
  }
1360
1360
  },
1361
1361
  "node_modules/flatted": {
1362
- "version": "3.3.1",
1363
- "resolved": "https://registry.npmjs.org/flatted/-/flatted-3.3.1.tgz",
1364
- "integrity": "sha512-X8cqMLLie7KsNUDSdzeN8FYK9rEt4Dt67OsG/DNGnYTSDBG4uFAJFBnUeiV+zCVAvwFy56IjM9sH51jVaEhNxw==",
1365
- "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"
1366
1367
  },
1367
1368
  "node_modules/for-each": {
1368
1369
  "version": "0.3.3",
@@ -2321,10 +2322,11 @@
2321
2322
  }
2322
2323
  },
2323
2324
  "node_modules/picomatch": {
2324
- "version": "2.3.1",
2325
- "resolved": "https://registry.npmjs.org/picomatch/-/picomatch-2.3.1.tgz",
2326
- "integrity": "sha512-JU3teHTNjmE2VCGFzuY8EXzCDVwEqB2a8fsIvwaStHhAWJEeVd1o1QD80CU6+ZdEXXSLbSsuLwJjkCBWqRQUVA==",
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==",
2327
2328
  "dev": true,
2329
+ "license": "MIT",
2328
2330
  "engines": {
2329
2331
  "node": ">=8.6"
2330
2332
  },
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@smileid/signature-pad",
3
- "version": "11.4.0",
3
+ "version": "11.4.1",
4
4
  "private": "true",
5
5
  "exports": {
6
6
  ".": "./index.js"
@@ -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
  }
@@ -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,6 @@
1
1
  {
2
2
  "name": "@smileid/web-components",
3
- "version": "11.4.0",
3
+ "version": "11.4.1",
4
4
  "private": false,
5
5
  "main": "dist/esm/main.js",
6
6
  "module": "dist/esm/main.js",
@@ -77,10 +77,11 @@
77
77
  "type": "module",
78
78
  "author": "SmileID <support@usesmileid.com> (https://usesmileid.com)",
79
79
  "dependencies": {
80
+ "@lottiefiles/dotlottie-web": "^0.71.0",
80
81
  "@mediapipe/tasks-vision": "^0.10.22-rc.20250304",
81
82
  "@preact/signals": "^2.1.1",
82
83
  "@tabler/icons-preact": "^3.34.0",
83
- "lodash": "^4.17.23",
84
+ "lodash": "^4.18.1",
84
85
  "preact": "^10.27.3",
85
86
  "preact-custom-element": "^4.3.0",
86
87
  "preact-router": "^4.1.2",
@@ -108,7 +109,7 @@
108
109
  "prettier": "^3.6.2",
109
110
  "rollup-plugin-visualizer": "^6.0.3",
110
111
  "typescript": "^5.8.3",
111
- "vite": "^7.2.2",
112
+ "vite": "^7.3.2",
112
113
  "vite-plugin-dts": "^4.5.4",
113
114
  "vite-plugin-tsconfig-paths": "^1.4.1"
114
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.