@designcrowd/fe-shared-lib 1.8.6 → 1.8.8

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@designcrowd/fe-shared-lib",
3
- "version": "1.8.6",
3
+ "version": "1.8.8",
4
4
  "scripts": {
5
5
  "start": "run-p storybook watch:translation",
6
6
  "build": "npm run build:css --production",
@@ -35,6 +35,7 @@ const ERROR_MESSAGES: Record<string, string> = {
35
35
  'language-not-supported': 'This language is not supported.',
36
36
  network: 'A network error occurred. Please check your connection.',
37
37
  'audio-capture': 'No microphone was found or microphone is not working.',
38
+ 'service-not-allowed': 'Speech recognition is off. Turn it on in Settings to use this feature.',
38
39
  };
39
40
 
40
41
  const ERROR_CLEAR_DELAY = 5000;
@@ -103,6 +104,8 @@ export function useVoiceToText(options: UseVoiceToTextOptions = {}): UseVoiceToT
103
104
  return;
104
105
  }
105
106
 
107
+ isListening.value = false;
108
+
106
109
  const message = ERROR_MESSAGES[event.error] || 'An error occurred with speech recognition.';
107
110
  error.value = message;
108
111
 
@@ -117,6 +120,10 @@ export function useVoiceToText(options: UseVoiceToTextOptions = {}): UseVoiceToT
117
120
  }, ERROR_CLEAR_DELAY);
118
121
  };
119
122
 
123
+ recognition.onstart = () => {
124
+ isListening.value = true;
125
+ };
126
+
120
127
  recognition.onend = () => {
121
128
  isListening.value = false;
122
129
  };
@@ -141,7 +148,6 @@ export function useVoiceToText(options: UseVoiceToTextOptions = {}): UseVoiceToT
141
148
 
142
149
  try {
143
150
  recognition.start();
144
- isListening.value = true;
145
151
  } catch (e: unknown) {
146
152
  // eslint-disable-next-line no-console
147
153
  console.warn('[useVoiceToText] Failed to start:', (e as Error).message);