@smileid/web-components 10.0.3 → 10.0.5

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 (44) hide show
  1. package/dist/esm/{DocumentCaptureScreens-CkWKSrqy.js → DocumentCaptureScreens-BIJUlWLB.js} +98 -56
  2. package/dist/esm/DocumentCaptureScreens-BIJUlWLB.js.map +1 -0
  3. package/dist/esm/{EndUserConsent-CMHp-34-.js → EndUserConsent-D4fd1ovG.js} +2 -2
  4. package/dist/esm/{EndUserConsent-CMHp-34-.js.map → EndUserConsent-D4fd1ovG.js.map} +1 -1
  5. package/dist/esm/{Navigation-juBE4qOw.js → Navigation-CTjK6tLU.js} +6 -6
  6. package/dist/esm/{Navigation-juBE4qOw.js.map → Navigation-CTjK6tLU.js.map} +1 -1
  7. package/dist/esm/SelfieCaptureScreens-CnMaKUmP.js +11361 -0
  8. package/dist/esm/SelfieCaptureScreens-CnMaKUmP.js.map +1 -0
  9. package/dist/esm/document.js +1 -1
  10. package/dist/esm/end-user-consent.js +1 -1
  11. package/dist/esm/main.js +4 -4
  12. package/dist/esm/navigation.js +1 -1
  13. package/dist/esm/{package-CmYr0HUS.js → package-PZvRbm5J.js} +2 -2
  14. package/dist/esm/{package-CmYr0HUS.js.map → package-PZvRbm5J.js.map} +1 -1
  15. package/dist/esm/selfie.js +1 -1
  16. package/dist/esm/smart-camera-web.js +12 -6
  17. package/dist/esm/smart-camera-web.js.map +1 -1
  18. package/dist/esm/{styles-D2i3GFLK.js → styles-BOEZtbuc.js} +19 -5
  19. package/dist/esm/{styles-D2i3GFLK.js.map → styles-BOEZtbuc.js.map} +1 -1
  20. package/dist/smart-camera-web.js +278 -290
  21. package/dist/smart-camera-web.js.map +1 -1
  22. package/lib/components/document/src/DocumentCaptureScreens.js +1 -1
  23. package/lib/components/document/src/document-capture/DocumentCapture.js +2 -1
  24. package/lib/components/document/src/document-capture-instructions/DocumentCaptureInstructions.js +54 -8
  25. package/lib/components/document/src/document-capture-review/DocumentCaptureReview.js +2 -3
  26. package/lib/components/navigation/src/Navigation.js +5 -5
  27. package/lib/components/selfie/src/SelfieCaptureScreens.js +116 -118
  28. package/lib/components/selfie/src/selfie-capture/SelfieCapture.js +54 -10
  29. package/lib/components/selfie/src/selfie-capture-instructions/SelfieCaptureInstructions.js +91 -58
  30. package/lib/components/selfie/src/selfie-capture-review/SelfieCaptureReview.js +23 -154
  31. package/lib/components/selfie/src/selfie-capture-wrapper/SelfieCaptureWrapper.tsx +13 -0
  32. package/lib/components/selfie/src/smartselfie-capture/SmartSelfieCapture.tsx +66 -6
  33. package/lib/components/selfie/src/smartselfie-capture/components/CaptureControls.tsx +2 -0
  34. package/lib/components/selfie/src/smartselfie-capture/hooks/useCamera.ts +165 -21
  35. package/lib/components/selfie/src/smartselfie-capture/hooks/useFaceCapture.ts +82 -23
  36. package/lib/components/selfie/src/smartselfie-capture/utils/alertMessages.ts +2 -1
  37. package/lib/components/selfie/src/smartselfie-capture/utils/mediapipeManager.ts +18 -1
  38. package/lib/components/signature-pad/package.json +1 -1
  39. package/lib/components/smart-camera-web/src/SmartCameraWeb.js +7 -1
  40. package/lib/styles/src/styles.js +18 -4
  41. package/package.json +3 -1
  42. package/dist/esm/DocumentCaptureScreens-CkWKSrqy.js.map +0 -1
  43. package/dist/esm/SelfieCaptureScreens-BF1keQ0h.js +0 -7619
  44. package/dist/esm/SelfieCaptureScreens-BF1keQ0h.js.map +0 -1
