@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.
- package/dist/components/explore.js +6 -6
- package/dist/components/explore.js.map +1 -1
- package/dist/components/explore.mjs +6 -6
- package/dist/components/explore.mjs.map +1 -1
- package/dist/hooks/index.js +6 -6
- package/dist/hooks/index.js.map +1 -1
- package/dist/hooks/index.mjs +6 -6
- package/dist/hooks/index.mjs.map +1 -1
- package/dist/index.js +6 -6
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +6 -6
- package/dist/index.mjs.map +1 -1
- package/package.json +1 -1
package/dist/hooks/index.mjs
CHANGED
|
@@ -1279,20 +1279,18 @@ function getRecognitionCtor() {
|
|
|
1279
1279
|
var MIC_DENIED_MESSAGE = "Microphone access was blocked. Allow it in your browser's site settings to dictate.";
|
|
1280
1280
|
async function ensureMicrophoneAccess() {
|
|
1281
1281
|
const media = typeof navigator === "undefined" ? void 0 : navigator.mediaDevices;
|
|
1282
|
-
if (!media?.getUserMedia) return { ok: true };
|
|
1282
|
+
if (!media?.getUserMedia) return { ok: true, confirmed: false };
|
|
1283
1283
|
try {
|
|
1284
1284
|
const status = await navigator.permissions?.query({
|
|
1285
1285
|
name: "microphone"
|
|
1286
1286
|
});
|
|
1287
|
-
if (status?.state === "granted") return { ok: true };
|
|
1288
|
-
if (status?.state === "denied")
|
|
1289
|
-
return { ok: false, message: MIC_DENIED_MESSAGE };
|
|
1287
|
+
if (status?.state === "granted") return { ok: true, confirmed: true };
|
|
1290
1288
|
} catch {
|
|
1291
1289
|
}
|
|
1292
1290
|
try {
|
|
1293
1291
|
const stream = await media.getUserMedia({ audio: true });
|
|
1294
1292
|
for (const track of stream.getTracks()) track.stop();
|
|
1295
|
-
return { ok: true };
|
|
1293
|
+
return { ok: true, confirmed: true };
|
|
1296
1294
|
} catch (error) {
|
|
1297
1295
|
const name = typeof error === "object" && error !== null && "name" in error ? String(error.name) : "";
|
|
1298
1296
|
if (name === "NotAllowedError" || name === "SecurityError") {
|
|
@@ -1335,6 +1333,7 @@ function useSpeechInput({
|
|
|
1335
1333
|
const [error, setError] = useState(null);
|
|
1336
1334
|
const recognitionRef = useRef(null);
|
|
1337
1335
|
const startTokenRef = useRef(0);
|
|
1336
|
+
const micConfirmedRef = useRef(false);
|
|
1338
1337
|
const beginRecognitionRef = useRef(null);
|
|
1339
1338
|
const beginRecognition = useCallback(
|
|
1340
1339
|
(Ctor, token) => {
|
|
@@ -1369,6 +1368,7 @@ function useSpeechInput({
|
|
|
1369
1368
|
const token = startTokenRef.current;
|
|
1370
1369
|
void ensureMicrophoneAccess().then((access) => {
|
|
1371
1370
|
if (token !== startTokenRef.current) return;
|
|
1371
|
+
micConfirmedRef.current = access.ok && access.confirmed;
|
|
1372
1372
|
if (!access.ok) {
|
|
1373
1373
|
setListening(false);
|
|
1374
1374
|
setError(access.message);
|
|
@@ -1404,7 +1404,7 @@ function useSpeechInput({
|
|
|
1404
1404
|
if (settled.trim() !== "") finalRef.current(settled);
|
|
1405
1405
|
};
|
|
1406
1406
|
recognition.onerror = (event) => {
|
|
1407
|
-
const message = describeError(event.error);
|
|
1407
|
+
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);
|
|
1408
1408
|
setListening(false);
|
|
1409
1409
|
setInterim("");
|
|
1410
1410
|
if (message !== "") {
|