biometry-react-components 1.3.5 → 2.0.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/README.md +68 -26
- package/dist/index.d.ts +124 -6
- package/dist/index.esm.js +263 -135
- package/dist/index.js +263 -135
- package/package.json +14 -7
package/dist/index.js
CHANGED
|
@@ -7215,7 +7215,78 @@ function requireRecordRTC () {
|
|
|
7215
7215
|
} (RecordRTC$1));
|
|
7216
7216
|
return RecordRTC$1.exports;
|
|
7217
7217
|
}var RecordRTCExports = /*@__PURE__*/ requireRecordRTC();
|
|
7218
|
-
var RecordRTC = /*@__PURE__*/getDefaultExportFromCjs(RecordRTCExports)
|
|
7218
|
+
var RecordRTC = /*@__PURE__*/getDefaultExportFromCjs(RecordRTCExports);/**
|
|
7219
|
+
* Digit challenge and phrase helpers, kept in step with
|
|
7220
|
+
* biometry-angular-components `src/lib/utils/numbers.ts`. The two packages must
|
|
7221
|
+
* produce the same `phrase` for the same digits: it is compared against what the
|
|
7222
|
+
* voice engine recognised, so a divergence here is a verification failure with no
|
|
7223
|
+
* obvious cause.
|
|
7224
|
+
*/
|
|
7225
|
+
/**
|
|
7226
|
+
* Digits a generated challenge may contain.
|
|
7227
|
+
*
|
|
7228
|
+
* `0` is deliberately absent. A server-issued challenge may still contain one
|
|
7229
|
+
* while the backend rolls out, and numbersToPhrase tolerates that — but nothing
|
|
7230
|
+
* we generate emits it.
|
|
7231
|
+
*/
|
|
7232
|
+
const CHALLENGE_DIGITS = [1, 2, 3, 4, 5, 6, 7, 8, 9];
|
|
7233
|
+
/**
|
|
7234
|
+
* Enrolment prompts, taken verbatim from the vendor guide's published set.
|
|
7235
|
+
*
|
|
7236
|
+
* These are fixed, not random, and that is the point: random prompting is only
|
|
7237
|
+
* required at verification time. Presenting every user the same sequences is
|
|
7238
|
+
* also what makes cross-user calibration accurate — and calibration is what
|
|
7239
|
+
* sets our acceptance threshold (BM-449).
|
|
7240
|
+
*
|
|
7241
|
+
* The guide selects these specifically because they contain no duplicate
|
|
7242
|
+
* 2-digit contexts: biometric performance depends on co-articulation between
|
|
7243
|
+
* adjacent digits, and "321" and "123" are different contexts for "2". Drawing
|
|
7244
|
+
* enrolment prompts at random gives each user an arbitrary, unmeasured slice of
|
|
7245
|
+
* that space.
|
|
7246
|
+
*
|
|
7247
|
+
* Order matters: the first two are count-up and count-down, which the guide
|
|
7248
|
+
* uses to open its enrolment flow because they are the easiest to comply with.
|
|
7249
|
+
*/
|
|
7250
|
+
const ENROLMENT_DIGIT_SEQUENCES = [
|
|
7251
|
+
[1, 2, 3, 4, 5, 6, 7, 8, 9],
|
|
7252
|
+
[9, 8, 7, 6, 5, 4, 3, 2, 1],
|
|
7253
|
+
[7, 1, 5, 2, 6, 3, 8, 4, 9],
|
|
7254
|
+
[6, 1, 8, 2, 9, 3, 5, 7, 4],
|
|
7255
|
+
[4, 7, 5, 9, 1, 6, 2, 8, 3],
|
|
7256
|
+
[5, 1, 9, 2, 7, 3, 6, 4, 8],
|
|
7257
|
+
[8, 1, 7, 2, 5, 3, 9, 4, 6],
|
|
7258
|
+
[2, 4, 1, 3, 7, 9, 6, 8, 5],
|
|
7259
|
+
];
|
|
7260
|
+
/**
|
|
7261
|
+
* Render digits as the spoken words the engine expects in `phrase`.
|
|
7262
|
+
*
|
|
7263
|
+
* Lowercase, matching the Angular package and therefore the only casing that
|
|
7264
|
+
* has been exercised in production. The gateway forwards `phrase` to the engine
|
|
7265
|
+
* untouched, so the client's casing is what gets compared.
|
|
7266
|
+
*
|
|
7267
|
+
* `zero` is retained even though we no longer generate it: a server-issued
|
|
7268
|
+
* challenge may contain a 0, and rendering it as "0" would send a phrase the
|
|
7269
|
+
* engine cannot match at all. A digit outside 0–9 is passed through as-is
|
|
7270
|
+
* rather than silently becoming a word that was never displayed.
|
|
7271
|
+
*/
|
|
7272
|
+
function numbersToPhrase(digits) {
|
|
7273
|
+
const words = ['zero', 'one', 'two', 'three', 'four', 'five', 'six', 'seven', 'eight', 'nine'];
|
|
7274
|
+
return digits.map(d => (d >= 0 && d <= 9 ? words[d] : String(d))).join(' ');
|
|
7275
|
+
}
|
|
7276
|
+
/**
|
|
7277
|
+
* `count` distinct digits drawn from CHALLENGE_DIGITS, in random order.
|
|
7278
|
+
*
|
|
7279
|
+
* Used for the face recorder's fallback challenge when the server issued none.
|
|
7280
|
+
* Enrolment does not call this — see ENROLMENT_DIGIT_SEQUENCES.
|
|
7281
|
+
*/
|
|
7282
|
+
function generateRandomDigits(count) {
|
|
7283
|
+
const digits = [...CHALLENGE_DIGITS];
|
|
7284
|
+
for (let i = digits.length - 1; i > 0; i--) {
|
|
7285
|
+
const j = Math.floor(Math.random() * (i + 1));
|
|
7286
|
+
[digits[i], digits[j]] = [digits[j], digits[i]];
|
|
7287
|
+
}
|
|
7288
|
+
return digits.slice(0, count);
|
|
7289
|
+
}function getSupportedMimeType() {
|
|
7219
7290
|
if (MediaRecorder.isTypeSupported('video/webm;codecs=vp9')) {
|
|
7220
7291
|
return 'video/webm;codecs=vp9';
|
|
7221
7292
|
}
|
|
@@ -7228,15 +7299,13 @@ var RecordRTC = /*@__PURE__*/getDefaultExportFromCjs(RecordRTCExports);function
|
|
|
7228
7299
|
else {
|
|
7229
7300
|
console.error("no suitable mimetype found for this device");
|
|
7230
7301
|
}
|
|
7231
|
-
}
|
|
7232
|
-
function numberToWord(num) {
|
|
7233
|
-
const words = ['ZERO', 'ONE', 'TWO', 'THREE', 'FOUR', 'FIVE', 'SIX', 'SEVEN', 'EIGHT', 'NINE'];
|
|
7234
|
-
return words[num] || 'ZERO';
|
|
7235
|
-
}
|
|
7236
|
-
function numbersToPhrase(numbers) {
|
|
7237
|
-
return numbers.map(numberToWord).join(' ');
|
|
7238
7302
|
}const VIDEO_LENGTH_MS = 7000;
|
|
7239
|
-
|
|
7303
|
+
/**
|
|
7304
|
+
* Voice *enrollment* reads all ten digits aloud, which does not fit in the
|
|
7305
|
+
* 7s video length unhurried. Verification keeps the shorter window (BM-407).
|
|
7306
|
+
*/
|
|
7307
|
+
const VOICE_ENROLL_LENGTH_MS = 10000;
|
|
7308
|
+
const useRecorder = (stream, type, onStopRecording, lengthMs = VIDEO_LENGTH_MS) => {
|
|
7240
7309
|
const [isRecording, setIsRecording] = React.useState(false);
|
|
7241
7310
|
const recorderRef = React.useRef(null);
|
|
7242
7311
|
const timeoutRef = React.useRef(null);
|
|
@@ -7294,7 +7363,7 @@ const useRecorder = (stream, type, onStopRecording) => {
|
|
|
7294
7363
|
// Set timeout to auto-stop recording
|
|
7295
7364
|
timeoutRef.current = window.setTimeout(() => {
|
|
7296
7365
|
stopRecording();
|
|
7297
|
-
},
|
|
7366
|
+
}, lengthMs);
|
|
7298
7367
|
}
|
|
7299
7368
|
catch (error) {
|
|
7300
7369
|
console.error(error);
|
|
@@ -7310,7 +7379,7 @@ const useRecorder = (stream, type, onStopRecording) => {
|
|
|
7310
7379
|
}
|
|
7311
7380
|
recorderRef.current.stopRecording(() => {
|
|
7312
7381
|
const blob = recorderRef.current.getBlob();
|
|
7313
|
-
fixWebmDuration(blob,
|
|
7382
|
+
fixWebmDuration(blob, lengthMs, function (fixedBlob) {
|
|
7314
7383
|
setIsRecording(false);
|
|
7315
7384
|
recorderRef.current.destroy();
|
|
7316
7385
|
recorderRef.current = null;
|
|
@@ -7336,6 +7405,10 @@ const useRecorder = (stream, type, onStopRecording) => {
|
|
|
7336
7405
|
const [permission, setPermission] = React.useState(false);
|
|
7337
7406
|
const [stream, setStream] = React.useState(null);
|
|
7338
7407
|
const [isLoading, setIsLoading] = React.useState(true);
|
|
7408
|
+
// The stream is mirrored in a ref so stopStreamTracks and the unmount
|
|
7409
|
+
// cleanup act on the live stream rather than a stale closure, and so a
|
|
7410
|
+
// getUserMedia that resolves after unmount can be stopped immediately
|
|
7411
|
+
// (restored from 1.3.5, which 1.4.0 reverted).
|
|
7339
7412
|
const streamRef = React.useRef(null);
|
|
7340
7413
|
const isMountedRef = React.useRef(false);
|
|
7341
7414
|
const stopStreamTracks = () => {
|
|
@@ -7358,7 +7431,7 @@ const useRecorder = (stream, type, onStopRecording) => {
|
|
|
7358
7431
|
noiseSuppression: true,
|
|
7359
7432
|
autoGainControl: true,
|
|
7360
7433
|
sampleRate: 48000,
|
|
7361
|
-
channelCount:
|
|
7434
|
+
channelCount: 1 // Mono: the gateway downmixes with -ac 1 and the engine expects mono (BM-446)
|
|
7362
7435
|
},
|
|
7363
7436
|
video: {
|
|
7364
7437
|
width: { ideal: Math.min(rectWidth, 1920), min: 1280 },
|
|
@@ -7412,7 +7485,8 @@ const useRecorder = (stream, type, onStopRecording) => {
|
|
|
7412
7485
|
const constraints = getAdaptiveConstraints();
|
|
7413
7486
|
const streamData = await navigator.mediaDevices.getUserMedia(constraints);
|
|
7414
7487
|
console.log('Media stream obtained, active:', streamData.active);
|
|
7415
|
-
//
|
|
7488
|
+
// Unmounted while getUserMedia was resolving: release the devices now,
|
|
7489
|
+
// otherwise the camera/mic indicator stays on with nothing holding it.
|
|
7416
7490
|
if (!isMountedRef.current) {
|
|
7417
7491
|
streamData.getTracks().forEach(track => track.stop());
|
|
7418
7492
|
return;
|
|
@@ -7461,22 +7535,14 @@ if (typeof window !== 'undefined' && typeof console !== 'undefined') {
|
|
|
7461
7535
|
console.log('MediaRecorder supported:', typeof MediaRecorder !== 'undefined');
|
|
7462
7536
|
console.log('getUserMedia supported:', !!(navigator.mediaDevices && navigator.mediaDevices.getUserMedia));
|
|
7463
7537
|
}
|
|
7464
|
-
const
|
|
7465
|
-
const
|
|
7538
|
+
const DEFAULT_RECORD_SECONDS = VIDEO_LENGTH_MS / 1000;
|
|
7539
|
+
const DEFAULT_PREP_SECONDS = 3;
|
|
7466
7540
|
const DIGITS_NUMBER$1 = 7;
|
|
7467
|
-
|
|
7468
|
-
const digits = Array.from({ length: 10 }, (_, i) => i);
|
|
7469
|
-
for (let i = digits.length - 1; i > 0; i--) {
|
|
7470
|
-
const j = Math.floor(Math.random() * (i + 1));
|
|
7471
|
-
[digits[i], digits[j]] = [digits[j], digits[i]];
|
|
7472
|
-
}
|
|
7473
|
-
return digits.slice(0, count);
|
|
7474
|
-
}
|
|
7475
|
-
const FaceRecorder = ({ rectWidth = 320, rectHeight = 512, onConfirmRecording, onRecorded, className, style, noShadow = false, }) => {
|
|
7541
|
+
const FaceRecorder = ({ rectWidth = 360, rectHeight = 576, challengeDigits, recordingSeconds = DEFAULT_RECORD_SECONDS, countdownSeconds = DEFAULT_PREP_SECONDS, emitAudio = false, onConfirmRecording, onRecorded, className, style, noShadow = false, }) => {
|
|
7476
7542
|
const [state, setState] = React.useState('preparation');
|
|
7477
|
-
const [prepTimer, setPrepTimer] = React.useState(
|
|
7478
|
-
const [recordTimer, setRecordTimer] = React.useState(
|
|
7479
|
-
const [digits, setDigits] = React.useState(generateRandomDigits
|
|
7543
|
+
const [prepTimer, setPrepTimer] = React.useState(countdownSeconds);
|
|
7544
|
+
const [recordTimer, setRecordTimer] = React.useState(recordingSeconds);
|
|
7545
|
+
const [digits, setDigits] = React.useState(generateRandomDigits(DIGITS_NUMBER$1));
|
|
7480
7546
|
const { permission, stream, stopStreamTracks, requestPermissions, isLoading } = usePermissions({ rectWidth, rectHeight });
|
|
7481
7547
|
const [videoBlob, setVideoBlob] = React.useState(null);
|
|
7482
7548
|
const [audioBlob, setAudioBlob] = React.useState(null);
|
|
@@ -7489,47 +7555,39 @@ const FaceRecorder = ({ rectWidth = 320, rectHeight = 512, onConfirmRecording, o
|
|
|
7489
7555
|
const analyserRef = React.useRef(null);
|
|
7490
7556
|
const audioCtxRef = React.useRef(null);
|
|
7491
7557
|
const rafRef = React.useRef(null);
|
|
7492
|
-
// Video recorder
|
|
7558
|
+
// Video recorder. This callback owns the transition to the review screen:
|
|
7559
|
+
// it used to live in the audio recorder's callback, which meant the component
|
|
7560
|
+
// could not reach 'result' at all unless a second recording existed (BM-461).
|
|
7561
|
+
const recordingMs = Math.max(1, Math.round(recordingSeconds * 1000));
|
|
7493
7562
|
const { startRecording: startVideoRecording, cancelRecording: cancelVideoRecording } = useRecorder(stream, "video", (blob) => {
|
|
7494
|
-
if (blob && blob.size > 0) {
|
|
7495
|
-
setVideoBlob(blob);
|
|
7496
|
-
const url = URL.createObjectURL(blob);
|
|
7497
|
-
setVideoUrl(url);
|
|
7498
|
-
}
|
|
7499
|
-
else {
|
|
7500
|
-
const dummyBlob = new Blob(['dummy video data'], { type: 'video/webm' });
|
|
7501
|
-
setVideoBlob(dummyBlob);
|
|
7502
|
-
const url = URL.createObjectURL(dummyBlob);
|
|
7503
|
-
setVideoUrl(url);
|
|
7504
|
-
}
|
|
7505
|
-
});
|
|
7506
|
-
// Audio recorder
|
|
7507
|
-
const { startRecording: startAudioRecording, cancelRecording: cancelAudioRecording } = useRecorder(stream, "audio", (blob) => {
|
|
7508
|
-
if (blob && blob.size > 0) {
|
|
7509
|
-
setAudioBlob(blob);
|
|
7510
|
-
}
|
|
7511
|
-
else {
|
|
7512
|
-
const dummyBlob = new Blob(['dummy audio data'], { type: 'audio/webm' });
|
|
7513
|
-
setAudioBlob(dummyBlob);
|
|
7514
|
-
}
|
|
7515
|
-
// Only show result when both recordings are done
|
|
7516
|
-
// Video callback will be called first, then audio
|
|
7517
7563
|
stopStreamTracks();
|
|
7564
|
+
stopAudioVisualization();
|
|
7565
|
+
// A capture that produced nothing is a failure, not a success with an
|
|
7566
|
+
// empty file. This used to substitute a ~15-byte text Blob named
|
|
7567
|
+
// face-video.webm and carry on, so a camera that failed surfaced later as
|
|
7568
|
+
// an unexplained ML error instead of a retry here.
|
|
7569
|
+
if (!blob || blob.size === 0) {
|
|
7570
|
+
console.warn('face recorder: capture produced no video; returning to preparation');
|
|
7571
|
+
resetAfterFailedCapture();
|
|
7572
|
+
return;
|
|
7573
|
+
}
|
|
7574
|
+
setVideoBlob(blob);
|
|
7575
|
+
setVideoUrl(URL.createObjectURL(blob));
|
|
7518
7576
|
setState('result');
|
|
7519
7577
|
setIsConfirming(true);
|
|
7520
|
-
|
|
7521
|
-
|
|
7578
|
+
}, recordingMs);
|
|
7579
|
+
// Audio recorder — only used when emitAudio is set; see FaceRecorderProps.
|
|
7580
|
+
const { startRecording: startAudioRecording, cancelRecording: cancelAudioRecording } = useRecorder(stream, "audio", (blob) => {
|
|
7581
|
+
setAudioBlob(blob && blob.size > 0 ? blob : null);
|
|
7582
|
+
}, recordingMs);
|
|
7522
7583
|
React.useEffect(() => {
|
|
7523
7584
|
// If we already notified for this recording, skip
|
|
7524
7585
|
if (hasNotifiedRef.current)
|
|
7525
7586
|
return;
|
|
7526
|
-
if (videoBlob &&
|
|
7587
|
+
if (videoBlob && onRecorded) {
|
|
7527
7588
|
hasNotifiedRef.current = true; // prevent double-calls
|
|
7528
|
-
const videoFile = new File([videoBlob], 'face-video.webm', { type: videoBlob.type });
|
|
7529
|
-
const audioFile = new File([audioBlob], 'face-audio.webm', { type: audioBlob.type });
|
|
7530
|
-
const phrase = numbersToPhrase(digits);
|
|
7531
7589
|
try {
|
|
7532
|
-
onRecorded(
|
|
7590
|
+
onRecorded(buildRecording(videoBlob, audioBlob, digits));
|
|
7533
7591
|
}
|
|
7534
7592
|
catch (err) {
|
|
7535
7593
|
// swallow errors from consumer callback to avoid breaking SDK logic
|
|
@@ -7564,10 +7622,10 @@ const FaceRecorder = ({ rectWidth = 320, rectHeight = 512, onConfirmRecording, o
|
|
|
7564
7622
|
}
|
|
7565
7623
|
else {
|
|
7566
7624
|
setState('recording');
|
|
7567
|
-
setPrepTimer(
|
|
7568
|
-
// Start both video and audio recording simultaneously
|
|
7625
|
+
setPrepTimer(countdownSeconds);
|
|
7569
7626
|
startVideoRecording();
|
|
7570
|
-
|
|
7627
|
+
if (emitAudio)
|
|
7628
|
+
startAudioRecording();
|
|
7571
7629
|
}
|
|
7572
7630
|
}
|
|
7573
7631
|
}, [state, prepTimer]);
|
|
@@ -7596,9 +7654,41 @@ const FaceRecorder = ({ rectWidth = 320, rectHeight = 512, onConfirmRecording, o
|
|
|
7596
7654
|
}
|
|
7597
7655
|
}
|
|
7598
7656
|
}, [state, recordTimer]);
|
|
7657
|
+
/**
|
|
7658
|
+
* Prefer the server-issued challenge; fall back to a generated one. Kept in
|
|
7659
|
+
* one place so every reset path applies the same rule.
|
|
7660
|
+
*/
|
|
7661
|
+
const applyChallenge = () => {
|
|
7662
|
+
var _a;
|
|
7663
|
+
const issued = (_a = challengeDigits === null || challengeDigits === void 0 ? void 0 : challengeDigits.filter(d => Number.isInteger(d) && d >= 0 && d <= 9)) !== null && _a !== void 0 ? _a : [];
|
|
7664
|
+
setDigits(issued.length > 0 ? issued : generateRandomDigits(DIGITS_NUMBER$1));
|
|
7665
|
+
};
|
|
7666
|
+
/** Build the emitted payload; `audio` is omitted unless a blob exists. */
|
|
7667
|
+
const buildRecording = (video, audio, challenge) => ({
|
|
7668
|
+
file: new File([video], 'face-video.webm', { type: video.type }),
|
|
7669
|
+
...(audio ? { audio: new File([audio], 'face-audio.webm', { type: audio.type }) } : {}),
|
|
7670
|
+
phrase: numbersToPhrase(challenge),
|
|
7671
|
+
});
|
|
7672
|
+
/** Return to the start after a capture that produced no usable video. */
|
|
7673
|
+
const resetAfterFailedCapture = () => {
|
|
7674
|
+
setVideoBlob(null);
|
|
7675
|
+
setAudioBlob(null);
|
|
7676
|
+
setVideoUrl(null);
|
|
7677
|
+
setIsConfirming(false);
|
|
7678
|
+
hasNotifiedRef.current = false;
|
|
7679
|
+
setState('preparation');
|
|
7680
|
+
applyChallenge();
|
|
7681
|
+
requestPermissions();
|
|
7682
|
+
};
|
|
7683
|
+
// Adopt a challenge that arrives (or changes) while idle; never mid-capture.
|
|
7684
|
+
React.useEffect(() => {
|
|
7685
|
+
if (state === 'preparation')
|
|
7686
|
+
applyChallenge();
|
|
7687
|
+
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
7688
|
+
}, [challengeDigits]);
|
|
7599
7689
|
const startRecording = async () => {
|
|
7600
|
-
|
|
7601
|
-
setRecordTimer(
|
|
7690
|
+
applyChallenge();
|
|
7691
|
+
setRecordTimer(recordingSeconds);
|
|
7602
7692
|
setState('countdown');
|
|
7603
7693
|
};
|
|
7604
7694
|
const handleCancel = () => {
|
|
@@ -7615,17 +7705,14 @@ const FaceRecorder = ({ rectWidth = 320, rectHeight = 512, onConfirmRecording, o
|
|
|
7615
7705
|
setVideoBlob(null);
|
|
7616
7706
|
setAudioBlob(null);
|
|
7617
7707
|
// Reset digits for next recording
|
|
7618
|
-
|
|
7708
|
+
applyChallenge();
|
|
7619
7709
|
// Restart the stream for cancellation
|
|
7620
7710
|
requestPermissions();
|
|
7621
7711
|
};
|
|
7622
7712
|
const handleConfirm = () => {
|
|
7623
|
-
if (videoBlob
|
|
7624
|
-
// Create file objects
|
|
7625
|
-
const videoFile = new File([videoBlob], 'face-video.webm', { type: videoBlob.type });
|
|
7626
|
-
const audioFile = new File([audioBlob], 'face-audio.webm', { type: audioBlob.type });
|
|
7713
|
+
if (videoBlob) {
|
|
7627
7714
|
// required callback in parent app
|
|
7628
|
-
onConfirmRecording(
|
|
7715
|
+
onConfirmRecording(buildRecording(videoBlob, audioBlob, digits));
|
|
7629
7716
|
// Clean up and reset state
|
|
7630
7717
|
if (videoUrl)
|
|
7631
7718
|
URL.revokeObjectURL(videoUrl);
|
|
@@ -7637,7 +7724,7 @@ const FaceRecorder = ({ rectWidth = 320, rectHeight = 512, onConfirmRecording, o
|
|
|
7637
7724
|
// Reset notified flag
|
|
7638
7725
|
hasNotifiedRef.current = false;
|
|
7639
7726
|
// Reset digits for next recording
|
|
7640
|
-
|
|
7727
|
+
applyChallenge();
|
|
7641
7728
|
// Restart stream for next recording
|
|
7642
7729
|
requestPermissions();
|
|
7643
7730
|
}
|
|
@@ -7653,7 +7740,7 @@ const FaceRecorder = ({ rectWidth = 320, rectHeight = 512, onConfirmRecording, o
|
|
|
7653
7740
|
// Reset notified flag
|
|
7654
7741
|
hasNotifiedRef.current = false;
|
|
7655
7742
|
// Reset digits for next recording
|
|
7656
|
-
|
|
7743
|
+
applyChallenge();
|
|
7657
7744
|
// Restart the stream for retake
|
|
7658
7745
|
requestPermissions();
|
|
7659
7746
|
};
|
|
@@ -7697,7 +7784,7 @@ const FaceRecorder = ({ rectWidth = 320, rectHeight = 512, onConfirmRecording, o
|
|
|
7697
7784
|
alignItems: 'center',
|
|
7698
7785
|
justifyContent: 'center',
|
|
7699
7786
|
width: rectWidth,
|
|
7700
|
-
height: rectHeight +
|
|
7787
|
+
height: rectHeight + 120,
|
|
7701
7788
|
margin: '0 auto',
|
|
7702
7789
|
...style,
|
|
7703
7790
|
};
|
|
@@ -7715,11 +7802,11 @@ const FaceRecorder = ({ rectWidth = 320, rectHeight = 512, onConfirmRecording, o
|
|
|
7715
7802
|
};
|
|
7716
7803
|
const ovalArea = {
|
|
7717
7804
|
position: 'absolute',
|
|
7718
|
-
top: '
|
|
7719
|
-
left: '
|
|
7720
|
-
|
|
7721
|
-
width: '
|
|
7722
|
-
height: '
|
|
7805
|
+
top: '15%',
|
|
7806
|
+
left: '50%',
|
|
7807
|
+
transform: 'translateX(-50%)',
|
|
7808
|
+
width: '75%',
|
|
7809
|
+
height: '70%',
|
|
7723
7810
|
zIndex: 2,
|
|
7724
7811
|
display: 'flex',
|
|
7725
7812
|
flexDirection: 'column',
|
|
@@ -7750,8 +7837,8 @@ const FaceRecorder = ({ rectWidth = 320, rectHeight = 512, onConfirmRecording, o
|
|
|
7750
7837
|
const numberRow = {
|
|
7751
7838
|
display: 'flex',
|
|
7752
7839
|
justifyContent: 'center',
|
|
7753
|
-
gap:
|
|
7754
|
-
|
|
7840
|
+
gap: 4,
|
|
7841
|
+
margin: '16px 0 24px 0',
|
|
7755
7842
|
width: '100%',
|
|
7756
7843
|
maxWidth: rectWidth - 40,
|
|
7757
7844
|
};
|
|
@@ -7871,7 +7958,7 @@ const FaceRecorder = ({ rectWidth = 320, rectHeight = 512, onConfirmRecording, o
|
|
|
7871
7958
|
if (!permission) {
|
|
7872
7959
|
return (jsxRuntime.jsx("div", { className: className, style: wrapperStyle, children: jsxRuntime.jsxs("div", { style: { textAlign: 'center', padding: '20px' }, children: [jsxRuntime.jsx("h3", { children: "Camera Permission Required" }), jsxRuntime.jsx("p", { children: "Please allow camera and microphone access to use this component." }), jsxRuntime.jsx("button", { type: "button", style: actionButton, onClick: requestPermissions, children: "Grant Permissions" })] }) }));
|
|
7873
7960
|
}
|
|
7874
|
-
return (jsxRuntime.jsxs("div", { className: className, style: wrapperStyle, children: [state !== 'result' && state !== 'processing' && !isConfirming && (jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [jsxRuntime.
|
|
7961
|
+
return (jsxRuntime.jsxs("div", { className: className, style: wrapperStyle, children: [state !== 'result' && state !== 'processing' && !isConfirming && (jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [jsxRuntime.jsxs("div", { className: "facerecorder-camera-area", style: cameraArea, children: [jsxRuntime.jsx("video", { ref: videoRef, width: rectWidth - 40, height: rectHeight - 40, className: "facerecorder-video", style: {
|
|
7875
7962
|
width: rectWidth - 40,
|
|
7876
7963
|
height: rectHeight - 40,
|
|
7877
7964
|
objectFit: 'cover',
|
|
@@ -7887,7 +7974,7 @@ const FaceRecorder = ({ rectWidth = 320, rectHeight = 512, onConfirmRecording, o
|
|
|
7887
7974
|
background: 'rgba(0,0,0,0.4)',
|
|
7888
7975
|
zIndex: 1,
|
|
7889
7976
|
borderRadius: noShadow ? 0 : 8,
|
|
7890
|
-
} }), jsxRuntime.jsxs("div", { className: "facerecorder-oval-area", style: ovalArea, children: [jsxRuntime.jsx("span", { className: "facerecorder-guidance-text", style: guidanceText, children: "Place your face in the oval" }), jsxRuntime.jsx("div", { className: "facerecorder-oval-dashed", style: ovalDashed })] }), state === 'countdown' && (jsxRuntime.jsx("div", { style: prepTimerStyle, children: prepTimer })), state === 'recording' && (jsxRuntime.jsx("div", { style: timerStyle, children: recordTimer })), (state === 'recording' || state === 'preparation') && (jsxRuntime.jsxs("div", { style: soundwaveStyle, children: [jsxRuntime.jsx("div", { style: { ...barBase, height: `${8 + micLevel * 30}px` } }), jsxRuntime.jsx("div", { style: { ...barBase, height: `${4 + micLevel * 40}px` } }), jsxRuntime.jsx("div", { style: { ...barBase, height: `${10 + micLevel * 20}px` } })] }))] }), state === 'preparation' && (jsxRuntime.jsx("button", { type: "button", style: actionButton, onClick: startRecording, children: "Start recording" })), state === 'recording' && (jsxRuntime.jsx("button", { type: "button", style: { ...actionButton, background: '#d32f2f' }, onClick: handleCancel, children: "Cancel" }))] })), state === 'processing' && (jsxRuntime.jsx(jsxRuntime.Fragment, { children: jsxRuntime.jsx("div", { className: "facerecorder-processing", style: preview, children: jsxRuntime.jsxs("div", { style: {
|
|
7977
|
+
} }), jsxRuntime.jsxs("div", { className: "facerecorder-oval-area", style: ovalArea, children: [jsxRuntime.jsx("span", { className: "facerecorder-guidance-text", style: guidanceText, children: "Place your face in the oval" }), jsxRuntime.jsx("div", { className: "facerecorder-oval-dashed", style: ovalDashed })] }), state === 'countdown' && (jsxRuntime.jsx("div", { style: prepTimerStyle, children: prepTimer })), state === 'recording' && (jsxRuntime.jsx("div", { style: timerStyle, children: recordTimer })), (state === 'recording' || state === 'preparation') && (jsxRuntime.jsxs("div", { style: soundwaveStyle, children: [jsxRuntime.jsx("div", { style: { ...barBase, height: `${8 + micLevel * 30}px` } }), jsxRuntime.jsx("div", { style: { ...barBase, height: `${4 + micLevel * 40}px` } }), jsxRuntime.jsx("div", { style: { ...barBase, height: `${10 + micLevel * 20}px` } })] }))] }), jsxRuntime.jsx("div", { style: numberRow, children: (state === 'recording' ? digits : Array(DIGITS_NUMBER$1).fill('*')).map((num, i) => (jsxRuntime.jsx("div", { style: numberBox, children: num }, i))) }), state === 'preparation' && (jsxRuntime.jsx("button", { type: "button", style: actionButton, onClick: startRecording, children: "Start recording" })), state === 'recording' && (jsxRuntime.jsx("button", { type: "button", style: { ...actionButton, background: '#d32f2f' }, onClick: handleCancel, children: "Cancel" }))] })), state === 'processing' && (jsxRuntime.jsx(jsxRuntime.Fragment, { children: jsxRuntime.jsx("div", { className: "facerecorder-processing", style: preview, children: jsxRuntime.jsxs("div", { style: {
|
|
7891
7978
|
display: 'flex',
|
|
7892
7979
|
flexDirection: 'column',
|
|
7893
7980
|
alignItems: 'center',
|
|
@@ -7912,6 +7999,10 @@ const FaceRecorder = ({ rectWidth = 320, rectHeight = 512, onConfirmRecording, o
|
|
|
7912
7999
|
const [permission, setPermission] = React.useState(false);
|
|
7913
8000
|
const [stream, setStream] = React.useState(null);
|
|
7914
8001
|
const [isLoading, setIsLoading] = React.useState(true);
|
|
8002
|
+
// The stream is mirrored in a ref so stopStreamTracks and the unmount
|
|
8003
|
+
// cleanup act on the live stream rather than a stale closure, and so a
|
|
8004
|
+
// getUserMedia that resolves after unmount can be stopped immediately
|
|
8005
|
+
// (restored from 1.3.5, which 1.4.0 reverted).
|
|
7915
8006
|
const streamRef = React.useRef(null);
|
|
7916
8007
|
const isMountedRef = React.useRef(false);
|
|
7917
8008
|
const stopStreamTracks = () => {
|
|
@@ -7934,7 +8025,7 @@ const FaceRecorder = ({ rectWidth = 320, rectHeight = 512, onConfirmRecording, o
|
|
|
7934
8025
|
noiseSuppression: true,
|
|
7935
8026
|
autoGainControl: true,
|
|
7936
8027
|
sampleRate: 48000,
|
|
7937
|
-
channelCount:
|
|
8028
|
+
channelCount: 1 // Mono: the gateway downmixes with -ac 1 and the engine expects mono (BM-446)
|
|
7938
8029
|
}
|
|
7939
8030
|
};
|
|
7940
8031
|
}
|
|
@@ -7966,7 +8057,8 @@ const FaceRecorder = ({ rectWidth = 320, rectHeight = 512, onConfirmRecording, o
|
|
|
7966
8057
|
setIsLoading(true);
|
|
7967
8058
|
const constraints = getAudioConstraints();
|
|
7968
8059
|
const streamData = await navigator.mediaDevices.getUserMedia(constraints);
|
|
7969
|
-
//
|
|
8060
|
+
// Unmounted while getUserMedia was resolving: release the devices now,
|
|
8061
|
+
// otherwise the camera/mic indicator stays on with nothing holding it.
|
|
7970
8062
|
if (!isMountedRef.current) {
|
|
7971
8063
|
streamData.getTracks().forEach(track => track.stop());
|
|
7972
8064
|
return;
|
|
@@ -8010,22 +8102,32 @@ if (typeof document !== 'undefined') {
|
|
|
8010
8102
|
style.textContent = spinnerStyle;
|
|
8011
8103
|
document.head.appendChild(style);
|
|
8012
8104
|
}
|
|
8013
|
-
const RECORD_SECONDS =
|
|
8105
|
+
const RECORD_SECONDS = VOICE_ENROLL_LENGTH_MS / 1000;
|
|
8014
8106
|
const PREP_SECONDS = 3;
|
|
8015
|
-
const
|
|
8016
|
-
|
|
8017
|
-
|
|
8018
|
-
|
|
8019
|
-
|
|
8020
|
-
|
|
8021
|
-
|
|
8022
|
-
|
|
8023
|
-
|
|
8024
|
-
|
|
8107
|
+
const DEFAULT_TAKES = 5;
|
|
8108
|
+
/**
|
|
8109
|
+
* Prompts come from ENROLMENT_DIGIT_SEQUENCES, not from a random draw.
|
|
8110
|
+
*
|
|
8111
|
+
* The published sequences are chosen to contain no duplicate 2-digit contexts,
|
|
8112
|
+
* and presenting every user the same set is what makes cross-user calibration
|
|
8113
|
+
* accurate — calibration being what sets the acceptance threshold (BM-449,
|
|
8114
|
+
* BM-450). Random enrolment prompts gave each user an arbitrary, unmeasured
|
|
8115
|
+
* slice of that space.
|
|
8116
|
+
*/
|
|
8117
|
+
const DIGITS_NUMBER = ENROLMENT_DIGIT_SEQUENCES[0].length;
|
|
8118
|
+
const VoiceRecorder = ({ rectWidth = 360, rectHeight, takes = DEFAULT_TAKES, onConfirmRecording, onRecorded, className, style, noShadow = false, }) => {
|
|
8025
8119
|
const [state, setState] = React.useState('preparation');
|
|
8026
8120
|
const [prepTimer, setPrepTimer] = React.useState(PREP_SECONDS);
|
|
8027
8121
|
const [recordTimer, setRecordTimer] = React.useState(RECORD_SECONDS);
|
|
8028
|
-
|
|
8122
|
+
/** Takes confirmed so far; emitted together once `takes` are collected. */
|
|
8123
|
+
const [collected, setCollected] = React.useState([]);
|
|
8124
|
+
/**
|
|
8125
|
+
* The prompt for the take being collected, keyed on how many are already
|
|
8126
|
+
* confirmed — so a retake re-prompts the *same* sequence rather than drawing
|
|
8127
|
+
* a new one: the user is re-recording a take, not being given a different
|
|
8128
|
+
* task. Wraps if a consumer asks for more takes than there are sequences.
|
|
8129
|
+
*/
|
|
8130
|
+
const digits = React.useMemo(() => [...ENROLMENT_DIGIT_SEQUENCES[collected.length % ENROLMENT_DIGIT_SEQUENCES.length]], [collected.length]);
|
|
8029
8131
|
const [audioLevel, setAudioLevel] = React.useState(0);
|
|
8030
8132
|
const [waveformData, setWaveformData] = React.useState([]);
|
|
8031
8133
|
const { permission, stream, stopStreamTracks, requestPermissions, isLoading } = useAudioPermissions();
|
|
@@ -8037,31 +8139,35 @@ const VoiceRecorder = ({ rectWidth = 360, rectHeight, onConfirmRecording, onReco
|
|
|
8037
8139
|
const animationFrameRef = React.useRef(null);
|
|
8038
8140
|
const { startRecording: startHookRecording, cancelRecording } = useRecorder(stream, "audio", (blob) => {
|
|
8039
8141
|
stopStreamTracks();
|
|
8040
|
-
|
|
8041
|
-
|
|
8042
|
-
|
|
8043
|
-
|
|
8044
|
-
|
|
8045
|
-
|
|
8046
|
-
|
|
8047
|
-
|
|
8048
|
-
|
|
8049
|
-
|
|
8050
|
-
|
|
8051
|
-
|
|
8052
|
-
console.error('onRecorded callback threw:', err);
|
|
8053
|
-
}
|
|
8054
|
-
}
|
|
8142
|
+
// A take that produced nothing is a failure, not a success with an empty
|
|
8143
|
+
// file. This used to substitute a ~15-byte text Blob named
|
|
8144
|
+
// voice-recording.webm and present it for confirmation, so a failed
|
|
8145
|
+
// recording went into the voiceprint as garbage (BM-461).
|
|
8146
|
+
if (!blob || blob.size === 0) {
|
|
8147
|
+
console.warn('voice recorder: take produced no audio; returning to preparation');
|
|
8148
|
+
setAudioBlob(null);
|
|
8149
|
+
setAudioUrl(null);
|
|
8150
|
+
setIsConfirming(false);
|
|
8151
|
+
setState('preparation');
|
|
8152
|
+
requestPermissions();
|
|
8153
|
+
return;
|
|
8055
8154
|
}
|
|
8056
|
-
|
|
8057
|
-
|
|
8058
|
-
|
|
8059
|
-
|
|
8060
|
-
|
|
8061
|
-
|
|
8062
|
-
|
|
8155
|
+
setAudioBlob(blob);
|
|
8156
|
+
setAudioUrl(URL.createObjectURL(blob));
|
|
8157
|
+
setState('result');
|
|
8158
|
+
setIsConfirming(true);
|
|
8159
|
+
if (onRecorded) {
|
|
8160
|
+
try {
|
|
8161
|
+
onRecorded({
|
|
8162
|
+
file: new File([blob], `voice-recording-${collected.length + 1}.webm`, { type: blob.type }),
|
|
8163
|
+
phrase: numbersToPhrase(digits),
|
|
8164
|
+
});
|
|
8165
|
+
}
|
|
8166
|
+
catch (err) {
|
|
8167
|
+
console.error('onRecorded callback threw:', err);
|
|
8168
|
+
}
|
|
8063
8169
|
}
|
|
8064
|
-
});
|
|
8170
|
+
}, VOICE_ENROLL_LENGTH_MS);
|
|
8065
8171
|
// Audio visualization setup
|
|
8066
8172
|
React.useEffect(() => {
|
|
8067
8173
|
if (stream && state === 'recording') {
|
|
@@ -8121,10 +8227,20 @@ const VoiceRecorder = ({ rectWidth = 360, rectHeight, onConfirmRecording, onReco
|
|
|
8121
8227
|
}
|
|
8122
8228
|
}, [state, recordTimer]);
|
|
8123
8229
|
const startRecording = async () => {
|
|
8124
|
-
|
|
8230
|
+
// The prompt is derived from how many takes are confirmed, so there is
|
|
8231
|
+
// nothing to re-draw here — a retake deliberately re-prompts the same
|
|
8232
|
+
// sequence.
|
|
8125
8233
|
setRecordTimer(RECORD_SECONDS);
|
|
8126
8234
|
setState('countdown');
|
|
8127
8235
|
};
|
|
8236
|
+
/**
|
|
8237
|
+
* Discards the take in flight, not the enrollment.
|
|
8238
|
+
*
|
|
8239
|
+
* Confirmed takes are kept: wiping `collected` here sent the user back to
|
|
8240
|
+
* take 1 with no warning and no undo, so the longer the enrollment the more a
|
|
8241
|
+
* stumble cost. Nothing is mixed across attempts — every take reads the same
|
|
8242
|
+
* `digits`, and the in-flight blob is released below rather than kept.
|
|
8243
|
+
*/
|
|
8128
8244
|
const handleCancel = () => {
|
|
8129
8245
|
// Cancel the recording first
|
|
8130
8246
|
cancelRecording();
|
|
@@ -8140,20 +8256,32 @@ const VoiceRecorder = ({ rectWidth = 360, rectHeight, onConfirmRecording, onReco
|
|
|
8140
8256
|
requestPermissions();
|
|
8141
8257
|
};
|
|
8142
8258
|
const handleConfirm = () => {
|
|
8143
|
-
if (audioBlob)
|
|
8144
|
-
|
|
8145
|
-
|
|
8146
|
-
|
|
8147
|
-
|
|
8148
|
-
|
|
8149
|
-
|
|
8150
|
-
|
|
8151
|
-
|
|
8152
|
-
|
|
8153
|
-
|
|
8154
|
-
|
|
8155
|
-
|
|
8259
|
+
if (!audioBlob)
|
|
8260
|
+
return;
|
|
8261
|
+
const take = {
|
|
8262
|
+
file: new File([audioBlob], `voice-recording-${collected.length + 1}.webm`, { type: audioBlob.type }),
|
|
8263
|
+
phrase: numbersToPhrase(digits),
|
|
8264
|
+
};
|
|
8265
|
+
const confirmed = [...collected, take];
|
|
8266
|
+
if (audioUrl)
|
|
8267
|
+
URL.revokeObjectURL(audioUrl);
|
|
8268
|
+
setAudioUrl(null);
|
|
8269
|
+
setAudioBlob(null);
|
|
8270
|
+
setIsConfirming(false);
|
|
8271
|
+
setState('preparation');
|
|
8272
|
+
// Emit only once every take is in: the consumer posts them together as one
|
|
8273
|
+
// enrollment, so a partial set is worse than none.
|
|
8274
|
+
if (confirmed.length >= takes) {
|
|
8275
|
+
setCollected([]);
|
|
8276
|
+
onConfirmRecording({
|
|
8277
|
+
files: confirmed.map(t => t.file),
|
|
8278
|
+
phrases: confirmed.map(t => t.phrase),
|
|
8279
|
+
});
|
|
8280
|
+
return;
|
|
8156
8281
|
}
|
|
8282
|
+
// More takes to go: re-arm the mic so the next one can start immediately.
|
|
8283
|
+
setCollected(confirmed);
|
|
8284
|
+
requestPermissions();
|
|
8157
8285
|
};
|
|
8158
8286
|
const handleDecline = () => {
|
|
8159
8287
|
if (audioUrl)
|
|
@@ -8334,13 +8462,13 @@ const VoiceRecorder = ({ rectWidth = 360, rectHeight, onConfirmRecording, onReco
|
|
|
8334
8462
|
justifyContent: 'center',
|
|
8335
8463
|
width: '100%',
|
|
8336
8464
|
padding: '20px',
|
|
8337
|
-
}, children: [state === 'preparation' && (jsxRuntime.
|
|
8465
|
+
}, children: [state === 'preparation' && (jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [takes > 1 && (jsxRuntime.jsxs("div", { style: { ...guidanceText, fontWeight: 600 }, children: ["Recording ", Math.min(collected.length + 1, takes), " of ", takes] })), jsxRuntime.jsx("div", { style: guidanceText, children: "Click Start to begin voice recording" })] })), state === 'countdown' && (jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [jsxRuntime.jsx("div", { style: guidanceText, children: "Get ready to speak clearly" }), jsxRuntime.jsx("div", { style: prepTimerStyle, children: prepTimer })] })), state === 'recording' && (jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [jsxRuntime.jsx("div", { style: waveformContainer, children: jsxRuntime.jsx("div", { style: {
|
|
8338
8466
|
display: 'flex',
|
|
8339
8467
|
alignItems: 'center',
|
|
8340
8468
|
justifyContent: 'center',
|
|
8341
8469
|
height: '120px',
|
|
8342
8470
|
gap: '2px',
|
|
8343
|
-
}, children: waveformData.map((value, index) => (jsxRuntime.jsx("div", { style: waveformBar(value / 255) }, index))) }) }), jsxRuntime.jsx("div", { style: timerStyle, children: recordTimer }), jsxRuntime.jsx("div", { style: guidanceText, children: "Speak clearly into your microphone" })] }))] })] }), jsxRuntime.jsx("div", { style: numberRow, children: (state === 'recording' ? digits : Array(DIGITS_NUMBER).fill('*')).map((num, i) => (jsxRuntime.jsx("div", { style: numberBox, children: num }, i))) }), state === 'preparation' && (jsxRuntime.jsx("button", { type: "button", style: actionButton, onClick: startRecording, children: "Start recording" })), state === 'recording' && (jsxRuntime.jsx("button", { type: "button", style: { ...actionButton, background: '#d32f2f' }, onClick: handleCancel, children:
|
|
8471
|
+
}, children: waveformData.map((value, index) => (jsxRuntime.jsx("div", { style: waveformBar(value / 255) }, index))) }) }), jsxRuntime.jsx("div", { style: timerStyle, children: recordTimer }), jsxRuntime.jsx("div", { style: guidanceText, children: "Speak clearly into your microphone" })] }))] })] }), jsxRuntime.jsx("div", { style: numberRow, children: (state === 'recording' ? digits : Array(DIGITS_NUMBER).fill('*')).map((num, i) => (jsxRuntime.jsx("div", { style: numberBox, children: num }, i))) }), state === 'preparation' && (jsxRuntime.jsx("button", { type: "button", style: actionButton, onClick: startRecording, children: "Start recording" })), state === 'recording' && (jsxRuntime.jsx("button", { type: "button", style: { ...actionButton, background: '#d32f2f' }, onClick: handleCancel, children: takes > 1 ? 'Discard this recording' : 'Cancel' }))] })), state === 'processing' && (jsxRuntime.jsx(jsxRuntime.Fragment, { children: jsxRuntime.jsx("div", { className: "voicerecorder-processing", style: preview, children: jsxRuntime.jsxs("div", { style: {
|
|
8344
8472
|
display: 'flex',
|
|
8345
8473
|
flexDirection: 'column',
|
|
8346
8474
|
alignItems: 'center',
|
|
@@ -8367,4 +8495,4 @@ const VoiceRecorder = ({ rectWidth = 360, rectHeight, onConfirmRecording, onReco
|
|
|
8367
8495
|
maxWidth: '300px',
|
|
8368
8496
|
marginBottom: '16px',
|
|
8369
8497
|
} })), jsxRuntime.jsx("div", { className: "voicerecorder-confirm-text", style: confirmText, children: "Do you want to use this recording?" }), jsxRuntime.jsxs("div", { className: "voicerecorder-confirm-btns", style: { display: 'flex', justifyContent: 'center', gap: 32, marginTop: 12, width: '100%' }, children: [jsxRuntime.jsx("button", { type: "button", "aria-label": "Retake", className: "voicerecorder-icon-btn", style: iconButton, onClick: handleDecline, onMouseOver: e => (e.currentTarget.style.background = 'rgba(211,47,47,0.12)'), onMouseOut: e => (e.currentTarget.style.background = 'none'), children: jsxRuntime.jsxs("svg", { width: "36", height: "36", viewBox: "0 0 36 36", fill: "none", xmlns: "http://www.w3.org/2000/svg", children: [jsxRuntime.jsx("circle", { cx: "18", cy: "18", r: "18", fill: "#fff", fillOpacity: "0.15" }), jsxRuntime.jsx("path", { d: "M12 12L24 24", stroke: "#d32f2f", strokeWidth: "3", strokeLinecap: "round" }), jsxRuntime.jsx("path", { d: "M24 12L12 24", stroke: "#d32f2f", strokeWidth: "3", strokeLinecap: "round" })] }) }), jsxRuntime.jsx("button", { type: "button", "aria-label": "Confirm", className: "voicerecorder-icon-btn", style: iconButton, onClick: handleConfirm, onMouseOver: e => (e.currentTarget.style.background = 'rgba(56,142,60,0.12)'), onMouseOut: e => (e.currentTarget.style.background = 'none'), children: jsxRuntime.jsxs("svg", { width: "36", height: "36", viewBox: "0 0 36 36", fill: "none", xmlns: "http://www.w3.org/2000/svg", children: [jsxRuntime.jsx("circle", { cx: "18", cy: "18", r: "18", fill: "#fff", fillOpacity: "0.15" }), jsxRuntime.jsx("path", { d: "M10 19L16 25L26 13", stroke: "#388e3c", strokeWidth: "3", strokeLinecap: "round", strokeLinejoin: "round" })] }) })] })] }) }))] }));
|
|
8370
|
-
};exports.DocScan=DocScan;exports.FaceCapture=FaceCapture;exports.FaceRecorder=FaceRecorder;exports.VoiceRecorder=VoiceRecorder;exports.useAudioPermissions=useAudioPermissions;exports.usePermissions=usePermissions;exports.useRecorder=useRecorder;
|
|
8498
|
+
};exports.CHALLENGE_DIGITS=CHALLENGE_DIGITS;exports.DocScan=DocScan;exports.ENROLMENT_DIGIT_SEQUENCES=ENROLMENT_DIGIT_SEQUENCES;exports.FaceCapture=FaceCapture;exports.FaceRecorder=FaceRecorder;exports.VoiceRecorder=VoiceRecorder;exports.generateRandomDigits=generateRandomDigits;exports.numbersToPhrase=numbersToPhrase;exports.useAudioPermissions=useAudioPermissions;exports.usePermissions=usePermissions;exports.useRecorder=useRecorder;
|