biometry-react-components 1.2.10 → 1.2.12
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 +9 -9
- package/dist/index.js +9 -9
- package/package.json +1 -1
package/dist/index.esm.js
CHANGED
|
@@ -7060,7 +7060,8 @@ function numberToWord(num) {
|
|
|
7060
7060
|
}
|
|
7061
7061
|
function numbersToPhrase(numbers) {
|
|
7062
7062
|
return numbers.map(numberToWord).join(' ');
|
|
7063
|
-
}const
|
|
7063
|
+
}const VIDEO_LENGTH_MS = 7000;
|
|
7064
|
+
const useRecorder = (stream, type, onStopRecording) => {
|
|
7064
7065
|
const [isRecording, setIsRecording] = useState(false);
|
|
7065
7066
|
const recorderRef = useRef(null);
|
|
7066
7067
|
const timeoutRef = useRef(null);
|
|
@@ -7118,7 +7119,7 @@ function numbersToPhrase(numbers) {
|
|
|
7118
7119
|
// Set timeout to auto-stop recording
|
|
7119
7120
|
timeoutRef.current = window.setTimeout(() => {
|
|
7120
7121
|
stopRecording();
|
|
7121
|
-
},
|
|
7122
|
+
}, VIDEO_LENGTH_MS);
|
|
7122
7123
|
}
|
|
7123
7124
|
catch (error) {
|
|
7124
7125
|
console.error(error);
|
|
@@ -7134,7 +7135,7 @@ function numbersToPhrase(numbers) {
|
|
|
7134
7135
|
}
|
|
7135
7136
|
recorderRef.current.stopRecording(() => {
|
|
7136
7137
|
const blob = recorderRef.current.getBlob();
|
|
7137
|
-
fixWebmDuration(blob,
|
|
7138
|
+
fixWebmDuration(blob, VIDEO_LENGTH_MS, function (fixedBlob) {
|
|
7138
7139
|
setIsRecording(false);
|
|
7139
7140
|
recorderRef.current.destroy();
|
|
7140
7141
|
recorderRef.current = null;
|
|
@@ -7267,7 +7268,7 @@ if (typeof window !== 'undefined' && typeof console !== 'undefined') {
|
|
|
7267
7268
|
console.log('MediaRecorder supported:', typeof MediaRecorder !== 'undefined');
|
|
7268
7269
|
console.log('getUserMedia supported:', !!(navigator.mediaDevices && navigator.mediaDevices.getUserMedia));
|
|
7269
7270
|
}
|
|
7270
|
-
const RECORD_SECONDS$1 =
|
|
7271
|
+
const RECORD_SECONDS$1 = VIDEO_LENGTH_MS / 1000;
|
|
7271
7272
|
const PREP_SECONDS$1 = 3;
|
|
7272
7273
|
const DIGITS_NUMBER$1 = 7;
|
|
7273
7274
|
function generateRandomDigits$1(count) {
|
|
@@ -7567,7 +7568,6 @@ const FaceRecorder = ({ rectWidth = 360, rectHeight = 576, onCapture, className,
|
|
|
7567
7568
|
width: 4,
|
|
7568
7569
|
background: '#4caf50',
|
|
7569
7570
|
borderRadius: 2,
|
|
7570
|
-
transition: 'height 0.1s',
|
|
7571
7571
|
};
|
|
7572
7572
|
const timerStyle = {
|
|
7573
7573
|
position: 'absolute',
|
|
@@ -7610,8 +7610,8 @@ const FaceRecorder = ({ rectWidth = 360, rectHeight = 576, onCapture, className,
|
|
|
7610
7610
|
display: 'block',
|
|
7611
7611
|
};
|
|
7612
7612
|
const preview = {
|
|
7613
|
-
width:
|
|
7614
|
-
height:
|
|
7613
|
+
width: '100%',
|
|
7614
|
+
height: '100%',
|
|
7615
7615
|
display: 'flex',
|
|
7616
7616
|
alignItems: 'center',
|
|
7617
7617
|
justifyContent: 'center',
|
|
@@ -7773,7 +7773,7 @@ if (typeof document !== 'undefined') {
|
|
|
7773
7773
|
style.textContent = spinnerStyle;
|
|
7774
7774
|
document.head.appendChild(style);
|
|
7775
7775
|
}
|
|
7776
|
-
const RECORD_SECONDS =
|
|
7776
|
+
const RECORD_SECONDS = VIDEO_LENGTH_MS / 1000;
|
|
7777
7777
|
const PREP_SECONDS = 3;
|
|
7778
7778
|
const DIGITS_NUMBER = 7;
|
|
7779
7779
|
function generateRandomDigits(count) {
|
|
@@ -8090,7 +8090,7 @@ const VoiceRecorder = ({ rectWidth = 360, rectHeight, onCapture, className, styl
|
|
|
8090
8090
|
justifyContent: 'center',
|
|
8091
8091
|
height: '120px',
|
|
8092
8092
|
gap: '2px',
|
|
8093
|
-
}, children: waveformData.map((value, index) => (jsx("div", { style: waveformBar(value / 255) }, index))) }) }), jsx("div", { style: timerStyle, children: recordTimer }), jsx("div", { style: guidanceText, children: "Speak clearly into your microphone" })] }))] })] }), jsx("div", { style: numberRow, children: (state === 'recording' ? digits : Array(
|
|
8093
|
+
}, children: waveformData.map((value, index) => (jsx("div", { style: waveformBar(value / 255) }, index))) }) }), jsx("div", { style: timerStyle, children: recordTimer }), jsx("div", { style: guidanceText, children: "Speak clearly into your microphone" })] }))] })] }), jsx("div", { style: numberRow, children: (state === 'recording' ? digits : Array(DIGITS_NUMBER).fill('*')).map((num, i) => (jsx("div", { style: numberBox, children: num }, i))) }), state === 'preparation' && (jsx("button", { type: "button", style: actionButton, onClick: startRecording, children: "Start recording" })), state === 'recording' && (jsx("button", { type: "button", style: { ...actionButton, background: '#d32f2f' }, onClick: handleCancel, children: "Cancel" }))] })), state === 'processing' && (jsx(Fragment, { children: jsx("div", { className: "voicerecorder-processing", style: preview, children: jsxs("div", { style: {
|
|
8094
8094
|
display: 'flex',
|
|
8095
8095
|
flexDirection: 'column',
|
|
8096
8096
|
alignItems: 'center',
|
package/dist/index.js
CHANGED
|
@@ -7060,7 +7060,8 @@ function numberToWord(num) {
|
|
|
7060
7060
|
}
|
|
7061
7061
|
function numbersToPhrase(numbers) {
|
|
7062
7062
|
return numbers.map(numberToWord).join(' ');
|
|
7063
|
-
}const
|
|
7063
|
+
}const VIDEO_LENGTH_MS = 7000;
|
|
7064
|
+
const useRecorder = (stream, type, onStopRecording) => {
|
|
7064
7065
|
const [isRecording, setIsRecording] = React.useState(false);
|
|
7065
7066
|
const recorderRef = React.useRef(null);
|
|
7066
7067
|
const timeoutRef = React.useRef(null);
|
|
@@ -7118,7 +7119,7 @@ function numbersToPhrase(numbers) {
|
|
|
7118
7119
|
// Set timeout to auto-stop recording
|
|
7119
7120
|
timeoutRef.current = window.setTimeout(() => {
|
|
7120
7121
|
stopRecording();
|
|
7121
|
-
},
|
|
7122
|
+
}, VIDEO_LENGTH_MS);
|
|
7122
7123
|
}
|
|
7123
7124
|
catch (error) {
|
|
7124
7125
|
console.error(error);
|
|
@@ -7134,7 +7135,7 @@ function numbersToPhrase(numbers) {
|
|
|
7134
7135
|
}
|
|
7135
7136
|
recorderRef.current.stopRecording(() => {
|
|
7136
7137
|
const blob = recorderRef.current.getBlob();
|
|
7137
|
-
fixWebmDuration(blob,
|
|
7138
|
+
fixWebmDuration(blob, VIDEO_LENGTH_MS, function (fixedBlob) {
|
|
7138
7139
|
setIsRecording(false);
|
|
7139
7140
|
recorderRef.current.destroy();
|
|
7140
7141
|
recorderRef.current = null;
|
|
@@ -7267,7 +7268,7 @@ if (typeof window !== 'undefined' && typeof console !== 'undefined') {
|
|
|
7267
7268
|
console.log('MediaRecorder supported:', typeof MediaRecorder !== 'undefined');
|
|
7268
7269
|
console.log('getUserMedia supported:', !!(navigator.mediaDevices && navigator.mediaDevices.getUserMedia));
|
|
7269
7270
|
}
|
|
7270
|
-
const RECORD_SECONDS$1 =
|
|
7271
|
+
const RECORD_SECONDS$1 = VIDEO_LENGTH_MS / 1000;
|
|
7271
7272
|
const PREP_SECONDS$1 = 3;
|
|
7272
7273
|
const DIGITS_NUMBER$1 = 7;
|
|
7273
7274
|
function generateRandomDigits$1(count) {
|
|
@@ -7567,7 +7568,6 @@ const FaceRecorder = ({ rectWidth = 360, rectHeight = 576, onCapture, className,
|
|
|
7567
7568
|
width: 4,
|
|
7568
7569
|
background: '#4caf50',
|
|
7569
7570
|
borderRadius: 2,
|
|
7570
|
-
transition: 'height 0.1s',
|
|
7571
7571
|
};
|
|
7572
7572
|
const timerStyle = {
|
|
7573
7573
|
position: 'absolute',
|
|
@@ -7610,8 +7610,8 @@ const FaceRecorder = ({ rectWidth = 360, rectHeight = 576, onCapture, className,
|
|
|
7610
7610
|
display: 'block',
|
|
7611
7611
|
};
|
|
7612
7612
|
const preview = {
|
|
7613
|
-
width:
|
|
7614
|
-
height:
|
|
7613
|
+
width: '100%',
|
|
7614
|
+
height: '100%',
|
|
7615
7615
|
display: 'flex',
|
|
7616
7616
|
alignItems: 'center',
|
|
7617
7617
|
justifyContent: 'center',
|
|
@@ -7773,7 +7773,7 @@ if (typeof document !== 'undefined') {
|
|
|
7773
7773
|
style.textContent = spinnerStyle;
|
|
7774
7774
|
document.head.appendChild(style);
|
|
7775
7775
|
}
|
|
7776
|
-
const RECORD_SECONDS =
|
|
7776
|
+
const RECORD_SECONDS = VIDEO_LENGTH_MS / 1000;
|
|
7777
7777
|
const PREP_SECONDS = 3;
|
|
7778
7778
|
const DIGITS_NUMBER = 7;
|
|
7779
7779
|
function generateRandomDigits(count) {
|
|
@@ -8090,7 +8090,7 @@ const VoiceRecorder = ({ rectWidth = 360, rectHeight, onCapture, className, styl
|
|
|
8090
8090
|
justifyContent: 'center',
|
|
8091
8091
|
height: '120px',
|
|
8092
8092
|
gap: '2px',
|
|
8093
|
-
}, 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(
|
|
8093
|
+
}, 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: "Cancel" }))] })), state === 'processing' && (jsxRuntime.jsx(jsxRuntime.Fragment, { children: jsxRuntime.jsx("div", { className: "voicerecorder-processing", style: preview, children: jsxRuntime.jsxs("div", { style: {
|
|
8094
8094
|
display: 'flex',
|
|
8095
8095
|
flexDirection: 'column',
|
|
8096
8096
|
alignItems: 'center',
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "biometry-react-components",
|
|
3
|
-
"version": "1.2.
|
|
3
|
+
"version": "1.2.12",
|
|
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",
|