@smileid/web-components 2.0.1 → 10.0.0

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 (125) hide show
  1. package/dist/DocumentCaptureScreens-Dwl7UqVH.js +1534 -0
  2. package/dist/DocumentCaptureScreens-Dwl7UqVH.js.map +1 -0
  3. package/dist/EndUserConsent-C5hZdJzH.js +715 -0
  4. package/dist/EndUserConsent-C5hZdJzH.js.map +1 -0
  5. package/dist/Navigation-juBE4qOw.js +136 -0
  6. package/dist/Navigation-juBE4qOw.js.map +1 -0
  7. package/dist/PoweredBySmileId-CxbaihMu.js +33 -0
  8. package/dist/PoweredBySmileId-CxbaihMu.js.map +1 -0
  9. package/dist/SelfieCaptureScreens-CQc251hz.js +7618 -0
  10. package/dist/SelfieCaptureScreens-CQc251hz.js.map +1 -0
  11. package/dist/SignaturePad-C7MtmT8m.js +324 -0
  12. package/dist/SignaturePad-C7MtmT8m.js.map +1 -0
  13. package/dist/TotpConsent-CQU5jQi4.js +730 -0
  14. package/dist/TotpConsent-CQU5jQi4.js.map +1 -0
  15. package/dist/combobox.js +300 -0
  16. package/dist/combobox.js.map +1 -0
  17. package/dist/document.js +5 -0
  18. package/dist/document.js.map +1 -0
  19. package/dist/end-user-consent.js +5 -0
  20. package/dist/end-user-consent.js.map +1 -0
  21. package/dist/main.js +22 -0
  22. package/dist/main.js.map +1 -0
  23. package/dist/navigation.js +5 -0
  24. package/dist/navigation.js.map +1 -0
  25. package/dist/package-Oi2Yil3b.js +105 -0
  26. package/dist/package-Oi2Yil3b.js.map +1 -0
  27. package/dist/selfie.js +5 -0
  28. package/dist/selfie.js.map +1 -0
  29. package/dist/signature-pad.js +5 -0
  30. package/dist/signature-pad.js.map +1 -0
  31. package/dist/smart-camera-web.js +303 -0
  32. package/dist/smart-camera-web.js.map +1 -0
  33. package/dist/styles-BUWNxWeQ.js +406 -0
  34. package/dist/styles-BUWNxWeQ.js.map +1 -0
  35. package/dist/totp-consent.js +5 -0
  36. package/dist/totp-consent.js.map +1 -0
  37. package/dist/types/combobox.d.ts +21 -0
  38. package/dist/types/document.d.ts +21 -0
  39. package/dist/types/end-user-consent.d.ts +21 -0
  40. package/dist/types/main.d.ts +331 -0
  41. package/dist/types/navigation.d.ts +21 -0
  42. package/dist/types/selfie.d.ts +21 -0
  43. package/dist/types/signature-pad.d.ts +21 -0
  44. package/dist/types/smart-camera-web.d.ts +21 -0
  45. package/dist/types/totp-consent.d.ts +21 -0
  46. package/{src → lib}/components/README.md +14 -14
  47. package/{src → lib}/components/attribution/PoweredBySmileId.js +42 -42
  48. package/{src → lib}/components/camera-permission/CameraPermission.js +140 -140
  49. package/{src → lib}/components/camera-permission/CameraPermission.stories.js +27 -27
  50. package/{src → lib}/components/combobox/src/Combobox.js +589 -589
  51. package/{src → lib}/components/combobox/src/index.js +1 -1
  52. package/{src → lib}/components/document/src/DocumentCaptureScreens.js +409 -409
  53. package/{src → lib}/components/document/src/DocumentCaptureScreens.stories.js +57 -57
  54. package/{src → lib}/components/document/src/README.md +111 -111
  55. package/{src → lib}/components/document/src/document-capture/DocumentCapture.js +760 -760
  56. package/{src → lib}/components/document/src/document-capture/DocumentCapture.stories.js +78 -78
  57. package/{src → lib}/components/document/src/document-capture/README.md +90 -90
  58. package/{src → lib}/components/document/src/document-capture/index.js +3 -3
  59. package/{src → lib}/components/document/src/document-capture-instructions/DocumentCaptureInstructions.js +499 -499
  60. package/{src → lib}/components/document/src/document-capture-instructions/DocumentCaptureInstructions.stories.js +24 -24
  61. package/{src → lib}/components/document/src/document-capture-instructions/README.md +56 -56
  62. package/{src → lib}/components/document/src/document-capture-instructions/index.js +3 -3
  63. package/{src → lib}/components/document/src/document-capture-review/DocumentCaptureReview.js +362 -362
  64. package/{src → lib}/components/document/src/document-capture-review/DocumentCaptureReview.stories.js +24 -24
  65. package/{src → lib}/components/document/src/document-capture-review/README.md +79 -79
  66. package/{src → lib}/components/document/src/document-capture-review/index.js +3 -3
  67. package/{src → lib}/components/document/src/index.js +3 -3
  68. package/{src → lib}/components/end-user-consent/src/EndUserConsent.js +795 -795
  69. package/{src → lib}/components/end-user-consent/src/EndUserConsent.stories.js +29 -29
  70. package/{src → lib}/components/end-user-consent/src/index.js +4 -4
  71. package/{src → lib}/components/navigation/src/Navigation.js +171 -171
  72. package/{src → lib}/components/navigation/src/Navigation.stories.js +24 -24
  73. package/{src → lib}/components/navigation/src/index.js +3 -3
  74. package/{src → lib}/components/selfie/README.md +225 -225
  75. package/{src → lib}/components/selfie/src/SelfieCaptureScreens.js +433 -282
  76. package/{src → lib}/components/selfie/src/SelfieCaptureScreens.stories.js +29 -29
  77. package/{src → lib}/components/selfie/src/index.js +3 -5
  78. package/{src → lib}/components/selfie/src/selfie-capture/SelfieCapture.js +1041 -1010
  79. package/{src → lib}/components/selfie/src/selfie-capture/SelfieCapture.stories.js +36 -36
  80. package/{src → lib}/components/selfie/src/selfie-capture/index.js +3 -3
  81. package/{src → lib}/components/selfie/src/selfie-capture-instructions/SelfieCaptureInstructions.js +657 -648
  82. package/{src → lib}/components/selfie/src/selfie-capture-instructions/SelfieCaptureInstructions.stories.js +23 -23
  83. package/{src → lib}/components/selfie/src/selfie-capture-instructions/index.js +3 -3
  84. package/{src → lib}/components/selfie/src/selfie-capture-review/SelfieCaptureReview.js +340 -347
  85. package/{src → lib}/components/selfie/src/selfie-capture-review/SelfieCaptureReview.stories.js +24 -24
  86. package/{src → lib}/components/selfie/src/selfie-capture-review/index.js +3 -3
  87. package/lib/components/selfie/src/selfie-capture-wrapper/SelfieCaptureWrapper.tsx +227 -0
  88. package/lib/components/selfie/src/selfie-capture-wrapper/index.ts +1 -0
  89. package/lib/components/selfie/src/smartselfie-capture/OvalProgress.tsx +81 -0
  90. package/lib/components/selfie/src/smartselfie-capture/SmartSelfieCapture.tsx +224 -0
  91. package/lib/components/selfie/src/smartselfie-capture/components/AlertDisplay.tsx +34 -0
  92. package/lib/components/selfie/src/smartselfie-capture/components/CameraPreview.tsx +97 -0
  93. package/lib/components/selfie/src/smartselfie-capture/components/CaptureControls.tsx +74 -0
  94. package/lib/components/selfie/src/smartselfie-capture/components/index.ts +3 -0
  95. package/lib/components/selfie/src/smartselfie-capture/constants.ts +23 -0
  96. package/lib/components/selfie/src/smartselfie-capture/hooks/index.ts +2 -0
  97. package/lib/components/selfie/src/smartselfie-capture/hooks/useCamera.ts +94 -0
  98. package/lib/components/selfie/src/smartselfie-capture/hooks/useFaceCapture.ts +558 -0
  99. package/lib/components/selfie/src/smartselfie-capture/index.ts +1 -0
  100. package/lib/components/selfie/src/smartselfie-capture/utils/alertMessages.ts +12 -0
  101. package/lib/components/selfie/src/smartselfie-capture/utils/canvas.ts +105 -0
  102. package/lib/components/selfie/src/smartselfie-capture/utils/faceDetection.ts +129 -0
  103. package/lib/components/selfie/src/smartselfie-capture/utils/imageCapture.ts +64 -0
  104. package/lib/components/selfie/src/smartselfie-capture/utils/index.ts +4 -0
  105. package/lib/components/selfie/src/smartselfie-capture/utils/mediapipeManager.ts +60 -0
  106. package/{src → lib}/components/signature-pad/package-lock.json +3009 -3009
  107. package/{src → lib}/components/signature-pad/package.json +30 -30
  108. package/{src → lib}/components/signature-pad/src/SignaturePad.js +484 -484
  109. package/{src → lib}/components/signature-pad/src/SignaturePad.stories.js +32 -32
  110. package/{src → lib}/components/signature-pad/src/index.js +3 -3
  111. package/{src → lib}/components/smart-camera-web/src/README.md +206 -207
  112. package/{src → lib}/components/smart-camera-web/src/SmartCameraWeb.js +299 -299
  113. package/{src → lib}/components/smart-camera-web/src/SmartCameraWeb.stories.js +57 -57
  114. package/{src → lib}/components/totp-consent/src/TotpConsent.js +949 -949
  115. package/{src → lib}/components/totp-consent/src/index.js +4 -4
  116. package/{src → lib}/domain/camera/src/README.md +38 -38
  117. package/{src → lib}/domain/camera/src/SmartCamera.js +109 -109
  118. package/{src → lib}/domain/constants/src/Constants.js +27 -27
  119. package/{src → lib}/domain/file-upload/README.md +35 -35
  120. package/{src → lib}/domain/file-upload/src/SmartFileUpload.js +65 -65
  121. package/{src → lib}/styles/README.md +3 -3
  122. package/{src → lib}/styles/src/styles.js +359 -359
  123. package/{src → lib}/styles/src/typography.js +52 -52
  124. package/package.json +109 -58
  125. package/src/index.js +0 -5
