@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/index.js
CHANGED
|
@@ -5996,20 +5996,18 @@ function getRecognitionCtor() {
|
|
|
5996
5996
|
var MIC_DENIED_MESSAGE = "Microphone access was blocked. Allow it in your browser's site settings to dictate.";
|
|
5997
5997
|
async function ensureMicrophoneAccess() {
|
|
5998
5998
|
const media = typeof navigator === "undefined" ? void 0 : navigator.mediaDevices;
|
|
5999
|
-
if (!media?.getUserMedia) return { ok: true };
|
|
5999
|
+
if (!media?.getUserMedia) return { ok: true, confirmed: false };
|
|
6000
6000
|
try {
|
|
6001
6001
|
const status = await navigator.permissions?.query({
|
|
6002
6002
|
name: "microphone"
|
|
6003
6003
|
});
|
|
6004
|
-
if (status?.state === "granted") return { ok: true };
|
|
6005
|
-
if (status?.state === "denied")
|
|
6006
|
-
return { ok: false, message: MIC_DENIED_MESSAGE };
|
|
6004
|
+
if (status?.state === "granted") return { ok: true, confirmed: true };
|
|
6007
6005
|
} catch {
|
|
6008
6006
|
}
|
|
6009
6007
|
try {
|
|
6010
6008
|
const stream = await media.getUserMedia({ audio: true });
|
|
6011
6009
|
for (const track of stream.getTracks()) track.stop();
|
|
6012
|
-
return { ok: true };
|
|
6010
|
+
return { ok: true, confirmed: true };
|
|
6013
6011
|
} catch (error) {
|
|
6014
6012
|
const name = typeof error === "object" && error !== null && "name" in error ? String(error.name) : "";
|
|
6015
6013
|
if (name === "NotAllowedError" || name === "SecurityError") {
|
|
@@ -6052,6 +6050,7 @@ function useSpeechInput({
|
|
|
6052
6050
|
const [error, setError] = React.useState(null);
|
|
6053
6051
|
const recognitionRef = React.useRef(null);
|
|
6054
6052
|
const startTokenRef = React.useRef(0);
|
|
6053
|
+
const micConfirmedRef = React.useRef(false);
|
|
6055
6054
|
const beginRecognitionRef = React.useRef(null);
|
|
6056
6055
|
const beginRecognition = React.useCallback(
|
|
6057
6056
|
(Ctor, token) => {
|
|
@@ -6086,6 +6085,7 @@ function useSpeechInput({
|
|
|
6086
6085
|
const token = startTokenRef.current;
|
|
6087
6086
|
void ensureMicrophoneAccess().then((access) => {
|
|
6088
6087
|
if (token !== startTokenRef.current) return;
|
|
6088
|
+
micConfirmedRef.current = access.ok && access.confirmed;
|
|
6089
6089
|
if (!access.ok) {
|
|
6090
6090
|
setListening(false);
|
|
6091
6091
|
setError(access.message);
|
|
@@ -6121,7 +6121,7 @@ function useSpeechInput({
|
|
|
6121
6121
|
if (settled.trim() !== "") finalRef.current(settled);
|
|
6122
6122
|
};
|
|
6123
6123
|
recognition.onerror = (event) => {
|
|
6124
|
-
const message = describeError(event.error);
|
|
6124
|
+
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);
|
|
6125
6125
|
setListening(false);
|
|
6126
6126
|
setInterim("");
|
|
6127
6127
|
if (message !== "") {
|