@arbidocs/react 0.3.172 → 0.3.173
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/index.cjs +46 -10
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +9 -1
- package/dist/index.d.ts +9 -1
- package/dist/index.js +39 -3
- package/dist/index.js.map +1 -1
- package/package.json +3 -3
package/dist/index.cjs
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
|
-
var chunk5DV7FW6T_cjs = require('./chunk-5DV7FW6T.cjs');
|
|
4
3
|
var chunkRWCMW36I_cjs = require('./chunk-RWCMW36I.cjs');
|
|
4
|
+
var chunk5DV7FW6T_cjs = require('./chunk-5DV7FW6T.cjs');
|
|
5
5
|
var React2 = require('react');
|
|
6
6
|
var reactQuery = require('@tanstack/react-query');
|
|
7
7
|
var jsxRuntime = require('react/jsx-runtime');
|
|
@@ -7384,12 +7384,34 @@ function VoiceNoteRecorder({
|
|
|
7384
7384
|
onDiscard,
|
|
7385
7385
|
onError,
|
|
7386
7386
|
title = "Voice note",
|
|
7387
|
-
isSaving = false
|
|
7387
|
+
isSaving = false,
|
|
7388
|
+
transcribe
|
|
7388
7389
|
}) {
|
|
7389
7390
|
const recorder = useAudioRecorder();
|
|
7391
|
+
const [transcript, setTranscript] = React2.useState(null);
|
|
7392
|
+
const [isTranscribing, setIsTranscribing] = React2.useState(false);
|
|
7390
7393
|
React2.useEffect(() => {
|
|
7391
7394
|
if (recorder.error) onError?.(recorder.error);
|
|
7392
7395
|
}, [recorder.error]);
|
|
7396
|
+
React2.useEffect(() => {
|
|
7397
|
+
if (recorder.state !== "stopped" || !recorder.blob) {
|
|
7398
|
+
setTranscript(null);
|
|
7399
|
+
setIsTranscribing(false);
|
|
7400
|
+
return;
|
|
7401
|
+
}
|
|
7402
|
+
if (!transcribe) return;
|
|
7403
|
+
let cancelled = false;
|
|
7404
|
+
setIsTranscribing(true);
|
|
7405
|
+
transcribe(recorder.blob).then((text) => {
|
|
7406
|
+
if (!cancelled) setTranscript(text);
|
|
7407
|
+
}).catch(() => {
|
|
7408
|
+
}).finally(() => {
|
|
7409
|
+
if (!cancelled) setIsTranscribing(false);
|
|
7410
|
+
});
|
|
7411
|
+
return () => {
|
|
7412
|
+
cancelled = true;
|
|
7413
|
+
};
|
|
7414
|
+
}, [recorder.state, recorder.blob]);
|
|
7393
7415
|
const handleSave = () => {
|
|
7394
7416
|
if (!recorder.blob) return;
|
|
7395
7417
|
void onSave(recorder.blob, recorder.mimeType);
|
|
@@ -7452,6 +7474,20 @@ function VoiceNoteRecorder({
|
|
|
7452
7474
|
] }),
|
|
7453
7475
|
recorder.state === "stopped" && recorder.blob && /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
|
|
7454
7476
|
/* @__PURE__ */ jsxRuntime.jsx("div", { className: "w-full max-w-md", children: /* @__PURE__ */ jsxRuntime.jsx(chunkRWCMW36I_cjs.AudioViewer, { blob: recorder.blob, title }) }),
|
|
7477
|
+
(isTranscribing || transcript) && /* @__PURE__ */ jsxRuntime.jsx(
|
|
7478
|
+
"div",
|
|
7479
|
+
{
|
|
7480
|
+
className: "w-full max-w-md rounded-md border border-border bg-muted/30 p-3 text-sm text-muted-foreground",
|
|
7481
|
+
"data-testid": "voice-note-rough-transcript",
|
|
7482
|
+
children: isTranscribing ? /* @__PURE__ */ jsxRuntime.jsxs("span", { className: "flex items-center gap-1.5", children: [
|
|
7483
|
+
/* @__PURE__ */ jsxRuntime.jsx(lucideReact.Loader2, { className: "h-3.5 w-3.5 animate-spin" }),
|
|
7484
|
+
"Transcribing\u2026"
|
|
7485
|
+
] }) : /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
|
|
7486
|
+
/* @__PURE__ */ jsxRuntime.jsx("p", { className: "mb-1 text-xs font-semibold uppercase tracking-wide", children: "Rough transcript" }),
|
|
7487
|
+
/* @__PURE__ */ jsxRuntime.jsx("p", { children: transcript })
|
|
7488
|
+
] })
|
|
7489
|
+
}
|
|
7490
|
+
),
|
|
7455
7491
|
/* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex items-center gap-3", children: [
|
|
7456
7492
|
/* @__PURE__ */ jsxRuntime.jsxs(
|
|
7457
7493
|
chunk5DV7FW6T_cjs.Button,
|
|
@@ -7523,6 +7559,14 @@ function hasVideoTrack(blob) {
|
|
|
7523
7559
|
});
|
|
7524
7560
|
}
|
|
7525
7561
|
|
|
7562
|
+
Object.defineProperty(exports, "ArbiProvider", {
|
|
7563
|
+
enumerable: true,
|
|
7564
|
+
get: function () { return chunkRWCMW36I_cjs.ArbiProvider; }
|
|
7565
|
+
});
|
|
7566
|
+
Object.defineProperty(exports, "useArbi", {
|
|
7567
|
+
enumerable: true,
|
|
7568
|
+
get: function () { return chunkRWCMW36I_cjs.useArbi; }
|
|
7569
|
+
});
|
|
7526
7570
|
Object.defineProperty(exports, "AiMarkdown", {
|
|
7527
7571
|
enumerable: true,
|
|
7528
7572
|
get: function () { return chunk5DV7FW6T_cjs.AiMarkdown; }
|
|
@@ -7947,14 +7991,6 @@ Object.defineProperty(exports, "toggleVariants", {
|
|
|
7947
7991
|
enumerable: true,
|
|
7948
7992
|
get: function () { return chunk5DV7FW6T_cjs.toggleVariants; }
|
|
7949
7993
|
});
|
|
7950
|
-
Object.defineProperty(exports, "ArbiProvider", {
|
|
7951
|
-
enumerable: true,
|
|
7952
|
-
get: function () { return chunkRWCMW36I_cjs.ArbiProvider; }
|
|
7953
|
-
});
|
|
7954
|
-
Object.defineProperty(exports, "useArbi", {
|
|
7955
|
-
enumerable: true,
|
|
7956
|
-
get: function () { return chunkRWCMW36I_cjs.useArbi; }
|
|
7957
|
-
});
|
|
7958
7994
|
Object.defineProperty(exports, "Arbi", {
|
|
7959
7995
|
enumerable: true,
|
|
7960
7996
|
get: function () { return browser.Arbi; }
|