@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
|
@@ -1526,20 +1526,18 @@ function getRecognitionCtor() {
|
|
|
1526
1526
|
var MIC_DENIED_MESSAGE = "Microphone access was blocked. Allow it in your browser's site settings to dictate.";
|
|
1527
1527
|
async function ensureMicrophoneAccess() {
|
|
1528
1528
|
const media = typeof navigator === "undefined" ? void 0 : navigator.mediaDevices;
|
|
1529
|
-
if (!media?.getUserMedia) return { ok: true };
|
|
1529
|
+
if (!media?.getUserMedia) return { ok: true, confirmed: false };
|
|
1530
1530
|
try {
|
|
1531
1531
|
const status = await navigator.permissions?.query({
|
|
1532
1532
|
name: "microphone"
|
|
1533
1533
|
});
|
|
1534
|
-
if (status?.state === "granted") return { ok: true };
|
|
1535
|
-
if (status?.state === "denied")
|
|
1536
|
-
return { ok: false, message: MIC_DENIED_MESSAGE };
|
|
1534
|
+
if (status?.state === "granted") return { ok: true, confirmed: true };
|
|
1537
1535
|
} catch {
|
|
1538
1536
|
}
|
|
1539
1537
|
try {
|
|
1540
1538
|
const stream = await media.getUserMedia({ audio: true });
|
|
1541
1539
|
for (const track of stream.getTracks()) track.stop();
|
|
1542
|
-
return { ok: true };
|
|
1540
|
+
return { ok: true, confirmed: true };
|
|
1543
1541
|
} catch (error) {
|
|
1544
1542
|
const name = typeof error === "object" && error !== null && "name" in error ? String(error.name) : "";
|
|
1545
1543
|
if (name === "NotAllowedError" || name === "SecurityError") {
|
|
@@ -1582,6 +1580,7 @@ function useSpeechInput({
|
|
|
1582
1580
|
const [error, setError] = React.useState(null);
|
|
1583
1581
|
const recognitionRef = React.useRef(null);
|
|
1584
1582
|
const startTokenRef = React.useRef(0);
|
|
1583
|
+
const micConfirmedRef = React.useRef(false);
|
|
1585
1584
|
const beginRecognitionRef = React.useRef(null);
|
|
1586
1585
|
const beginRecognition = React.useCallback(
|
|
1587
1586
|
(Ctor, token) => {
|
|
@@ -1616,6 +1615,7 @@ function useSpeechInput({
|
|
|
1616
1615
|
const token = startTokenRef.current;
|
|
1617
1616
|
void ensureMicrophoneAccess().then((access) => {
|
|
1618
1617
|
if (token !== startTokenRef.current) return;
|
|
1618
|
+
micConfirmedRef.current = access.ok && access.confirmed;
|
|
1619
1619
|
if (!access.ok) {
|
|
1620
1620
|
setListening(false);
|
|
1621
1621
|
setError(access.message);
|
|
@@ -1651,7 +1651,7 @@ function useSpeechInput({
|
|
|
1651
1651
|
if (settled.trim() !== "") finalRef.current(settled);
|
|
1652
1652
|
};
|
|
1653
1653
|
recognition.onerror = (event) => {
|
|
1654
|
-
const message = describeError(event.error);
|
|
1654
|
+
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);
|
|
1655
1655
|
setListening(false);
|
|
1656
1656
|
setInterim("");
|
|
1657
1657
|
if (message !== "") {
|