@smileid/web-components 11.4.5 → 11.5.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 (83) hide show
  1. package/dist/esm/{DocumentCaptureScreens-D2G0NOQr.js → DocumentCaptureScreens-ucJDu5nH.js} +555 -2470
  2. package/dist/esm/DocumentCaptureScreens-ucJDu5nH.js.map +1 -0
  3. package/dist/esm/{EndUserConsent-uHfA3txP.js → EndUserConsent-CsiwoThZ.js} +3 -3
  4. package/dist/esm/{EndUserConsent-uHfA3txP.js.map → EndUserConsent-CsiwoThZ.js.map} +1 -1
  5. package/dist/esm/{Navigation-Bb7MPLE8.js → Navigation-Xg565kcu.js} +28 -22
  6. package/dist/esm/Navigation-Xg565kcu.js.map +1 -0
  7. package/dist/esm/SelfieCaptureScreens-D3KuMzZA.js +11471 -0
  8. package/dist/esm/SelfieCaptureScreens-D3KuMzZA.js.map +1 -0
  9. package/dist/esm/{TotpConsent-Depzg0ti.js → TotpConsent-CRtmtudl.js} +2 -2
  10. package/dist/esm/{TotpConsent-Depzg0ti.js.map → TotpConsent-CRtmtudl.js.map} +1 -1
  11. package/dist/esm/combobox.js +1 -1
  12. package/dist/esm/document.js +1 -1
  13. package/dist/esm/end-user-consent.js +1 -1
  14. package/dist/esm/index-CUwa6MPI.js +1363 -0
  15. package/dist/esm/{index-C4RTMbgw.js.map → index-CUwa6MPI.js.map} +1 -1
  16. package/dist/esm/localisation.js +1 -1
  17. package/dist/esm/main.js +6 -6
  18. package/dist/esm/navigation.js +1 -1
  19. package/dist/esm/package-BmVbDNny.js +2535 -0
  20. package/dist/esm/package-BmVbDNny.js.map +1 -0
  21. package/dist/esm/selfie.js +1 -1
  22. package/dist/esm/smart-camera-web.js +67 -37
  23. package/dist/esm/smart-camera-web.js.map +1 -1
  24. package/dist/esm/totp-consent.js +1 -1
  25. package/dist/smart-camera-web.js +877 -122
  26. package/dist/smart-camera-web.js.map +1 -1
  27. package/dist/types/main.d.ts +11 -0
  28. package/lib/components/navigation/src/Navigation.js +27 -8
  29. package/lib/components/selfie/src/SelfieCaptureScreens.js +56 -8
  30. package/lib/components/selfie/src/enhanced-smartselfie-capture/EnhancedSmartSelfieCapture.tsx +684 -0
  31. package/lib/components/selfie/src/enhanced-smartselfie-capture/EnhancedSmartSelfieConsent.tsx +71 -0
  32. package/lib/components/selfie/src/enhanced-smartselfie-capture/EnhancedSmartSelfieSubmission.tsx +181 -0
  33. package/lib/components/selfie/src/enhanced-smartselfie-capture/OvalProgress.tsx +87 -0
  34. package/lib/components/selfie/src/enhanced-smartselfie-capture/assets/Icon.svg +8 -0
  35. package/lib/components/selfie/src/enhanced-smartselfie-capture/assets/accessories.svg +77 -0
  36. package/lib/components/selfie/src/enhanced-smartselfie-capture/assets/active_liveness_animation.lottie +0 -0
  37. package/lib/components/selfie/src/enhanced-smartselfie-capture/assets/device.svg +12 -0
  38. package/lib/components/selfie/src/enhanced-smartselfie-capture/assets/device_orientation.lottie +0 -0
  39. package/lib/components/selfie/src/enhanced-smartselfie-capture/assets/good.svg +52 -0
  40. package/lib/components/selfie/src/enhanced-smartselfie-capture/assets/id-card.svg +9 -0
  41. package/lib/components/selfie/src/enhanced-smartselfie-capture/assets/illustrations.tsx +852 -0
  42. package/lib/components/selfie/src/enhanced-smartselfie-capture/assets/instructions-img.svg +3 -0
  43. package/lib/components/selfie/src/enhanced-smartselfie-capture/assets/multiple-faces.svg +69 -0
  44. package/lib/components/selfie/src/enhanced-smartselfie-capture/assets/person.svg +6 -0
  45. package/lib/components/selfie/src/enhanced-smartselfie-capture/assets/phone.svg +8 -0
  46. package/lib/components/selfie/src/enhanced-smartselfie-capture/assets/poor-lighting.svg +53 -0
  47. package/lib/components/selfie/src/enhanced-smartselfie-capture/assets/too_dark_animation.lottie +0 -0
  48. package/lib/components/selfie/src/enhanced-smartselfie-capture/components/ActiveLivenessOverlay.tsx +226 -0
  49. package/lib/components/selfie/src/enhanced-smartselfie-capture/components/AlertDisplay.tsx +38 -0
  50. package/lib/components/selfie/src/enhanced-smartselfie-capture/components/BackNavigation.tsx +45 -0
  51. package/lib/components/selfie/src/enhanced-smartselfie-capture/components/CameraPreview.tsx +96 -0
  52. package/lib/components/selfie/src/enhanced-smartselfie-capture/components/CaptureControls.tsx +97 -0
  53. package/lib/components/selfie/src/enhanced-smartselfie-capture/components/CaptureGuidelines.tsx +374 -0
  54. package/lib/components/selfie/src/enhanced-smartselfie-capture/components/ConsentView.tsx +460 -0
  55. package/lib/components/selfie/src/enhanced-smartselfie-capture/components/SubmissionView.tsx +426 -0
  56. package/lib/components/selfie/src/enhanced-smartselfie-capture/components/index.ts +3 -0
  57. package/lib/components/selfie/src/enhanced-smartselfie-capture/constants.ts +23 -0
  58. package/lib/components/selfie/src/enhanced-smartselfie-capture/hooks/index.ts +2 -0
  59. package/lib/components/selfie/src/enhanced-smartselfie-capture/hooks/useCamera.ts +238 -0
  60. package/lib/components/selfie/src/enhanced-smartselfie-capture/hooks/useFaceCapture.ts +1075 -0
  61. package/lib/components/selfie/src/enhanced-smartselfie-capture/index.ts +1 -0
  62. package/lib/components/selfie/src/enhanced-smartselfie-capture/utils/alertMessages.ts +20 -0
  63. package/lib/components/selfie/src/enhanced-smartselfie-capture/utils/canvas.ts +108 -0
  64. package/lib/components/selfie/src/enhanced-smartselfie-capture/utils/faceDetection.ts +545 -0
  65. package/lib/components/selfie/src/enhanced-smartselfie-capture/utils/imageCapture.ts +66 -0
  66. package/lib/components/selfie/src/enhanced-smartselfie-capture/utils/imageQuality.ts +151 -0
  67. package/lib/components/selfie/src/enhanced-smartselfie-capture/utils/index.ts +5 -0
  68. package/lib/components/selfie/src/enhanced-smartselfie-capture/utils/mediapipeManager.ts +215 -0
  69. package/lib/components/selfie/src/selfie-capture-wrapper/SelfieCaptureWrapper.tsx +24 -1
  70. package/lib/components/selfie/src/smartselfie-capture/SmartSelfieCapture.tsx +2 -2
  71. package/lib/components/selfie/src/smartselfie-capture/hooks/useFaceCapture.ts +15 -7
  72. package/lib/components/selfie/src/smartselfie-capture/utils/canvas.ts +4 -6
  73. package/lib/components/signature-pad/package.json +1 -1
  74. package/lib/components/smart-camera-web/src/SmartCameraWeb.js +64 -7
  75. package/lib/domain/localisation/index.js +2 -2
  76. package/package.json +2 -2
  77. package/dist/esm/DocumentCaptureScreens-D2G0NOQr.js.map +0 -1
  78. package/dist/esm/Navigation-Bb7MPLE8.js.map +0 -1
  79. package/dist/esm/SelfieCaptureScreens-Dr7VzON7.js +0 -7651
  80. package/dist/esm/SelfieCaptureScreens-Dr7VzON7.js.map +0 -1
  81. package/dist/esm/index-C4RTMbgw.js +0 -1360
  82. package/dist/esm/package-D6YrpMcO.js +0 -565
  83. package/dist/esm/package-D6YrpMcO.js.map +0 -1
