@smileid/web-components 11.4.4 → 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 (84) hide show
  1. package/dist/esm/{DocumentCaptureScreens-bLFW-yEM.js → DocumentCaptureScreens-ucJDu5nH.js} +555 -2470
  2. package/dist/esm/DocumentCaptureScreens-ucJDu5nH.js.map +1 -0
  3. package/dist/esm/{EndUserConsent-D26UoVk5.js → EndUserConsent-CsiwoThZ.js} +3 -3
  4. package/dist/esm/{EndUserConsent-D26UoVk5.js.map → EndUserConsent-CsiwoThZ.js.map} +1 -1
  5. package/dist/esm/{Navigation-nvehze1F.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-owUOdKzP.js → TotpConsent-CRtmtudl.js} +2 -2
  10. package/dist/esm/{TotpConsent-owUOdKzP.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-5Nn2kzHI.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 -40
  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 +13 -0
  28. package/lib/components/navigation/src/Navigation.js +27 -8
  29. package/lib/components/selfie/src/SelfieCaptureScreens.js +139 -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 +163 -17
  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/selfie/src/smartselfie-capture/utils/mediapipeManager.ts +145 -9
  74. package/lib/components/signature-pad/package.json +1 -1
  75. package/lib/components/smart-camera-web/src/SmartCameraWeb.js +70 -11
  76. package/lib/domain/localisation/index.js +2 -2
  77. package/package.json +3 -3
  78. package/dist/esm/DocumentCaptureScreens-bLFW-yEM.js.map +0 -1
  79. package/dist/esm/Navigation-nvehze1F.js.map +0 -1
  80. package/dist/esm/SelfieCaptureScreens-BXIs6_tl.js +0 -7522
  81. package/dist/esm/SelfieCaptureScreens-BXIs6_tl.js.map +0 -1
  82. package/dist/esm/index-5Nn2kzHI.js +0 -1360
  83. package/dist/esm/package-DmH-I6GW.js +0 -565
  84. package/dist/esm/package-DmH-I6GW.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();
@@ -166,11 +186,13 @@ class SmartCameraWeb extends HTMLElement {
166
186
  this.documentCapture.addEventListener(
167
187
  'document-capture-screens.cancelled',
168
188
  () => {
169
- this.SelfieCaptureScreens.setAttribute(
170
- 'initial-screen',
171
- 'selfie-capture',
172
- );
173
189
  this.setActiveScreen(this.SelfieCaptureScreens);
190
+ // Land on a clean selfie capture screen by driving the navigation
191
+ // explicitly. Previously this set `initial-screen="selfie-capture"`,
192
+ // whose side effect was a full SelfieCaptureScreens rebuild — re-fired
193
+ // on every back-navigation (setAttribute invokes attributeChangedCallback
194
+ // even when the value is unchanged).
195
+ this.SelfieCaptureScreens.restartSelfieCapture();
174
196
  this.SelfieCaptureScreens.removeAttribute('data-camera-error');
175
197
  this.SelfieCaptureScreens.setAttribute('data-camera-ready', true);
176
198
  },
@@ -237,6 +259,12 @@ class SmartCameraWeb extends HTMLElement {
237
259
  return this.hasAttribute('show-navigation') ? 'show-navigation' : '';
238
260
  }
239
261
 
262
+ get showBackOnGuidelines() {
263
+ return this.hasAttribute('show-back-on-guidelines')
264
+ ? 'show-back-on-guidelines'
265
+ : '';
266
+ }
267
+
240
268
  get hideBackToHost() {
241
269
  return this.hasAttribute('hide-back-to-host') ||
242
270
  this.hasAttribute('hide-back')
@@ -246,7 +274,7 @@ class SmartCameraWeb extends HTMLElement {
246
274
 
247
275
  get allowAgentMode() {
248
276
  return this.hasAttribute('allow-agent-mode')
249
- ? `allow-agent-mode=${this.getAttribute('allow-agent-mode')}`
277
+ ? `allow-agent-mode="${escAttr(this.getAttribute('allow-agent-mode'))}"`
250
278
  : '';
251
279
  }
252
280
 
@@ -258,13 +286,13 @@ class SmartCameraWeb extends HTMLElement {
258
286
 
259
287
  get title() {
260
288
  return this.hasAttribute('title')
261
- ? `title=${this.getAttribute('title')}`
289
+ ? `title="${escAttr(this.getAttribute('title'))}"`
262
290
  : '';
263
291
  }
264
292
 
265
293
  get documentCaptureModes() {
266
294
  return this.hasAttribute('document-capture-modes')
267
- ? `document-capture-modes='${this.getAttribute('document-capture-modes')}'`
295
+ ? `document-capture-modes="${escAttr(this.getAttribute('document-capture-modes'))}"`
268
296
  : '';
269
297
  }
270
298
 
@@ -276,7 +304,14 @@ class SmartCameraWeb extends HTMLElement {
276
304
 
277
305
  get allowLegacySelfieFallback() {
278
306
  return this.hasAttribute('allow-legacy-selfie-fallback')
279
- ? `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"'
280
315
  : '';
281
316
  }
282
317
 
@@ -284,6 +319,28 @@ class SmartCameraWeb extends HTMLElement {
284
319
  return this.hasAttribute('hide-attribution') ? 'hide-attribution' : '';
285
320
  }
286
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
+
287
344
  get hasThemeColor() {
288
345
  return (
289
346
  this.hasAttribute('theme-color') &&
@@ -298,7 +355,9 @@ class SmartCameraWeb extends HTMLElement {
298
355
  }
299
356
 
300
357
  get applyComponentThemeColor() {
301
- return this.hasThemeColor ? `theme-color='${this.themeColor}'` : '';
358
+ return this.hasThemeColor
359
+ ? `theme-color="${escAttr(this.themeColor)}"`
360
+ : '';
302
361
  }
303
362
 
304
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.4",
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",
@@ -105,7 +105,7 @@
105
105
  "@typescript-eslint/eslint-plugin": "^8.49.0",
106
106
  "@typescript-eslint/parser": "^8.49.0",
107
107
  "cross-env": "^7.0.3",
108
- "cypress": "^13.15.0",
108
+ "cypress": "^13.17.0",
109
109
  "eslint": "^8.57.0",
110
110
  "eslint-config-airbnb-base": "^15.0.0",
111
111
  "eslint-config-prettier": "^9.1.0",