biometry-react-components 1.2.11 → 1.2.13

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 CHANGED
@@ -7060,7 +7060,8 @@ function numberToWord(num) {
7060
7060
  }
7061
7061
  function numbersToPhrase(numbers) {
7062
7062
  return numbers.map(numberToWord).join(' ');
7063
- }const useRecorder = (stream, type, onStopRecording) => {
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
- }, 10000);
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, 10000, function (fixedBlob) {
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 = 7;
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) {
@@ -7772,7 +7773,7 @@ if (typeof document !== 'undefined') {
7772
7773
  style.textContent = spinnerStyle;
7773
7774
  document.head.appendChild(style);
7774
7775
  }
7775
- const RECORD_SECONDS = 7;
7776
+ const RECORD_SECONDS = VIDEO_LENGTH_MS / 1000;
7776
7777
  const PREP_SECONDS = 3;
7777
7778
  const DIGITS_NUMBER = 7;
7778
7779
  function generateRandomDigits(count) {
@@ -7902,6 +7903,8 @@ const VoiceRecorder = ({ rectWidth = 360, rectHeight, onCapture, className, styl
7902
7903
  setAudioBlob(null);
7903
7904
  setIsConfirming(false);
7904
7905
  setState('preparation');
7906
+ // Restart the stream for retake (yep.)
7907
+ requestPermissions();
7905
7908
  }
7906
7909
  };
7907
7910
  const handleDecline = () => {
@@ -8089,7 +8092,7 @@ const VoiceRecorder = ({ rectWidth = 360, rectHeight, onCapture, className, styl
8089
8092
  justifyContent: 'center',
8090
8093
  height: '120px',
8091
8094
  gap: '2px',
8092
- }, 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(10).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: {
8095
+ }, 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: {
8093
8096
  display: 'flex',
8094
8097
  flexDirection: 'column',
8095
8098
  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 useRecorder = (stream, type, onStopRecording) => {
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
- }, 10000);
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, 10000, function (fixedBlob) {
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 = 7;
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) {
@@ -7772,7 +7773,7 @@ if (typeof document !== 'undefined') {
7772
7773
  style.textContent = spinnerStyle;
7773
7774
  document.head.appendChild(style);
7774
7775
  }
7775
- const RECORD_SECONDS = 7;
7776
+ const RECORD_SECONDS = VIDEO_LENGTH_MS / 1000;
7776
7777
  const PREP_SECONDS = 3;
7777
7778
  const DIGITS_NUMBER = 7;
7778
7779
  function generateRandomDigits(count) {
@@ -7902,6 +7903,8 @@ const VoiceRecorder = ({ rectWidth = 360, rectHeight, onCapture, className, styl
7902
7903
  setAudioBlob(null);
7903
7904
  setIsConfirming(false);
7904
7905
  setState('preparation');
7906
+ // Restart the stream for retake (yep.)
7907
+ requestPermissions();
7905
7908
  }
7906
7909
  };
7907
7910
  const handleDecline = () => {
@@ -8089,7 +8092,7 @@ const VoiceRecorder = ({ rectWidth = 360, rectHeight, onCapture, className, styl
8089
8092
  justifyContent: 'center',
8090
8093
  height: '120px',
8091
8094
  gap: '2px',
8092
- }, 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(10).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: {
8095
+ }, 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: {
8093
8096
  display: 'flex',
8094
8097
  flexDirection: 'column',
8095
8098
  alignItems: 'center',
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "biometry-react-components",
3
- "version": "1.2.11",
3
+ "version": "1.2.13",
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",