@smileid/web-components 1.0.1-beta → 1.4.2

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 (36) hide show
  1. package/components/camera-permission/CameraPermission.js +6 -2
  2. package/components/camera-permission/CameraPermission.stories.js +10 -4
  3. package/components/document/src/DocumentCaptureScreens.js +15 -9
  4. package/components/document/src/DocumentCaptureScreens.stories.js +16 -12
  5. package/components/document/src/document-capture/DocumentCapture.js +295 -217
  6. package/components/document/src/document-capture/DocumentCapture.stories.js +9 -2
  7. package/components/document/src/document-capture-instructions/DocumentCaptureInstructions.js +33 -33
  8. package/components/document/src/document-capture-instructions/DocumentCaptureInstructions.stories.js +8 -1
  9. package/components/document/src/document-capture-review/DocumentCaptureReview.js +15 -31
  10. package/components/document/src/document-capture-review/DocumentCaptureReview.stories.js +12 -2
  11. package/components/end-user-consent/src/EndUserConsent.js +14 -31
  12. package/components/end-user-consent/src/EndUserConsent.stories.js +8 -2
  13. package/components/navigation/src/Navigation.js +10 -2
  14. package/components/selfie/src/SelfieCaptureScreens.js +36 -10
  15. package/components/selfie/src/SelfieCaptureScreens.stories.js +13 -4
  16. package/components/selfie/src/selfie-capture/SelfieCapture.js +94 -23
  17. package/components/selfie/src/selfie-capture/SelfieCapture.stories.js +14 -1
  18. package/components/selfie/src/selfie-capture-instructions/SelfieCaptureInstructions.js +50 -44
  19. package/components/selfie/src/selfie-capture-instructions/SelfieCaptureInstructions.stories.js +8 -1
  20. package/components/selfie/src/selfie-capture-review/SelfieCaptureReview.js +3 -4
  21. package/components/selfie/src/selfie-capture-review/SelfieCaptureReview.stories.js +8 -1
  22. package/components/signature-pad/package-lock.json +3009 -0
  23. package/components/signature-pad/package.json +6 -6
  24. package/components/signature-pad/src/SignaturePad.js +5 -1
  25. package/components/signature-pad/src/SignaturePad.stories.js +10 -2
  26. package/components/smart-camera-web/src/SmartCameraWeb.js +53 -8
  27. package/components/smart-camera-web/src/SmartCameraWeb.stories.js +22 -9
  28. package/components/totp-consent/src/TotpConsent.js +15 -3
  29. package/cypress/e2e/smart-camera-web-agent-mode.cy.js +144 -0
  30. package/cypress/e2e/smart-camera-web-complete-flow.cy.js +221 -0
  31. package/cypress/e2e/smart-camera-web.cy.js +1 -1
  32. package/cypress/pages/smart-camera-web-agent-mode.html +36 -0
  33. package/cypress/pages/smart-camera-web-complete-flow.html +42 -0
  34. package/domain/camera/src/SmartCamera.js +28 -0
  35. package/package.json +8 -8
  36. package/styles/src/styles.js +14 -3