@@ -1,6 +1,6 @@
1
- import { S as c, p as M, I as C } from "./package-CmYr0HUS.js";
2
- import { s as w } from "./styles-D2i3GFLK.js";
3
- import "./Navigation-juBE4qOw.js";
1
+ import { S as c, p as M, I as w } from "./package-PZvRbm5J.js";
2
+ import { s as C } from "./styles-BOEZtbuc.js";
3
+ import "./Navigation-CTjK6tLU.js";
4
4
  function A(l, e = 16) {
5
5
  const t = /* @__PURE__ */ new Set();
6
6
  for (let i = 0; i < Math.min(l.length, 1e4); i += 4)
@@ -54,11 +54,11 @@ function H() {
54
54
 
55
55
  #document-capture-screen,
56
56
  #back-of-document-capture-screen {
57
- block-size: 45rem;
58
57
  display: flex;
59
58
  flex-direction: column;
60
59
  max-block-size: 100%;
61
60
  max-inline-size: 40ch;
61
+ padding: 1rem;
62
62
  }
63
63
 
64
64
  #document-capture-screen header p {
@@ -115,6 +115,7 @@ function H() {
115
115
  inset: -1px;
116
116
  }
117
117
  canvas {
118
+ width: 100%;
118
119
  border-width: 0.25rem;
119
120
  border-color: #9394ab;
120
121
  border-style: solid;
@@ -153,7 +154,7 @@ function H() {
153
154
  padding-top: 10px;
154
155
  }
155
156
  </style>
156
- ${w(this.themeColor)}
157
+ ${C(this.themeColor)}
157
158
  <div id='document-capture-screen' class='flow center flex-column'>
158
159
  <smileid-navigation theme-color='${this.themeColor}' ${this.showNavigation ? "show-navigation" : ""} ${this.hideBack ? "hide-back" : ""}></smileid-navigation>
159
160
  <h2 class='text-base font-bold title-color'>${this.documentName}</h2>
@@ -225,9 +226,9 @@ class L extends HTMLElement {
225
226
  const t = document.createElement("canvas");
226
227
  if (this.isPortraitCaptureView) {
227
228
  t.width = e.videoWidth, t.height = t.width * 16 / 9;
228
- const r = document.createElement("canvas");
229
- r.width = t.width, r.height = t.height, this.updatePortraitId(t, e, 1, 1), this.updatePortraitId(r, e);
230
- const n = t.toDataURL("image/jpeg"), h = r.toDataURL("image/jpeg");
229
+ const s = document.createElement("canvas");
230
+ s.width = t.width, s.height = t.height, this.updatePortraitId(t, e, 1, 1), this.updatePortraitId(s, e);
231
+ const n = t.toDataURL("image/jpeg"), h = s.toDataURL("image/jpeg");
231
232
  return {
232
233
  image: n,
233
234
  originalHeight: t.height,
@@ -241,13 +242,13 @@ class L extends HTMLElement {
241
242
  t.height = i;
242
243
  const o = document.createElement("canvas");
243
244
  if (o.height = t.height, o.width = t.width, e.videoWidth < e.videoHeight) {
244
- const r = document.createElement("canvas");
245
- o.height = t.width / 1.75, t.width = 2240, t.height = t.width / 1.77, this._capturePortraitToLandscapeImage(r, e), this._drawLandscapeImageFromCanvas(t, r, 1, 1), this._drawLandscapeImageFromCanvas(o, r);
245
+ const s = document.createElement("canvas");
246
+ o.height = t.width / 1.75, t.width = 2240, t.height = t.width / 1.77, this._capturePortraitToLandscapeImage(s, e), this._drawLandscapeImageFromCanvas(t, s, 1, 1), this._drawLandscapeImageFromCanvas(o, s);
246
247
  } else
247
248
  this._drawLandscapeImage(t, e, 1, 1), this._drawLandscapeImage(o, e);
248
- const s = t.toDataURL("image/jpeg"), d = o.toDataURL("image/jpeg");
249
+ const r = t.toDataURL("image/jpeg"), d = o.toDataURL("image/jpeg");
249
250
  return {
250
- image: s,
251
+ image: r,
251
252
  originalHeight: t.height,
252
253
  originalWidth: t.width,
253
254
  previewImage: d,
@@ -289,23 +290,23 @@ class L extends HTMLElement {
289
290
  i.muted = !0, i.setAttribute("muted", "true"), i.autoplay = !0, i.playsInline = !0, "srcObject" in i ? i.srcObject = e : i.src = window.URL.createObjectURL(e), o.width = a.clientWidth, o.height = a.clientWidth * 9 / 16, this.isPortraitCaptureView && (o.height = a.clientWidth * 16 / 9), i.onloadedmetadata = () => {
290
291
  i.play(), this.shadowRoot.querySelector("#loader").hidden = !0, this.shadowRoot.querySelector(".id-video").hidden = !1, this.shadowRoot.querySelector(".actions").hidden = !1, t || a.prepend(o);
291
292
  };
292
- const s = () => {
293
+ const r = () => {
293
294
  if (i.paused || i.ended) return;
294
- i.removeEventListener("playing", s);
295
- const r = i.videoWidth / i.videoHeight < 1;
295
+ i.removeEventListener("playing", r);
296
+ const s = i.videoWidth / i.videoHeight < 1;
296
297
  if (this.isPortraitCaptureView) {
297
- this.updatePortraitId(o, i), requestAnimationFrame(s);
298
+ this.updatePortraitId(o, i), requestAnimationFrame(r);
298
299
  return;
299
300
  }
300
- if (r) {
301
+ if (s) {
301
302
  a.classList.add("mobile-camera-screen");
302
303
  const n = document.createElement("canvas");
303
304
  this._capturePortraitToLandscapeImage(n, i), this._drawLandscapeImageFromCanvas(o, n);
304
305
  } else
305
306
  this._drawLandscapeImage(o, i);
306
- requestAnimationFrame(s);
307
+ requestAnimationFrame(r);
307
308
  };
308
- i.addEventListener("playing", s), this._IDStream = e, this._IDVideo = i;
309
+ i.addEventListener("playing", r), this._IDStream = e, this._IDVideo = i;
309
310
  } catch (t) {
310
311
  this.setAttribute(
311
312
  "data-camera-error",
@@ -314,7 +315,7 @@ class L extends HTMLElement {
314
315
  }
315
316
  }
316
317
  _drawLandscapeImage(e, t = this._IDVideo, i = v, o = v) {
317
- const a = this.height ? this.height / t.videoHeight : i, s = this.width ? this.width / t.videoWidth : o, d = (1 - i) / 2, r = (1 - o) / 2, n = t.videoWidth * s, h = t.videoHeight * a, m = t.videoWidth * r, g = t.videoHeight * d;
318
+ const a = this.height ? this.height / t.videoHeight : i, r = this.width ? this.width / t.videoWidth : o, d = (1 - i) / 2, s = (1 - o) / 2, n = t.videoWidth * r, h = t.videoHeight * a, m = t.videoWidth * s, g = t.videoHeight * d;
318
319
  e.getContext("2d").drawImage(
319
320
  t,
320
321
  m,
@@ -328,13 +329,13 @@ class L extends HTMLElement {
328
329
  );
329
330
  }
330
331
  _capturePortraitToLandscapeImage(e, t = this._IDVideo) {
331
- const { videoHeight: i, videoWidth: o } = t, a = o, s = o * 9 / 16, d = 0, r = (i - s) / 2;
332
- e.width = a, e.height = s, e.getContext("2d").drawImage(
332
+ const { videoHeight: i, videoWidth: o } = t, a = o, r = o * 9 / 16, d = 0, s = (i - r) / 2;
333
+ e.width = a, e.height = r, e.getContext("2d").drawImage(
333
334
  t,
334
335
  d,
335
- r,
336
- a,
337
336
  s,
337
+ a,
338
+ r,
338
339
  0,
339
340
  0,
340
341
  e.width,
@@ -342,7 +343,7 @@ class L extends HTMLElement {
342
343
  );
343
344
  }
344
345
  _drawLandscapeImageFromCanvas(e, t, i = v, o = v) {
345
- const a = this.height ? this.height / t.height : i, s = this.width ? this.width / t.width : o, d = (1 - i) / 2, r = (1 - o) / 2, n = t.width * s, h = t.height * a, m = t.width * r, g = t.height * d;
346
+ const a = this.height ? this.height / t.height : i, r = this.width ? this.width / t.width : o, d = (1 - i) / 2, s = (1 - o) / 2, n = t.width * r, h = t.height * a, m = t.width * s, g = t.height * d;
346
347
  e.getContext("2d").drawImage(
347
348
  t,
348
349
  m,
@@ -356,15 +357,15 @@ class L extends HTMLElement {
356
357
  );
357
358
  }
358
359
  _drawPortraitToLandscapeImage(e, t = this._IDVideo) {
359
- const { videoHeight: i, videoWidth: o } = t, a = 600, s = 400;
360
- e.width = a, e.height = s;
361
- const d = (o - a) / 2, r = (i - s) / 2;
360
+ const { videoHeight: i, videoWidth: o } = t, a = 600, r = 400;
361
+ e.width = a, e.height = r;
362
+ const d = (o - a) / 2, s = (i - r) / 2;
362
363
  e.getContext("2d").drawImage(
363
364
  t,
364
365
  d,
365
- r,
366
- a,
367
366
  s,
367
+ a,
368
+ r,
368
369
  0,
369
370
  0,
370
371
  e.width,
@@ -372,11 +373,11 @@ class L extends HTMLElement {
372
373
  );
373
374
  }
374
375
  updatePortraitId(e, t = this._IDVideo, i = v, o = v) {
375
- const { videoWidth: a, videoHeight: s } = t;
376
- if (a && s) {
377
- const d = document.createElement("canvas"), r = 9 / 16;
376
+ const { videoWidth: a, videoHeight: r } = t;
377
+ if (a && r) {
378
+ const d = document.createElement("canvas"), s = 9 / 16;
378
379
  let n, h, m, g;
379
- a / s > r ? (h = s, n = h * r, m = (a - n) / 2, g = 0) : (n = a, h = n, m = 0, g = 0), d.height = h, d.width = n, d.getContext("2d").drawImage(
380
+ a / r > s ? (h = r, n = h * s, m = (a - n) / 2, g = 0) : (n = a, h = n, m = 0, g = 0), d.height = h, d.width = n, d.getContext("2d").drawImage(
380
381
  t,
381
382
  m,
382
383
  g,
@@ -387,12 +388,12 @@ class L extends HTMLElement {
387
388
  d.width,
388
389
  d.height
389
390
  );
390
- const b = this.height ? this.height / n : i, y = this.width ? this.width / h : o, x = (1 - i) / 2, k = (1 - o) / 2, E = n * y, _ = h * b, I = n * k, B = h * x;
391
+ const b = this.height ? this.height / n : i, y = this.width ? this.width / h : o, x = (1 - i) / 2, E = (1 - o) / 2, k = n * y, _ = h * b, I = n * E, B = h * x;
391
392
  e.getContext("2d").drawImage(
392
393
  d,
393
394
  I,
394
395
  B,
395
- E,
396
+ k,
396
397
  _,
397
398
  0,
398
399
  0,
@@ -513,7 +514,6 @@ function S() {
513
514
 
514
515
  .section {
515
516
  width: 100%;
516
- height: 100vh;
517
517
  justify-content: center;
518
518
  }
519
519
  }
@@ -621,11 +621,11 @@ function S() {
621
621
  }
622
622
 
623
623
  #document-capture-review-screen {
624
- block-size: 45rem;
625
624
  display: flex;
626
625
  flex-direction: column;
627
626
  max-block-size: 100%;
628
627
  max-inline-size: 40ch;
628
+ padding: 1rem;
629
629
  }
630
630
 
631
631
  #document-capture-review-screen .id-image-container.landscape {
@@ -690,7 +690,7 @@ function S() {
690
690
  text-align: center;
691
691
 
692
692
  /* h1 */
693
- font-size: 1.5rem;
693
+ font-size: 1.25rem;
694
694
  font-style: normal;
695
695
  font-weight: 700;
696
696
  line-height: 36px; /* 150% */
@@ -714,7 +714,7 @@ function S() {
714
714
  line-height: 1.5rem;
715
715
  }
716
716
  </style>
717
- ${w(this.themeColor)}
717
+ ${C(this.themeColor)}
718
718
  <div id='document-capture-review-screen' class='flow center'>
719
719
  <smileid-navigation ${this.showNavigation ? "show-navigation" : ""} hide-back></smileid-navigation>
720
720
  <h1 class="header-title title-color">
@@ -1002,12 +1002,51 @@ function $() {
1002
1002
  }
1003
1003
  function V() {
1004
1004
  return `
1005
+ <style>
1006
+ h1 {
1007
+ font-size: 1.25rem;
1008
+ }
1009
+
1010
+ .controls {
1011
+ width: 100%;
1012
+ margin-top: 1rem;
1013
+ display: flex;
1014
+ flex-direction: column;
1015
+ gap: 0.5rem;
1016
+ }
1017
+
1018
+ .content-root {
1019
+ height: 100%;
1020
+ display: flex;
1021
+ align-items: center;
1022
+ flex-direction: column;
1023
+ }
1024
+
1025
+ .content-header, .content-body, .content-footer {
1026
+ width: 100%;
1027
+ }
1028
+
1029
+ .content-body {
1030
+ height: 100%;
1031
+ display: flex;
1032
+ flex-direction: column;
1033
+ align-items: center;
1034
+ justify-content: space-between;
1035
+ }
1036
+
1037
+ .content-body header {
1038
+ margin-top: 1rem;
1039
+ }
1040
+ </style>
1005
1041
  <div id="document-capture-instructions-screen" class="flow center">
1006
- <section className="main">
1042
+ <div class="content-root">
1043
+ <div class="content-header">
1007
1044
  <smileid-navigation theme-color='${this.themeColor}' ${this.showNavigation ? "show-navigation" : ""} ${this.hideBack ? "hide-back" : ""}></smileid-navigation>
1045
+ </div>
1046
+ <div class="content-body">
1008
1047
  <header>
1009
1048
  ${this.isFrontOfId ? F() : $()}
1010
- <h1 class='text-2xl title-color font-bold'>${this.title}</h1>
1049
+ <h1 class='title-color font-bold'>${this.title}</h1>
1011
1050
  <p class="description text-sm font-normal">
1012
1051
  We'll use it to verify your identity.
1013
1052
  </p>
@@ -1015,7 +1054,7 @@ function V() {
1015
1054
  Please follow the instructions below.
1016
1055
  </p>
1017
1056
  </header>
1018
- <div class="flow instructions-wrapper">
1057
+ <div class="instructions-wrapper">
1019
1058
  <div class="instructions">
1020
1059
  <svg
1021
1060
  xmlns="http://www.w3.org/2000/svg"
@@ -1189,9 +1228,7 @@ function V() {
1189
1228
  <div id="error" class='color-red'>
1190
1229
  </div>
1191
1230
  </div>
1192
- </section>
1193
- <section className="footer">
1194
- <div class='flow'>
1231
+ <div class='controls'>
1195
1232
  ${this.supportBothCaptureModes || this.documentCaptureModes === "camera" ? `
1196
1233
  <button data-variant='solid full-width' class='button' type='button' id='take-photo'>
1197
1234
  Take Photo
@@ -1204,10 +1241,15 @@ function V() {
1204
1241
  </label>
1205
1242
  ` : ""}
1206
1243
  </div>
1207
- ${this.hideAttribution ? "" : "<powered-by-smile-id></powered-by-smile-id>"}
1208
- </section>
1244
+ ${this.hideAttribution ? "" : `
1245
+ <div class="content-footer">
1246
+ <powered-by-smile-id></powered-by-smile-id>
1247
+ </div>
1248
+ `}
1249
+ </div>
1209
1250
  </div>
1210
- ${w(this.themeColor)}
1251
+ </div>
1252
+ ${C(this.themeColor)}
1211
1253
  `;
1212
1254
  }
1213
1255
  class Z extends HTMLElement {
@@ -1312,8 +1354,8 @@ class O extends HTMLElement {
1312
1354
  }
1313
1355
  connectedCallback() {
1314
1356
  this.innerHTML = `
1315
- ${w(this.themeColor)}
1316
- <div>
1357
+ ${C(this.themeColor)}
1358
+ <div style="height: 100%;">
1317
1359
  <document-capture-instructions theme-color='${this.themeColor}' id='document-capture-instructions-front' ${this.title}
1318
1360
  ${this.documentCaptureModes} ${this.showNavigation} ${this.hideInstructions ? "hidden" : ""}
1319
1361
  ${this.hideAttribution}
@@ -1374,7 +1416,7 @@ class O extends HTMLElement {
1374
1416
  })
1375
1417
  ), this.idReview.setAttribute("data-image", t.detail.previewImage), this._data.images.push({
1376
1418
  image: t.detail.image.split(",")[1],
1377
- image_type_id: C.ID_CARD_IMAGE_BASE64
1419
+ image_type_id: w.ID_CARD_IMAGE_BASE64
1378
1420
  }), this.setActiveScreen(this.idReview);
1379
1421
  }
1380
1422
  ), this.idCapture.addEventListener("document-capture.publish", (t) => {
@@ -1382,7 +1424,7 @@ class O extends HTMLElement {
1382
1424
  new CustomEvent("metadata.document-front-capture-end")
1383
1425
  ), this.idReview.setAttribute("data-image", t.detail.previewImage), this._data.images.push({
1384
1426
  image: t.detail.image.split(",")[1],
1385
- image_type_id: C.ID_CARD_IMAGE_BASE64
1427
+ image_type_id: w.ID_CARD_IMAGE_BASE64
1386
1428
  }), c.stopMedia(), this.setActiveScreen(this.idReview);
1387
1429
  }), this.idCapture.addEventListener("document-capture.cancelled", () => {
1388
1430
  this.hideInstructions ? this.handleBackEvents() : this.setActiveScreen(this.documentInstruction);
@@ -1423,7 +1465,7 @@ class O extends HTMLElement {
1423
1465
  })
1424
1466
  ), this.backOfIdReview.setAttribute("data-image", t.detail.image), this._data.images.push({
1425
1467
  image: t.detail.image.split(",")[1],
1426
- image_type_id: C.ID_CARD_BACK_IMAGE_BASE64
1468
+ image_type_id: w.ID_CARD_BACK_IMAGE_BASE64
1427
1469
  }), this.setActiveScreen(this.backOfIdReview);
1428
1470
  }
1429
1471
  ), this.idCaptureBack.addEventListener("document-capture.publish", (t) => {
@@ -1431,7 +1473,7 @@ class O extends HTMLElement {
1431
1473
  new CustomEvent("metadata.document-back-capture-end")
1432
1474
  ), this.backOfIdReview.setAttribute("data-image", t.detail.previewImage), this._data.images.push({
1433
1475
  image: t.detail.image.split(",")[1],
1434
- image_type_id: C.ID_CARD_BACK_IMAGE_BASE64
1476
+ image_type_id: w.ID_CARD_BACK_IMAGE_BASE64
1435
1477
  }), this.setActiveScreen(this.backOfIdReview), c.stopMedia();
1436
1478
  }), this.idCaptureBack.addEventListener(
1437
1479
  "document-capture.cancelled",
@@ -1529,4 +1571,4 @@ class O extends HTMLElement {
1529
1571
  export {
1530
1572
  O as D
1531
1573
  };
1532
- //# sourceMappingURL=DocumentCaptureScreens-CkWKSrqy.js.map
1574
+ //# sourceMappingURL=DocumentCaptureScreens-BIJUlWLB.js.map