sera-ai 1.0.6 → 1.0.7

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.mjs CHANGED
@@ -4583,6 +4583,7 @@ var useAudioDictation = ({
4583
4583
  onDictationComplete,
4584
4584
  onDictationStart,
4585
4585
  onProcessingStart,
4586
+ onError,
4586
4587
  apiKey,
4587
4588
  apiBaseUrl = API_BASE_URL2,
4588
4589
  appendMode = true,
@@ -4671,7 +4672,9 @@ var useAudioDictation = ({
4671
4672
  setAudioBuffer(combinedBuffer);
4672
4673
  } else {
4673
4674
  console.warn("Final chunk received but no audio data accumulated");
4674
- setDictationError("No audio data was recorded");
4675
+ const errorMessage = "No audio data was recorded";
4676
+ setDictationError(errorMessage);
4677
+ onError?.(errorMessage);
4675
4678
  }
4676
4679
  }
4677
4680
  };
@@ -4685,7 +4688,9 @@ var useAudioDictation = ({
4685
4688
  } catch (error) {
4686
4689
  console.error("Error starting dictation:", error);
4687
4690
  setIsDictating(false);
4688
- setDictationError("An error occurred while starting dictation");
4691
+ const errorMessage = "An error occurred while starting dictation";
4692
+ setDictationError(errorMessage);
4693
+ onError?.(errorMessage);
4689
4694
  }
4690
4695
  };
4691
4696
  const stopDictating = async () => {
@@ -4744,15 +4749,21 @@ var useAudioDictation = ({
4744
4749
  await processDictationAudio(combinedBuffer);
4745
4750
  } else {
4746
4751
  console.error("No valid audio data found");
4747
- setDictationError("No audio data recorded");
4752
+ const errorMessage = "No audio data recorded";
4753
+ setDictationError(errorMessage);
4754
+ onError?.(errorMessage);
4748
4755
  }
4749
4756
  } else {
4750
4757
  console.error("No audio data to process");
4751
- setDictationError("No audio data to process");
4758
+ const errorMessage = "No audio data to process";
4759
+ setDictationError(errorMessage);
4760
+ onError?.(errorMessage);
4752
4761
  }
4753
4762
  } catch (error) {
4754
4763
  console.error("Error stopping recording:", error);
4755
- setDictationError("An error occurred while stopping dictation");
4764
+ const errorMessage = "An error occurred while stopping dictation";
4765
+ setDictationError(errorMessage);
4766
+ onError?.(errorMessage);
4756
4767
  } finally {
4757
4768
  setIsDictating(false);
4758
4769
  audioSamplesRef.current = [];
@@ -4871,11 +4882,15 @@ var useAudioDictation = ({
4871
4882
  onDictationComplete(convertedData.dictation);
4872
4883
  } else {
4873
4884
  console.error("No dictation text in response");
4874
- setDictationError("No dictation text in response");
4885
+ const errorMessage = "No dictation text in response";
4886
+ setDictationError(errorMessage);
4887
+ onError?.(errorMessage);
4875
4888
  }
4876
4889
  } catch (error) {
4877
4890
  console.error("Error processing dictation audio:", error);
4878
- setDictationError("An error occurred while processing dictation");
4891
+ const errorMessage = "An error occurred while processing dictation";
4892
+ setDictationError(errorMessage);
4893
+ onError?.(errorMessage);
4879
4894
  } finally {
4880
4895
  setIsProcessing(false);
4881
4896
  setIsDictating(false);
@@ -4964,6 +4979,7 @@ var AudioDictation = ({
4964
4979
  onDictationComplete,
4965
4980
  onDictationStart,
4966
4981
  onProcessingStart,
4982
+ onError,
4967
4983
  className = "",
4968
4984
  style,
4969
4985
  buttonText,
@@ -4976,6 +4992,7 @@ var AudioDictation = ({
4976
4992
  onDictationComplete,
4977
4993
  onDictationStart,
4978
4994
  onProcessingStart,
4995
+ onError,
4979
4996
  apiKey,
4980
4997
  apiBaseUrl,
4981
4998
  appendMode,