biometry-react-components 1.1.0 → 1.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/index.esm.js +15 -3
- package/dist/index.js +15 -3
- package/package.json +1 -1
package/dist/index.esm.js
CHANGED
|
@@ -7053,6 +7053,13 @@ var RecordRTC = /*@__PURE__*/getDefaultExportFromCjs(RecordRTCExports);function
|
|
|
7053
7053
|
else {
|
|
7054
7054
|
console.error("no suitable mimetype found for this device");
|
|
7055
7055
|
}
|
|
7056
|
+
}
|
|
7057
|
+
function numberToWord(num) {
|
|
7058
|
+
const words = ['ZERO', 'ONE', 'TWO', 'THREE', 'FOUR', 'FIVE', 'SIX', 'SEVEN', 'EIGHT', 'NINE'];
|
|
7059
|
+
return words[num] || 'ZERO';
|
|
7060
|
+
}
|
|
7061
|
+
function numbersToPhrase(numbers) {
|
|
7062
|
+
return numbers.map(numberToWord).join(' ');
|
|
7056
7063
|
}const useRecorder = (stream, type, onStopRecording) => {
|
|
7057
7064
|
const [isRecording, setIsRecording] = useState(false);
|
|
7058
7065
|
const recorderRef = useRef(null);
|
|
@@ -7356,7 +7363,7 @@ const FaceRecorder = ({ rectWidth = 360, rectHeight = 576, onCapture, className,
|
|
|
7356
7363
|
const handleConfirm = () => {
|
|
7357
7364
|
if (videoBlob) {
|
|
7358
7365
|
const file = new File([videoBlob], 'face-video.webm', { type: videoBlob.type });
|
|
7359
|
-
onCapture(file, digits
|
|
7366
|
+
onCapture(file, numbersToPhrase(digits));
|
|
7360
7367
|
if (videoUrl)
|
|
7361
7368
|
URL.revokeObjectURL(videoUrl);
|
|
7362
7369
|
setVideoUrl(null);
|
|
@@ -7663,7 +7670,12 @@ if (typeof document !== 'undefined') {
|
|
|
7663
7670
|
const RECORD_SECONDS = 10;
|
|
7664
7671
|
const PREP_SECONDS = 3;
|
|
7665
7672
|
function generateRandomDigits(count) {
|
|
7666
|
-
|
|
7673
|
+
const digits = Array.from({ length: 10 }, (_, i) => i);
|
|
7674
|
+
for (let i = digits.length - 1; i > 0; i--) {
|
|
7675
|
+
const j = Math.floor(Math.random() * (i + 1));
|
|
7676
|
+
[digits[i], digits[j]] = [digits[j], digits[i]];
|
|
7677
|
+
}
|
|
7678
|
+
return digits.slice(0, count);
|
|
7667
7679
|
}
|
|
7668
7680
|
const VoiceRecorder = ({ rectWidth = 360, rectHeight, onCapture, className, style, noShadow = false, }) => {
|
|
7669
7681
|
const [state, setState] = useState('preparation');
|
|
@@ -7777,7 +7789,7 @@ const VoiceRecorder = ({ rectWidth = 360, rectHeight, onCapture, className, styl
|
|
|
7777
7789
|
const handleConfirm = () => {
|
|
7778
7790
|
if (audioBlob) {
|
|
7779
7791
|
const file = new File([audioBlob], 'voice-recording.webm', { type: audioBlob.type });
|
|
7780
|
-
onCapture(file, digits
|
|
7792
|
+
onCapture(file, numbersToPhrase(digits));
|
|
7781
7793
|
if (audioUrl)
|
|
7782
7794
|
URL.revokeObjectURL(audioUrl);
|
|
7783
7795
|
setAudioUrl(null);
|
package/dist/index.js
CHANGED
|
@@ -7053,6 +7053,13 @@ var RecordRTC = /*@__PURE__*/getDefaultExportFromCjs(RecordRTCExports);function
|
|
|
7053
7053
|
else {
|
|
7054
7054
|
console.error("no suitable mimetype found for this device");
|
|
7055
7055
|
}
|
|
7056
|
+
}
|
|
7057
|
+
function numberToWord(num) {
|
|
7058
|
+
const words = ['ZERO', 'ONE', 'TWO', 'THREE', 'FOUR', 'FIVE', 'SIX', 'SEVEN', 'EIGHT', 'NINE'];
|
|
7059
|
+
return words[num] || 'ZERO';
|
|
7060
|
+
}
|
|
7061
|
+
function numbersToPhrase(numbers) {
|
|
7062
|
+
return numbers.map(numberToWord).join(' ');
|
|
7056
7063
|
}const useRecorder = (stream, type, onStopRecording) => {
|
|
7057
7064
|
const [isRecording, setIsRecording] = react.useState(false);
|
|
7058
7065
|
const recorderRef = react.useRef(null);
|
|
@@ -7356,7 +7363,7 @@ const FaceRecorder = ({ rectWidth = 360, rectHeight = 576, onCapture, className,
|
|
|
7356
7363
|
const handleConfirm = () => {
|
|
7357
7364
|
if (videoBlob) {
|
|
7358
7365
|
const file = new File([videoBlob], 'face-video.webm', { type: videoBlob.type });
|
|
7359
|
-
onCapture(file, digits
|
|
7366
|
+
onCapture(file, numbersToPhrase(digits));
|
|
7360
7367
|
if (videoUrl)
|
|
7361
7368
|
URL.revokeObjectURL(videoUrl);
|
|
7362
7369
|
setVideoUrl(null);
|
|
@@ -7663,7 +7670,12 @@ if (typeof document !== 'undefined') {
|
|
|
7663
7670
|
const RECORD_SECONDS = 10;
|
|
7664
7671
|
const PREP_SECONDS = 3;
|
|
7665
7672
|
function generateRandomDigits(count) {
|
|
7666
|
-
|
|
7673
|
+
const digits = Array.from({ length: 10 }, (_, i) => i);
|
|
7674
|
+
for (let i = digits.length - 1; i > 0; i--) {
|
|
7675
|
+
const j = Math.floor(Math.random() * (i + 1));
|
|
7676
|
+
[digits[i], digits[j]] = [digits[j], digits[i]];
|
|
7677
|
+
}
|
|
7678
|
+
return digits.slice(0, count);
|
|
7667
7679
|
}
|
|
7668
7680
|
const VoiceRecorder = ({ rectWidth = 360, rectHeight, onCapture, className, style, noShadow = false, }) => {
|
|
7669
7681
|
const [state, setState] = react.useState('preparation');
|
|
@@ -7777,7 +7789,7 @@ const VoiceRecorder = ({ rectWidth = 360, rectHeight, onCapture, className, styl
|
|
|
7777
7789
|
const handleConfirm = () => {
|
|
7778
7790
|
if (audioBlob) {
|
|
7779
7791
|
const file = new File([audioBlob], 'voice-recording.webm', { type: audioBlob.type });
|
|
7780
|
-
onCapture(file, digits
|
|
7792
|
+
onCapture(file, numbersToPhrase(digits));
|
|
7781
7793
|
if (audioUrl)
|
|
7782
7794
|
URL.revokeObjectURL(audioUrl);
|
|
7783
7795
|
setAudioUrl(null);
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "biometry-react-components",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.2.0",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"description": "React UI component library for capturing high-quality biometric data (voice, face, documents, video) to facilitate integration with Biometry services",
|
|
6
6
|
"main": "dist/index.js",
|