@smileid/web-components 1.0.0-beta

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 (73) hide show
  1. package/.eslintrc.cjs +72 -0
  2. package/components/README.md +14 -0
  3. package/components/attribution/PoweredBySmileId.js +42 -0
  4. package/components/camera-permission/CameraPermission.js +136 -0
  5. package/components/camera-permission/CameraPermission.stories.js +21 -0
  6. package/components/combobox/src/Combobox.js +586 -0
  7. package/components/combobox/src/index.js +1 -0
  8. package/components/document/src/DocumentCaptureScreens.js +317 -0
  9. package/components/document/src/DocumentCaptureScreens.stories.js +51 -0
  10. package/components/document/src/README.md +108 -0
  11. package/components/document/src/document-capture/DocumentCapture.js +677 -0
  12. package/components/document/src/document-capture/DocumentCapture.stories.js +71 -0
  13. package/components/document/src/document-capture/README.md +89 -0
  14. package/components/document/src/document-capture/index.js +3 -0
  15. package/components/document/src/document-capture-instructions/DocumentCaptureInstructions.js +499 -0
  16. package/components/document/src/document-capture-instructions/DocumentCaptureInstructions.stories.js +17 -0
  17. package/components/document/src/document-capture-instructions/README.md +56 -0
  18. package/components/document/src/document-capture-instructions/index.js +3 -0
  19. package/components/document/src/document-capture-review/DocumentCaptureReview.js +378 -0
  20. package/components/document/src/document-capture-review/DocumentCaptureReview.stories.js +14 -0
  21. package/components/document/src/document-capture-review/README.md +79 -0
  22. package/components/document/src/document-capture-review/index.js +3 -0
  23. package/components/document/src/index.js +3 -0
  24. package/components/end-user-consent/src/EndUserConsent.js +809 -0
  25. package/components/end-user-consent/src/EndUserConsent.stories.js +23 -0
  26. package/components/end-user-consent/src/index.js +4 -0
  27. package/components/navigation/src/Navigation.js +160 -0
  28. package/components/navigation/src/Navigation.stories.js +24 -0
  29. package/components/navigation/src/index.js +3 -0
  30. package/components/selfie/README.md +201 -0
  31. package/components/selfie/src/SelfieCaptureScreens.js +224 -0
  32. package/components/selfie/src/SelfieCaptureScreens.stories.js +21 -0
  33. package/components/selfie/src/index.js +5 -0
  34. package/components/selfie/src/selfie-capture/SelfieCapture.js +878 -0
  35. package/components/selfie/src/selfie-capture/SelfieCapture.stories.js +23 -0
  36. package/components/selfie/src/selfie-capture/index.js +3 -0
  37. package/components/selfie/src/selfie-capture-instructions/SelfieCaptureInstructions.js +638 -0
  38. package/components/selfie/src/selfie-capture-instructions/SelfieCaptureInstructions.stories.js +17 -0
  39. package/components/selfie/src/selfie-capture-instructions/index.js +3 -0
  40. package/components/selfie/src/selfie-capture-review/SelfieCaptureReview.js +348 -0
  41. package/components/selfie/src/selfie-capture-review/SelfieCaptureReview.stories.js +17 -0
  42. package/components/selfie/src/selfie-capture-review/index.js +3 -0
  43. package/components/signature-pad/package.json +30 -0
  44. package/components/signature-pad/src/SignaturePad.js +477 -0
  45. package/components/signature-pad/src/SignaturePad.stories.js +24 -0
  46. package/components/signature-pad/src/index.js +3 -0
  47. package/components/smart-camera-web/src/SmartCameraWeb.js +246 -0
  48. package/components/smart-camera-web/src/SmartCameraWeb.stories.js +35 -0
  49. package/components/totp-consent/src/TotpConsent.js +935 -0
  50. package/components/totp-consent/src/index.js +4 -0
  51. package/cypress/e2e/smart-camera-web-attribution.cy.js +21 -0
  52. package/cypress/e2e/smart-camera-web-back-press.cy.js +481 -0
  53. package/cypress/e2e/smart-camera-web-hide-instructions.cy.js +334 -0
  54. package/cypress/e2e/smart-camera-web.cy.js +309 -0
  55. package/cypress/fixtures/example.json +5 -0
  56. package/cypress/pages/capture-back-of-id-hide-attribution.html +44 -0
  57. package/cypress/pages/capture-back-of-id-navigation.html +72 -0
  58. package/cypress/pages/smart-camera-web-hide-instructions.html +38 -0
  59. package/cypress/pages/smart-camera-web.html +38 -0
  60. package/cypress/support/commands.js +144 -0
  61. package/cypress/support/e2e.js +20 -0
  62. package/cypress.config.js +11 -0
  63. package/domain/camera/src/README.md +38 -0
  64. package/domain/camera/src/SmartCamera.js +81 -0
  65. package/domain/constants/src/Constants.js +27 -0
  66. package/domain/file-upload/README.md +35 -0
  67. package/domain/file-upload/src/SmartFileUpload.js +65 -0
  68. package/esbuild.js +119 -0
  69. package/index.js +5 -0
  70. package/package.json +46 -0
  71. package/styles/README.md +3 -0
  72. package/styles/src/styles.js +348 -0
  73. package/styles/src/typography.js +52 -0
