@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,347 +1,340 @@
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
- .icon-btn {
11
- appearance: none;
12
- background: none;
13
- border: none;
14
- color: hsl(0deg 0% 94%);
15
- cursor: pointer;
16
- display: flex;
17
- align-items: center;
18
- justify-content: center;
19
- padding: 4px 8px;
20
- }
21
- .justify-right {
22
- justify-content: end !important;
23
- }
24
- .nav {
25
- display: flex;
26
- justify-content: space-between;
27
- }
28
- .back-wrapper {
29
- display: flex;
30
- align-items: center;
31
- }
32
- .back-button-text {
33
- font-size: 11px;
34
- line-height: 11px;
35
- color: rgb(21, 31, 114);
36
- }
37
- .section {
38
- border-radius: .5rem;
39
- margin-left: auto;
40
- margin-right: auto;
41
- max-width: 35ch;
42
- padding: 1rem;
43
- }
44
- .selfie-capture-review-image {
45
- overflow: hidden;
46
- aspect-ratio: 1/1;
47
- }
48
- #review-image {
49
- scale: 1.75;
50
- }
51
- @media (max-aspect-ratio: 1/1) {
52
- #review-image {
53
- transform: scaleX(-1) translateY(-10%);
54
- }
55
- }
56
- .tips,
57
- .powered-by {
58
- align-items: center;
59
- border-radius: 0.25rem;
60
- color: #4e6577;
61
- display: flex;
62
- justify-content: center;
63
- letter-spacing: 0.075em;
64
- }
65
- .powered-by {
66
- box-shadow: 0px 2.57415px 2.57415px rgba(0, 0, 0, 0.06);
67
- display: inline-flex;
68
- font-size: 0.5rem;
69
- }
70
- .tips {
71
- margin-left: auto;
72
- margin-right: auto;
73
- max-width: 17rem;
74
- }
75
- .tips > * + *,
76
- .powered-by > * + * {
77
- display: inline-block;
78
- margin-left: 0.5em;
79
- }
80
- .powered-by .company {
81
- color: #18406d;
82
- font-weight: 700;
83
- letter-spacing: 0.15rem;
84
- }
85
- .logo-mark {
86
- background-color: #004071;
87
- display: inline-block;
88
- padding: 0.25em 0.5em;
89
- }
90
- .logo-mark svg {
91
- height: auto;
92
- justify-self: center;
93
- width: 0.75em;
94
- }
95
- #selfie-capture-review-screen {
96
- block-size: 45rem;
97
- padding-block: 2rem;
98
- display: flex;
99
- flex-direction: column;
100
- max-block-size: 100%;
101
- max-inline-size: 40ch;
102
- }
103
- #selfie-capture-review-screen .selfie-review-container.landscape {
104
- height: auto;
105
- }
106
- #selfie-capture-review-screen header p {
107
- margin-block: 0 !important;
108
- }
109
- .selfie-review-container.portrait {
110
- width: 100%;
111
- position: relative;
112
- height: calc(200px * 1.4);
113
- }
114
-
115
- .selfie-review-container.portrait img {
116
- width: calc(213px + 0.9rem);
117
- height: 100%;
118
- position: absolute;
119
- top: 239px;
120
- left: 161px;
121
- padding-bottom: calc((214px * 1.4) / 3);
122
- padding-top: calc((191px * 1.4) / 3);
123
- object-fit: cover;
124
-
125
- transform: translateX(-50%) translateY(-50%);
126
- z-index: 1;
127
- block-size: 100%;
128
- }
129
-
130
- .selfie-container,
131
- .selfie-review-container.landscape {
132
- height: auto;
133
- clip-path: inset(15% 20% 20% 20% round 10px);
134
- overflow: hidden;
135
- }
136
-
137
- .selfie-container img {
138
- background-color: black;
139
- position: absolute;
140
- left: 50%;
141
- height: calc(100% - 6px);
142
- clip-path: ellipse(101px 118px);
143
- }
144
-
145
- .description {
146
- color: var(--neutral-off-black, #2D2B2A);
147
- text-align: center;
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
- .padding-bottom-2 {
156
- padding-bottom: 2rem;
157
- }
158
- .instructions-wrapper {
159
- display: inline-flex;
160
- flex-direction: column;
161
- align-items: flex-start;
162
- gap: 2rem;
163
- margin-block-start: 2rem;
164
- margin-block-end: 4rem;
165
- }
166
- .instructions {
167
- display: flex;
168
- align-items: center;
169
- text-align: initial;
170
- }
171
- .instructions svg {
172
- flex-shrink: 0;
173
- margin-inline-end: 2rem;
174
- }
175
- .instructions p {
176
- margin-block: 0;
177
- }
178
- .instruction-body {
179
- font-size: 0.75rem;
180
- }
181
- h1 {
182
- color: var(--web-digital-blue, #001096);
183
- text-align: center;
184
- /* h1 */
185
- font-size: 1.5rem;
186
- font-style: normal;
187
- font-weight: 700;
188
- line-height: 36px; /* 150% */
189
- }
190
- .p2 {
191
- font-size: 1rem;
192
- font-style: normal;
193
- font-weight: 500;
194
- line-height: 1rem;
195
- }
196
- .instruction-header {
197
- color: var(--web-digital-blue, #001096);
198
- }
199
- .h2 {
200
- font-size: 1rem;
201
- font-style: normal;
202
- font-weight: 700;
203
- line-height: 1.5rem;
204
- }
205
- </style>
206
- ${styles(this.themeColor)}
207
- <div id='selfie-capture-review-screen' class='flow center'>
208
- <smileid-navigation ${this.showNavigation ? 'show-navigation' : ''} hide-back></smileid-navigation>
209
- <h1 class="header-title text-2xl title-color font-bold">
210
- Is your whole face visible and clear in this photo?
211
- </h1>
212
- <div class='section | flow'>
213
- <div class='selfie-review-container ${this.isPortraitCaptureView ? 'portrait' : 'landscape'}'>
214
- ${
215
- this.imageSrc
216
- ? `<img
217
- alt='your ID card'
218
- id='document-capture-review-image'
219
- src='${this.imageSrc}'
220
- width='396'
221
- />`
222
- : ''
223
- }
224
- </div>
225
- <div class='flow action-buttons'>
226
- <button data-variant='solid full-width' class='button' type='button' id='select-id-image'>
227
- Yes, use this
228
- </button>
229
- <button data-variant='ghost full-width' class='button retake-photo' type='button' id='re-capture-image'>
230
- No, Retake Selfie
231
- </button>
232
- </div>
233
- ${
234
- this.hideAttribution
235
- ? ''
236
- : `
237
- <powered-by-smile-id></powered-by-smile-id>
238
- `
239
- }
240
- </div>
241
- </div>
242
- `;
243
- }
244
-
245
- class SelfieCaptureReview extends HTMLElement {
246
- constructor() {
247
- super();
248
- this.templateString = templateString.bind(this);
249
- this.render = () => this.templateString();
250
-
251
- this.attachShadow({ mode: 'open' });
252
- }
253
-
254
- connectedCallback() {
255
- const template = document.createElement('template');
256
- template.innerHTML = this.render();
257
- this.shadowRoot.innerHTML = '';
258
- this.shadowRoot.appendChild(template.content.cloneNode(true));
259
- this.setUpEventListeners();
260
- }
261
-
262
- static get observedAttributes() {
263
- return ['hide-back-to-host', 'show-navigation', 'data-image'];
264
- }
265
-
266
- get hideBack() {
267
- return this.hasAttribute('hide-back-to-host');
268
- }
269
-
270
- get showNavigation() {
271
- return this.hasAttribute('show-navigation');
272
- }
273
-
274
- get themeColor() {
275
- return this.getAttribute('theme-color') || '#001096';
276
- }
277
-
278
- get hideAttribution() {
279
- return this.hasAttribute('hide-attribution');
280
- }
281
-
282
- get imageSrc() {
283
- return this.getAttribute('data-image');
284
- }
285
-
286
- get title() {
287
- return this.getAttribute('title') || 'Submit Front of ID';
288
- }
289
-
290
- handleBackEvents() {
291
- this.dispatchEvent(new CustomEvent('selfie-capture-review.cancelled'));
292
- }
293
-
294
- handleCloseEvents() {
295
- this.dispatchEvent(new CustomEvent('selfie-capture-review.close'));
296
- }
297
-
298
- attributeChangedCallback(name) {
299
- switch (name) {
300
- case 'data-image':
301
- case 'hide-back-to-host':
302
- case 'show-navigation':
303
- this.shadowRoot.innerHTML = this.render();
304
- this.setUpEventListeners();
305
- break;
306
- default:
307
- break;
308
- }
309
- }
310
-
311
- setUpEventListeners() {
312
- this.selectImage = this.shadowRoot.querySelector('#select-id-image');
313
- this.reCaptureImage = this.shadowRoot.querySelector('#re-capture-image');
314
- this.navigation = this.shadowRoot.querySelector('smileid-navigation');
315
-
316
- this.navigation.addEventListener('navigation.back', () => {
317
- this.handleBackEvents();
318
- });
319
- this.navigation.addEventListener('navigation.close', () => {
320
- this.handleCloseEvents();
321
- });
322
-
323
- this.selectImage.addEventListener('click', () => {
324
- this.dispatchEvent(
325
- new CustomEvent('selfie-capture-review.accepted', {
326
- detail: {},
327
- }),
328
- );
329
- });
330
- this.reCaptureImage.addEventListener('click', () => {
331
- this.dispatchEvent(
332
- new CustomEvent('selfie-capture-review.rejected', {
333
- detail: {},
334
- }),
335
- );
336
- });
337
- }
338
- }
339
-
340
- if (
341
- 'customElements' in window &&
342
- !customElements.get('selfie-capture-review')
343
- ) {
344
- window.customElements.define('selfie-capture-review', SelfieCaptureReview);
345
- }
346
-
347
- export default SelfieCaptureReview;
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
+ .icon-btn {
11
+ appearance: none;
12
+ background: none;
13
+ border: none;
14
+ color: hsl(0deg 0% 94%);
15
+ cursor: pointer;
16
+ display: flex;
17
+ align-items: center;
18
+ justify-content: center;
19
+ padding: 4px 8px;
20
+ }
21
+ .justify-right {
22
+ justify-content: end !important;
23
+ }
24
+ .nav {
25
+ display: flex;
26
+ justify-content: space-between;
27
+ }
28
+ .back-wrapper {
29
+ display: flex;
30
+ align-items: center;
31
+ }
32
+ .back-button-text {
33
+ font-size: 11px;
34
+ line-height: 11px;
35
+ color: rgb(21, 31, 114);
36
+ }
37
+ .section {
38
+ border-radius: .5rem;
39
+ margin-left: auto;
40
+ margin-right: auto;
41
+ max-width: 35ch;
42
+ padding: 1rem;
43
+ }
44
+ .selfie-capture-review-image {
45
+ overflow: hidden;
46
+ aspect-ratio: 1/1;
47
+ }
48
+ #review-image {
49
+ scale: 1.75;
50
+ }
51
+ @media (max-aspect-ratio: 1/1) {
52
+ #review-image {
53
+ transform: scaleX(-1) translateY(-10%);
54
+ }
55
+ }
56
+ .tips,
57
+ .powered-by {
58
+ align-items: center;
59
+ border-radius: 0.25rem;
60
+ color: #4e6577;
61
+ display: flex;
62
+ justify-content: center;
63
+ letter-spacing: 0.075em;
64
+ }
65
+ .powered-by {
66
+ box-shadow: 0px 2.57415px 2.57415px rgba(0, 0, 0, 0.06);
67
+ display: inline-flex;
68
+ font-size: 0.5rem;
69
+ }
70
+ .tips {
71
+ margin-left: auto;
72
+ margin-right: auto;
73
+ max-width: 17rem;
74
+ }
75
+ .tips > * + *,
76
+ .powered-by > * + * {
77
+ display: inline-block;
78
+ margin-left: 0.5em;
79
+ }
80
+ .powered-by .company {
81
+ color: #18406d;
82
+ font-weight: 700;
83
+ letter-spacing: 0.15rem;
84
+ }
85
+ .logo-mark {
86
+ background-color: #004071;
87
+ display: inline-block;
88
+ padding: 0.25em 0.5em;
89
+ }
90
+ .logo-mark svg {
91
+ height: auto;
92
+ justify-self: center;
93
+ width: 0.75em;
94
+ }
95
+ #selfie-capture-review-screen {
96
+ block-size: 45rem;
97
+ padding-block: 2rem;
98
+ display: flex;
99
+ flex-direction: column;
100
+ max-block-size: 100%;
101
+ max-inline-size: 40ch;
102
+ }
103
+ #selfie-capture-review-screen .selfie-review-container.landscape {
104
+ height: auto;
105
+ }
106
+ #selfie-capture-review-screen header p {
107
+ margin-block: 0 !important;
108
+ }
109
+ .selfie-review-container.portrait {
110
+ width: 100%;
111
+ position: relative;
112
+ height: calc(200px * 1.4);
113
+ }
114
+
115
+ .selfie-review-container.portrait img {
116
+ width: calc(213px + 0.9rem);
117
+ height: 100%;
118
+ position: absolute;
119
+ top: 239px;
120
+ left: 161px;
121
+ padding-bottom: calc((214px * 1.4) / 3);
122
+ padding-top: calc((191px * 1.4) / 3);
123
+ object-fit: cover;
124
+
125
+ transform: translateX(-50%) translateY(-50%);
126
+ z-index: 1;
127
+ block-size: 100%;
128
+ }
129
+
130
+ .selfie-container img {
131
+ background-color: black;
132
+ position: absolute;
133
+ left: 50%;
134
+ height: calc(100% - 6px);
135
+ clip-path: ellipse(101px 118px);
136
+ }
137
+
138
+ .description {
139
+ color: var(--neutral-off-black, #2D2B2A);
140
+ text-align: center;
141
+ /* p */
142
+ font-family: DM Sans;
143
+ font-size: 0.875rem;
144
+ font-style: normal;
145
+ font-weight: 400;
146
+ line-height: 18px;
147
+ }
148
+ .padding-bottom-2 {
149
+ padding-bottom: 2rem;
150
+ }
151
+ .instructions-wrapper {
152
+ display: inline-flex;
153
+ flex-direction: column;
154
+ align-items: flex-start;
155
+ gap: 2rem;
156
+ margin-block-start: 2rem;
157
+ margin-block-end: 4rem;
158
+ }
159
+ .instructions {
160
+ display: flex;
161
+ align-items: center;
162
+ text-align: initial;
163
+ }
164
+ .instructions svg {
165
+ flex-shrink: 0;
166
+ margin-inline-end: 2rem;
167
+ }
168
+ .instructions p {
169
+ margin-block: 0;
170
+ }
171
+ .instruction-body {
172
+ font-size: 0.75rem;
173
+ }
174
+ h1 {
175
+ color: var(--web-digital-blue, #001096);
176
+ text-align: center;
177
+ /* h1 */
178
+ font-size: 1.5rem;
179
+ font-style: normal;
180
+ font-weight: 700;
181
+ line-height: 36px; /* 150% */
182
+ }
183
+ .p2 {
184
+ font-size: 1rem;
185
+ font-style: normal;
186
+ font-weight: 500;
187
+ line-height: 1rem;
188
+ }
189
+ .instruction-header {
190
+ color: var(--web-digital-blue, #001096);
191
+ }
192
+ .h2 {
193
+ font-size: 1rem;
194
+ font-style: normal;
195
+ font-weight: 700;
196
+ line-height: 1.5rem;
197
+ }
198
+ </style>
199
+ ${styles(this.themeColor)}
200
+ <div id='selfie-capture-review-screen' class='flow center'>
201
+ <smileid-navigation ${this.showNavigation ? 'show-navigation' : ''} hide-back></smileid-navigation>
202
+ <h1 class="header-title text-2xl title-color font-bold">
203
+ Is your whole face visible and clear in this photo?
204
+ </h1>
205
+ <div class='section | flow'>
206
+ <div class='selfie-review-container ${this.isPortraitCaptureView ? 'portrait' : 'landscape'}'>
207
+ ${
208
+ this.imageSrc
209
+ ? `<img
210
+ alt='your ID card'
211
+ id='document-capture-review-image'
212
+ src='${this.imageSrc}'
213
+ width='396'
214
+ />`
215
+ : ''
216
+ }
217
+ </div>
218
+ <div class='flow action-buttons'>
219
+ <button data-variant='solid full-width' class='button' type='button' id='select-id-image'>
220
+ Yes, use this
221
+ </button>
222
+ <button data-variant='ghost full-width' class='button retake-photo' type='button' id='re-capture-image'>
223
+ No, Retake Selfie
224
+ </button>
225
+ </div>
226
+ ${
227
+ this.hideAttribution
228
+ ? ''
229
+ : `
230
+ <powered-by-smile-id></powered-by-smile-id>
231
+ `
232
+ }
233
+ </div>
234
+ </div>
235
+ `;
236
+ }
237
+
238
+ class SelfieCaptureReview extends HTMLElement {
239
+ constructor() {
240
+ super();
241
+ this.templateString = templateString.bind(this);
242
+ this.render = () => this.templateString();
243
+
244
+ this.attachShadow({ mode: 'open' });
245
+ }
246
+
247
+ connectedCallback() {
248
+ const template = document.createElement('template');
249
+ template.innerHTML = this.render();
250
+ this.shadowRoot.innerHTML = '';
251
+ this.shadowRoot.appendChild(template.content.cloneNode(true));
252
+ this.setUpEventListeners();
253
+ }
254
+
255
+ static get observedAttributes() {
256
+ return ['hide-back-to-host', 'show-navigation', 'data-image'];
257
+ }
258
+
259
+ get hideBack() {
260
+ return this.hasAttribute('hide-back-to-host');
261
+ }
262
+
263
+ get showNavigation() {
264
+ return this.hasAttribute('show-navigation');
265
+ }
266
+
267
+ get themeColor() {
268
+ return this.getAttribute('theme-color') || '#001096';
269
+ }
270
+
271
+ get hideAttribution() {
272
+ return this.hasAttribute('hide-attribution');
273
+ }
274
+
275
+ get imageSrc() {
276
+ return this.getAttribute('data-image');
277
+ }
278
+
279
+ get title() {
280
+ return this.getAttribute('title') || 'Submit Front of ID';
281
+ }
282
+
283
+ handleBackEvents() {
284
+ this.dispatchEvent(new CustomEvent('selfie-capture-review.cancelled'));
285
+ }
286
+
287
+ handleCloseEvents() {
288
+ this.dispatchEvent(new CustomEvent('selfie-capture-review.close'));
289
+ }
290
+
291
+ attributeChangedCallback(name) {
292
+ switch (name) {
293
+ case 'data-image':
294
+ case 'hide-back-to-host':
295
+ case 'show-navigation':
296
+ this.shadowRoot.innerHTML = this.render();
297
+ this.setUpEventListeners();
298
+ break;
299
+ default:
300
+ break;
301
+ }
302
+ }
303
+
304
+ setUpEventListeners() {
305
+ this.selectImage = this.shadowRoot.querySelector('#select-id-image');
306
+ this.reCaptureImage = this.shadowRoot.querySelector('#re-capture-image');
307
+ this.navigation = this.shadowRoot.querySelector('smileid-navigation');
308
+
309
+ this.navigation.addEventListener('navigation.back', () => {
310
+ this.handleBackEvents();
311
+ });
312
+ this.navigation.addEventListener('navigation.close', () => {
313
+ this.handleCloseEvents();
314
+ });
315
+
316
+ this.selectImage.addEventListener('click', () => {
317
+ this.dispatchEvent(
318
+ new CustomEvent('selfie-capture-review.accepted', {
319
+ detail: {},
320
+ }),
321
+ );
322
+ });
323
+ this.reCaptureImage.addEventListener('click', () => {
324
+ this.dispatchEvent(
325
+ new CustomEvent('selfie-capture-review.rejected', {
326
+ detail: {},
327
+ }),
328
+ );
329
+ });
330
+ }
331
+ }
332
+
333
+ if (
334
+ 'customElements' in window &&
335
+ !customElements.get('selfie-capture-review')
336
+ ) {
337
+ window.customElements.define('selfie-capture-review', SelfieCaptureReview);
338
+ }
339
+
340
+ export default SelfieCaptureReview;