@burdenoff/website-sdk 2026.828.6 → 2026.828.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.
@@ -1281,20 +1281,18 @@ function getRecognitionCtor() {
1281
1281
  var MIC_DENIED_MESSAGE = "Microphone access was blocked. Allow it in your browser's site settings to dictate.";
1282
1282
  async function ensureMicrophoneAccess() {
1283
1283
  const media = typeof navigator === "undefined" ? void 0 : navigator.mediaDevices;
1284
- if (!media?.getUserMedia) return { ok: true };
1284
+ if (!media?.getUserMedia) return { ok: true, confirmed: false };
1285
1285
  try {
1286
1286
  const status = await navigator.permissions?.query({
1287
1287
  name: "microphone"
1288
1288
  });
1289
- if (status?.state === "granted") return { ok: true };
1290
- if (status?.state === "denied")
1291
- return { ok: false, message: MIC_DENIED_MESSAGE };
1289
+ if (status?.state === "granted") return { ok: true, confirmed: true };
1292
1290
  } catch {
1293
1291
  }
1294
1292
  try {
1295
1293
  const stream = await media.getUserMedia({ audio: true });
1296
1294
  for (const track of stream.getTracks()) track.stop();
1297
- return { ok: true };
1295
+ return { ok: true, confirmed: true };
1298
1296
  } catch (error) {
1299
1297
  const name = typeof error === "object" && error !== null && "name" in error ? String(error.name) : "";
1300
1298
  if (name === "NotAllowedError" || name === "SecurityError") {
@@ -1337,6 +1335,7 @@ function useSpeechInput({
1337
1335
  const [error, setError] = react.useState(null);
1338
1336
  const recognitionRef = react.useRef(null);
1339
1337
  const startTokenRef = react.useRef(0);
1338
+ const micConfirmedRef = react.useRef(false);
1340
1339
  const beginRecognitionRef = react.useRef(null);
1341
1340
  const beginRecognition = react.useCallback(
1342
1341
  (Ctor, token) => {
@@ -1371,6 +1370,7 @@ function useSpeechInput({
1371
1370
  const token = startTokenRef.current;
1372
1371
  void ensureMicrophoneAccess().then((access) => {
1373
1372
  if (token !== startTokenRef.current) return;
1373
+ micConfirmedRef.current = access.ok && access.confirmed;
1374
1374
  if (!access.ok) {
1375
1375
  setListening(false);
1376
1376
  setError(access.message);
@@ -1406,7 +1406,7 @@ function useSpeechInput({
1406
1406
  if (settled.trim() !== "") finalRef.current(settled);
1407
1407
  };
1408
1408
  recognition.onerror = (event) => {
1409
- const message = describeError(event.error);
1409
+ const message = micConfirmedRef.current && (event.error === "not-allowed" || event.error === "service-not-allowed") ? "Dictation isn't available in this browser. You can type instead." : describeError(event.error);
1410
1410
  setListening(false);
1411
1411
  setInterim("");
1412
1412
  if (message !== "") {