@exode-team/react-recorder 1.1.3 → 1.1.5

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.d.ts CHANGED
@@ -12,9 +12,8 @@ export { useVoiceRecorder } from './hooks/useVoiceRecorder';
12
12
  export { useVoiceMessagePlayer } from './hooks/useVoiceMessagePlayer';
13
13
  export { useRecorderVisualization } from './hooks/useRecorderVisualization';
14
14
  export { useRecordingTiming } from './hooks/useRecordingTiming';
15
- export type { StorageSpace, StorageFileEntity, UploadStrategy } from './types/upload';
15
+ export type { StorageFileEntity, UploadStrategy } from './types/upload';
16
16
  export type { UseVoiceRecorderOptions, UseVoiceRecorderResult, UseVoiceMessagePlayerOptions, UseVoiceMessagePlayerResult, } from './types/recorder';
17
- export { StorageSpaceEnum } from './types/upload';
18
17
  export { AUDIO_LEVEL_BARS } from './constants';
19
18
  export { clampValue } from './utils/math';
20
19
  export { formatTime } from './utils/format';
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAGH,OAAO,EAAE,aAAa,EAAE,MAAM,4BAA4B,CAAC;AAC3D,OAAO,EAAE,kBAAkB,EAAE,MAAM,oDAAoD,CAAC;AACxF,OAAO,EAAE,kBAAkB,EAAE,MAAM,oDAAoD,CAAC;AACxF,YAAY,EAAE,qBAAqB,EAAE,MAAM,oDAAoD,CAAC;AAChG,OAAO,EAAE,YAAY,EAAE,MAAM,wCAAwC,CAAC;AAGtE,OAAO,EAAE,gBAAgB,EAAE,MAAM,0BAA0B,CAAC;AAC5D,OAAO,EAAE,qBAAqB,EAAE,MAAM,+BAA+B,CAAC;AACtE,OAAO,EAAE,wBAAwB,EAAE,MAAM,kCAAkC,CAAC;AAC5E,OAAO,EAAE,kBAAkB,EAAE,MAAM,4BAA4B,CAAC;AAGhE,YAAY,EAAE,YAAY,EAAE,iBAAiB,EAAE,cAAc,EAA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EAAE,MAAM,cAAc,CAAC;AAC1C,OAAO,EAAE,UAAU,EAAE,MAAM,gBAAgB,CAAC;AAC5C,OAAO,EAAE,cAAc,EAAE,MAAM,0BAA0B,CAAC;AAC1D,OAAO,EAAE,kBAAkB,EAAE,MAAM,8BAA8B,CAAC"}
package/dist/index.js CHANGED
@@ -585,7 +585,7 @@ const useRecorderVisualization = () => {
585
585
  * @author: exode <hello@exode.ru>
586
586
  */
587
587
  const useRecordingSender = (options) => {
588
- const { space, uploader, fileName, mimeType, uploadId, audioBlob, onUploaded, onRecordingError, deleteRecording, autoResetAfterUpload, } = options;
588
+ const { uploader, fileName, mimeType, uploadId, audioBlob, onUploaded, onRecordingError, deleteRecording, autoResetAfterUpload, } = options;
589
589
  const sendRecording = useCallback(async () => {
590
590
  if (!audioBlob) {
591
591
  const error = new Error('Voice recording is not available');
@@ -601,7 +601,7 @@ const useRecordingSender = (options) => {
601
601
  const file = new File([audioBlob], fileName, {
602
602
  type: audioBlob.type || mimeType,
603
603
  });
604
- const uploaded = await uploader(file, { space, uploadId });
604
+ const uploaded = await uploader(file, { uploadId });
605
605
  await onUploaded(uploaded);
606
606
  if (autoResetAfterUpload) {
607
607
  deleteRecording();
@@ -612,7 +612,6 @@ const useRecordingSender = (options) => {
612
612
  throw error;
613
613
  }
614
614
  }, [
615
- space,
616
615
  uploadId,
617
616
  uploader,
618
617
  fileName,
@@ -632,7 +631,7 @@ const useRecordingSender = (options) => {
632
631
  * @author: exode <hello@exode.ru>
633
632
  */
634
633
  function useVoiceRecorder(props) {
635
- const { space, uploadId, uploader, onUploaded, onRecordingStop, onRecordingStart, onRecordingError, onRecordingDelete, onPermissionDenied, fileName = 'record.webm', mimeType = 'audio/webm', autoResetAfterUpload = true, } = props;
634
+ const { uploadId, uploader, onUploaded, onRecordingStop, onRecordingStart, onRecordingError, onRecordingDelete, onPermissionDenied, fileName = 'record.webm', mimeType = 'audio/webm', autoResetAfterUpload = true, } = props;
636
635
  const [audioBlob, setAudioBlob] = useState(null);
637
636
  const { audioURL, isPlaying, mountBlob, playbackTime, stopPlayback, resetPlayback, togglePlayback: _togglePlayback, playbackDuration, } = useAudioPlayback();
638
637
  const { audioLevels, previewLevels, resetAudioLevels, stopVisualization, resetPreviewLevels, resumeVisualization, cleanupVisualization, generatePreviewLevels, initializeVisualization, } = useRecorderVisualization();
@@ -662,7 +661,6 @@ function useVoiceRecorder(props) {
662
661
  audioBlob,
663
662
  fileName,
664
663
  mimeType,
665
- space,
666
664
  uploadId,
667
665
  uploader,
668
666
  autoResetAfterUpload,
@@ -1319,7 +1317,7 @@ const CircleButton = styled.button `
1319
1317
  cursor: pointer;
1320
1318
  transition: transform 160ms ease, color 160ms ease, background-color 160ms ease, box-shadow 160ms ease;
1321
1319
  flex-shrink: 0;
1322
- background: ${({ $variant }) => ($variant === 'play' ? 'var(--background_content, #ffffff)' : 'var(--background_content, #ffffff)')};
1320
+ background: var(--background_content, #ffffff);
1323
1321
 
1324
1322
  color: ${({ $variant }) => {
1325
1323
  if ($variant === 'record') {
@@ -1536,24 +1534,12 @@ const mergeMessages = (custom) => {
1536
1534
  };
1537
1535
  };
1538
1536
 
1539
- /**
1540
- * Upload types
1541
- *
1542
- * @author: exode <hello@exode.ru>
1543
- */
1544
- const StorageSpaceEnum = {
1545
- User: 'user',
1546
- Shared: 'shared',
1547
- System: 'system',
1548
- };
1549
-
1550
1537
  const AudioRecorder = (props) => {
1551
- const { space, fileName, uploadId, mimeType, className, uploader, onUploaded, onUploadError, onRecordingStop, onRecordingError, onRecordingStart, onRecordingDelete, onPermissionDenied, autoResetAfterUpload, messages: customMessages, } = props;
1538
+ const { fileName, uploadId, mimeType, className, uploader, onUploaded, onUploadError, onRecordingStop, onRecordingError, onRecordingStart, onRecordingDelete, onPermissionDenied, autoResetAfterUpload, messages: customMessages, } = props;
1552
1539
  const messages = useMemo(() => mergeMessages(customMessages), [customMessages]);
1553
1540
  const [resolvedUploadId] = useState(() => uploadId !== null && uploadId !== void 0 ? uploadId : (typeof crypto !== 'undefined' && 'randomUUID' in crypto
1554
1541
  ? crypto.randomUUID()
1555
1542
  : `upload-${Date.now()}`));
1556
- const resolvedSpace = space !== null && space !== void 0 ? space : StorageSpaceEnum.User;
1557
1543
  const handleRecorderError = useCallback((error) => {
1558
1544
  onRecordingError === null || onRecordingError === void 0 ? void 0 : onRecordingError(error);
1559
1545
  onUploadError === null || onUploadError === void 0 ? void 0 : onUploadError(error);
@@ -1571,7 +1557,6 @@ const AudioRecorder = (props) => {
1571
1557
  onRecordingDelete,
1572
1558
  onPermissionDenied,
1573
1559
  autoResetAfterUpload,
1574
- space: resolvedSpace,
1575
1560
  uploader,
1576
1561
  uploadId: resolvedUploadId,
1577
1562
  onRecordingError: handleRecorderError,
@@ -1594,7 +1579,7 @@ const AudioRecorder = (props) => {
1594
1579
  * @author: exode <hello@exode.ru>
1595
1580
  */
1596
1581
  const useVoiceRecorderInput = (options) => {
1597
- const { onSend, onError, onCancel, uploader, onUploaded, onPermissionDenied, autoStart = true, space = StorageSpaceEnum.User, mimeType = 'audio/webm', fileName = 'voice-message.webm', } = options;
1582
+ const { onSend, onError, onCancel, uploader, onUploaded, onPermissionDenied, autoStart = true, mimeType = 'audio/webm', fileName = 'voice-message.webm', } = options;
1598
1583
  const [isSending, setIsSending] = useState(false);
1599
1584
  const [timelineLevels, setTimelineLevels] = useState([]);
1600
1585
  const audioBlobRef = useRef(null);
@@ -1615,7 +1600,6 @@ const useVoiceRecorderInput = (options) => {
1615
1600
  }
1616
1601
  }, []);
1617
1602
  const recorder = useVoiceRecorder({
1618
- space,
1619
1603
  fileName,
1620
1604
  mimeType,
1621
1605
  uploadId,
@@ -1942,14 +1926,10 @@ const MicIndicator = styled.button `
1942
1926
  border: 0;
1943
1927
  flex-shrink: 0;
1944
1928
  cursor: pointer;
1945
- background: color-mix(in srgb, var(--exode_red, #ed1c24) 14%, transparent);
1946
- color: var(--exode_red, #ed1c24);
1929
+ background: var(--background_content, #ffffff);
1930
+ color: color-mix(in srgb, var(--accent, #3f8ae0) 86%, white 14%);
1947
1931
  transition: background-color 140ms ease, transform 120ms ease;
1948
1932
 
1949
- &:hover {
1950
- background: color-mix(in srgb, var(--exode_red, #ed1c24) 22%, transparent);
1951
- }
1952
-
1953
1933
  &:active {
1954
1934
  transform: scale(0.94);
1955
1935
  }
@@ -2312,5 +2292,5 @@ class VoiceBlobCacheClass {
2312
2292
  }
2313
2293
  const VoiceBlobCache = new VoiceBlobCacheClass();
2314
2294
 
2315
- export { AUDIO_LEVEL_BARS, AudioRecorder, StorageSpaceEnum, VoiceBlobCache, VoiceMessagePlayer, VoicePlaybackChain, VoiceRecorderInput, WaveformBars, clampValue, formatTime, useRecorderVisualization, useRecordingTiming, useVoiceMessagePlayer, useVoiceRecorder };
2295
+ export { AUDIO_LEVEL_BARS, AudioRecorder, VoiceBlobCache, VoiceMessagePlayer, VoicePlaybackChain, VoiceRecorderInput, WaveformBars, clampValue, formatTime, useRecorderVisualization, useRecordingTiming, useVoiceMessagePlayer, useVoiceRecorder };
2316
2296
  //# sourceMappingURL=index.js.map