@@ -157,10 +157,10 @@ function templateString() {
157
157
  return `
158
158
  <div id="document-capture-instructions-screen" class="flow center">
159
159
  <section className="main">
160
- <smileid-navigation ${this.showNavigation ? 'show-navigation' : ''} ${this.hideBack ? 'hide-back' : ''}></smileid-navigation>
160
+ <smileid-navigation theme-color='${this.themeColor}' ${this.showNavigation ? 'show-navigation' : ''} ${this.hideBack ? 'hide-back' : ''}></smileid-navigation>
161
161
  <header>
162
162
  ${this.isFrontOfId ? frontDocumentIcon() : backDocumentIcon()}
163
- <h1 class='text-2xl color-digital-blue font-bold'>${this.title}</h1>
163
+ <h1 class='text-2xl title-color font-bold'>${this.title}</h1>
164
164
  <p class="description text-sm font-normal">
165
165
  We'll use it to verify your identity.
166
166
  </p>
@@ -182,55 +182,55 @@ function templateString() {
182
182
  fill-rule="evenodd"
183
183
  clip-rule="evenodd"
184
184
  d="M31.8569 19C31.8569 21.5428 31.1029 24.0285 29.6902 26.1428C28.2774 28.2571 26.2695 29.9049 23.9203 30.878C21.571 31.8511 18.986 32.1057 16.492 31.6096C13.9981 31.1136 11.7072 29.8891 9.90919 28.091C8.11115 26.293 6.88668 24.0022 6.3906 21.5082C5.89452 19.0143 6.14913 16.4292 7.12222 14.08C8.09531 11.7307 9.74318 9.72279 11.8574 8.31008C13.9717 6.89737 16.4574 6.14334 19.0002 6.14334C22.41 6.14334 25.6802 7.49788 28.0913 9.90897C30.5024 12.3201 31.8569 15.5902 31.8569 19Z"
185
- fill="#001096"
185
+ fill="${this.themeColor}"
186
186
  />
187
187
  <path
188
188
  d="M19.6064 4.5419H18.394L18.9912 0L19.6064 4.5419Z"
189
- fill="#001096"
189
+ fill="${this.themeColor}"
190
190
  />
191
191
  <path
192
192
  d="M26.7541 6.77667L25.7046 6.17048L28.4913 2.54239L26.7541 6.77667Z"
193
- fill="#001096"
193
+ fill="${this.themeColor}"
194
194
  />
195
195
  <path
196
196
  d="M31.8298 12.2957L31.2236 11.2462L35.4489 9.49097L31.8298 12.2957Z"
197
- fill="#001096"
197
+ fill="${this.themeColor}"
198
198
  />
199
199
  <path
200
200
  d="M33.4674 19.6062V18.3938L38.0003 18.9909L33.4674 19.6062Z"
201
- fill="#001096"
201
+ fill="${this.themeColor}"
202
202
  />
203
203
  <path
204
204
  d="M31.2236 26.7538L31.8298 25.7043L35.4579 28.491L31.2236 26.7538Z"
205
- fill="#001096"
205
+ fill="${this.themeColor}"
206
206
  />
207
207
  <path
208
208
  d="M25.7046 31.8295L26.7541 31.2233L28.5094 35.4486L25.7046 31.8295Z"
209
- fill="#001096"
209
+ fill="${this.themeColor}"
210
210
  />
211
211
  <path
212
212
  d="M18.394 33.4671H19.6064L19.0093 38L18.394 33.4671Z"
213
- fill="#001096"
213
+ fill="${this.themeColor}"
214
214
  />
215
215
  <path
216
216
  d="M11.2464 31.2233L12.2959 31.8295L9.50928 35.4576L11.2464 31.2233Z"
217
- fill="#001096"
217
+ fill="${this.themeColor}"
218
218
  />
219
219
  <path
220
220
  d="M6.17068 25.7043L6.77687 26.7538L2.55164 28.509L6.17068 25.7043Z"
221
- fill="#001096"
221
+ fill="${this.themeColor}"
222
222
  />
223
223
  <path
224
224
  d="M4.54215 18.3938V19.6062L0.000244141 19.009L4.54215 18.3938Z"
225
- fill="#001096"
225
+ fill="${this.themeColor}"
226
226
  />
227
227
  <path
228
228
  d="M6.77689 11.2462L6.1707 12.2957L2.5426 9.50903L6.77689 11.2462Z"
229
- fill="#001096"
229
+ fill="${this.themeColor}"
230
230
  />
231
231
  <path
232
232
  d="M12.296 6.17047L11.2464 6.77666L9.49121 2.55142L12.296 6.17047Z"
233
- fill="#001096"
233
+ fill="${this.themeColor}"
234
234
  />
235
235
  </g>
236
236
  <defs>
@@ -262,63 +262,63 @@ function templateString() {
262
262
  <g clip-path="url(#clip0_604_672)">
263
263
  <path
264
264
  d="M36.7211 12.6391H1.22537C1.06275 13.0909 0.910962 13.5427 0.77002 14.0055H37.1764C37.0463 13.5427 36.8946 13.0909 36.7211 12.6391Z"
265
- fill="#001096"
265
+ fill="${this.themeColor}"
266
266
  />
267
267
  <path
268
268
  d="M37.3716 14.7438H0.574875C0.466458 15.1625 0.379725 15.5813 0.303833 16.011H37.6426C37.5667 15.5813 37.48 15.1625 37.3716 14.7438Z"
269
- fill="#001096"
269
+ fill="${this.themeColor}"
270
270
  />
271
271
  <path
272
272
  d="M37.7727 16.8485H0.173703C0.119494 17.2342 0.0869685 17.6198 0.0544434 18.0055H37.892C37.8594 17.6198 37.8269 17.2342 37.7727 16.8485Z"
273
- fill="#001096"
273
+ fill="${this.themeColor}"
274
274
  />
275
275
  <path
276
276
  d="M37.9462 19.4711C37.9462 19.2948 37.9462 19.1295 37.9353 18.9532H0.0110865C0.000244802 19.1295 0.000244141 19.2948 0.000244141 19.4711C0.000244141 19.6474 0.000244802 19.8347 0.0110865 20.011H37.9353C37.9462 19.8347 37.9462 19.6474 37.9462 19.4711Z"
277
- fill="#001096"
277
+ fill="${this.themeColor}"
278
278
  />
279
279
  <path
280
280
  d="M37.8811 21.0579H0.0653076C0.086991 21.3774 0.119515 21.697 0.162882 22.0055H37.7836C37.8269 21.697 37.8595 21.3774 37.8811 21.0579Z"
281
- fill="#001096"
281
+ fill="${this.themeColor}"
282
282
  />
283
283
  <path
284
284
  d="M37.5992 23.1625H0.347168C0.401376 23.449 0.466426 23.7245 0.531477 24H37.4149C37.48 23.7245 37.545 23.449 37.5992 23.1625Z"
285
- fill="#001096"
285
+ fill="${this.themeColor}"
286
286
  />
287
287
  <path
288
288
  d="M37.0788 25.2672H0.867554C0.954287 25.5096 1.03018 25.7631 1.11691 26.0055H36.8295C36.9162 25.7631 37.0029 25.5096 37.0788 25.2672Z"
289
- fill="#001096"
289
+ fill="${this.themeColor}"
290
290
  />
291
291
  <path
292
292
  d="M36.2874 27.3719H1.65906L1.95178 28H35.9947L36.2874 27.3719Z"
293
- fill="#001096"
293
+ fill="${this.themeColor}"
294
294
  />
295
295
  <path
296
296
  d="M35.2032 29.4766H2.75403C2.84799 29.6529 2.95641 29.8292 3.07928 30.0055H34.878L35.2032 29.4766Z"
297
- fill="#001096"
297
+ fill="${this.themeColor}"
298
298
  />
299
299
  <path
300
300
  d="M33.7396 31.5813H4.20679L4.54288 32H33.4035L33.7396 31.5813Z"
301
- fill="#001096"
301
+ fill="${this.themeColor}"
302
302
  />
303
303
  <path
304
304
  d="M31.7989 33.6859H6.14746L6.49439 33.9945H31.452L31.7989 33.6859Z"
305
- fill="#001096"
305
+ fill="${this.themeColor}"
306
306
  />
307
307
  <path
308
308
  d="M29.0993 35.7906H8.84705L9.18314 36H28.7632L29.0993 35.7906Z"
309
- fill="#001096"
309
+ fill="${this.themeColor}"
310
310
  />
311
311
  <path
312
312
  d="M34.2384 8.01102C33.8914 7.53719 33.5228 7.07438 33.1325 6.63361C29.8258 2.60055 24.6977 0 18.9407 0C12.891 0 7.53525 2.86501 4.25021 7.26171H4.28274C4.08759 7.51515 3.89244 7.75757 3.70813 8.01102H34.2384Z"
313
- fill="#001096"
313
+ fill="${this.themeColor}"
314
314
  />
315
315
  <path
316
316
  d="M34.531 8.44077H3.41533C3.06839 8.94765 2.74314 9.47658 2.43958 10.0165H35.5068C35.2124 9.47215 34.8866 8.94597 34.531 8.44077Z"
317
- fill="#001096"
317
+ fill="${this.themeColor}"
318
318
  />
319
319
  <path
320
320
  d="M35.7887 10.5344H2.15776C1.9084 11.0193 1.68072 11.5151 1.47473 12.011H36.4717C36.2657 11.5151 36.0381 11.0193 35.7887 10.5344Z"
321
- fill="#001096"
321
+ fill="${this.themeColor}"
322
322
  />
323
323
  </g>
324
324
  <defs>
@@ -370,7 +370,7 @@ function templateString() {
370
370
  ${this.hideAttribution ? '' : '<powered-by-smile-id></powered-by-smile-id>'}
371
371
  </section>
372
372
  </div>
373
- ${styles}
373
+ ${styles(this.themeColor)}
374
374
  `;
375
375
  }
