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