@@ -8,6 +8,14 @@ import packageJson from '../../../../package.json';
8
8
 
9
9
  const COMPONENTS_VERSION = packageJson.version;
10
10
 
11
+ // Minimal HTML-attribute escaper for values interpolated into the innerHTML
12
+ // template below. Order matters: encode `&` first so we don't double-encode
13
+ // the `&` we introduce when escaping `"`. Used because partner-supplied
14
+ // attributes (partner-name, partner-logo, policy-url, theme-color, ...) flow
15
+ // straight into the template string and an unescaped quote would otherwise
16
+ // allow attribute injection / XSS.
17
+ const escAttr = (s) => String(s).replace(/&/g, '&').replace(/"/g, '"');
18
+
11
19
  function scwTemplateString() {
12
20
  return `
13
21
  <style>
@@ -19,8 +27,8 @@ function scwTemplateString() {
19
27
  ${styles(this.themeColor)}
20
28
  <div style="height: 100%;">
21
29
  <camera-permission ${this.applyComponentThemeColor} ${this.title} ${this.showNavigation} ${this.hideInstructions ? '' : 'hidden'} ${this.hideAttribution}></camera-permission>
22
- <selfie-capture-screens ${this.applyComponentThemeColor} ${this.title} ${this.showNavigation} ${this.disableImageTests} ${this.hideAttribution} ${this.hideInstructions} hidden
23
- ${this.hideBackToHost} ${this.allowAgentMode} ${this.allowAgentModeTests} ${this.allowLegacySelfieFallback}
30
+ <selfie-capture-screens ${this.applyComponentThemeColor} ${this.title} ${this.showNavigation} ${this.disableImageTests} ${this.hideAttribution} ${this.hideInstructions} ${this.hideConsent} ${this.partnerName} ${this.partnerLogo} ${this.policyUrl} hidden
31
+ ${this.hideBackToHost} ${this.allowAgentMode} ${this.allowAgentModeTests} ${this.allowLegacySelfieFallback} ${this.useStrictMode} ${this.showBackOnGuidelines}
24
32
  ></selfie-capture-screens>
25
33
  <document-capture-screens ${this.applyComponentThemeColor} document-type=${this.documentType} ${this.title} ${this.documentCaptureModes} ${this.showNavigation} ${this.hideAttribution}
26
34
  ${this.hideBackOfId} ${this.newInstructions} ${this.applyComponentThemeColor} hidden></document-capture-screens>
@@ -76,9 +84,15 @@ class SmartCameraWeb extends HTMLElement {
76
84
  'hide-attribution',
77
85
  'hide-back-of-id',
78
86
  'hide-back-to-host',
87
+ 'hide-consent',
88
+ 'partner-name',
89
+ 'partner-logo',
90
+ 'policy-url',
79
91
  'show-navigation',
92
+ 'show-back-on-guidelines',
80
93
  'theme-color',
81
94
  'new-instructions',
95
+ 'use-strict-mode',
82
96
  ];
83
97
  }
84
98
 
@@ -92,9 +106,15 @@ class SmartCameraWeb extends HTMLElement {
92
106
  case 'hide-attribution':
93
107
  case 'hide-back-of-id':
94
108
  case 'hide-back-to-host':
109
+ case 'hide-consent':
110
+ case 'partner-name':
111
+ case 'partner-logo':
112
+ case 'policy-url':
95
113
  case 'show-navigation':
114
+ case 'show-back-on-guidelines':
96
115
  case 'theme-color':
97
116
  case 'new-instructions':
117
+ case 'use-strict-mode':
98
118
  this.disconnectedCallback();
99
119
  this.shadowRoot.innerHTML = this.render();
100
120
  this.setUpEventListeners();
@@ -239,6 +259,12 @@ class SmartCameraWeb extends HTMLElement {
239
259
  return this.hasAttribute('show-navigation') ? 'show-navigation' : '';
240
260
  }
241
261
 
262
+ get showBackOnGuidelines() {
263
+ return this.hasAttribute('show-back-on-guidelines')
264
+ ? 'show-back-on-guidelines'
265
+ : '';
266
+ }
267
+
242
268
  get hideBackToHost() {
243
269
  return this.hasAttribute('hide-back-to-host') ||
244
270
  this.hasAttribute('hide-back')
@@ -248,7 +274,7 @@ class SmartCameraWeb extends HTMLElement {
248
274
 
249
275
  get allowAgentMode() {
250
276
  return this.hasAttribute('allow-agent-mode')
251
- ? `allow-agent-mode=${this.getAttribute('allow-agent-mode')}`
277
+ ? `allow-agent-mode="${escAttr(this.getAttribute('allow-agent-mode'))}"`
252
278
  : '';
253
279
  }
254
280
 
@@ -260,13 +286,13 @@ class SmartCameraWeb extends HTMLElement {
260
286
 
261
287
  get title() {
262
288
  return this.hasAttribute('title')
263
- ? `title=${this.getAttribute('title')}`
289
+ ? `title="${escAttr(this.getAttribute('title'))}"`
264
290
  : '';
265
291
  }
266
292
 
267
293
  get documentCaptureModes() {
268
294
  return this.hasAttribute('document-capture-modes')
269
- ? `document-capture-modes='${this.getAttribute('document-capture-modes')}'`
295
+ ? `document-capture-modes="${escAttr(this.getAttribute('document-capture-modes'))}"`
270
296
  : '';
271
297
  }
272
298
 
@@ -278,7 +304,14 @@ class SmartCameraWeb extends HTMLElement {
278
304
 
279
305
  get allowLegacySelfieFallback() {
280
306
  return this.hasAttribute('allow-legacy-selfie-fallback')
281
- ? `allow-legacy-selfie-fallback='${this.getAttribute('allow-legacy-selfie-fallback')}'`
307
+ ? `allow-legacy-selfie-fallback="${escAttr(this.getAttribute('allow-legacy-selfie-fallback'))}"`
308
+ : '';
309
+ }
310
+
311
+ get useStrictMode() {
312
+ return this.hasAttribute('use-strict-mode') &&
313
+ this.getAttribute('use-strict-mode') !== 'false'
314
+ ? 'use-strict-mode="true"'
282
315
  : '';
283
316
  }
284
317
 
@@ -286,6 +319,28 @@ class SmartCameraWeb extends HTMLElement {
286
319
  return this.hasAttribute('hide-attribution') ? 'hide-attribution' : '';
287
320
  }
288
321
 
322
+ get hideConsent() {
323
+ return this.hasAttribute('hide-consent') ? 'hide-consent' : '';
324
+ }
325
+
326
+ get partnerName() {
327
+ return this.hasAttribute('partner-name')
328
+ ? `partner-name="${escAttr(this.getAttribute('partner-name'))}"`
329
+ : '';
330
+ }
331
+
332
+ get partnerLogo() {
333
+ return this.hasAttribute('partner-logo')
334
+ ? `partner-logo="${escAttr(this.getAttribute('partner-logo'))}"`
335
+ : '';
336
+ }
337
+
338
+ get policyUrl() {
339
+ return this.hasAttribute('policy-url')
340
+ ? `policy-url="${escAttr(this.getAttribute('policy-url'))}"`
341
+ : '';
342
+ }
343
+
289
344
  get hasThemeColor() {
290
345
  return (
291
346
  this.hasAttribute('theme-color') &&
@@ -300,7 +355,9 @@ class SmartCameraWeb extends HTMLElement {
300
355
  }
301
356
 
302
357
  get applyComponentThemeColor() {
303
- return this.hasThemeColor ? `theme-color='${this.themeColor}'` : '';
358
+ return this.hasThemeColor
359
+ ? `theme-color="${escAttr(this.themeColor)}"`
360
+ : '';
304
361
  }
305
362
 
306
363
  setActiveScreen(screen) {
@@ -218,7 +218,7 @@ export function t(key) {
218
218
  const resolvedLocale = resolveLocale(currentLocale);
219
219
  const currentLocaleData = locales[resolvedLocale];
220
220
  const value = getNestedValue(currentLocaleData, key);
221
- if (value) {
221
+ if (typeof value === 'string') {
222
222
  return value;
223
223
  }
224
224
 
@@ -226,7 +226,7 @@ export function t(key) {
226
226
  const resolvedDefault = resolveLocale(DEFAULT_LOCALE);
227
227
  if (resolvedLocale !== resolvedDefault) {
228
228
  const defaultValue = getNestedValue(locales[resolvedDefault], key);
229
- if (defaultValue) {
229
+ if (typeof defaultValue === 'string') {
230
230
  return defaultValue;
231
231
  }
232
232
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@smileid/web-components",
3
- "version": "11.4.5",
3
+ "version": "11.5.0",
4
4
  "private": false,
5
5
  "main": "dist/esm/main.js",
6
6
  "module": "dist/esm/main.js",
@@ -86,7 +86,7 @@
86
86
  },
87
87
  "homepage": "https://github.com/smileidentity/web-client#readme",
88
88
  "dependencies": {
89
- "@lottiefiles/dotlottie-web": "^0.71.0",
89
+ "@lottiefiles/dotlottie-web": "^0.72.1",
90
90
  "@mediapipe/tasks-vision": "^0.10.22-rc.20250304",
91
91
  "@preact/signals": "^2.1.1",
92
92
  "@tabler/icons-preact": "^3.34.0",