@@ -1,362 +1,362 @@
1
- import styles from '../../../../styles/src/styles';
2
- import '../../../navigation/src';
3
-
4
- function templateString() {
5
- return `
6
- <style>
7
- .retake-photo.button[data-variant~="ghost"] {
8
- color: #FF5805;
9
- }
10
-
11
-
12
- @media (max-width: 600px) {
13
- .id-camera-screen {
14
- width: 100%;
15
- height: 100vh;
16
- }
17
-
18
- .section {
19
- width: 100%;
20
- height: 100vh;
21
- justify-content: center;
22
- }
23
- }
24
-
25
- .id-image-container {
26
- display: flex;
27
- flex-direction: column;
28
- align-items: center;
29
- gap: 1.75rem;
30
- }
31
-
32
- .id-image {
33
- width: 100%;
34
- text-align: center;
35
- position: relative;
36
- background: white;
37
- }
38
- img {
39
- height: 100%;
40
- min-height: 100px;
41
- width: 98%;
42
- }
43
-
44
- .action-buttons {
45
- width: 80%;
46
- }
47
-
48
-
49
- .icon-btn {
50
- appearance: none;
51
- background: none;
52
- border: none;
53
- color: hsl(0deg 0% 94%);
54
- cursor: pointer;
55
- display: flex;
56
- align-items: center;
57
- justify-content: center;
58
- padding: 4px 8px;
59
- }
60
- .justify-right {
61
- justify-content: end !important;
62
- }
63
- .nav {
64
- display: flex;
65
- justify-content: space-between;
66
- }
67
-
68
- .back-wrapper {
69
- display: flex;
70
- align-items: center;
71
- }
72
-
73
- .back-button-text {
74
- font-size: 11px;
75
- line-height: 11px;
76
- color: rgb(21, 31, 114);
77
- }
78
-
79
-
80
-
81
- .tips,
82
- .powered-by {
83
- align-items: center;
84
- border-radius: 0.25rem;
85
- color: #4e6577;
86
- display: flex;
87
- justify-content: center;
88
- letter-spacing: 0.075em;
89
- }
90
-
91
- .powered-by {
92
- box-shadow: 0px 2.57415px 2.57415px rgba(0, 0, 0, 0.06);
93
- display: inline-flex;
94
- font-size: 0.5rem;
95
- }
96
-
97
- .tips {
98
- margin-left: auto;
99
- margin-right: auto;
100
- max-width: 17rem;
101
- }
102
-
103
- .tips > * + *,
104
- .powered-by > * + * {
105
- display: inline-block;
106
- margin-left: 0.5em;
107
- }
108
-
109
- .powered-by .company {
110
- color: #18406d;
111
- font-weight: 700;
112
- letter-spacing: 0.15rem;
113
- }
114
-
115
- .logo-mark {
116
- background-color: #004071;
117
- display: inline-block;
118
- padding: 0.25em 0.5em;
119
- }
120
-
121
- .logo-mark svg {
122
- height: auto;
123
- justify-self: center;
124
- width: 0.75em;
125
- }
126
-
127
- #document-capture-review-screen {
128
- block-size: 45rem;
129
- padding-block: 2rem;
130
- display: flex;
131
- flex-direction: column;
132
- max-block-size: 100%;
133
- max-inline-size: 40ch;
134
- }
135
-
136
- #document-capture-review-screen .id-image-container.landscape {
137
- height: auto;
138
- }
139
-
140
- #document-capture-review-screen header p {
141
- margin-block: 0 !important;
142
- }
143
-
144
- .description {
145
- color: var(--neutral-off-black, #2D2B2A);
146
- text-align: center;
147
-
148
- /* p */
149
- font-family: DM Sans;
150
- font-size: 0.875rem;
151
- font-style: normal;
152
- font-weight: 400;
153
- line-height: 18px;
154
- }
155
-
156
- .padding-bottom-2 {
157
- padding-bottom: 2rem;
158
- }
159
- img {
160
- border-width: 0.25rem;
161
- border-color: #9394ab;
162
- border-style: solid;
163
- border-radius: 0.25rem;
164
- }
165
-
166
- .instructions-wrapper {
167
- display: inline-flex;
168
- flex-direction: column;
169
- align-items: flex-start;
170
- gap: 2rem;
171
- margin-block-start: 2rem;
172
- margin-block-end: 4rem;
173
- }
174
- .instructions {
175
- display: flex;
176
- align-items: center;
177
- text-align: initial;
178
- }
179
-
180
- .instructions svg {
181
- flex-shrink: 0;
182
- margin-inline-end: 2rem;
183
- }
184
-
185
- .instructions p {
186
- margin-block: 0;
187
- }
188
-
189
- .instruction-body {
190
- font-size: 0.75rem;
191
- }
192
-
193
- h1 {
194
- color: var(--web-digital-blue, #001096);
195
- text-align: center;
196
-
197
- /* h1 */
198
- font-size: 1.5rem;
199
- font-style: normal;
200
- font-weight: 700;
201
- line-height: 36px; /* 150% */
202
- }
203
-
204
- .p2 {
205
- font-size: 1rem;
206
- font-style: normal;
207
- font-weight: 500;
208
- line-height: 1rem;
209
- }
210
-
211
- .instruction-header {
212
- color: var(--web-digital-blue, #001096);
213
- }
214
-
215
- .h2 {
216
- font-size: 1rem;
217
- font-style: normal;
218
- font-weight: 700;
219
- line-height: 1.5rem;
220
- }
221
- </style>
222
- ${styles(this.themeColor)}
223
- <div id='document-capture-review-screen' class='flow center'>
224
- <smileid-navigation ${this.showNavigation ? 'show-navigation' : ''} hide-back></smileid-navigation>
225
- <h1 class="header-title title-color">
226
- Is the document clear and readable?
227
- </h1>
228
- <p class="description">Make sure all corners of the document
229
- are visible and there is no glare</p>
230
- <div class='section | flow'>
231
- <div class='id-image-container'>
232
- <div class='id-image'>
233
- <div class='video-overlay'></div>
234
- ${this.imageSrc ? `<img alt='your ID card' id='document-capture-review-image' src='${this.imageSrc}' />` : ''}
235
- </div>
236
- <div class='flow action-buttons'>
237
- <button data-variant='solid full-width' class='button' type='button' id='select-id-image'>
238
- Yes, my ID is readable
239
- </button>
240
- <button data-variant='ghost full-width' class='button retake-photo' type='button' id='re-capture-id-image'>
241
- No, retake photo
242
- </button>
243
- </div>
244
- </div>
245
-
246
- ${
247
- this.hideAttribution
248
- ? ''
249
- : `
250
- <powered-by-smile-id></powered-by-smile-id>
251
- `
252
- }
253
- </div>
254
- </div>
255
- `;
256
- }
257
-
258
- class IdReview extends HTMLElement {
259
- constructor() {
260
- super();
261
- this.templateString = templateString.bind(this);
262
- this.render = () => this.templateString();
263
-
264
- this.attachShadow({ mode: 'open' });
265
- }
266
-
267
- connectedCallback() {
268
- const template = document.createElement('template');
269
- template.innerHTML = this.render();
270
- this.shadowRoot.innerHTML = '';
271
- this.shadowRoot.appendChild(template.content.cloneNode(true));
272
- this.setUpEventListeners();
273
- }
274
-
275
- static get observedAttributes() {
276
- return ['hide-back-to-host', 'show-navigation', 'data-image'];
277
- }
278
-
279
- get hideBack() {
280
- return this.hasAttribute('hide-back-to-host');
281
- }
282
-
283
- get showNavigation() {
284
- return this.hasAttribute('show-navigation');
285
- }
286
-
287
- get themeColor() {
288
- return this.getAttribute('theme-color') || '#001096';
289
- }
290
-
291
- get hideAttribution() {
292
- return this.hasAttribute('hide-attribution');
293
- }
294
-
295
- get imageSrc() {
296
- return this.getAttribute('data-image');
297
- }
298
-
299
- get title() {
300
- return this.getAttribute('title') || 'Submit Front of ID';
301
- }
302
-
303
- handleBackEvents() {
304
- this.dispatchEvent(new CustomEvent('document-capture-review.cancelled'));
305
- }
306
-
307
- handleCloseEvents() {
308
- this.dispatchEvent(new CustomEvent('document-capture-review.close'));
309
- }
310
-
311
- attributeChangedCallback(name) {
312
- switch (name) {
313
- case 'data-image':
314
- case 'hide-back-to-host':
315
- case 'show-navigation':
316
- this.shadowRoot.innerHTML = this.render();
317
- this.setUpEventListeners();
318
- break;
319
- default:
320
- break;
321
- }
322
- }
323
-
324
- setUpEventListeners() {
325
- this.selectIDImage = this.shadowRoot.querySelector('#select-id-image');
326
- this.reCaptureIDImage = this.shadowRoot.querySelector(
327
- '#re-capture-id-image',
328
- );
329
- this.navigation = this.shadowRoot.querySelector('smileid-navigation');
330
- this.navigation.addEventListener('navigation.back', () => {
331
- this.handleBackEvents();
332
- });
333
-
334
- this.navigation.addEventListener('navigation.close', () => {
335
- this.handleCloseEvents();
336
- });
337
-
338
- this.selectIDImage.addEventListener('click', () => {
339
- this.dispatchEvent(
340
- new CustomEvent('document-capture-review.accepted', {
341
- detail: {},
342
- }),
343
- );
344
- });
345
- this.reCaptureIDImage.addEventListener('click', () => {
346
- this.dispatchEvent(
347
- new CustomEvent('document-capture-review.rejected', {
348
- detail: {},
349
- }),
350
- );
351
- });
352
- }
353
- }
354
-
355
- if (
356
- 'customElements' in window &&
357
- !customElements.get('document-capture-review')
358
- ) {
359
- window.customElements.define('document-capture-review', IdReview);
360
- }
361
-
362
- export default IdReview;
1
+ import styles from '../../../../styles/src/styles';
2
+ import '../../../navigation/src';
3
+
4
+ function templateString() {
5
+ return `
6
+ <style>
7
+ .retake-photo.button[data-variant~="ghost"] {
8
+ color: #FF5805;
9
+ }
10
+
11
+
12
+ @media (max-width: 600px) {
13
+ .id-camera-screen {
14
+ width: 100%;
15
+ height: 100vh;
16
+ }
17
+
18
+ .section {
19
+ width: 100%;
20
+ height: 100vh;
21
+ justify-content: center;
22
+ }
23
+ }
24
+
25
+ .id-image-container {
26
+ display: flex;
27
+ flex-direction: column;
28
+ align-items: center;
29
+ gap: 1.75rem;
30
+ }
31
+
32
+ .id-image {
33
+ width: 100%;
34
+ text-align: center;
35
+ position: relative;
36
+ background: white;
37
+ }
38
+ img {
39
+ height: 100%;
40
+ min-height: 100px;
41
+ width: 98%;
42
+ }
43
+
44
+ .action-buttons {
45
+ width: 80%;
46
+ }
47
+
48
+
49
+ .icon-btn {
50
+ appearance: none;
51
+ background: none;
52
+ border: none;
53
+ color: hsl(0deg 0% 94%);
54
+ cursor: pointer;
55
+ display: flex;
56
+ align-items: center;
57
+ justify-content: center;
58
+ padding: 4px 8px;
59
+ }
60
+ .justify-right {
61
+ justify-content: end !important;
62
+ }
63
+ .nav {
64
+ display: flex;
65
+ justify-content: space-between;
66
+ }
67
+
68
+ .back-wrapper {
69
+ display: flex;
70
+ align-items: center;
71
+ }
72
+
73
+ .back-button-text {
74
+ font-size: 11px;
75
+ line-height: 11px;
76
+ color: rgb(21, 31, 114);
77
+ }
78
+
79
+
80
+
81
+ .tips,
82
+ .powered-by {
83
+ align-items: center;
84
+ border-radius: 0.25rem;
85
+ color: #4e6577;
86
+ display: flex;
87
+ justify-content: center;
88
+ letter-spacing: 0.075em;
89
+ }
90
+
91
+ .powered-by {
92
+ box-shadow: 0px 2.57415px 2.57415px rgba(0, 0, 0, 0.06);
93
+ display: inline-flex;
94
+ font-size: 0.5rem;
95
+ }
96
+
97
+ .tips {
98
+ margin-left: auto;
99
+ margin-right: auto;
100
+ max-width: 17rem;
101
+ }
102
+
103
+ .tips > * + *,
104
+ .powered-by > * + * {
105
+ display: inline-block;
106
+ margin-left: 0.5em;
107
+ }
108
+
109
+ .powered-by .company {
110
+ color: #18406d;
111
+ font-weight: 700;
112
+ letter-spacing: 0.15rem;
113
+ }
114
+
115
+ .logo-mark {
116
+ background-color: #004071;
117
+ display: inline-block;
118
+ padding: 0.25em 0.5em;
119
+ }
120
+
121
+ .logo-mark svg {
122
+ height: auto;
123
+ justify-self: center;
124
+ width: 0.75em;
125
+ }
126
+
127
+ #document-capture-review-screen {
128
+ block-size: 45rem;
129
+ padding-block: 2rem;
130
+ display: flex;
131
+ flex-direction: column;
132
+ max-block-size: 100%;
133
+ max-inline-size: 40ch;
134
+ }
135
+
136
+ #document-capture-review-screen .id-image-container.landscape {
137
+ height: auto;
138
+ }
139
+
140
+ #document-capture-review-screen header p {
141
+ margin-block: 0 !important;
142
+ }
143
+
144
+ .description {
145
+ color: var(--neutral-off-black, #2D2B2A);
146
+ text-align: center;
147
+
148
+ /* p */
149
+ font-family: DM Sans;
150
+ font-size: 0.875rem;
151
+ font-style: normal;
152
+ font-weight: 400;
153
+ line-height: 18px;
154
+ }
155
+
156
+ .padding-bottom-2 {
157
+ padding-bottom: 2rem;
158
+ }
159
+ img {
160
+ border-width: 0.25rem;
161
+ border-color: #9394ab;
162
+ border-style: solid;
163
+ border-radius: 0.25rem;
164
+ }
165
+
166
+ .instructions-wrapper {
167
+ display: inline-flex;
168
+ flex-direction: column;
169
+ align-items: flex-start;
170
+ gap: 2rem;
171
+ margin-block-start: 2rem;
172
+ margin-block-end: 4rem;
173
+ }
174
+ .instructions {
175
+ display: flex;
176
+ align-items: center;
177
+ text-align: initial;
178
+ }
179
+
180
+ .instructions svg {
181
+ flex-shrink: 0;
182
+ margin-inline-end: 2rem;
183
+ }
184
+
185
+ .instructions p {
186
+ margin-block: 0;
187
+ }
188
+
189
+ .instruction-body {
190
+ font-size: 0.75rem;
191
+ }
192
+
193
+ h1 {
194
+ color: var(--web-digital-blue, #001096);
195
+ text-align: center;
196
+
197
+ /* h1 */
198
+ font-size: 1.5rem;
199
+ font-style: normal;
200
+ font-weight: 700;
201
+ line-height: 36px; /* 150% */
202
+ }
203
+
204
+ .p2 {
205
+ font-size: 1rem;
206
+ font-style: normal;
207
+ font-weight: 500;
208
+ line-height: 1rem;
209
+ }
210
+
211
+ .instruction-header {
212
+ color: var(--web-digital-blue, #001096);
213
+ }
214
+
215
+ .h2 {
216
+ font-size: 1rem;
217
+ font-style: normal;
218
+ font-weight: 700;
219
+ line-height: 1.5rem;
220
+ }
221
+ </style>
222
+ ${styles(this.themeColor)}
223
+ <div id='document-capture-review-screen' class='flow center'>
224
+ <smileid-navigation ${this.showNavigation ? 'show-navigation' : ''} hide-back></smileid-navigation>
225
+ <h1 class="header-title title-color">
226
+ Is the document clear and readable?
227
+ </h1>
228
+ <p class="description">Make sure all corners of the document
229
+ are visible and there is no glare</p>
230
+ <div class='section | flow'>
231
+ <div class='id-image-container'>
232
+ <div class='id-image'>
233
+ <div class='video-overlay'></div>
234
+ ${this.imageSrc ? `<img alt='your ID card' id='document-capture-review-image' src='${this.imageSrc}' />` : ''}
235
+ </div>
236
+ <div class='flow action-buttons'>
237
+ <button data-variant='solid full-width' class='button' type='button' id='select-id-image'>
238
+ Yes, my ID is readable
239
+ </button>
240
+ <button data-variant='ghost full-width' class='button retake-photo' type='button' id='re-capture-id-image'>
241
+ No, retake photo
242
+ </button>
243
+ </div>
244
+ </div>
245
+
246
+ ${
247
+ this.hideAttribution
248
+ ? ''
249
+ : `
250
+ <powered-by-smile-id></powered-by-smile-id>
251
+ `
252
+ }
253
+ </div>
254
+ </div>
255
+ `;
256
+ }
257
+
258
+ class IdReview extends HTMLElement {
259
+ constructor() {
260
+ super();
261
+ this.templateString = templateString.bind(this);
262
+ this.render = () => this.templateString();
263
+
264
+ this.attachShadow({ mode: 'open' });
265
+ }
266
+
267
+ connectedCallback() {
268
+ const template = document.createElement('template');
269
+ template.innerHTML = this.render();
270
+ this.shadowRoot.innerHTML = '';
271
+ this.shadowRoot.appendChild(template.content.cloneNode(true));
272
+ this.setUpEventListeners();
273
+ }
274
+
275
+ static get observedAttributes() {
276
+ return ['hide-back-to-host', 'show-navigation', 'data-image'];
277
+ }
278
+
279
+ get hideBack() {
280
+ return this.hasAttribute('hide-back-to-host');
281
+ }
282
+
283
+ get showNavigation() {
284
+ return this.hasAttribute('show-navigation');
285
+ }
286
+
287
+ get themeColor() {
288
+ return this.getAttribute('theme-color') || '#001096';
289
+ }
290
+
291
+ get hideAttribution() {
292
+ return this.hasAttribute('hide-attribution');
293
+ }
294
+
295
+ get imageSrc() {
296
+ return this.getAttribute('data-image');
297
+ }
298
+
299
+ get title() {
300
+ return this.getAttribute('title') || 'Submit Front of ID';
301
+ }
302
+
303
+ handleBackEvents() {
304
+ this.dispatchEvent(new CustomEvent('document-capture-review.cancelled'));
305
+ }
306
+
307
+ handleCloseEvents() {
308
+ this.dispatchEvent(new CustomEvent('document-capture-review.close'));
309
+ }
310
+
311
+ attributeChangedCallback(name) {
312
+ switch (name) {
313
+ case 'data-image':
314
+ case 'hide-back-to-host':
315
+ case 'show-navigation':
316
+ this.shadowRoot.innerHTML = this.render();
317
+ this.setUpEventListeners();
318
+ break;
319
+ default:
320
+ break;
321
+ }
322
+ }
323
+
324
+ setUpEventListeners() {
325
+ this.selectIDImage = this.shadowRoot.querySelector('#select-id-image');
326
+ this.reCaptureIDImage = this.shadowRoot.querySelector(
327
+ '#re-capture-id-image',
328
+ );
329
+ this.navigation = this.shadowRoot.querySelector('smileid-navigation');
330
+ this.navigation.addEventListener('navigation.back', () => {
331
+ this.handleBackEvents();
332
+ });
333
+
334
+ this.navigation.addEventListener('navigation.close', () => {
335
+ this.handleCloseEvents();
336
+ });
337
+
338
+ this.selectIDImage.addEventListener('click', () => {
339
+ this.dispatchEvent(
340
+ new CustomEvent('document-capture-review.accepted', {
341
+ detail: {},
342
+ }),
343
+ );
344
+ });
345
+ this.reCaptureIDImage.addEventListener('click', () => {
346
+ this.dispatchEvent(
347
+ new CustomEvent('document-capture-review.rejected', {
348
+ detail: {},
349
+ }),
350
+ );
351
+ });
352
+ }
353
+ }
354
+
355
+ if (
356
+ 'customElements' in window &&
357
+ !customElements.get('document-capture-review')
358
+ ) {
359
+ window.customElements.define('document-capture-review', IdReview);
360
+ }
361
+
362
+ export default IdReview;