package/index.js ADDED
@@ -0,0 +1,5 @@
1
+ import DocumentCaptureScreens from './components/document/src';
2
+ import SelfieCaptureScreens from './components/selfie/src';
3
+ import SmartCameraWeb from './components/smart-camera-web/src/SmartCameraWeb';
4
+
5
+ export { DocumentCaptureScreens, SelfieCaptureScreens, SmartCameraWeb };
package/package.json ADDED
@@ -0,0 +1,46 @@
1
+ {
2
+ "name": "@smileid/web-components",
3
+ "version": "1.0.0-beta",
4
+ "exports": {
5
+ ".": "./index.js",
6
+ "./combobox": "./components/combobox/src/index.js",
7
+ "./document-capture": "./components/document/src/index.js",
8
+ "./end-user-consent": "./components/end-user-consent/src/index.js",
9
+ "./navigation": "./components/navigation/src/index.js",
10
+ "./selfie-capture": "./components/selfie/src/index.js",
11
+ "./signature-pad": "./components/signature-pad/src/index.js",
12
+ "./totp-consent": "./components/totp-consent/src/index.js",
13
+ "./smart-camera-web": "./components/smart-camera-web/src/SmartCameraWeb.js"
14
+ },
15
+ "scripts": {
16
+ "build": "NODE_ENV=development node esbuild.js",
17
+ "clean": "rm -rf build dist",
18
+ "lint:fix": "eslint . --ext .js --fix",
19
+ "lint:html": "npx prettier --write $(git ls-files '*.html')",
20
+ "lint": "eslint . --ext .js",
21
+ "start": "npm run build && npx serve -p 8000 build",
22
+ "test": "npx cypress run"
23
+ },
24
+ "description": "A collection of Web Components used by SmileID",
25
+ "keywords": [
26
+ "Web Components"
27
+ ],
28
+ "type": "module",
29
+ "author": "SmileID <support@usesmileid.com> (https://usesmileid.com)",
30
+ "dependencies": {
31
+ "signature_pad": "^4.1.7",
32
+ "validate.js": "^0.13.1"
33
+ },
34
+ "devDependencies": {
35
+ "cypress": "^13.6.6",
36
+ "esbuild": "^0.20.2",
37
+ "eslint": "^8.57.0",
38
+ "eslint-config-airbnb-base": "^15.0.0",
39
+ "eslint-config-prettier": "^9.1.0",
40
+ "eslint-plugin-cypress": "^2.15.1",
41
+ "eslint-plugin-import": "^2.29.1",
42
+ "eslint-plugin-jest": "^28.2.0",
43
+ "eslint-plugin-prettier": "^5.1.3",
44
+ "prettier": "^3.2.2"
45
+ }
46
+ }
@@ -0,0 +1,3 @@
1
+ # @smileid/styles
2
+
3
+ This is a package that contains global styles exported as a string to be used in composing CSS in Web Components and anywhere else
@@ -0,0 +1,348 @@
1
+ import typography from './typography';
2
+
3
+ const styles = `<link rel="preconnect" href="https://fonts.gstatic.com" />
4
+ <link
5
+ href="https://fonts.googleapis.com/css2?family=DM+Sans:wght@400;500;600;700&display=swap"
6
+ rel="stylesheet"
7
+ as="style"
8
+ />
9
+ <style>
10
+ ${typography}
11
+ :host {
12
+ --color-active: #001096;
13
+ --color-default: #2d2b2a;
14
+ --color-disabled: #848282;
15
+ --web-digital-blue: #001096;
16
+ }
17
+
18
+ * {
19
+ font-family: "DM Sans", sans-serif;
20
+ }
21
+
22
+ [hidden] {
23
+ display: none !important;
24
+ }
25
+
26
+ [disabled] {
27
+ cursor: not-allowed !important;
28
+ filter: grayscale(75%);
29
+ }
30
+
31
+ .visually-hidden {
32
+ border: 0;
33
+ clip: rect(1px 1px 1px 1px);
34
+ clip: rect(1px, 1px, 1px, 1px);
35
+ height: auto;
36
+ margin: 0;
37
+ overflow: hidden;
38
+ padding: 0;
39
+ position: absolute;
40
+ white-space: nowrap;
41
+ width: 1px;
42
+ }
43
+
44
+ img {
45
+ height: auto;
46
+ max-width: 100%;
47
+ }
48
+
49
+ video {
50
+ background-color: black;
51
+ }
52
+
53
+ a {
54
+ color: currentColor;
55
+ text-decoration: none;
56
+ }
57
+
58
+ svg {
59
+ max-width: 100%;
60
+ }
61
+
62
+ .color-gray {
63
+ color: #797979;
64
+ }
65
+
66
+ .color-red {
67
+ color: red;
68
+ }
69
+
70
+ .color-richblue {
71
+ color: #4e6577;
72
+ }
73
+
74
+ .color-richblue-shade {
75
+ color: #0e1b42;
76
+ }
77
+
78
+ .color-digital-blue {
79
+ color: var(--web-digital-blue) !important;
80
+ }
81
+
82
+ .color-deep-blue {
83
+ color: #001096;
84
+ }
85
+
86
+ .center {
87
+ text-align: center;
88
+ margin-left: auto;
89
+ margin-right: auto;
90
+ }
91
+
92
+ .font-size-small {
93
+ font-size: 0.75rem;
94
+ }
95
+
96
+ .font-size-large {
97
+ font-size: 1.5rem;
98
+ }
99
+
100
+ .text-transform-uppercase {
101
+ text-transform: uppercase;
102
+ }
103
+
104
+ [id*=-"screen"] {
105
+ min-block-size: 100%;
106
+ }
107
+
108
+ [data-variant~="full-width"] {
109
+ inline-size: 100%;
110
+ }
111
+
112
+ .flow > * + * {
113
+ margin-top: var(--flow-space, 1rem);
114
+ }
115
+
116
+ .button {
117
+ --button-color: var(--color-active);
118
+ -webkit-appearance: none;
119
+ appearance: none;
120
+ border-radius: 2.5rem;
121
+ border: 0;
122
+ background-color: transparent;
123
+ color: #fff;
124
+ cursor: pointer;
125
+ display: block;
126
+ font-size: 18px;
127
+ font-weight: 600;
128
+ padding: 0.75rem 1.5rem;
129
+ text-align: center;
130
+ }
131
+
132
+ .button:hover,
133
+ .button:focus,
134
+ .button:active {
135
+ --button-color: var(--color-default);
136
+ }
137
+
138
+ .button:disabled {
139
+ --button-color: var(--color-disabled);
140
+ }
141
+
142
+ .button[data-variant~="solid"] {
143
+ background-color: var(--button-color);
144
+ border: 2px solid var(--button-color);
145
+ }
146
+
147
+ .button[data-variant~="outline"] {
148
+ color: var(--button-color);
149
+ border: 2px solid var(--button-color);
150
+ }
151
+
152
+ .button[data-variant~="ghost"] {
153
+ padding: 0px;
154
+ color: var(--button-color);
155
+ background-color: transparent;
156
+ }
157
+
158
+ .icon-btn {
159
+ appearance: none;
160
+ background: none;
161
+ border: none;
162
+ color: hsl(0deg 0% 94%);
163
+ cursor: pointer;
164
+ display: flex;
165
+ align-items: center;
166
+ justify-content: center;
167
+ padding: 4px 8px;
168
+ }
169
+ .justify-right {
170
+ justify-content: end !important;
171
+ }
172
+ .nav {
173
+ display: flex;
174
+ justify-content: space-between;
175
+ }
176
+
177
+ .back-wrapper {
178
+ display: flex;
179
+ align-items: center;
180
+ }
181
+
182
+ .back-button-text {
183
+ font-size: 11px;
184
+ line-height: 11px;
185
+ color: rgb(21, 31, 114);
186
+ }
187
+
188
+
189
+ .selfie-capture-review-image {
190
+ overflow: hidden;
191
+ aspect-ratio: 1/1;
192
+ }
193
+
194
+ #review-image {
195
+ scale: 1.75;
196
+ }
197
+
198
+ @media (max-aspect-ratio: 1/1) {
199
+ #review-image {
200
+ transform: scaleX(-1) translateY(-10%);
201
+ }
202
+ }
203
+
204
+ .tips,
205
+ .powered-by {
206
+ align-items: center;
207
+ border-radius: 0.25rem;
208
+ color: #4e6577;
209
+ display: flex;
210
+ justify-content: center;
211
+ letter-spacing: 0.075em;
212
+ }
213
+
214
+ .powered-by {
215
+ box-shadow: 0px 2.57415px 2.57415px rgba(0, 0, 0, 0.06);
216
+ display: inline-flex;
217
+ font-size: 0.5rem;
218
+ }
219
+
220
+ .tips {
221
+ margin-left: auto;
222
+ margin-right: auto;
223
+ max-width: 17rem;
224
+ }
225
+
226
+ .tips > * + *,
227
+ .powered-by > * + * {
228
+ display: inline-block;
229
+ margin-left: 0.5em;
230
+ }
231
+
232
+ .powered-by .company {
233
+ color: #18406d;
234
+ font-weight: 700;
235
+ letter-spacing: 0.15rem;
236
+ }
237
+
238
+ .logo-mark {
239
+ background-color: #004071;
240
+ display: inline-block;
241
+ padding: 0.25em 0.5em;
242
+ }
243
+
244
+ .logo-mark svg {
245
+ height: auto;
246
+ justify-self: center;
247
+ width: 0.75em;
248
+ }
249
+
250
+ #document-capture-instructions-screen,
251
+ #back-of-document-capture-instructions-screen {
252
+ padding-block: 2rem;
253
+ display: flex;
254
+ flex-direction: column;
255
+ max-block-size: 100%;
256
+ max-inline-size: 40ch;
257
+ justify-content: space-between;
258
+ }
259
+
260
+ #document-capture-instructions-screen header p {
261
+ margin-block: 0 !important;
262
+ }
263
+
264
+ .description {
265
+ color: var(--neutral-off-black, #2D2B2A);
266
+ text-align: center;
267
+
268
+ /* p */
269
+ font-family: DM Sans;
270
+ font-size: 0.875rem;
271
+ font-style: normal;
272
+ font-weight: 400;
273
+ line-height: 18px;
274
+ }
275
+
276
+ .padding-bottom-2 {
277
+ padding-bottom: 2rem;
278
+ }
279
+
280
+ .instructions-wrapper {
281
+ display: inline-flex;
282
+ flex-direction: column;
283
+ gap: 1.5rem;
284
+ margin-block-start: 2rem;
285
+ margin-block-end: 2rem;
286
+ }
287
+ .instructions {
288
+ display: flex;
289
+ align-items: center;
290
+ text-align: initial;
291
+ }
292
+
293
+ .instructions svg {
294
+ flex-shrink: 0;
295
+ margin-inline-end: 2rem;
296
+ }
297
+
298
+ .instructions p {
299
+ margin-block: 0;
300
+ }
301
+
302
+ .instruction {
303
+ display: flex;
304
+ flex-direction: column;
305
+ gap: 0.5rem;
306
+ }
307
+
308
+ .instruction-body {
309
+ font-size: 0.75rem;
310
+ }
311
+
312
+ .instruction-header {
313
+ color: var(--web-digital-blue, #001096);
314
+ }
315
+
316
+ .flex-column {
317
+ display: flex;
318
+ flex-direction: column;
319
+ }
320
+
321
+ @keyframes spin {
322
+ 0% {
323
+ transform: translate3d(-50%, -50%, 0) rotate(0deg);
324
+ }
325
+ 100% {
326
+ transform: translate3d(-50%, -50%, 0) rotate(360deg);
327
+ }
328
+ }
329
+
330
+ .spinner {
331
+ animation: 1.5s linear infinite spin;
332
+ animation-play-state: inherit;
333
+ border: solid 5px #cfd0d1;
334
+ border-bottom-color: var(--color-active);
335
+ border-radius: 50%;
336
+ content: "";
337
+ display: block;
338
+ height: 25px;
339
+ width: 25px;
340
+ will-change: transform;
341
+ position: relative;
342
+ top: .675rem;
343
+ left: 1.25rem;
344
+ }
345
+
346
+ </style>`;
347
+
348
+ export default styles;
@@ -0,0 +1,52 @@
1
+ const typography = `
2
+ .text-xs {
3
+ font-size: 0.75rem;
4
+ line-height: 1rem;
5
+ }
6
+ .text-sm {
7
+ font-size: 0.875rem;
8
+ line-height: 1.125rem;
9
+ }
10
+ .text-base {
11
+ font-size: 1rem;
12
+ line-height: 1rem;
13
+ }
14
+ .text-lg {
15
+ font-size: 1.125rem;
16
+ line-height: 1.75rem;
17
+ }
18
+ .text-xl {
19
+ font-size: 1.25rem;
20
+ line-height: 1.75rem;
21
+ }
22
+ .text-2xl {
23
+ font-size: 1.5rem;
24
+ line-height: 2rem;
25
+ }
26
+ .text-3xl {
27
+ font-size: 1.875rem;
28
+ line-height: 2.25rem;
29
+ }
30
+ .text-4xl {
31
+ font-size: 2rem;
32
+ line-height: 2.5rem;
33
+ }
34
+ .text-5xl {
35
+ font-size: 2.25rem;
36
+ line-height: 2.5rem;
37
+ }
38
+ .font-bold {
39
+ font-weight: 700;
40
+ }
41
+ .font-semibold {
42
+ font-weight: 600;
43
+ }
44
+ .font-medium {
45
+ font-weight: 500;
46
+ }
47
+ .font-normal {
48
+ font-weight: 400;
49
+ }
50
+ `;
51
+
52
+ export default typography;