376
376
 
@@ -423,7 +423,7 @@ class DocumentInstruction extends HTMLElement {
423
423
 
424
424
  this.dispatchEvent(
425
425
  new CustomEvent('document-capture-instructions.upload', {
426
- detail: { image: fileData },
426
+ detail: { image: fileData, previewImage: fileData },
427
427
  }),
428
428
  );
429
429
  } catch (error) {
@@ -443,7 +443,7 @@ class DocumentInstruction extends HTMLElement {
443
443
  }
444
444
 
445
445
  get themeColor() {
446
- return this.getAttribute('theme-color') || '#043C93';
446
+ return this.getAttribute('theme-color') || '#001096';
447
447
  }
448
448
 
449
449
  get hideAttribution() {
@@ -1,16 +1,23 @@
1
1
  import './index';
2
2
 
3
3
  const meta = {
4
+ argTypes: {
5
+ 'theme-color': { control: 'color' },
6
+ },
4
7
  component: 'document-capture-instructions',
5
8
  };
6
9
 
7
10
  export default meta;
8
11
 
9
12
  export const DocumentInstruction = {
10
- render: () => `
13
+ args: {
14
+ 'theme-color': '#001096',
15
+ },
16
+ render: (args) => `
11
17
  <document-capture-instructions
12
18
  show-navigation
13
19
  document-capture-modes="camera,upload"
20
+ theme-color='${args['theme-color']}'
14
21
  >
15
22
  </document-capture-instructions>
16
23
  `,
@@ -3,7 +3,6 @@ import '../../../navigation/src';
3
3
 
4
4
  function templateString() {
5
5
  return `
6
- ${styles}
7
6
  <style>
8
7
  .retake-photo.button[data-variant~="ghost"] {
9
8
  color: #FF5805;
@@ -21,18 +20,6 @@ function templateString() {
21
20
  height: 100vh;
22
21
  justify-content: center;
23
22
  }
24
-
25
- .video-overlay {
26
- position: absolute;
27
- border-width: 1rem;
28
- border-color: white;
29
- border-style: solid;
30
- inset: 0px;
31
- }
32
-
33
- img {
34
- clip-path: polygon(10% 10%, 90% 10%, 90% 85%, 10% 85%);
35
- }
36
23
  }
37
24
 
38
25
  .id-image-container {
@@ -43,25 +30,15 @@ function templateString() {
43
30
  }
44
31
 
45
32
  .id-image {
46
- max-width: fit-content;
47
- height: auto;
48
- text-align: center;
49
- position: relative;
50
- overflow: hidden;
33
+ width: 100%;
34
+ text-align: center;
35
+ position: relative;
36
+ background: white;
51
37
  }
52
38
  img {
53
39
  height: 100%;
54
40
  min-height: 100px;
55
- clip-path: polygon(5% 5%, 95% 5%, 95% 90%, 5% 90%);
56
- }
57
-
58
- .video-overlay .inner-border {
59
- position: absolute;
60
- border-width: 1rem;
61
- border-color: #9394ab;
62
- border-style: solid;
63
- border-radius: 1rem;
64
- inset: -8px;
41
+ width: 98%;
65
42
  }
66
43
 
67
44
  .action-buttons {
@@ -179,6 +156,12 @@ function templateString() {
179
156
  .padding-bottom-2 {
180
157
  padding-bottom: 2rem;
181
158
  }
159
+ img {
160
+ border-width: 0.25rem;
161
+ border-color: #9394ab;
162
+ border-style: solid;
163
+ border-radius: 0.25rem;
164
+ }
182
165
 
183
166
  .instructions-wrapper {
184
167
  display: inline-flex;
@@ -236,9 +219,10 @@ function templateString() {
236
219
  line-height: 1.5rem;
237
220
  }
238
221
  </style>
222
+ ${styles(this.themeColor)}
239
223
  <div id='document-capture-review-screen' class='flow center'>
240
224
  <smileid-navigation ${this.showNavigation ? 'show-navigation' : ''} hide-back></smileid-navigation>
241
- <h1 class="header-title">
225
+ <h1 class="header-title title-color">
242
226
  Is the document clear and readable?
243
227
  </h1>
244
228
  <p class="description">Make sure all corners of the document
@@ -247,7 +231,7 @@ function templateString() {
247
231
  <div class='id-image-container'>
248
232
  <div class='id-image'>
249
233
  <div class='video-overlay'></div>
250
- ${this.imageSrc ? `<img alt='your ID card' id='document-capture-review-image' src='${this.imageSrc}' width='396' />` : ''}
234
+ ${this.imageSrc ? `<img alt='your ID card' id='document-capture-review-image' src='${this.imageSrc}' />` : ''}
251
235
  </div>
252
236
  <div class='flow action-buttons'>
253
237
  <button data-variant='solid full-width' class='button' type='button' id='select-id-image'>
@@ -301,7 +285,7 @@ class IdReview extends HTMLElement {
301
285
  }
302
286
 
303
287
  get themeColor() {
304
- return this.getAttribute('theme-color') || '#043C93';
288
+ return this.getAttribute('theme-color') || '#001096';
305
289
  }
306
290
 
307
291
  get hideAttribution() {
@@ -1,14 +1,24 @@
1
1
  import './index';
2
2
 
3
3
  const meta = {
4
+ argTypes: {
5
+ 'theme-color': { control: 'color' },
6
+ },
4
7
  component: 'document-capture-review',
5
8
  };
6
9
 
7
10
  export default meta;
8
11
 
9
12
  export const IdReview = {
10
- render: () => `
11
- <document-capture-review show-navigation data-image="https://placehold.co/600x400">
13
+ args: {
14
+ 'theme-color': '#001096',
15
+ },
16
+ render: (args) => `
17
+ <document-capture-review
18
+ show-navigation
19
+ data-image="https://placehold.co/600x400"
20
+ theme-color='${args['theme-color']}'
21
+ >
12
22
  </document-capture-review>
13
23
  `,
14
24
  };
@@ -1,5 +1,6 @@
1
1
  import styles from '../../../styles/src/styles';
2
2
  import '../../totp-consent/src/TotpConsent';
3
+ import '../../attribution/PoweredBySmileId';
3
4
 
4
5
  function templateString() {
5
6
  return `
@@ -124,7 +125,7 @@ function templateString() {
124
125
  button:hover,
125
126
  button:focus,
126
127
  button:active {
127
- --button-color: var(--color-active);
128
+ --button-color: var(--theme-color);
128
129
  }
129
130
 
130
131
  button:disabled {
@@ -163,8 +164,8 @@ function templateString() {
163
164
 
164
165
  .back-button-text {
165
166
  font-size: 11px;
166
- line-height: 11px;
167
- color: rgb(21, 31, 114);
167
+ line-height: 1;
168
+ color: ${this.themeColor} !important;
168
169
  }
169
170
 
170
171
  img {
@@ -230,7 +231,7 @@ function templateString() {
230
231
  gap: 0.5rem;
231
232
  }
232
233
  .processing-list__item__title {
233
- color: #151F72;
234
+ color: var(--color-theme);
234
235
  }
235
236
 
236
237
  .processing-list__items-item__description {
@@ -314,7 +315,7 @@ function templateString() {
314
315
  color: var(--color-danger);
315
316
  }
316
317
  </style>
317
- ${styles}
318
+ ${styles(this.themeColor)}
318
319
  <div id='consent-screen'>
319
320
  <section class='flow center'>
320
321
  <div class="nav ${this.hideBack ? 'justify-right' : ''}">
@@ -322,7 +323,7 @@ function templateString() {
322
323
  <button type='button' data-type='icon' id="back-button" class="back-button">
323
324
  <svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" fill="none">
324
325
  <path fill="#DBDBC4" d="M12 22c5.523 0 10-4.477 10-10S17.523 2 12 2 2 6.477 2 12s4.477 10 10 10Z" opacity=".4"/>
325
- <path fill="#001096" d="M15.5 11.25h-5.19l1.72-1.72c.29-.29.29-.77 0-1.06a.754.754 0 0 0-1.06 0l-3 3c-.29.29-.29.77 0 1.06l3 3c.15.15.34.22.53.22s.38-.07.53-.22c.29-.29.29-.77 0-1.06l-1.72-1.72h5.19c.41 0 .75-.34.75-.75s-.34-.75-.75-.75Z"/>
326
+ <path fill="${this.themeColor}" d="M15.5 11.25h-5.19l1.72-1.72c.29-.29.29-.77 0-1.06a.754.754 0 0 0-1.06 0l-3 3c-.29.29-.29.77 0 1.06l3 3c.15.15.34.22.53.22s.38-.07.53-.22c.29-.29.29-.77 0-1.06l-1.72-1.72h5.19c.41 0 .75-.34.75-.75s-.34-.75-.75-.75Z"/>
326
327
  </svg>
327
328
  </button>
328
329
  <div class="back-button-text">Back</div>
@@ -444,6 +445,8 @@ function templateString() {
444
445
  partner-id='${this.partnerId}'
445
446
  partner-name='${this.partnerName}'
446
447
  token='${this.token}'
448
+ theme-color='${this.themeColor}'
449
+ ${this.hideAttribution ? 'hide-attribution' : ''}
447
450
  >
448
451
  </totp-consent>
449
452
 
@@ -577,31 +580,7 @@ function templateString() {
577
580
  No, Cancel Verification
578
581
  </button>
579
582
 
580
- <p class='center credits'>
581
- <span class='visually-hidden'>Powered by SmileID</span>
582
- <svg aria-hidden='true' viewBox="0 0 90 9" fill="none" xmlns="http://www.w3.org/2000/svg">
583
- <symbol id='attribution'>
584
- <path d="M0.544 7V1.4H2.616C3.064 1.4 3.43467 1.47467 3.728 1.624C4.02133 1.77333 4.24 1.97867 4.384 2.24C4.528 2.50133 4.6 2.79467 4.6 3.12C4.6 3.42933 4.53067 3.71467 4.392 3.976C4.25333 4.232 4.03733 4.44 3.744 4.6C3.45067 4.75467 3.07467 4.832 2.616 4.832H1.568V7H0.544ZM1.568 4H2.552C2.90933 4 3.16533 3.92267 3.32 3.768C3.48 3.608 3.56 3.392 3.56 3.12C3.56 2.84267 3.48 2.62667 3.32 2.472C3.16533 2.312 2.90933 2.232 2.552 2.232H1.568V4ZM7.08025 7.096C6.69625 7.096 6.34958 7.008 6.04025 6.832C5.73625 6.656 5.49358 6.41333 5.31225 6.104C5.13625 5.78933 5.04825 5.42667 5.04825 5.016C5.04825 4.60533 5.13892 4.24533 5.32025 3.936C5.50158 3.62133 5.74425 3.376 6.04825 3.2C6.35758 3.024 6.70425 2.936 7.08825 2.936C7.46692 2.936 7.80825 3.024 8.11225 3.2C8.42158 3.376 8.66425 3.62133 8.84025 3.936C9.02158 4.24533 9.11225 4.60533 9.11225 5.016C9.11225 5.42667 9.02158 5.78933 8.84025 6.104C8.66425 6.41333 8.42158 6.656 8.11225 6.832C7.80292 7.008 7.45892 7.096 7.08025 7.096ZM7.08025 6.208C7.34692 6.208 7.57892 6.10933 7.77625 5.912C7.97358 5.70933 8.07225 5.41067 8.07225 5.016C8.07225 4.62133 7.97358 4.32533 7.77625 4.128C7.57892 3.92533 7.34958 3.824 7.08825 3.824C6.81625 3.824 6.58158 3.92533 6.38425 4.128C6.19225 4.32533 6.09625 4.62133 6.09625 5.016C6.09625 5.41067 6.19225 5.70933 6.38425 5.912C6.58158 6.10933 6.81358 6.208 7.08025 6.208ZM10.6632 7L9.50319 3.032H10.5192L11.2072 5.888L12.0072 3.032H13.1432L13.9432 5.888L14.6392 3.032H15.6552L14.4872 7H13.4232L12.5752 4.032L11.7272 7H10.6632ZM18.0886 7.096C17.6886 7.096 17.334 7.01067 17.0246 6.84C16.7153 6.66933 16.4726 6.42933 16.2966 6.12C16.1206 5.81067 16.0326 5.45333 16.0326 5.048C16.0326 4.63733 16.118 4.272 16.2886 3.952C16.4646 3.632 16.7046 3.384 17.0086 3.208C17.318 3.02667 17.6806 2.936 18.0966 2.936C18.486 2.936 18.83 3.02133 19.1286 3.192C19.4273 3.36267 19.6593 3.59733 19.8246 3.896C19.9953 4.18933 20.0806 4.51733 20.0806 4.88C20.0806 4.93867 20.078 5 20.0726 5.064C20.0726 5.128 20.07 5.19467 20.0646 5.264H17.0486C17.07 5.57333 17.1766 5.816 17.3686 5.992C17.566 6.168 17.8033 6.256 18.0806 6.256C18.2886 6.256 18.462 6.21067 18.6006 6.12C18.7446 6.024 18.8513 5.90133 18.9206 5.752H19.9606C19.886 6.00267 19.7606 6.232 19.5846 6.44C19.414 6.64267 19.2006 6.80267 18.9446 6.92C18.694 7.03733 18.4086 7.096 18.0886 7.096ZM18.0966 3.768C17.846 3.768 17.6246 3.84 17.4326 3.984C17.2406 4.12267 17.118 4.336 17.0646 4.624H19.0406C19.0246 4.36267 18.9286 4.15467 18.7526 4C18.5766 3.84533 18.358 3.768 18.0966 3.768ZM20.9419 7V3.032H21.8539L21.9499 3.776C22.0939 3.52 22.2885 3.31733 22.5339 3.168C22.7845 3.01333 23.0779 2.936 23.4139 2.936V4.016H23.1259C22.9019 4.016 22.7019 4.05067 22.5259 4.12C22.3499 4.18933 22.2112 4.30933 22.1099 4.48C22.0139 4.65067 21.9659 4.888 21.9659 5.192V7H20.9419ZM25.9714 7.096C25.5714 7.096 25.2168 7.01067 24.9074 6.84C24.5981 6.66933 24.3554 6.42933 24.1794 6.12C24.0034 5.81067 23.9154 5.45333 23.9154 5.048C23.9154 4.63733 24.0008 4.272 24.1714 3.952C24.3474 3.632 24.5874 3.384 24.8914 3.208C25.2008 3.02667 25.5634 2.936 25.9794 2.936C26.3688 2.936 26.7128 3.02133 27.0114 3.192C27.3101 3.36267 27.5421 3.59733 27.7074 3.896C27.8781 4.18933 27.9634 4.51733 27.9634 4.88C27.9634 4.93867 27.9608 5 27.9554 5.064C27.9554 5.128 27.9528 5.19467 27.9474 5.264H24.9314C24.9528 5.57333 25.0594 5.816 25.2514 5.992C25.4488 6.168 25.6861 6.256 25.9634 6.256C26.1714 6.256 26.3448 6.21067 26.4834 6.12C26.6274 6.024 26.7341 5.90133 26.8034 5.752H27.8434C27.7688 6.00267 27.6434 6.232 27.4674 6.44C27.2968 6.64267 27.0834 6.80267 26.8274 6.92C26.5768 7.03733 26.2914 7.096 25.9714 7.096ZM25.9794 3.768C25.7288 3.768 25.5074 3.84 25.3154 3.984C25.1234 4.12267 25.0008 4.336 24.9474 4.624H26.9234C26.9074 4.36267 26.8114 4.15467 26.6354 4C26.4594 3.84533 26.2408 3.768 25.9794 3.768ZM30.6487 7.096C30.2754 7.096 29.942 7.00533 29.6487 6.824C29.3554 6.64267 29.1234 6.39467 28.9527 6.08C28.782 5.76533 28.6967 5.408 28.6967 5.008C28.6967 4.608 28.782 4.25333 28.9527 3.944C29.1234 3.62933 29.3554 3.384 29.6487 3.208C29.942 3.02667 30.2754 2.936 30.6487 2.936C30.9474 2.936 31.2087 2.992 31.4327 3.104C31.6567 3.216 31.838 3.37333 31.9767 3.576V1.24H33.0007V7H32.0887L31.9767 6.432C31.8487 6.608 31.678 6.76267 31.4647 6.896C31.2567 7.02933 30.9847 7.096 30.6487 7.096ZM30.8647 6.2C31.1954 6.2 31.4647 6.09067 31.6727 5.872C31.886 5.648 31.9927 5.36267 31.9927 5.016C31.9927 4.66933 31.886 4.38667 31.6727 4.168C31.4647 3.944 31.1954 3.832 30.8647 3.832C30.5394 3.832 30.27 3.94133 30.0567 4.16C29.8434 4.37867 29.7367 4.66133 29.7367 5.008C29.7367 5.35467 29.8434 5.64 30.0567 5.864C30.27 6.088 30.5394 6.2 30.8647 6.2ZM38.3017 7.096C38.003 7.096 37.7417 7.04 37.5177 6.928C37.2937 6.816 37.1124 6.65867 36.9737 6.456L36.8617 7H35.9497V1.24H36.9737V3.6C37.1017 3.424 37.2697 3.26933 37.4777 3.136C37.691 3.00267 37.9657 2.936 38.3017 2.936C38.675 2.936 39.0084 3.02667 39.3017 3.208C39.595 3.38933 39.827 3.63733 39.9977 3.952C40.1684 4.26667 40.2537 4.624 40.2537 5.024C40.2537 5.424 40.1684 5.78133 39.9977 6.096C39.827 6.40533 39.595 6.65067 39.3017 6.832C39.0084 7.008 38.675 7.096 38.3017 7.096ZM38.0857 6.2C38.411 6.2 38.6804 6.09067 38.8937 5.872C39.107 5.65333 39.2137 5.37067 39.2137 5.024C39.2137 4.67733 39.107 4.392 38.8937 4.168C38.6804 3.944 38.411 3.832 38.0857 3.832C37.755 3.832 37.483 3.944 37.2697 4.168C37.0617 4.38667 36.9577 4.66933 36.9577 5.016C36.9577 5.36267 37.0617 5.648 37.2697 5.872C37.483 6.09067 37.755 6.2 38.0857 6.2ZM41.3051 8.76L42.2251 6.736H41.9851L40.4411 3.032H41.5531L42.6651 5.824L43.8251 3.032H44.9131L42.3931 8.76H41.3051Z" fill="#001096"/>
585
- <g clipPath="url(#clip0_1923_23296)">
586
- <path d="M58.5141 6.02913C58.5644 6.37005 58.8092 6.77098 59.4839 6.77098C60.0578 6.77098 60.336 6.56623 60.336 6.23338C60.336 5.90053 60.142 5.75579 59.788 5.71292L58.5988 5.58482C57.5612 5.47387 56.9539 4.86819 56.9539 3.87872C56.9539 2.77779 57.7801 2.04401 59.4335 2.04401C61.2135 2.04401 61.9221 2.88874 61.9894 3.88679H60.3195C60.2687 3.51157 59.965 3.27253 59.442 3.27253C58.9783 3.27253 58.6577 3.44349 58.6577 3.75062C58.6577 3.99774 58.8097 4.18534 59.2141 4.21964L60.1844 4.30486C61.4918 4.41582 62.0397 5.04672 62.0397 6.0962C62.0397 7.21377 61.3477 7.999 59.4504 7.999C57.5532 7.999 56.9534 7.02667 56.8691 6.02862H58.5141V6.02913Z" fill="#001096" />
587
- <path d="M70.1965 5.28736V7.85484H68.5431V5.56019C68.5431 5.09925 68.3746 4.80069 67.9194 4.80069C67.4212 4.80069 67.2108 5.11639 67.2108 5.78159V7.85484H65.5824V5.56019C65.5824 5.09925 65.4133 4.80069 64.9581 4.80069C64.4605 4.80069 64.2496 5.11639 64.2496 5.78159V7.85484H62.5967V3.58932H64.2496V4.24644C64.5113 3.75171 64.9581 3.45265 65.6586 3.45265C66.3592 3.45265 66.8309 3.7855 67.0587 4.35689C67.3285 3.80265 67.7842 3.45265 68.5351 3.45265C69.6735 3.45265 70.197 4.16928 70.197 5.28736H70.1965Z" fill="#001096" />
588
- <path d="M70.9785 3.8535V2.18118H72.6319V3.8535H70.9785ZM70.9785 7.85476V4.2504H72.6319V7.85476H70.9785Z" fill="#001096" />
589
- <path d="M73.4121 7.85475V2.18167H75.065V7.85525H73.4121V7.85475Z" fill="#001096" />
590
- <path d="M78.7264 6.53958H80.3579C80.1968 7.3243 79.5696 7.99151 78.0179 7.99151C76.2294 7.99151 75.6221 6.8568 75.6221 5.71351C75.6221 4.48499 76.3391 3.45265 78.0179 3.45265C79.8653 3.45265 80.3629 4.59594 80.3629 5.77302C80.3629 5.91776 80.3539 6.05443 80.3374 6.13966H77.2336C77.3178 6.68583 77.5881 6.89059 78.0518 6.89059C78.3729 6.89059 78.6083 6.73526 78.7269 6.53908L78.7264 6.53958ZM77.2416 5.21877H78.8022C78.7519 4.77497 78.5404 4.52785 78.0428 4.52785C77.5791 4.52785 77.3348 4.70689 77.2416 5.21877Z" fill="#001096" />
591
- <path d="M83.5907 7.85476H81.8994L81.9034 2.18118H83.5902L83.5912 7.85476H83.5907Z" fill="#001096" />
592
- <path d="M89.9995 5.00535C89.9995 6.46434 89.1474 7.85475 87.3345 7.85475H84.3652V2.18167H87.3345C89.1479 2.18167 89.9995 3.54686 89.9995 5.00535ZM86.9376 6.5067C87.8401 6.5067 88.2364 5.99482 88.2364 5.00535C88.2364 4.01588 87.8226 3.52971 86.9376 3.52971H86.06V6.5067H86.9376Z" fill="#001096" />
593
- <path d="M52.2123 3.88737H48V7.86846H52.2123V3.88737Z" fill="#001096" />
594
- <path d="M53.2359 0C53.2165 0 53.1975 0.00201727 53.1786 0.00252159C53.1591 0.00252159 53.1402 0 53.1207 0C52.0457 0 51.0869 0.708567 51.0869 2.27044V3.8888H55.2882V2.27044C55.2882 0.708567 54.3174 0 53.2359 0Z" fill="#FF9B00" />
595
- </g>
596
- <defs>
597
- <clipPath id="clip0_1923_23296">
598
- <rect width="42" height="8" fill="white" transform="translate(48)" />
599
- </clipPath>
600
- </defs>
601
- </symbol>
602
- <use href='#attribution' />
603
- </svg>
604
- </p>
583
+ ${this.hideAttribution ? '' : '<powered-by-smile-id></powered-by-smile-id>'}
605
584
  </div>
606
585
  `;
607
586
  }
@@ -710,6 +689,10 @@ class EndUserConsent extends HTMLElement {
710
689
  return this.getAttribute('id-hint') || 'Your BVN should be 11 digits long';
711
690
  }
712
691
 
692
+ get hideAttribution() {
693
+ return this.hasAttribute('hide-attribution');
694
+ }
695
+
713
696
  get idRegex() {
714
697
  return this.getAttribute('id-regex');
715
698
  }
@@ -1,13 +1,19 @@
1
1
  import './EndUserConsent';
2
2
 
3
3
  const meta = {
4
+ args: {
5
+ 'theme-color': '#001096',
6
+ },
7
+ argTypes: {
8
+ 'theme-color': { control: 'color' },
9
+ },
4
10
  component: 'end-user-consent',
5
11
  };
6
12
 
7
13
  export default meta;
8
14
 
9
15
  export const EndUserConsent = {
10
- render: () => `
16
+ render: (args) => `
11
17
  <end-user-consent
12
18
  country="NG"
13
19
  id-type="NATIONAL_ID"
@@ -15,7 +21,7 @@ export const EndUserConsent = {
15
21
  partner-id="007"
16
22
  partner-name="SmileID Stories"
17
23
  policy-url="https://usesmileid.com/privacy-policy"
18
- theme-color="#001096"
24
+ theme-color="${args['theme-color']}"
19
25
  partner-logo="https://portal.usesmileid.com/favicon.ico"
20
26
  >
21
27
  </end-user-consent>
@@ -51,7 +51,7 @@ button[data-type="icon"] {
51
51
 
52
52
  :host::part(back-button-text) {
53
53
  line-height: 1;
54
- color: rgb(21, 31, 114) !important;
54
+ color: ${this.hasThemeColor ? this.themeColor : 'rgb(21, 31, 114)'} !important;
55
55
  }
56
56
 
57
57
  :host::part(close-button) {
@@ -87,7 +87,7 @@ button[data-type="icon"] {
87
87
  opacity=".4"
88
88
  />
89
89
  <path
90
- fill="#001096"
90
+ fill="${this.themeColor}"
91
91
  d="M15.5 11.25h-5.19l1.72-1.72c.29-.29.29-.77 0-1.06a.754.754 0 0 0-1.06 0l-3 3c-.29.29-.29.77 0 1.06l3 3c.15.15.34.22.53.22s.38-.07.53-.22c.29-.29.29-.77 0-1.06l-1.72-1.72h5.19c.41 0 .75-.34.75-.75s-.34-.75-.75-.75Z"
92
92
  />
93
93
  </svg>
@@ -151,6 +151,14 @@ button[data-type="icon"] {
151
151
  get showBackButton() {
152
152
  return !this.hasAttribute('hide-back');
153
153
  }
154
+
155
+ get themeColor() {
156
+ return this.getAttribute('theme-color') || '#001096';
157
+ }
158
+
159
+ get hasThemeColor() {
160
+ return this.getAttribute('theme-color')?.trim();
161
+ }
154
162
  }
155
163
 
156
164
  if ('customElements' in window) {
@@ -5,9 +5,12 @@ import SmartCamera from '../../../domain/camera/src/SmartCamera';
5
5
  import styles from '../../../styles/src/styles';
6
6
  import { version as COMPONENTS_VERSION } from '../../../package.json';
7
7
 
8
- async function getPermissions(captureScreen) {
8
+ async function getPermissions(captureScreen, facingMode = 'user') {
9
9
  try {
10
- await SmartCamera.getMedia({ audio: false, video: true });
10
+ await SmartCamera.getMedia({
11
+ audio: false,
12
+ video: { facingMode },
13
+ });
11
14
  captureScreen.removeAttribute('data-camera-error');
12
15
  captureScreen.setAttribute('data-camera-ready', true);
13
16
  } catch (error) {
@@ -27,11 +30,11 @@ class SelfieCaptureScreens extends HTMLElement {
27
30
 
28
31
  connectedCallback() {
29
32
  this.innerHTML = `
30
- ${styles}
33
+ ${styles(this.themeColor)}
31
34
  <div>
32
- <selfie-capture-instructions ${this.showNavigation} ${this.hideAttribution} ${this.hideBack} hidden></selfie-capture-instructions>
33
- <selfie-capture ${this.showNavigation} ${this.hideAttribution} ${this.disableImageTests} hidden></selfie-capture>
34
- <selfie-capture-review ${this.showNavigation} ${this.hideAttribution} hidden></selfie-capture-review>
35
+ <selfie-capture-instructions theme-color='${this.themeColor}' ${this.showNavigation} ${this.hideAttribution} ${this.hideBack} hidden></selfie-capture-instructions>
36
+ <selfie-capture theme-color='${this.themeColor}' ${this.showNavigation} ${this.allowAgentMode} ${this.allowAgentModeTests} ${this.hideAttribution} ${this.disableImageTests} hidden></selfie-capture>
37
+ <selfie-capture-review theme-color='${this.themeColor}' ${this.showNavigation} ${this.hideAttribution} hidden></selfie-capture-review>
35
38
  </div>
36
39
  `;
37
40
 
@@ -47,11 +50,12 @@ class SelfieCaptureScreens extends HTMLElement {
47
50
  this.selfieReview = this.querySelector('selfie-capture-review');
48
51
 
49
52
  if (this.hideInstructions && !this.hasAttribute('hidden')) {
50
- getPermissions(this.selfieCapture);
53
+ getPermissions(this.selfieCapture, this.getAgentMode());
51
54
  }
52
55
 
56
+ // If the initial screen is selfie-capture, we need to get permissions
53
57
  if (this.getAttribute('initial-screen') === 'selfie-capture') {
54
- getPermissions(this.selfieCapture);
58
+ getPermissions(this.selfieCapture, this.getAgentMode());
55
59
  this.setActiveScreen(this.selfieCapture);
56
60
  } else if (this.hideInstructions) {
57
61
  this.setActiveScreen(this.selfieCapture);
@@ -62,6 +66,10 @@ class SelfieCaptureScreens extends HTMLElement {
62
66
  this.setUpEventListeners();
63
67
  }
64
68
 
69
+ getAgentMode() {
70
+ return this.inAgentMode ? 'environment' : 'user';
71
+ }
72
+
65
73
  disconnectedCallback() {
66
74
  SmartCamera.stopMedia();
67
75
  if (this.activeScreen) {
@@ -75,7 +83,7 @@ class SelfieCaptureScreens extends HTMLElement {
75
83
  this.selfieInstruction.addEventListener(
76
84
  'selfie-capture-instructions.capture',
77
85
  async () => {
78
- await getPermissions(this.selfieCapture);
86
+ await getPermissions(this.selfieCapture, this.getAgentMode());
79
87
  this.setActiveScreen(this.selfieCapture);
80
88
  },
81
89
  );
@@ -119,7 +127,7 @@ class SelfieCaptureScreens extends HTMLElement {
119
127
  this._data.images = [];
120
128
  if (this.hideInstructions) {
121
129
  this.setActiveScreen(this.selfieCapture);
122
- await getPermissions(this.selfieCapture);
130
+ await getPermissions(this.selfieCapture, this.getAgentMode());
123
131
  } else {
124
132
  this.setActiveScreen(this.selfieInstruction);
125
133
  }
@@ -167,6 +175,20 @@ class SelfieCaptureScreens extends HTMLElement {
167
175
  return this.hasAttribute('show-navigation') ? 'show-navigation' : '';
168
176
  }
169
177
 
178
+ get inAgentMode() {
179
+ return this.getAttribute('allow-agent-mode') === 'true';
180
+ }
181
+
182
+ get allowAgentMode() {
183
+ return this.inAgentMode ? "allow-agent-mode='true'" : '';
184
+ }
185
+
186
+ get allowAgentModeTests() {
187
+ return this.hasAttribute('show-agent-mode-for-tests')
188
+ ? 'show-agent-mode-for-tests'
189
+ : '';
190
+ }
191
+
170
192
  get hideBack() {
171
193
  return this.hasAttribute('hide-back-to-host') ? 'hide-back' : '';
172
194
  }
@@ -177,6 +199,10 @@ class SelfieCaptureScreens extends HTMLElement {
177
199
  : '';
178
200
  }
179
201
 
202
+ get themeColor() {
203
+ return this.getAttribute('theme-color') || '#001096';
204
+ }
205
+
180
206
  setActiveScreen(screen) {
181
207
  this.activeScreen?.setAttribute('hidden', '');
182
208
  screen.removeAttribute('hidden');
@@ -1,21 +1,30 @@
1
1
  import './SelfieCaptureScreens';
2
2
 
3
3
  const meta = {
4
+ argTypes: {
5
+ 'theme-color': { control: 'color' },
6
+ },
4
7
  component: 'selfie-capture-screens',
5
8
  };
6
9
 
7
10
  export default meta;
8
11
 
9
12
  export const SelfieCaptureFlow = {
10
- render: () => `
11
- <selfie-capture-screens>
13
+ args: {
14
+ 'theme-color': '#001096',
15
+ },
16
+ render: (args) => `
17
+ <selfie-capture-screens theme-color='${args['theme-color']}'>
12
18
  </selfie-capture-screens>
13
19
  `,
14
20
  };
15
21
 
16
22
  export const SelfieCaptureFlowHiddenInstructions = {
17
- render: () => `
18
- <selfie-capture-screens hide-instructions >
23
+ args: {
24
+ 'theme-color': '#001096',
25
+ },
26
+ render: (args) => `
27
+ <selfie-capture-screens hide-instructions theme-color='${args['theme-color']}'>
19
28
  </selfie-capture-screens>
20
29
  `,
21
30
  };