@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.
- package/dist/esm/{DocumentCaptureScreens-D2G0NOQr.js → DocumentCaptureScreens-ucJDu5nH.js} +555 -2470
- package/dist/esm/DocumentCaptureScreens-ucJDu5nH.js.map +1 -0
- package/dist/esm/{EndUserConsent-uHfA3txP.js → EndUserConsent-CsiwoThZ.js} +3 -3
- package/dist/esm/{EndUserConsent-uHfA3txP.js.map → EndUserConsent-CsiwoThZ.js.map} +1 -1
- package/dist/esm/{Navigation-Bb7MPLE8.js → Navigation-Xg565kcu.js} +28 -22
- package/dist/esm/Navigation-Xg565kcu.js.map +1 -0
- package/dist/esm/SelfieCaptureScreens-D3KuMzZA.js +11471 -0
- package/dist/esm/SelfieCaptureScreens-D3KuMzZA.js.map +1 -0
- package/dist/esm/{TotpConsent-Depzg0ti.js → TotpConsent-CRtmtudl.js} +2 -2
- package/dist/esm/{TotpConsent-Depzg0ti.js.map → TotpConsent-CRtmtudl.js.map} +1 -1
- package/dist/esm/combobox.js +1 -1
- package/dist/esm/document.js +1 -1
- package/dist/esm/end-user-consent.js +1 -1
- package/dist/esm/index-CUwa6MPI.js +1363 -0
- package/dist/esm/{index-C4RTMbgw.js.map → index-CUwa6MPI.js.map} +1 -1
- package/dist/esm/localisation.js +1 -1
- package/dist/esm/main.js +6 -6
- package/dist/esm/navigation.js +1 -1
- package/dist/esm/package-BmVbDNny.js +2535 -0
- package/dist/esm/package-BmVbDNny.js.map +1 -0
- package/dist/esm/selfie.js +1 -1
- package/dist/esm/smart-camera-web.js +67 -37
- package/dist/esm/smart-camera-web.js.map +1 -1
- package/dist/esm/totp-consent.js +1 -1
- package/dist/smart-camera-web.js +877 -122
- package/dist/smart-camera-web.js.map +1 -1
- package/dist/types/main.d.ts +11 -0
- package/lib/components/navigation/src/Navigation.js +27 -8
- package/lib/components/selfie/src/SelfieCaptureScreens.js +56 -8
- package/lib/components/selfie/src/enhanced-smartselfie-capture/EnhancedSmartSelfieCapture.tsx +684 -0
- package/lib/components/selfie/src/enhanced-smartselfie-capture/EnhancedSmartSelfieConsent.tsx +71 -0
- package/lib/components/selfie/src/enhanced-smartselfie-capture/EnhancedSmartSelfieSubmission.tsx +181 -0
- package/lib/components/selfie/src/enhanced-smartselfie-capture/OvalProgress.tsx +87 -0
- package/lib/components/selfie/src/enhanced-smartselfie-capture/assets/Icon.svg +8 -0
- package/lib/components/selfie/src/enhanced-smartselfie-capture/assets/accessories.svg +77 -0
- package/lib/components/selfie/src/enhanced-smartselfie-capture/assets/active_liveness_animation.lottie +0 -0
- package/lib/components/selfie/src/enhanced-smartselfie-capture/assets/device.svg +12 -0
- package/lib/components/selfie/src/enhanced-smartselfie-capture/assets/device_orientation.lottie +0 -0
- package/lib/components/selfie/src/enhanced-smartselfie-capture/assets/good.svg +52 -0
- package/lib/components/selfie/src/enhanced-smartselfie-capture/assets/id-card.svg +9 -0
- package/lib/components/selfie/src/enhanced-smartselfie-capture/assets/illustrations.tsx +852 -0
- package/lib/components/selfie/src/enhanced-smartselfie-capture/assets/instructions-img.svg +3 -0
- package/lib/components/selfie/src/enhanced-smartselfie-capture/assets/multiple-faces.svg +69 -0
- package/lib/components/selfie/src/enhanced-smartselfie-capture/assets/person.svg +6 -0
- package/lib/components/selfie/src/enhanced-smartselfie-capture/assets/phone.svg +8 -0
- package/lib/components/selfie/src/enhanced-smartselfie-capture/assets/poor-lighting.svg +53 -0
- package/lib/components/selfie/src/enhanced-smartselfie-capture/assets/too_dark_animation.lottie +0 -0
- package/lib/components/selfie/src/enhanced-smartselfie-capture/components/ActiveLivenessOverlay.tsx +226 -0
- package/lib/components/selfie/src/enhanced-smartselfie-capture/components/AlertDisplay.tsx +38 -0
- package/lib/components/selfie/src/enhanced-smartselfie-capture/components/BackNavigation.tsx +45 -0
- package/lib/components/selfie/src/enhanced-smartselfie-capture/components/CameraPreview.tsx +96 -0
- package/lib/components/selfie/src/enhanced-smartselfie-capture/components/CaptureControls.tsx +97 -0
- package/lib/components/selfie/src/enhanced-smartselfie-capture/components/CaptureGuidelines.tsx +374 -0
- package/lib/components/selfie/src/enhanced-smartselfie-capture/components/ConsentView.tsx +460 -0
- package/lib/components/selfie/src/enhanced-smartselfie-capture/components/SubmissionView.tsx +426 -0
- package/lib/components/selfie/src/enhanced-smartselfie-capture/components/index.ts +3 -0
- package/lib/components/selfie/src/enhanced-smartselfie-capture/constants.ts +23 -0
- package/lib/components/selfie/src/enhanced-smartselfie-capture/hooks/index.ts +2 -0
- package/lib/components/selfie/src/enhanced-smartselfie-capture/hooks/useCamera.ts +238 -0
- package/lib/components/selfie/src/enhanced-smartselfie-capture/hooks/useFaceCapture.ts +1075 -0
- package/lib/components/selfie/src/enhanced-smartselfie-capture/index.ts +1 -0
- package/lib/components/selfie/src/enhanced-smartselfie-capture/utils/alertMessages.ts +20 -0
- package/lib/components/selfie/src/enhanced-smartselfie-capture/utils/canvas.ts +108 -0
- package/lib/components/selfie/src/enhanced-smartselfie-capture/utils/faceDetection.ts +545 -0
- package/lib/components/selfie/src/enhanced-smartselfie-capture/utils/imageCapture.ts +66 -0
- package/lib/components/selfie/src/enhanced-smartselfie-capture/utils/imageQuality.ts +151 -0
- package/lib/components/selfie/src/enhanced-smartselfie-capture/utils/index.ts +5 -0
- package/lib/components/selfie/src/enhanced-smartselfie-capture/utils/mediapipeManager.ts +215 -0
- package/lib/components/selfie/src/selfie-capture-wrapper/SelfieCaptureWrapper.tsx +24 -1
- package/lib/components/selfie/src/smartselfie-capture/SmartSelfieCapture.tsx +2 -2
- package/lib/components/selfie/src/smartselfie-capture/hooks/useFaceCapture.ts +15 -7
- package/lib/components/selfie/src/smartselfie-capture/utils/canvas.ts +4 -6
- package/lib/components/signature-pad/package.json +1 -1
- package/lib/components/smart-camera-web/src/SmartCameraWeb.js +64 -7
- package/lib/domain/localisation/index.js +2 -2
- package/package.json +2 -2
- package/dist/esm/DocumentCaptureScreens-D2G0NOQr.js.map +0 -1
- package/dist/esm/Navigation-Bb7MPLE8.js.map +0 -1
- package/dist/esm/SelfieCaptureScreens-Dr7VzON7.js +0 -7651
- package/dist/esm/SelfieCaptureScreens-Dr7VzON7.js.map +0 -1
- package/dist/esm/index-C4RTMbgw.js +0 -1360
- package/dist/esm/package-D6YrpMcO.js +0 -565
- package/dist/esm/package-D6YrpMcO.js.map +0 -1
package/dist/types/main.d.ts
CHANGED
|
@@ -194,6 +194,7 @@ export declare class Navigation extends HTMLElement {
|
|
|
194
194
|
handleBack(): void;
|
|
195
195
|
handleClose(): void;
|
|
196
196
|
get showBackButton(): boolean;
|
|
197
|
+
get showCloseButton(): boolean;
|
|
197
198
|
get themeColor(): string;
|
|
198
199
|
get hasThemeColor(): string | undefined;
|
|
199
200
|
}
|
|
@@ -257,6 +258,10 @@ export declare class SelfieCaptureScreens extends HTMLElement {
|
|
|
257
258
|
get hideBack(): "" | "hide-back=\"\"";
|
|
258
259
|
get disableImageTests(): "" | "disable-image-tests=\"\"";
|
|
259
260
|
get allowLegacySelfieFallback(): string;
|
|
261
|
+
get useStrictMode(): "" | "use-strict-mode=\"true\"";
|
|
262
|
+
get showBackOnGuidelines(): "" | "show-back-on-guidelines=\"true\"";
|
|
263
|
+
/** Boolean form of `use-strict-mode` for runtime checks. */
|
|
264
|
+
get isStrictMode(): boolean;
|
|
260
265
|
get themeColor(): string;
|
|
261
266
|
handleBackEvents(): void;
|
|
262
267
|
handleCloseEvent(): void;
|
|
@@ -335,6 +340,7 @@ export declare class SmartCameraWeb extends HTMLElement {
|
|
|
335
340
|
get hideBackOfId(): "" | "hide-back-of-id";
|
|
336
341
|
get newInstructions(): "" | "new-instructions";
|
|
337
342
|
get showNavigation(): "" | "show-navigation";
|
|
343
|
+
get showBackOnGuidelines(): "" | "show-back-on-guidelines";
|
|
338
344
|
get hideBackToHost(): "" | "hide-back";
|
|
339
345
|
get allowAgentMode(): string;
|
|
340
346
|
get allowAgentModeTests(): "" | "show-agent-mode-for-tests";
|
|
@@ -342,7 +348,12 @@ export declare class SmartCameraWeb extends HTMLElement {
|
|
|
342
348
|
get documentCaptureModes(): string;
|
|
343
349
|
get disableImageTests(): "" | "disable-image-tests";
|
|
344
350
|
get allowLegacySelfieFallback(): string;
|
|
351
|
+
get useStrictMode(): "" | "use-strict-mode=\"true\"";
|
|
345
352
|
get hideAttribution(): "" | "hide-attribution";
|
|
353
|
+
get hideConsent(): "" | "hide-consent";
|
|
354
|
+
get partnerName(): string;
|
|
355
|
+
get partnerLogo(): string;
|
|
356
|
+
get policyUrl(): string;
|
|
346
357
|
get hasThemeColor(): boolean;
|
|
347
358
|
get themeColor(): string | null;
|
|
348
359
|
get applyComponentThemeColor(): string;
|
|
@@ -12,12 +12,19 @@ class Navigation extends HTMLElement {
|
|
|
12
12
|
const iconColor = this.hasThemeColor ? this.themeColor : '#FFFFFF';
|
|
13
13
|
const focusColor = '#FFFFFF';
|
|
14
14
|
|
|
15
|
+
let justifyContent = 'flex-end';
|
|
16
|
+
if (this.showBackButton && this.showCloseButton) {
|
|
17
|
+
justifyContent = 'space-between';
|
|
18
|
+
} else if (this.showBackButton) {
|
|
19
|
+
justifyContent = 'flex-start';
|
|
20
|
+
}
|
|
21
|
+
|
|
15
22
|
const style = document.createElement('style');
|
|
16
23
|
style.textContent = `
|
|
17
24
|
:host {
|
|
18
25
|
display: flex;
|
|
19
26
|
max-inline-size: 100%;
|
|
20
|
-
justify-content: ${
|
|
27
|
+
justify-content: ${justifyContent};
|
|
21
28
|
direction: ${direction};
|
|
22
29
|
padding: var(--smileid-navigation-padding, ${hostPadding});
|
|
23
30
|
gap: 1rem;
|
|
@@ -135,23 +142,31 @@ button svg {
|
|
|
135
142
|
|
|
136
143
|
shadow.appendChild(style);
|
|
137
144
|
if (this.showBackButton) shadow.appendChild(backButton);
|
|
138
|
-
shadow.appendChild(closeButton);
|
|
145
|
+
if (this.showCloseButton) shadow.appendChild(closeButton);
|
|
139
146
|
|
|
140
147
|
// Set language direction attribute on host for CSS selectors
|
|
141
148
|
this.setAttribute('dir', direction);
|
|
142
149
|
|
|
143
150
|
// Back Button Controls
|
|
144
|
-
this.
|
|
145
|
-
|
|
151
|
+
if (this.showBackButton) {
|
|
152
|
+
this.backButton = backButton;
|
|
153
|
+
this.backButton.addEventListener('click', () => this.handleBack());
|
|
154
|
+
}
|
|
146
155
|
|
|
147
156
|
// Close Button Controls
|
|
148
|
-
this.
|
|
149
|
-
|
|
157
|
+
if (this.showCloseButton) {
|
|
158
|
+
this.closeButton = closeButton;
|
|
159
|
+
this.closeButton.addEventListener('click', () => this.handleClose());
|
|
160
|
+
}
|
|
150
161
|
}
|
|
151
162
|
|
|
152
163
|
disconnectedCallback() {
|
|
153
|
-
this.backButton
|
|
154
|
-
|
|
164
|
+
if (this.backButton) {
|
|
165
|
+
this.backButton.removeEventListener('click', () => this.handleBack());
|
|
166
|
+
}
|
|
167
|
+
if (this.closeButton) {
|
|
168
|
+
this.closeButton.removeEventListener('click', () => this.handleClose());
|
|
169
|
+
}
|
|
155
170
|
}
|
|
156
171
|
|
|
157
172
|
handleBack() {
|
|
@@ -166,6 +181,10 @@ button svg {
|
|
|
166
181
|
return !this.hasAttribute('hide-back');
|
|
167
182
|
}
|
|
168
183
|
|
|
184
|
+
get showCloseButton() {
|
|
185
|
+
return !this.hasAttribute('hide-close');
|
|
186
|
+
}
|
|
187
|
+
|
|
169
188
|
get themeColor() {
|
|
170
189
|
return this.getAttribute('theme-color') || '#001096';
|
|
171
190
|
}
|
|
@@ -11,6 +11,15 @@ const COMPONENTS_VERSION = packageJson.version;
|
|
|
11
11
|
|
|
12
12
|
const smartCameraWeb = document.querySelector('smart-camera-web');
|
|
13
13
|
|
|
14
|
+
/**
|
|
15
|
+
* Minimum-correct HTML attribute escape. `&` must be replaced first so the
|
|
16
|
+
* subsequent `"` -> `"` substitution isn't double-encoded. Used by every
|
|
17
|
+
* getter that interpolates a partner-supplied value into the `innerHTML`
|
|
18
|
+
* template in `connectedCallback` — without this, a value containing `"`
|
|
19
|
+
* (or `&`) would break out of the attribute and inject markup.
|
|
20
|
+
*/
|
|
21
|
+
const escAttr = (s) => String(s).replace(/&/g, '&').replace(/"/g, '"');
|
|
22
|
+
|
|
14
23
|
const cropImageFromDataUri = (dataUri, cropPercentX = 0, cropPercentY = 0) =>
|
|
15
24
|
new Promise((resolve, reject) => {
|
|
16
25
|
if (!dataUri || typeof dataUri !== 'string') {
|
|
@@ -83,9 +92,9 @@ class SelfieCaptureScreens extends HTMLElement {
|
|
|
83
92
|
this.innerHTML = `
|
|
84
93
|
${styles(this.themeColor)}
|
|
85
94
|
<div style="height: 100%;">
|
|
86
|
-
<selfie-capture-instructions theme-color=
|
|
87
|
-
<selfie-capture-wrapper theme-color=
|
|
88
|
-
<selfie-capture-review theme-color=
|
|
95
|
+
<selfie-capture-instructions theme-color="${escAttr(this.themeColor)}" ${this.showNavigation} ${this.hideAttribution} ${this.hideBack} hidden></selfie-capture-instructions>
|
|
96
|
+
<selfie-capture-wrapper theme-color="${escAttr(this.themeColor)}" ${this.showNavigation} ${this.allowAgentMode} ${this.allowAgentModeTests} ${this.hideAttribution} ${this.disableImageTests} ${this.allowLegacySelfieFallback} ${this.useStrictMode} ${this.showBackOnGuidelines} key="${this._remountKey}" start-countdown="false" hidden></selfie-capture-wrapper>
|
|
97
|
+
<selfie-capture-review theme-color="${escAttr(this.themeColor)}" ${this.showNavigation} ${this.hideAttribution} hidden></selfie-capture-review>
|
|
89
98
|
</div>
|
|
90
99
|
`;
|
|
91
100
|
|
|
@@ -101,7 +110,11 @@ class SelfieCaptureScreens extends HTMLElement {
|
|
|
101
110
|
|
|
102
111
|
if (
|
|
103
112
|
this.getAttribute('initial-screen') === 'selfie-capture' ||
|
|
104
|
-
this.hideInstructions
|
|
113
|
+
this.hideInstructions ||
|
|
114
|
+
// In strict mode the modern `enhanced-smartselfie-capture` element
|
|
115
|
+
// renders its own guidelines screen, so we skip the legacy
|
|
116
|
+
// `selfie-capture-instructions` element entirely.
|
|
117
|
+
this.isStrictMode
|
|
105
118
|
) {
|
|
106
119
|
this.setActiveScreen(this.selfieCapture);
|
|
107
120
|
} else {
|
|
@@ -346,7 +359,7 @@ class SelfieCaptureScreens extends HTMLElement {
|
|
|
346
359
|
// Force remount of selfie-capture-wrapper for clean state on next visit
|
|
347
360
|
await this.forceWrapperRemount();
|
|
348
361
|
|
|
349
|
-
if (this.hideInstructions) {
|
|
362
|
+
if (this.hideInstructions || this.isStrictMode) {
|
|
350
363
|
this.handleBackEvents();
|
|
351
364
|
return;
|
|
352
365
|
}
|
|
@@ -367,6 +380,18 @@ class SelfieCaptureScreens extends HTMLElement {
|
|
|
367
380
|
smartCameraWeb?.dispatchEvent(
|
|
368
381
|
new CustomEvent('metadata.selfie-capture-end'),
|
|
369
382
|
);
|
|
383
|
+
this._data.images = event.detail.images;
|
|
384
|
+
SmartCamera.stopMedia();
|
|
385
|
+
|
|
386
|
+
// In strict mode (Enhanced SmartSelfie), the ESS component already
|
|
387
|
+
// shows its own review screen and only re-dispatches `publish` after
|
|
388
|
+
// the user confirms. Skip the legacy `selfie-capture-review` step and
|
|
389
|
+
// publish straight up to the host page.
|
|
390
|
+
if (this.isStrictMode) {
|
|
391
|
+
this._publishSelectedImages();
|
|
392
|
+
return;
|
|
393
|
+
}
|
|
394
|
+
|
|
370
395
|
this.selfieReview.setAttribute(
|
|
371
396
|
'data-image',
|
|
372
397
|
await cropImageFromDataUri(event.detail.referenceImage, 20, 20),
|
|
@@ -376,8 +401,6 @@ class SelfieCaptureScreens extends HTMLElement {
|
|
|
376
401
|
'mirror-image',
|
|
377
402
|
shouldMirror ? 'true' : 'false',
|
|
378
403
|
);
|
|
379
|
-
this._data.images = event.detail.images;
|
|
380
|
-
SmartCamera.stopMedia();
|
|
381
404
|
this.setActiveScreen(this.selfieReview);
|
|
382
405
|
};
|
|
383
406
|
|
|
@@ -450,10 +473,31 @@ class SelfieCaptureScreens extends HTMLElement {
|
|
|
450
473
|
|
|
451
474
|
get allowLegacySelfieFallback() {
|
|
452
475
|
return this.hasAttribute('allow-legacy-selfie-fallback')
|
|
453
|
-
? `allow-legacy-selfie-fallback=
|
|
476
|
+
? `allow-legacy-selfie-fallback="${escAttr(this.getAttribute('allow-legacy-selfie-fallback'))}"`
|
|
454
477
|
: '';
|
|
455
478
|
}
|
|
456
479
|
|
|
480
|
+
get useStrictMode() {
|
|
481
|
+
return this.hasAttribute('use-strict-mode') &&
|
|
482
|
+
this.getAttribute('use-strict-mode') !== 'false'
|
|
483
|
+
? 'use-strict-mode="true"'
|
|
484
|
+
: '';
|
|
485
|
+
}
|
|
486
|
+
|
|
487
|
+
get showBackOnGuidelines() {
|
|
488
|
+
return this.hasAttribute('show-back-on-guidelines')
|
|
489
|
+
? 'show-back-on-guidelines="true"'
|
|
490
|
+
: '';
|
|
491
|
+
}
|
|
492
|
+
|
|
493
|
+
/** Boolean form of `use-strict-mode` for runtime checks. */
|
|
494
|
+
get isStrictMode() {
|
|
495
|
+
return (
|
|
496
|
+
this.hasAttribute('use-strict-mode') &&
|
|
497
|
+
this.getAttribute('use-strict-mode') !== 'false'
|
|
498
|
+
);
|
|
499
|
+
}
|
|
500
|
+
|
|
457
501
|
get themeColor() {
|
|
458
502
|
return this.getAttribute('theme-color') || '#001096';
|
|
459
503
|
}
|
|
@@ -477,6 +521,8 @@ class SelfieCaptureScreens extends HTMLElement {
|
|
|
477
521
|
'allow-legacy-selfie-fallback',
|
|
478
522
|
'show-agent-mode-for-tests',
|
|
479
523
|
'disable-image-tests',
|
|
524
|
+
'use-strict-mode',
|
|
525
|
+
'show-back-on-guidelines',
|
|
480
526
|
];
|
|
481
527
|
}
|
|
482
528
|
|
|
@@ -489,6 +535,8 @@ class SelfieCaptureScreens extends HTMLElement {
|
|
|
489
535
|
case 'allow-legacy-selfie-fallback':
|
|
490
536
|
case 'show-agent-mode-for-tests':
|
|
491
537
|
case 'disable-image-tests':
|
|
538
|
+
case 'use-strict-mode':
|
|
539
|
+
case 'show-back-on-guidelines':
|
|
492
540
|
this.connectedCallback();
|
|
493
541
|
break;
|
|
494
542
|
default:
|