@smileid/web-components 11.1.0 → 11.2.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-DHAfE8VG.js → DocumentCaptureScreens-BbtA-WkX.js} +13 -13
- package/dist/esm/DocumentCaptureScreens-BbtA-WkX.js.map +1 -0
- package/dist/esm/{EndUserConsent-DE6OBSGG.js → EndUserConsent-HVufMamg.js} +3 -3
- package/dist/esm/{EndUserConsent-DE6OBSGG.js.map → EndUserConsent-HVufMamg.js.map} +1 -1
- package/dist/esm/{Navigation-kjll5SgE.js → Navigation-B-dqPkZj.js} +2 -2
- package/dist/esm/{Navigation-kjll5SgE.js.map → Navigation-B-dqPkZj.js.map} +1 -1
- package/dist/esm/{SelfieCaptureScreens-DaREKFi4.js → SelfieCaptureScreens-ChAMfKi3.js} +1591 -1574
- package/dist/esm/SelfieCaptureScreens-ChAMfKi3.js.map +1 -0
- package/dist/esm/{TotpConsent-DsMJhXD8.js → TotpConsent-XxR8TNxy.js} +2 -2
- package/dist/esm/{TotpConsent-DsMJhXD8.js.map → TotpConsent-XxR8TNxy.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-LJce6hoU.js → index-B_ozpejI.js} +76 -76
- package/dist/esm/{index-LJce6hoU.js.map → index-B_ozpejI.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-BoRHLVSv.js → package-u3FEJ3Fm.js} +3 -3
- package/dist/esm/{package-BoRHLVSv.js.map → package-u3FEJ3Fm.js.map} +1 -1
- package/dist/esm/selfie.js +1 -1
- package/dist/esm/smart-camera-web.js +21 -16
- package/dist/esm/smart-camera-web.js.map +1 -1
- package/dist/esm/totp-consent.js +1 -1
- package/dist/package.json +1 -1
- package/dist/smart-camera-web.js +45 -45
- package/dist/smart-camera-web.js.map +1 -1
- package/lib/components/camera-permission/CameraPermission.js +1 -1
- package/lib/components/document/src/document-capture/DocumentCapture.js +3 -3
- package/lib/components/document/src/document-capture-instructions/DocumentCaptureInstructions.js +3 -3
- package/lib/components/document/src/document-capture-review/DocumentCaptureReview.js +3 -3
- package/lib/components/selfie/src/SelfieCaptureScreens.js +9 -1
- package/lib/components/selfie/src/selfie-capture/SelfieCapture.js +2 -2
- package/lib/components/selfie/src/selfie-capture-instructions/SelfieCaptureInstructions.js +3 -3
- package/lib/components/selfie/src/selfie-capture-review/SelfieCaptureReview.js +3 -3
- package/lib/components/selfie/src/selfie-capture-wrapper/SelfieCaptureWrapper.tsx +97 -46
- package/lib/components/signature-pad/package.json +1 -1
- package/lib/components/smart-camera-web/src/SmartCameraWeb.js +9 -1
- package/package.json +2 -2
- package/dist/esm/DocumentCaptureScreens-DHAfE8VG.js.map +0 -1
- package/dist/esm/SelfieCaptureScreens-DaREKFi4.js.map +0 -1
- package/lib/components/selfie/src/smartselfie-capture/SmartSelfieCapture.stories.js +0 -47
|
@@ -32,7 +32,7 @@ function templateString() {
|
|
|
32
32
|
}
|
|
33
33
|
</style>
|
|
34
34
|
<div class='camera-permission-screen flow center' dir='${this.direction}'>
|
|
35
|
-
|
|
35
|
+
${this.showNavigation ? `<smileid-navigation theme-color='${this.themeColor}' ${this.hideBack ? 'hide-back' : ''}></smileid-navigation>` : ''}
|
|
36
36
|
<div class='flow center'>
|
|
37
37
|
<p class='color-red | center' id='error'>
|
|
38
38
|
</p>
|
|
@@ -164,7 +164,7 @@ function templateString() {
|
|
|
164
164
|
</style>
|
|
165
165
|
${styles(this.themeColor)}
|
|
166
166
|
<div id='document-capture-screen' class='flow center flex-column' dir='${this.direction}'>
|
|
167
|
-
|
|
167
|
+
${this.showNavigation ? `<smileid-navigation theme-color='${this.themeColor}' show-navigation ${this.hideBack ? 'hide-back' : ''}></smileid-navigation>` : ''}
|
|
168
168
|
<h2 class='text-base font-bold title-color'>${this.documentName}</h2>
|
|
169
169
|
<div class="circle-progress" id="loader">
|
|
170
170
|
${this.cameraError ? '' : '<p class="spinner"></p>'}
|
|
@@ -629,11 +629,11 @@ class DocumentCapture extends HTMLElement {
|
|
|
629
629
|
this.handleIDStream(SmartCamera.stream);
|
|
630
630
|
}
|
|
631
631
|
|
|
632
|
-
this.navigation
|
|
632
|
+
this.navigation?.addEventListener('navigation.back', () => {
|
|
633
633
|
this.handleBackEvents();
|
|
634
634
|
});
|
|
635
635
|
|
|
636
|
-
this.navigation
|
|
636
|
+
this.navigation?.addEventListener('navigation.close', () => {
|
|
637
637
|
this.handleCloseEvents();
|
|
638
638
|
});
|
|
639
639
|
|
package/lib/components/document/src/document-capture-instructions/DocumentCaptureInstructions.js
CHANGED
|
@@ -195,7 +195,7 @@ function templateString() {
|
|
|
195
195
|
<div id="document-capture-instructions-screen" class="flow center" dir="${this.direction}">
|
|
196
196
|
<div class="content-root">
|
|
197
197
|
<div class="content-header">
|
|
198
|
-
|
|
198
|
+
${this.showNavigation ? `<smileid-navigation theme-color='${this.themeColor}' show-navigation ${this.hideBack ? 'hide-back' : ''}></smileid-navigation>` : ''}
|
|
199
199
|
</div>
|
|
200
200
|
<div class="content-body">
|
|
201
201
|
<header>
|
|
@@ -441,11 +441,11 @@ class DocumentInstruction extends HTMLElement {
|
|
|
441
441
|
this.uploadDocumentPhotoButton =
|
|
442
442
|
this.shadowRoot.querySelector('#upload-photo');
|
|
443
443
|
|
|
444
|
-
this.navigation
|
|
444
|
+
this.navigation?.addEventListener('navigation.back', () => {
|
|
445
445
|
this.handleBackEvents();
|
|
446
446
|
});
|
|
447
447
|
|
|
448
|
-
this.navigation
|
|
448
|
+
this.navigation?.addEventListener('navigation.close', () => {
|
|
449
449
|
this.handleCloseEvents();
|
|
450
450
|
});
|
|
451
451
|
|
|
@@ -220,7 +220,7 @@ function templateString() {
|
|
|
220
220
|
</style>
|
|
221
221
|
${styles(this.themeColor)}
|
|
222
222
|
<div id='document-capture-review-screen' class='flow center' dir='${this.direction}'>
|
|
223
|
-
|
|
223
|
+
${this.showNavigation ? `<smileid-navigation show-navigation hide-back></smileid-navigation>` : ''}
|
|
224
224
|
<h1 class="header-title title-color">
|
|
225
225
|
${t('document.review.question')}
|
|
226
226
|
</h1>
|
|
@@ -329,11 +329,11 @@ class IdReview extends HTMLElement {
|
|
|
329
329
|
'#re-capture-id-image',
|
|
330
330
|
);
|
|
331
331
|
this.navigation = this.shadowRoot.querySelector('smileid-navigation');
|
|
332
|
-
this.navigation
|
|
332
|
+
this.navigation?.addEventListener('navigation.back', () => {
|
|
333
333
|
this.handleBackEvents();
|
|
334
334
|
});
|
|
335
335
|
|
|
336
|
-
this.navigation
|
|
336
|
+
this.navigation?.addEventListener('navigation.close', () => {
|
|
337
337
|
this.handleCloseEvents();
|
|
338
338
|
});
|
|
339
339
|
|
|
@@ -83,7 +83,7 @@ class SelfieCaptureScreens extends HTMLElement {
|
|
|
83
83
|
${styles(this.themeColor)}
|
|
84
84
|
<div style="height: 100%;">
|
|
85
85
|
<selfie-capture-instructions theme-color='${this.themeColor}' ${this.showNavigation} ${this.hideAttribution} ${this.hideBack} hidden></selfie-capture-instructions>
|
|
86
|
-
<selfie-capture-wrapper theme-color='${this.themeColor}' ${this.showNavigation} ${this.allowAgentMode} ${this.allowAgentModeTests} ${this.hideAttribution} ${this.disableImageTests} key="${this._remountKey}" start-countdown="false" hidden></selfie-capture-wrapper>
|
|
86
|
+
<selfie-capture-wrapper theme-color='${this.themeColor}' ${this.showNavigation} ${this.allowAgentMode} ${this.allowAgentModeTests} ${this.hideAttribution} ${this.disableImageTests} ${this.allowLegacySelfieFallback} key="${this._remountKey}" start-countdown="false" hidden></selfie-capture-wrapper>
|
|
87
87
|
<selfie-capture-review theme-color='${this.themeColor}' ${this.showNavigation} ${this.hideAttribution} hidden></selfie-capture-review>
|
|
88
88
|
</div>
|
|
89
89
|
`;
|
|
@@ -365,6 +365,12 @@ class SelfieCaptureScreens extends HTMLElement {
|
|
|
365
365
|
: '';
|
|
366
366
|
}
|
|
367
367
|
|
|
368
|
+
get allowLegacySelfieFallback() {
|
|
369
|
+
return this.hasAttribute('allow-legacy-selfie-fallback')
|
|
370
|
+
? `allow-legacy-selfie-fallback='${this.getAttribute('allow-legacy-selfie-fallback')}'`
|
|
371
|
+
: '';
|
|
372
|
+
}
|
|
373
|
+
|
|
368
374
|
get themeColor() {
|
|
369
375
|
return this.getAttribute('theme-color') || '#001096';
|
|
370
376
|
}
|
|
@@ -385,6 +391,7 @@ class SelfieCaptureScreens extends HTMLElement {
|
|
|
385
391
|
'hide-back-to-host',
|
|
386
392
|
'initial-screen',
|
|
387
393
|
'allow-agent-mode',
|
|
394
|
+
'allow-legacy-selfie-fallback',
|
|
388
395
|
'show-agent-mode-for-tests',
|
|
389
396
|
'disable-image-tests',
|
|
390
397
|
];
|
|
@@ -396,6 +403,7 @@ class SelfieCaptureScreens extends HTMLElement {
|
|
|
396
403
|
case 'hidden':
|
|
397
404
|
case 'initial-screen':
|
|
398
405
|
case 'allow-agent-mode':
|
|
406
|
+
case 'allow-legacy-selfie-fallback':
|
|
399
407
|
case 'show-agent-mode-for-tests':
|
|
400
408
|
case 'disable-image-tests':
|
|
401
409
|
this.connectedCallback();
|
|
@@ -932,11 +932,11 @@ class SelfieCaptureScreen extends HTMLElement {
|
|
|
932
932
|
this._switchCamera();
|
|
933
933
|
});
|
|
934
934
|
|
|
935
|
-
this.navigation
|
|
935
|
+
this.navigation?.addEventListener('navigation.back', () => {
|
|
936
936
|
this.handleBackEvents();
|
|
937
937
|
});
|
|
938
938
|
|
|
939
|
-
this.navigation
|
|
939
|
+
this.navigation?.addEventListener('navigation.close', () => {
|
|
940
940
|
this.closeWindow();
|
|
941
941
|
});
|
|
942
942
|
|
|
@@ -343,7 +343,7 @@ function templateString() {
|
|
|
343
343
|
<div id="selfie-capture-instruction-screen" class="center" dir="${this.direction}">
|
|
344
344
|
<div class="content-root">
|
|
345
345
|
<div class="content-header">
|
|
346
|
-
|
|
346
|
+
${this.showNavigation ? `<smileid-navigation theme-color='${this.themeColor}' ${this.hideBack ? 'hide-back' : ''}></smileid-navigation>` : ''}
|
|
347
347
|
</div>
|
|
348
348
|
<div class="content-body">
|
|
349
349
|
<header>
|
|
@@ -625,7 +625,7 @@ class SelfieCaptureInstructions extends HTMLElement {
|
|
|
625
625
|
this.allowButton = this.shadowRoot.querySelector('#allow');
|
|
626
626
|
this.navigation = this.shadowRoot.querySelector('smileid-navigation');
|
|
627
627
|
|
|
628
|
-
this.navigation
|
|
628
|
+
this.navigation?.addEventListener('navigation.back', () => {
|
|
629
629
|
this.handleBackEvents();
|
|
630
630
|
});
|
|
631
631
|
|
|
@@ -637,7 +637,7 @@ class SelfieCaptureInstructions extends HTMLElement {
|
|
|
637
637
|
});
|
|
638
638
|
}
|
|
639
639
|
|
|
640
|
-
this.navigation
|
|
640
|
+
this.navigation?.addEventListener(
|
|
641
641
|
'navigation.close',
|
|
642
642
|
() => {
|
|
643
643
|
this.handleCloseEvents();
|
|
@@ -57,7 +57,7 @@ function templateString() {
|
|
|
57
57
|
</style>
|
|
58
58
|
${styles(this.themeColor)}
|
|
59
59
|
<div id='selfie-capture-review-screen' class='center' dir='${this.direction}'>
|
|
60
|
-
|
|
60
|
+
${this.showNavigation ? `<smileid-navigation hide-back></smileid-navigation>` : ''}
|
|
61
61
|
<h1 class="header-title title-color font-bold">
|
|
62
62
|
${t('selfie.review.question')}
|
|
63
63
|
</h1>
|
|
@@ -180,10 +180,10 @@ class SelfieCaptureReview extends HTMLElement {
|
|
|
180
180
|
this.reCaptureImage = this.shadowRoot.querySelector('#re-capture-image');
|
|
181
181
|
this.navigation = this.shadowRoot.querySelector('smileid-navigation');
|
|
182
182
|
|
|
183
|
-
this.navigation
|
|
183
|
+
this.navigation?.addEventListener('navigation.back', () => {
|
|
184
184
|
this.handleBackEvents();
|
|
185
185
|
});
|
|
186
|
-
this.navigation
|
|
186
|
+
this.navigation?.addEventListener('navigation.close', () => {
|
|
187
187
|
this.handleCloseEvents();
|
|
188
188
|
});
|
|
189
189
|
|
|
@@ -4,6 +4,7 @@ import register from 'preact-custom-element';
|
|
|
4
4
|
import type { FunctionComponent } from 'preact';
|
|
5
5
|
|
|
6
6
|
import { getBoolProp } from '../../../../utils/props';
|
|
7
|
+
import { translate, translateHtml } from '../../../../domain/localisation';
|
|
7
8
|
import SmartSelfieCapture from '../smartselfie-capture/SmartSelfieCapture';
|
|
8
9
|
// Legacy web component fallback (used when Mediapipe isn't available)
|
|
9
10
|
import '../selfie-capture/SelfieCapture';
|
|
@@ -17,6 +18,7 @@ interface Props {
|
|
|
17
18
|
'theme-color'?: string;
|
|
18
19
|
'show-navigation'?: string | boolean;
|
|
19
20
|
'allow-agent-mode'?: string | boolean;
|
|
21
|
+
'allow-legacy-selfie-fallback'?: string | boolean;
|
|
20
22
|
'show-agent-mode-for-tests'?: string | boolean;
|
|
21
23
|
'hide-attribution'?: string | boolean;
|
|
22
24
|
'disable-image-tests'?: string | boolean;
|
|
@@ -25,12 +27,16 @@ interface Props {
|
|
|
25
27
|
hidden?: string | boolean;
|
|
26
28
|
}
|
|
27
29
|
|
|
30
|
+
const DEFAULT_MEDIAPIPE_WAIT_MS = 90 * 1000; // For when legacy fallback is NOT allowed, we wait the full 90s for mediapipe to load before showing an error.
|
|
31
|
+
const DEFAULT_WAIT_MS = 20 * 1000; // default for when legacy fallback is allowed we wait for 20s
|
|
32
|
+
|
|
28
33
|
// Wrapper component that decides whether to use the modern
|
|
29
34
|
// SmartSelfieCapture (Mediapipe-based) or fallback to the legacy `selfie-capture`
|
|
30
|
-
// web component after a timeout
|
|
35
|
+
// web component after a timeout (default 90 seconds).
|
|
31
36
|
const SelfieCaptureWrapper: FunctionComponent<Props> = ({
|
|
32
|
-
timeout =
|
|
37
|
+
timeout = DEFAULT_MEDIAPIPE_WAIT_MS,
|
|
33
38
|
'start-countdown': startCountdownProp = false,
|
|
39
|
+
'allow-legacy-selfie-fallback': allowLegacySelfieFallbackProp = false,
|
|
34
40
|
hidden: hiddenProp = false,
|
|
35
41
|
...props
|
|
36
42
|
}) => {
|
|
@@ -54,6 +60,9 @@ const SelfieCaptureWrapper: FunctionComponent<Props> = ({
|
|
|
54
60
|
|
|
55
61
|
const hidden = getBoolProp(hiddenProp);
|
|
56
62
|
const startCountdown = getBoolProp(startCountdownProp);
|
|
63
|
+
const allowLegacySelfieFallback = getBoolProp(allowLegacySelfieFallbackProp);
|
|
64
|
+
const loadingTime = allowLegacySelfieFallback ? DEFAULT_WAIT_MS : timeout;
|
|
65
|
+
|
|
57
66
|
// Component state:
|
|
58
67
|
// - mediapipeReady: whether the mediapipe instance has successfully loaded
|
|
59
68
|
// - loadingProgress: percentage used for the visible loading UI
|
|
@@ -96,12 +105,12 @@ const SelfieCaptureWrapper: FunctionComponent<Props> = ({
|
|
|
96
105
|
|
|
97
106
|
const timer = setInterval(() => {
|
|
98
107
|
setLoadingProgress((prev: number) => Math.min(prev + 1, 100));
|
|
99
|
-
},
|
|
108
|
+
}, loadingTime / 100);
|
|
100
109
|
|
|
101
110
|
return () => {
|
|
102
111
|
clearInterval(timer);
|
|
103
112
|
};
|
|
104
|
-
}, [hidden, startCountdown,
|
|
113
|
+
}, [hidden, startCountdown, loadingTime, mediapipeReady]);
|
|
105
114
|
|
|
106
115
|
useEffect(() => {
|
|
107
116
|
if (hidden || mediapipeReady || loadingProgress < 100) return undefined;
|
|
@@ -155,8 +164,22 @@ const SelfieCaptureWrapper: FunctionComponent<Props> = ({
|
|
|
155
164
|
};
|
|
156
165
|
}, [hidden, mediapipeReady, loadingProgress]);
|
|
157
166
|
|
|
167
|
+
// Dispatch allow_legacy_selfie_fallback config for observability
|
|
168
|
+
useEffect(() => {
|
|
169
|
+
if (hidden) return;
|
|
170
|
+
|
|
171
|
+
const smartCameraWeb = document.querySelector('smart-camera-web');
|
|
172
|
+
smartCameraWeb?.dispatchEvent(
|
|
173
|
+
new CustomEvent('metadata.allow-legacy-selfie-fallback', {
|
|
174
|
+
detail: {
|
|
175
|
+
allow_legacy_selfie_fallback: allowLegacySelfieFallback,
|
|
176
|
+
},
|
|
177
|
+
}),
|
|
178
|
+
);
|
|
179
|
+
}, [hidden, allowLegacySelfieFallback]);
|
|
180
|
+
|
|
158
181
|
// Announce to any `smart-camera-web` element which liveness version is active.
|
|
159
|
-
// The old capture
|
|
182
|
+
// The old capture uses 0.0.1, the new one 1.0.0.
|
|
160
183
|
useEffect(() => {
|
|
161
184
|
if (hidden || mediapipeLoading) return;
|
|
162
185
|
|
|
@@ -185,52 +208,71 @@ const SelfieCaptureWrapper: FunctionComponent<Props> = ({
|
|
|
185
208
|
}
|
|
186
209
|
|
|
187
210
|
if (loadingProgress >= 100) {
|
|
188
|
-
// When loading completes without Mediapipe becoming ready,
|
|
189
|
-
//
|
|
190
|
-
//
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
211
|
+
// When loading completes without Mediapipe becoming ready, check if legacy
|
|
212
|
+
// fallback is allowed. Legacy is allowed if:
|
|
213
|
+
// 1. allow-legacy-selfie-fallback attribute is set to true, OR
|
|
214
|
+
// 2. Running under Cypress (to keep existing test behavior)
|
|
215
|
+
const legacyFallbackAllowed = allowLegacySelfieFallback || isCypress;
|
|
216
|
+
|
|
217
|
+
if (legacyFallbackAllowed) {
|
|
218
|
+
// Mount the legacy `selfie-capture` web component. We also set
|
|
219
|
+
// `usingSelfieCapture` so other effects can react (e.g. metadata dispatch).
|
|
220
|
+
if (!usingSelfieCapture) {
|
|
221
|
+
setUsingSelfieCapture(true);
|
|
222
|
+
}
|
|
223
|
+
|
|
224
|
+
const propsWithoutHidden = { ...props };
|
|
225
|
+
delete (propsWithoutHidden as any).hidden;
|
|
226
|
+
|
|
227
|
+
return (
|
|
228
|
+
// @ts-expect-error --- preact-custom-element doesn't have proper types for refs
|
|
229
|
+
<selfie-capture
|
|
230
|
+
{...propsWithoutHidden}
|
|
231
|
+
ref={(el: HTMLElement) => {
|
|
232
|
+
if (el && !el.hasAttribute('data-events-setup')) {
|
|
233
|
+
el.setAttribute('data-events-setup', 'true');
|
|
194
234
|
|
|
195
|
-
|
|
196
|
-
|
|
235
|
+
const forwardEvent = (event: Event) => {
|
|
236
|
+
const customEvent = event as CustomEvent;
|
|
197
237
|
|
|
238
|
+
if (
|
|
239
|
+
customEvent.type === 'selfie-capture.publish' ||
|
|
240
|
+
customEvent.type === 'selfie-capture.cancelled' ||
|
|
241
|
+
customEvent.type === 'selfie-capture.close'
|
|
242
|
+
) {
|
|
243
|
+
setInitialSessionCompleted(true);
|
|
244
|
+
}
|
|
245
|
+
|
|
246
|
+
window.dispatchEvent(
|
|
247
|
+
new CustomEvent(customEvent.type, {
|
|
248
|
+
detail: customEvent.detail,
|
|
249
|
+
bubbles: true,
|
|
250
|
+
}),
|
|
251
|
+
);
|
|
252
|
+
};
|
|
253
|
+
|
|
254
|
+
el.addEventListener('selfie-capture.publish', forwardEvent);
|
|
255
|
+
el.addEventListener('selfie-capture.cancelled', forwardEvent);
|
|
256
|
+
el.addEventListener('selfie-capture.close', forwardEvent);
|
|
257
|
+
}
|
|
258
|
+
}}
|
|
259
|
+
/>
|
|
260
|
+
);
|
|
261
|
+
}
|
|
262
|
+
|
|
263
|
+
// Legacy fallback is NOT allowed: show error message
|
|
198
264
|
return (
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
el.setAttribute('data-events-setup', 'true');
|
|
205
|
-
|
|
206
|
-
const forwardEvent = (event: Event) => {
|
|
207
|
-
const customEvent = event as CustomEvent;
|
|
208
|
-
|
|
209
|
-
if (
|
|
210
|
-
customEvent.type === 'selfie-capture.publish' ||
|
|
211
|
-
customEvent.type === 'selfie-capture.cancelled' ||
|
|
212
|
-
customEvent.type === 'selfie-capture.close'
|
|
213
|
-
) {
|
|
214
|
-
setInitialSessionCompleted(true);
|
|
215
|
-
}
|
|
216
|
-
|
|
217
|
-
window.dispatchEvent(
|
|
218
|
-
new CustomEvent(customEvent.type, {
|
|
219
|
-
detail: customEvent.detail,
|
|
220
|
-
bubbles: true,
|
|
221
|
-
}),
|
|
222
|
-
);
|
|
223
|
-
};
|
|
224
|
-
|
|
225
|
-
el.addEventListener('selfie-capture.publish', forwardEvent);
|
|
226
|
-
el.addEventListener('selfie-capture.cancelled', forwardEvent);
|
|
227
|
-
el.addEventListener('selfie-capture.close', forwardEvent);
|
|
228
|
-
}
|
|
229
|
-
}}
|
|
230
|
-
/>
|
|
265
|
+
<div style={{ textAlign: 'center', marginTop: '20%', padding: '0 20px' }}>
|
|
266
|
+
<p style={{ fontSize: '1.2rem', color: '#333' }}>
|
|
267
|
+
{translate('selfie.capture.loading.connectionError')}
|
|
268
|
+
</p>
|
|
269
|
+
</div>
|
|
231
270
|
);
|
|
232
271
|
}
|
|
233
272
|
|
|
273
|
+
// Midpoint threshold (40s out of 90s ≈ 44%)
|
|
274
|
+
const SLOW_CONNECTION_THRESHOLD = 44;
|
|
275
|
+
|
|
234
276
|
return (
|
|
235
277
|
<div style={{ textAlign: 'center', marginTop: '20%' }}>
|
|
236
278
|
<div
|
|
@@ -245,7 +287,15 @@ const SelfieCaptureWrapper: FunctionComponent<Props> = ({
|
|
|
245
287
|
style={{ animation: 'spin 1s linear infinite' }}
|
|
246
288
|
/>
|
|
247
289
|
</div>
|
|
248
|
-
|
|
290
|
+
{loadingProgress >= SLOW_CONNECTION_THRESHOLD ? (
|
|
291
|
+
<p>{translate('selfie.capture.loading.slowConnection')}</p>
|
|
292
|
+
) : (
|
|
293
|
+
<p>
|
|
294
|
+
{translateHtml('selfie.capture.loading.progress', {
|
|
295
|
+
progress: loadingProgress,
|
|
296
|
+
})}
|
|
297
|
+
</p>
|
|
298
|
+
)}
|
|
249
299
|
<style>{`
|
|
250
300
|
@keyframes spin {
|
|
251
301
|
from { transform: rotate(0deg); }
|
|
@@ -267,6 +317,7 @@ if (!customElements.get('selfie-capture-wrapper')) {
|
|
|
267
317
|
'theme-color',
|
|
268
318
|
'show-navigation',
|
|
269
319
|
'allow-agent-mode',
|
|
320
|
+
'allow-legacy-selfie-fallback',
|
|
270
321
|
'show-agent-mode-for-tests',
|
|
271
322
|
'hide-attribution',
|
|
272
323
|
'disable-image-tests',
|
|
@@ -20,7 +20,7 @@ function scwTemplateString() {
|
|
|
20
20
|
<div style="height: 100%;">
|
|
21
21
|
<camera-permission ${this.applyComponentThemeColor} ${this.title} ${this.showNavigation} ${this.hideInstructions ? '' : 'hidden'} ${this.hideAttribution}></camera-permission>
|
|
22
22
|
<selfie-capture-screens ${this.applyComponentThemeColor} ${this.title} ${this.showNavigation} ${this.disableImageTests} ${this.hideAttribution} ${this.hideInstructions} hidden
|
|
23
|
-
${this.hideBackToHost} ${this.allowAgentMode} ${this.allowAgentModeTests}
|
|
23
|
+
${this.hideBackToHost} ${this.allowAgentMode} ${this.allowAgentModeTests} ${this.allowLegacySelfieFallback}
|
|
24
24
|
></selfie-capture-screens>
|
|
25
25
|
<document-capture-screens ${this.applyComponentThemeColor} document-type=${this.documentType} ${this.title} ${this.documentCaptureModes} ${this.showNavigation} ${this.hideAttribution}
|
|
26
26
|
${this.hideBackOfId} ${this.applyComponentThemeColor} hidden></document-capture-screens>
|
|
@@ -69,6 +69,7 @@ class SmartCameraWeb extends HTMLElement {
|
|
|
69
69
|
static get observedAttributes() {
|
|
70
70
|
return [
|
|
71
71
|
'allow-agent-mode',
|
|
72
|
+
'allow-legacy-selfie-fallback',
|
|
72
73
|
'disable-image-tests',
|
|
73
74
|
'document-capture-modes',
|
|
74
75
|
'document-type',
|
|
@@ -83,6 +84,7 @@ class SmartCameraWeb extends HTMLElement {
|
|
|
83
84
|
attributeChangedCallback(name) {
|
|
84
85
|
switch (name) {
|
|
85
86
|
case 'allow-agent-mode':
|
|
87
|
+
case 'allow-legacy-selfie-fallback':
|
|
86
88
|
case 'disable-image-tests':
|
|
87
89
|
case 'document-capture-modes':
|
|
88
90
|
case 'document-type':
|
|
@@ -266,6 +268,12 @@ class SmartCameraWeb extends HTMLElement {
|
|
|
266
268
|
: '';
|
|
267
269
|
}
|
|
268
270
|
|
|
271
|
+
get allowLegacySelfieFallback() {
|
|
272
|
+
return this.hasAttribute('allow-legacy-selfie-fallback')
|
|
273
|
+
? `allow-legacy-selfie-fallback='${this.getAttribute('allow-legacy-selfie-fallback')}'`
|
|
274
|
+
: '';
|
|
275
|
+
}
|
|
276
|
+
|
|
269
277
|
get hideAttribution() {
|
|
270
278
|
return this.hasAttribute('hide-attribution') ? 'hide-attribution' : '';
|
|
271
279
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@smileid/web-components",
|
|
3
|
-
"version": "11.
|
|
3
|
+
"version": "11.2.0",
|
|
4
4
|
"main": "dist/esm/main.js",
|
|
5
5
|
"module": "dist/esm/main.js",
|
|
6
6
|
"types": "dist/types/main.d.ts",
|
|
@@ -79,7 +79,7 @@
|
|
|
79
79
|
"@mediapipe/tasks-vision": "^0.10.22-rc.20250304",
|
|
80
80
|
"@preact/signals": "^2.1.1",
|
|
81
81
|
"@tabler/icons-preact": "^3.34.0",
|
|
82
|
-
"lodash": "^4.17.
|
|
82
|
+
"lodash": "^4.17.23",
|
|
83
83
|
"preact": "^10.27.3",
|
|
84
84
|
"preact-custom-element": "^4.3.0",
|
|
85
85
|
"preact-router": "^4.1.2",
|