@arbidocs/react 0.5.152 → 0.5.153
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/artifacts/index.cjs +46 -46
- package/dist/calls/livekit/index.cjs +51 -51
- package/dist/{chunk-VXFTVWEI.cjs → chunk-4VHECR5O.cjs} +44 -44
- package/dist/{chunk-VXFTVWEI.cjs.map → chunk-4VHECR5O.cjs.map} +1 -1
- package/dist/{chunk-P2DPOZBS.cjs → chunk-5ZNO77YB.cjs} +11 -2
- package/dist/chunk-5ZNO77YB.cjs.map +1 -0
- package/dist/{chunk-MK5L56Z3.cjs → chunk-BUMLF3MS.cjs} +60 -60
- package/dist/{chunk-MK5L56Z3.cjs.map → chunk-BUMLF3MS.cjs.map} +1 -1
- package/dist/{chunk-6RRKO4ZK.cjs → chunk-DBWW6DXJ.cjs} +5 -5
- package/dist/{chunk-6RRKO4ZK.cjs.map → chunk-DBWW6DXJ.cjs.map} +1 -1
- package/dist/{chunk-KULS4YWP.cjs → chunk-DQODLWFX.cjs} +3 -3
- package/dist/{chunk-KULS4YWP.cjs.map → chunk-DQODLWFX.cjs.map} +1 -1
- package/dist/{chunk-GFX7LQGR.cjs → chunk-HISGJISX.cjs} +67 -67
- package/dist/{chunk-GFX7LQGR.cjs.map → chunk-HISGJISX.cjs.map} +1 -1
- package/dist/{chunk-BI7HFGXF.cjs → chunk-NJWQPNGD.cjs} +14 -14
- package/dist/{chunk-BI7HFGXF.cjs.map → chunk-NJWQPNGD.cjs.map} +1 -1
- package/dist/{chunk-SKJWJ3OY.cjs → chunk-WWGUGZZN.cjs} +39 -39
- package/dist/{chunk-SKJWJ3OY.cjs.map → chunk-WWGUGZZN.cjs.map} +1 -1
- package/dist/{chunk-WJIRX5MS.cjs → chunk-XQLJSNAL.cjs} +3 -3
- package/dist/{chunk-WJIRX5MS.cjs.map → chunk-XQLJSNAL.cjs.map} +1 -1
- package/dist/datasets/aggregate-source.js +133 -0
- package/dist/datasets/aggregate-source.js.map +7 -0
- package/dist/datasets/aggregate.js +72 -22
- package/dist/datasets/aggregate.js.map +2 -2
- package/dist/datasets/index.js +27 -1
- package/dist/datasets/index.js.map +2 -2
- package/dist/datasets/sources/activity.js +44 -9
- package/dist/datasets/sources/activity.js.map +2 -2
- package/dist/datasets/sources/conversations.js +37 -7
- package/dist/datasets/sources/conversations.js.map +2 -2
- package/dist/datasets/sources/documents.js +44 -6
- package/dist/datasets/sources/documents.js.map +2 -2
- package/dist/datasets/sources/facts.js +31 -5
- package/dist/datasets/sources/facts.js.map +3 -3
- package/dist/datasets/sources/tags.js +37 -5
- package/dist/datasets/sources/tags.js.map +3 -3
- package/dist/datasets/sources/usage.js +29 -32
- package/dist/datasets/sources/usage.js.map +2 -2
- package/dist/datasets/sources/workflows.js +56 -22
- package/dist/datasets/sources/workflows.js.map +2 -2
- package/dist/datasets/workspace-aggregate.js +64 -0
- package/dist/datasets/workspace-aggregate.js.map +7 -0
- package/dist/document-tools/core.cjs +102 -102
- package/dist/document-tools/core.d.ts +2 -2
- package/dist/document-tools/index.cjs +104 -104
- package/dist/document-tools/index.d.ts +2 -2
- package/dist/{file-shares.d-CamKxNLC.d.ts → file-shares.d-CyTnJ2Re.d.ts} +11 -0
- package/dist/index.cjs +2935 -2476
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.ts +138 -5
- package/dist/index.js +11 -2
- package/dist/index.js.map +2 -2
- package/dist/projects.js +9 -0
- package/dist/projects.js.map +2 -2
- package/dist/query-keys.js +9 -0
- package/dist/query-keys.js.map +2 -2
- package/dist/shell/index.cjs +40 -40
- package/dist/storage.js +24 -1
- package/dist/storage.js.map +2 -2
- package/dist/table-views.js +19 -1
- package/dist/table-views.js.map +2 -2
- package/dist/ui/index.cjs +181 -181
- package/dist/viewers/index.cjs +9 -9
- package/package.json +3 -3
- package/dist/chunk-P2DPOZBS.cjs.map +0 -1
package/dist/artifacts/index.cjs
CHANGED
|
@@ -1,15 +1,15 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
|
-
var
|
|
4
|
-
var
|
|
3
|
+
var chunk4VHECR5O_cjs = require('../chunk-4VHECR5O.cjs');
|
|
4
|
+
var chunkEM6DP62E_cjs = require('../chunk-EM6DP62E.cjs');
|
|
5
|
+
var chunkBUMLF3MS_cjs = require('../chunk-BUMLF3MS.cjs');
|
|
5
6
|
var chunk3AADNIOK_cjs = require('../chunk-3AADNIOK.cjs');
|
|
6
|
-
var chunkP2DPOZBS_cjs = require('../chunk-P2DPOZBS.cjs');
|
|
7
7
|
require('../chunk-N73IMVFF.cjs');
|
|
8
|
-
var
|
|
9
|
-
var
|
|
10
|
-
var chunkEM6DP62E_cjs = require('../chunk-EM6DP62E.cjs');
|
|
8
|
+
var chunk5ZNO77YB_cjs = require('../chunk-5ZNO77YB.cjs');
|
|
9
|
+
var chunkDQODLWFX_cjs = require('../chunk-DQODLWFX.cjs');
|
|
11
10
|
require('../chunk-5NOZDH3F.cjs');
|
|
12
11
|
require('../chunk-S6A6FSG7.cjs');
|
|
12
|
+
var chunkVOFNX4P6_cjs = require('../chunk-VOFNX4P6.cjs');
|
|
13
13
|
var react = require('react');
|
|
14
14
|
var reactQuery = require('@tanstack/react-query');
|
|
15
15
|
var jsxRuntime = require('react/jsx-runtime');
|
|
@@ -270,24 +270,24 @@ var isRefusal = (error) => {
|
|
|
270
270
|
return code === 401 || code === 403;
|
|
271
271
|
};
|
|
272
272
|
function useArtifactText(docId, options) {
|
|
273
|
-
const arbi =
|
|
273
|
+
const arbi = chunk5ZNO77YB_cjs.useArbi();
|
|
274
274
|
const { attempts, baseDelayMs, maxDelayMs } = {
|
|
275
275
|
...DEFAULT_ARTIFACT_TEXT_RETRY,
|
|
276
276
|
...options?.retry
|
|
277
277
|
};
|
|
278
|
-
const enabled = (options?.enabled ?? true) &&
|
|
278
|
+
const enabled = (options?.enabled ?? true) && chunkDQODLWFX_cjs.isDocumentId(docId) && arbi.hasWorkspace;
|
|
279
279
|
const query = reactQuery.useQuery({
|
|
280
280
|
// Under the shared `parsedDoc` key, so a document's invalidation reaches it too.
|
|
281
|
-
queryKey: [...
|
|
281
|
+
queryKey: [...chunk5ZNO77YB_cjs.arbiQueryKeys.parsedDoc(docId ?? "", "marker"), "artifact-text"],
|
|
282
282
|
queryFn: async () => {
|
|
283
|
-
const { docId: plainId, version } =
|
|
283
|
+
const { docId: plainId, version } = chunkDQODLWFX_cjs.parseVersionRef(docId);
|
|
284
284
|
const parsed = await arbi.documents.getParsedContent(
|
|
285
285
|
plainId,
|
|
286
286
|
"marker",
|
|
287
287
|
version ?? void 0
|
|
288
288
|
);
|
|
289
289
|
if (!parsed.chunks?.some((c) => c.content?.trim())) throw new NotParsedYetError();
|
|
290
|
-
return
|
|
290
|
+
return chunkDQODLWFX_cjs.flattenChunks(parsed.chunks, { unescape: true });
|
|
291
291
|
},
|
|
292
292
|
enabled,
|
|
293
293
|
retry: (failureCount, error) => !isRefusal(error) && failureCount < attempts,
|
|
@@ -325,22 +325,22 @@ function useArtifactText(docId, options) {
|
|
|
325
325
|
|
|
326
326
|
// src/artifacts/useArtifactSession.ts
|
|
327
327
|
function useArtifactVersions(workspaceId, docId) {
|
|
328
|
-
const plainId = docId ?
|
|
329
|
-
const { data: documents } =
|
|
328
|
+
const plainId = docId ? chunkDQODLWFX_cjs.parseVersionRef(docId).docId : null;
|
|
329
|
+
const { data: documents } = chunk4VHECR5O_cjs.useDocuments(workspaceId);
|
|
330
330
|
const listed = react.useMemo(
|
|
331
331
|
() => (documents ?? []).find((d) => d.external_id === plainId),
|
|
332
332
|
[documents, plainId]
|
|
333
333
|
);
|
|
334
|
-
const { data: history } =
|
|
334
|
+
const { data: history } = chunkBUMLF3MS_cjs.useDocumentVersionList(plainId, {
|
|
335
335
|
enabled: !!plainId && documents !== void 0 && !listed
|
|
336
336
|
});
|
|
337
337
|
return react.useMemo(
|
|
338
|
-
() => listed ?
|
|
338
|
+
() => listed ? chunkDQODLWFX_cjs.documentVersions(listed) : chunkDQODLWFX_cjs.toArtifactVersions(plainId, history),
|
|
339
339
|
[listed, history, plainId]
|
|
340
340
|
);
|
|
341
341
|
}
|
|
342
342
|
function useSaveArtifactVersion() {
|
|
343
|
-
const arbi =
|
|
343
|
+
const arbi = chunk5ZNO77YB_cjs.useArbi();
|
|
344
344
|
const queryClient = reactQuery.useQueryClient();
|
|
345
345
|
return reactQuery.useMutation({
|
|
346
346
|
mutationFn: async ({ title, content, versionOf, configId, wpType, autosave }) => {
|
|
@@ -351,15 +351,15 @@ function useSaveArtifactVersion() {
|
|
|
351
351
|
{
|
|
352
352
|
wpType: wpType ?? "artifact",
|
|
353
353
|
autosave,
|
|
354
|
-
versionOf: versionOf ?
|
|
354
|
+
versionOf: versionOf ? chunkDQODLWFX_cjs.parseVersionRef(versionOf).docId : void 0,
|
|
355
355
|
configExtId: configId ?? void 0
|
|
356
356
|
}
|
|
357
357
|
);
|
|
358
358
|
const docId = result.doc_ext_ids?.[0];
|
|
359
|
-
if (docId) await
|
|
360
|
-
await queryClient.invalidateQueries({ queryKey:
|
|
359
|
+
if (docId) await chunk4VHECR5O_cjs.refreshDocuments(queryClient, arbi, [docId]);
|
|
360
|
+
await queryClient.invalidateQueries({ queryKey: chunk5ZNO77YB_cjs.arbiQueryKeys.allDocumentVersions() });
|
|
361
361
|
if (docId)
|
|
362
|
-
await queryClient.invalidateQueries({ queryKey:
|
|
362
|
+
await queryClient.invalidateQueries({ queryKey: chunk5ZNO77YB_cjs.arbiQueryKeys.parsedDocument(docId) });
|
|
363
363
|
return { docId, version: result.version ?? void 0 };
|
|
364
364
|
}
|
|
365
365
|
});
|
|
@@ -379,7 +379,7 @@ function useArtifactSession(options) {
|
|
|
379
379
|
const [saved, setSaved] = react.useState(null);
|
|
380
380
|
const adopted = saved && saved.forId === hostDocId ? saved : null;
|
|
381
381
|
const docId = adopted?.id ?? hostDocId;
|
|
382
|
-
const isLocal = !
|
|
382
|
+
const isLocal = !chunkDQODLWFX_cjs.isDocumentId(docId);
|
|
383
383
|
const [ownCompareId, setOwnCompareId] = react.useState(null);
|
|
384
384
|
const activeCompareId = compareId === void 0 ? ownCompareId : compareId;
|
|
385
385
|
const changeCompare = react.useCallback(
|
|
@@ -396,7 +396,7 @@ function useArtifactSession(options) {
|
|
|
396
396
|
});
|
|
397
397
|
const saveVersion = useSaveArtifactVersion();
|
|
398
398
|
const autosaveVersion = saveVersion.mutateAsync;
|
|
399
|
-
const current =
|
|
399
|
+
const current = chunkDQODLWFX_cjs.findVersion(versions, docId);
|
|
400
400
|
const save = react.useCallback(
|
|
401
401
|
async (content) => {
|
|
402
402
|
const result = await saveVersion.mutateAsync({
|
|
@@ -412,7 +412,7 @@ function useArtifactSession(options) {
|
|
|
412
412
|
);
|
|
413
413
|
const handleSaved = react.useCallback(
|
|
414
414
|
(result, content) => {
|
|
415
|
-
if (!
|
|
415
|
+
if (!chunkDQODLWFX_cjs.isDocumentId(hostDocId) && result.docId)
|
|
416
416
|
setSaved({ forId: hostDocId, id: result.docId, text: content });
|
|
417
417
|
onSaved?.(result, content);
|
|
418
418
|
},
|
|
@@ -457,7 +457,7 @@ function useArtifactSession(options) {
|
|
|
457
457
|
]);
|
|
458
458
|
react.useEffect(() => {
|
|
459
459
|
if (!docId) return;
|
|
460
|
-
return
|
|
460
|
+
return chunk4VHECR5O_cjs.registerDocumentTurnFlush(docId, async () => {
|
|
461
461
|
if (session.hasChanges && !await session.save())
|
|
462
462
|
throw new Error("Save the document before sending your message.");
|
|
463
463
|
});
|
|
@@ -471,7 +471,7 @@ function useArtifactSession(options) {
|
|
|
471
471
|
isLoading,
|
|
472
472
|
status,
|
|
473
473
|
versions,
|
|
474
|
-
labelOf: (id) =>
|
|
474
|
+
labelOf: (id) => chunkDQODLWFX_cjs.versionLabel(versions, id),
|
|
475
475
|
view: {
|
|
476
476
|
content: session.baseline,
|
|
477
477
|
isEditing: session.isEditing,
|
|
@@ -518,9 +518,9 @@ function useArtifactSession(options) {
|
|
|
518
518
|
);
|
|
519
519
|
}
|
|
520
520
|
function useArtifactSource(documentId, enabled = true) {
|
|
521
|
-
const arbi =
|
|
521
|
+
const arbi = chunk5ZNO77YB_cjs.useArbi();
|
|
522
522
|
return reactQuery.useQuery({
|
|
523
|
-
queryKey:
|
|
523
|
+
queryKey: chunk5ZNO77YB_cjs.arbiQueryKeys.artifactSource(documentId ?? ""),
|
|
524
524
|
queryFn: async () => (await arbi.documents.download(documentId)).text(),
|
|
525
525
|
enabled: enabled && !!documentId && arbi.isLoggedIn,
|
|
526
526
|
staleTime: 5 * 60 * 1e3
|
|
@@ -547,7 +547,7 @@ function useStreamedArtifact({
|
|
|
547
547
|
const started = react.useRef(null);
|
|
548
548
|
const content = artifact?.content ?? "";
|
|
549
549
|
const title = artifact?.title ?? "Draft";
|
|
550
|
-
const passThrough = !!artifact &&
|
|
550
|
+
const passThrough = !!artifact && chunkDQODLWFX_cjs.isDocumentId(artifact.doc_ext_id);
|
|
551
551
|
const needsSave = settled && !!artifact && !passThrough && !!content.trim() && !!workspaceId;
|
|
552
552
|
react.useEffect(() => {
|
|
553
553
|
const key = `${attempt}:${content}`;
|
|
@@ -557,7 +557,7 @@ function useStreamedArtifact({
|
|
|
557
557
|
let stored;
|
|
558
558
|
if (clean) stored = clean(content);
|
|
559
559
|
else {
|
|
560
|
-
const report =
|
|
560
|
+
const report = chunkDQODLWFX_cjs.cleanDraftWithReport(content);
|
|
561
561
|
stored = report.text;
|
|
562
562
|
setCleaned(report);
|
|
563
563
|
onCleaned?.(report);
|
|
@@ -625,71 +625,71 @@ Object.defineProperty(exports, "revertRedlineRegion", {
|
|
|
625
625
|
});
|
|
626
626
|
Object.defineProperty(exports, "cleanDraftMarkdown", {
|
|
627
627
|
enumerable: true,
|
|
628
|
-
get: function () { return
|
|
628
|
+
get: function () { return chunkDQODLWFX_cjs.cleanDraftMarkdown; }
|
|
629
629
|
});
|
|
630
630
|
Object.defineProperty(exports, "cleanDraftWithReport", {
|
|
631
631
|
enumerable: true,
|
|
632
|
-
get: function () { return
|
|
632
|
+
get: function () { return chunkDQODLWFX_cjs.cleanDraftWithReport; }
|
|
633
633
|
});
|
|
634
634
|
Object.defineProperty(exports, "documentVersions", {
|
|
635
635
|
enumerable: true,
|
|
636
|
-
get: function () { return
|
|
636
|
+
get: function () { return chunkDQODLWFX_cjs.documentVersions; }
|
|
637
637
|
});
|
|
638
638
|
Object.defineProperty(exports, "findVersion", {
|
|
639
639
|
enumerable: true,
|
|
640
|
-
get: function () { return
|
|
640
|
+
get: function () { return chunkDQODLWFX_cjs.findVersion; }
|
|
641
641
|
});
|
|
642
642
|
Object.defineProperty(exports, "flattenChunks", {
|
|
643
643
|
enumerable: true,
|
|
644
|
-
get: function () { return
|
|
644
|
+
get: function () { return chunkDQODLWFX_cjs.flattenChunks; }
|
|
645
645
|
});
|
|
646
646
|
Object.defineProperty(exports, "isDocumentId", {
|
|
647
647
|
enumerable: true,
|
|
648
|
-
get: function () { return
|
|
648
|
+
get: function () { return chunkDQODLWFX_cjs.isDocumentId; }
|
|
649
649
|
});
|
|
650
650
|
Object.defineProperty(exports, "parseVersionRef", {
|
|
651
651
|
enumerable: true,
|
|
652
|
-
get: function () { return
|
|
652
|
+
get: function () { return chunkDQODLWFX_cjs.parseVersionRef; }
|
|
653
653
|
});
|
|
654
654
|
Object.defineProperty(exports, "promoteBoldTitle", {
|
|
655
655
|
enumerable: true,
|
|
656
|
-
get: function () { return
|
|
656
|
+
get: function () { return chunkDQODLWFX_cjs.promoteBoldTitle; }
|
|
657
657
|
});
|
|
658
658
|
Object.defineProperty(exports, "repairParsedStructure", {
|
|
659
659
|
enumerable: true,
|
|
660
|
-
get: function () { return
|
|
660
|
+
get: function () { return chunkDQODLWFX_cjs.repairParsedStructure; }
|
|
661
661
|
});
|
|
662
662
|
Object.defineProperty(exports, "repairParsedTitle", {
|
|
663
663
|
enumerable: true,
|
|
664
|
-
get: function () { return
|
|
664
|
+
get: function () { return chunkDQODLWFX_cjs.repairParsedTitle; }
|
|
665
665
|
});
|
|
666
666
|
Object.defineProperty(exports, "savedFromId", {
|
|
667
667
|
enumerable: true,
|
|
668
|
-
get: function () { return
|
|
668
|
+
get: function () { return chunkDQODLWFX_cjs.savedFromId; }
|
|
669
669
|
});
|
|
670
670
|
Object.defineProperty(exports, "stripAgentPreamble", {
|
|
671
671
|
enumerable: true,
|
|
672
|
-
get: function () { return
|
|
672
|
+
get: function () { return chunkDQODLWFX_cjs.stripAgentPreamble; }
|
|
673
673
|
});
|
|
674
674
|
Object.defineProperty(exports, "toArtifactVersions", {
|
|
675
675
|
enumerable: true,
|
|
676
|
-
get: function () { return
|
|
676
|
+
get: function () { return chunkDQODLWFX_cjs.toArtifactVersions; }
|
|
677
677
|
});
|
|
678
678
|
Object.defineProperty(exports, "unescapeMarkdown", {
|
|
679
679
|
enumerable: true,
|
|
680
|
-
get: function () { return
|
|
680
|
+
get: function () { return chunkDQODLWFX_cjs.unescapeMarkdown; }
|
|
681
681
|
});
|
|
682
682
|
Object.defineProperty(exports, "unwrapCitationLinks", {
|
|
683
683
|
enumerable: true,
|
|
684
|
-
get: function () { return
|
|
684
|
+
get: function () { return chunkDQODLWFX_cjs.unwrapCitationLinks; }
|
|
685
685
|
});
|
|
686
686
|
Object.defineProperty(exports, "versionLabel", {
|
|
687
687
|
enumerable: true,
|
|
688
|
-
get: function () { return
|
|
688
|
+
get: function () { return chunkDQODLWFX_cjs.versionLabel; }
|
|
689
689
|
});
|
|
690
690
|
Object.defineProperty(exports, "versionRef", {
|
|
691
691
|
enumerable: true,
|
|
692
|
-
get: function () { return
|
|
692
|
+
get: function () { return chunkDQODLWFX_cjs.versionRef; }
|
|
693
693
|
});
|
|
694
694
|
Object.defineProperty(exports, "normalizeMarkdown", {
|
|
695
695
|
enumerable: true,
|
|
@@ -1,15 +1,15 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
|
-
var
|
|
4
|
-
require('../../chunk-
|
|
5
|
-
|
|
3
|
+
var chunkHISGJISX_cjs = require('../../chunk-HISGJISX.cjs');
|
|
4
|
+
require('../../chunk-EEIYXVM4.cjs');
|
|
5
|
+
require('../../chunk-BUMLF3MS.cjs');
|
|
6
6
|
var chunkIX4HOS5Z_cjs = require('../../chunk-IX4HOS5Z.cjs');
|
|
7
7
|
require('../../chunk-N73IMVFF.cjs');
|
|
8
|
-
require('../../chunk-
|
|
9
|
-
require('../../chunk-
|
|
10
|
-
require('../../chunk-EEIYXVM4.cjs');
|
|
8
|
+
var chunk5ZNO77YB_cjs = require('../../chunk-5ZNO77YB.cjs');
|
|
9
|
+
require('../../chunk-DQODLWFX.cjs');
|
|
11
10
|
require('../../chunk-5NOZDH3F.cjs');
|
|
12
11
|
require('../../chunk-S6A6FSG7.cjs');
|
|
12
|
+
require('../../chunk-VOFNX4P6.cjs');
|
|
13
13
|
var react = require('react');
|
|
14
14
|
var livekitClient = require('livekit-client');
|
|
15
15
|
var componentsReact = require('@livekit/components-react');
|
|
@@ -120,11 +120,11 @@ function useCallTranscriber({
|
|
|
120
120
|
const room = componentsReact.useRoomContext();
|
|
121
121
|
const { localParticipant } = componentsReact.useLocalParticipant();
|
|
122
122
|
const myIdentity = localParticipant.identity;
|
|
123
|
-
const arbi =
|
|
123
|
+
const arbi = chunk5ZNO77YB_cjs.useArbi();
|
|
124
124
|
const queryClient = reactQuery.useQueryClient();
|
|
125
125
|
const profile = arbi.isLoggedIn ? arbi.user.profile() : null;
|
|
126
|
-
const myProfileName = profile &&
|
|
127
|
-
const deploymentAvailable =
|
|
126
|
+
const myProfileName = profile && chunkHISGJISX_cjs.toProfileView(profile).fullName || null;
|
|
127
|
+
const deploymentAvailable = chunkHISGJISX_cjs.useCallTranscriptionAvailable();
|
|
128
128
|
const available = deploymentAvailable && !!callKey;
|
|
129
129
|
const [state, setState] = react.useState(null);
|
|
130
130
|
const [creatorExtId, setCreatorExtId] = react.useState(null);
|
|
@@ -167,7 +167,7 @@ function useCallTranscriber({
|
|
|
167
167
|
};
|
|
168
168
|
}, [available, callExtId]);
|
|
169
169
|
react.useEffect(
|
|
170
|
-
() =>
|
|
170
|
+
() => chunkHISGJISX_cjs.onCallEvent("call.transcription", (message) => {
|
|
171
171
|
if (message.call_ext_id === callExtId) applyState(message);
|
|
172
172
|
}),
|
|
173
173
|
[callExtId, applyState]
|
|
@@ -183,7 +183,7 @@ function useCallTranscriber({
|
|
|
183
183
|
const persist = react.useCallback(
|
|
184
184
|
(segment, speakerNeedsProxy) => {
|
|
185
185
|
if (!callKey || persisted.current.has(segment.segmentId)) return;
|
|
186
|
-
const role =
|
|
186
|
+
const role = chunkHISGJISX_cjs.transcriptPersistRole({
|
|
187
187
|
myIdentity,
|
|
188
188
|
canPost: canPost && (segment.speakerIdentity !== myIdentity || selfPosts.current),
|
|
189
189
|
hasCallKey: true,
|
|
@@ -192,7 +192,7 @@ function useCallTranscriber({
|
|
|
192
192
|
});
|
|
193
193
|
if (!role) return;
|
|
194
194
|
persisted.current.add(segment.segmentId);
|
|
195
|
-
|
|
195
|
+
chunkHISGJISX_cjs.persistTranscriptSegment(arbi, queryClient, callExtId, callKey, segment).catch(
|
|
196
196
|
(err) => {
|
|
197
197
|
persisted.current.delete(segment.segmentId);
|
|
198
198
|
if (role === "own" && err?.status === 403) {
|
|
@@ -212,7 +212,7 @@ function useCallTranscriber({
|
|
|
212
212
|
);
|
|
213
213
|
react.useEffect(() => {
|
|
214
214
|
const onData = (payload, participant, _kind, topic, _encryption, participantIdentity) => {
|
|
215
|
-
if (topic ===
|
|
215
|
+
if (topic === chunkHISGJISX_cjs.CALL_TRANSCRIPTION_TOPIC) {
|
|
216
216
|
if (participant || participantIdentity) return;
|
|
217
217
|
try {
|
|
218
218
|
const next = browser.calls.transcriptionStateFrom(JSON.parse(new TextDecoder().decode(payload)));
|
|
@@ -221,10 +221,10 @@ function useCallTranscriber({
|
|
|
221
221
|
}
|
|
222
222
|
return;
|
|
223
223
|
}
|
|
224
|
-
if (topic !==
|
|
224
|
+
if (topic !== chunkHISGJISX_cjs.CALL_CAPTION_TOPIC || !callKey) return;
|
|
225
225
|
const identity = participant?.identity ?? participantIdentity;
|
|
226
226
|
if (!identity || identity === myIdentity) return;
|
|
227
|
-
void
|
|
227
|
+
void chunkHISGJISX_cjs.decodeCaptionPacket(payload, callKey).then((packet) => {
|
|
228
228
|
if (!packet || packet.identity !== identity) return;
|
|
229
229
|
const name = participant?.name || packet.name || identity;
|
|
230
230
|
const t = Math.min(packet.t, Date.now());
|
|
@@ -264,7 +264,7 @@ function useCallTranscriber({
|
|
|
264
264
|
})) {
|
|
265
265
|
return;
|
|
266
266
|
}
|
|
267
|
-
const segmentId =
|
|
267
|
+
const segmentId = chunkHISGJISX_cjs.newSegmentId();
|
|
268
268
|
const startedAt = new Date(segment.startedAt).toISOString();
|
|
269
269
|
let text;
|
|
270
270
|
try {
|
|
@@ -298,7 +298,7 @@ function useCallTranscriber({
|
|
|
298
298
|
});
|
|
299
299
|
try {
|
|
300
300
|
await localParticipant.publishData(
|
|
301
|
-
await
|
|
301
|
+
await chunkHISGJISX_cjs.encodeCaptionPacket(
|
|
302
302
|
{
|
|
303
303
|
v: 1,
|
|
304
304
|
segment_id: segmentId,
|
|
@@ -310,7 +310,7 @@ function useCallTranscriber({
|
|
|
310
310
|
},
|
|
311
311
|
callKey
|
|
312
312
|
),
|
|
313
|
-
{ reliable: true, topic:
|
|
313
|
+
{ reliable: true, topic: chunkHISGJISX_cjs.CALL_CAPTION_TOPIC }
|
|
314
314
|
);
|
|
315
315
|
} catch (err) {
|
|
316
316
|
console.warn("[calls] could not broadcast a caption", err);
|
|
@@ -391,7 +391,7 @@ function useCallRecorder({
|
|
|
391
391
|
isCreator,
|
|
392
392
|
linkVersion = null
|
|
393
393
|
}) {
|
|
394
|
-
const arbi =
|
|
394
|
+
const arbi = chunk5ZNO77YB_cjs.useArbi();
|
|
395
395
|
const queryClient = reactQuery.useQueryClient();
|
|
396
396
|
const room = componentsReact.useRoomContext();
|
|
397
397
|
const { localParticipant } = componentsReact.useLocalParticipant();
|
|
@@ -425,14 +425,14 @@ function useCallRecorder({
|
|
|
425
425
|
};
|
|
426
426
|
}, [callExtId]);
|
|
427
427
|
react.useEffect(
|
|
428
|
-
() =>
|
|
428
|
+
() => chunkHISGJISX_cjs.onCallEvent("call.recording", (message) => {
|
|
429
429
|
if (message.call_ext_id === callExtId) applyState(message);
|
|
430
430
|
}),
|
|
431
431
|
[callExtId, applyState]
|
|
432
432
|
);
|
|
433
433
|
react.useEffect(() => {
|
|
434
434
|
const onData = (payload, participant, _kind, topic, _encryption, participantIdentity) => {
|
|
435
|
-
if (topic !==
|
|
435
|
+
if (topic !== chunkHISGJISX_cjs.CALL_RECORDING_TOPIC) return;
|
|
436
436
|
if (participant || participantIdentity) return;
|
|
437
437
|
try {
|
|
438
438
|
const next = browser.calls.recordingStateFrom(JSON.parse(new TextDecoder().decode(payload)));
|
|
@@ -453,7 +453,7 @@ function useCallRecorder({
|
|
|
453
453
|
try {
|
|
454
454
|
const row = call ?? await arbi.calls.get(callExtId);
|
|
455
455
|
if (!row.workspace_locked && !row.chat_ext_id && callKey) {
|
|
456
|
-
const ref = await
|
|
456
|
+
const ref = await chunkHISGJISX_cjs.ensureMeetingChat(arbi, queryClient, callExtId, callKey);
|
|
457
457
|
if (ref.kind === "chat") setCall({ ...row, chat_ext_id: ref.chatExtId });
|
|
458
458
|
}
|
|
459
459
|
const answer = await arbi.calls.recording.start(callExtId, mode);
|
|
@@ -551,11 +551,11 @@ function useCallRecorder({
|
|
|
551
551
|
}
|
|
552
552
|
function useTrackUploader(recording, callKey, kind, mimeType) {
|
|
553
553
|
const { recordingExtId, call, startedAt, shouldCapture, markStopped, linkVersion } = recording;
|
|
554
|
-
const arbi =
|
|
554
|
+
const arbi = chunk5ZNO77YB_cjs.useArbi();
|
|
555
555
|
const queryClient = reactQuery.useQueryClient();
|
|
556
556
|
return react.useMemo(() => {
|
|
557
557
|
if (!shouldCapture || !recordingExtId || !call) return null;
|
|
558
|
-
return
|
|
558
|
+
return chunkHISGJISX_cjs.trackUploaderFor({
|
|
559
559
|
arbi,
|
|
560
560
|
callExtId: call.external_id,
|
|
561
561
|
recordingExtId,
|
|
@@ -563,7 +563,7 @@ function useTrackUploader(recording, callKey, kind, mimeType) {
|
|
|
563
563
|
mimeType,
|
|
564
564
|
recordingStartedAt: startedAt,
|
|
565
565
|
linkVersion,
|
|
566
|
-
conversationKey: () =>
|
|
566
|
+
conversationKey: () => chunkHISGJISX_cjs.conversationKeyForCall(arbi, queryClient, call, { callKey }),
|
|
567
567
|
// The server stopped the recording at the quota (its state event says so too).
|
|
568
568
|
onStopped: () => markStopped()
|
|
569
569
|
});
|
|
@@ -591,9 +591,9 @@ function useInCallChat({
|
|
|
591
591
|
const room = componentsReact.useRoomContext();
|
|
592
592
|
const { localParticipant } = componentsReact.useLocalParticipant();
|
|
593
593
|
const myIdentity = localParticipant.identity;
|
|
594
|
-
const arbi =
|
|
594
|
+
const arbi = chunk5ZNO77YB_cjs.useArbi();
|
|
595
595
|
const queryClient = reactQuery.useQueryClient();
|
|
596
|
-
const openMeetingChat =
|
|
596
|
+
const openMeetingChat = chunk5ZNO77YB_cjs.useArbiHost().calls?.openMeetingChat;
|
|
597
597
|
const signedIn = arbi.isLoggedIn;
|
|
598
598
|
const persists = !!callKey && signedIn && !readOnly && persist;
|
|
599
599
|
const [live, setLive] = react.useState([]);
|
|
@@ -612,10 +612,10 @@ function useInCallChat({
|
|
|
612
612
|
react.useEffect(() => {
|
|
613
613
|
if (!callKey) return;
|
|
614
614
|
const onData = (payload, participant, _kind, topic, _encryption, participantIdentity) => {
|
|
615
|
-
if (topic !==
|
|
615
|
+
if (topic !== chunkHISGJISX_cjs.CALL_CHAT_TOPIC) return;
|
|
616
616
|
const identity = participant?.identity ?? participantIdentity;
|
|
617
617
|
if (!identity || identity === myIdentity) return;
|
|
618
|
-
void
|
|
618
|
+
void chunkHISGJISX_cjs.decodeCallChatPacket(payload, callKey).then((packet) => {
|
|
619
619
|
if (!packet) return;
|
|
620
620
|
const key = `${identity}:${packet.id}`;
|
|
621
621
|
if (seen.current.has(key)) return;
|
|
@@ -645,7 +645,7 @@ function useInCallChat({
|
|
|
645
645
|
if (!open || !canRead || historyRequested.current) return;
|
|
646
646
|
historyRequested.current = true;
|
|
647
647
|
setHistoryLoading(true);
|
|
648
|
-
|
|
648
|
+
chunkHISGJISX_cjs.loadMeetingHistory(arbi, queryClient, callExtId).then((result) => {
|
|
649
649
|
if (!result) return;
|
|
650
650
|
setMeetingChat(result.ref);
|
|
651
651
|
setHistory(result.messages);
|
|
@@ -656,13 +656,13 @@ function useInCallChat({
|
|
|
656
656
|
}, [open, canRead, callExtId]);
|
|
657
657
|
const send = react.useCallback(
|
|
658
658
|
async (raw) => {
|
|
659
|
-
const text = raw.trim().slice(0,
|
|
659
|
+
const text = raw.trim().slice(0, chunkHISGJISX_cjs.CALL_CHAT_MAX_CHARS);
|
|
660
660
|
if (!text || !callKey || readOnly) return;
|
|
661
|
-
const id =
|
|
661
|
+
const id = chunkHISGJISX_cjs.newPacketId();
|
|
662
662
|
const at = Date.now();
|
|
663
663
|
await localParticipant.publishData(
|
|
664
|
-
await
|
|
665
|
-
{ reliable: true, topic:
|
|
664
|
+
await chunkHISGJISX_cjs.encodeCallChatPacket({ v: 1, id, text, at }, callKey),
|
|
665
|
+
{ reliable: true, topic: chunkHISGJISX_cjs.CALL_CHAT_TOPIC }
|
|
666
666
|
);
|
|
667
667
|
setLive((prev) => [
|
|
668
668
|
...prev,
|
|
@@ -681,7 +681,7 @@ function useInCallChat({
|
|
|
681
681
|
(prev) => prev.map((l) => l.id === id && l.senderIdentity === myIdentity ? { ...l, status } : l)
|
|
682
682
|
);
|
|
683
683
|
try {
|
|
684
|
-
setMeetingChat(await
|
|
684
|
+
setMeetingChat(await chunkHISGJISX_cjs.persistMeetingMessage(arbi, queryClient, callExtId, callKey, text));
|
|
685
685
|
mark("saved");
|
|
686
686
|
} catch (err) {
|
|
687
687
|
console.warn("[calls] could not keep the message in the meeting chat", err);
|
|
@@ -693,7 +693,7 @@ function useInCallChat({
|
|
|
693
693
|
const openMeeting = react.useCallback(async () => {
|
|
694
694
|
if (!callKey) return;
|
|
695
695
|
try {
|
|
696
|
-
const ref = meetingChat ?? await
|
|
696
|
+
const ref = meetingChat ?? await chunkHISGJISX_cjs.ensureMeetingChat(arbi, queryClient, callExtId, callKey);
|
|
697
697
|
setMeetingChat(ref);
|
|
698
698
|
openMeetingChat?.(ref);
|
|
699
699
|
} catch (err) {
|
|
@@ -701,7 +701,7 @@ function useInCallChat({
|
|
|
701
701
|
}
|
|
702
702
|
}, [callExtId, callKey, meetingChat]);
|
|
703
703
|
const lines = react.useMemo(
|
|
704
|
-
() =>
|
|
704
|
+
() => chunkHISGJISX_cjs.mergeChatLines(history, live, {
|
|
705
705
|
myIdentity,
|
|
706
706
|
nameOf: (identity) => identity === myIdentity ? localParticipant.name || "You" : room.remoteParticipants.get(identity)?.name || null
|
|
707
707
|
}),
|
|
@@ -733,7 +733,7 @@ function useWebinar({
|
|
|
733
733
|
linkVersion = null,
|
|
734
734
|
callKey
|
|
735
735
|
}) {
|
|
736
|
-
const arbi =
|
|
736
|
+
const arbi = chunk5ZNO77YB_cjs.useArbi();
|
|
737
737
|
const webinarApi = react.useCallback(() => arbi.calls.webinar, [arbi]);
|
|
738
738
|
const enabled = !!roleHint;
|
|
739
739
|
const room = componentsReact.useRoomContext();
|
|
@@ -760,7 +760,7 @@ function useWebinar({
|
|
|
760
760
|
const n = ++questionsRead.current;
|
|
761
761
|
try {
|
|
762
762
|
const rows = await webinarApi().questions.list(callExtId, linkVersion);
|
|
763
|
-
const opened = await Promise.all(rows.map((q) =>
|
|
763
|
+
const opened = await Promise.all(rows.map((q) => chunkHISGJISX_cjs.openQuestion(q, callKey)));
|
|
764
764
|
if (n === questionsRead.current) setQuestions(opened);
|
|
765
765
|
} catch (err) {
|
|
766
766
|
console.warn("[calls] could not load the questions", err);
|
|
@@ -772,7 +772,7 @@ function useWebinar({
|
|
|
772
772
|
}, [refresh, refreshQuestions]);
|
|
773
773
|
react.useEffect(() => {
|
|
774
774
|
if (!enabled) return;
|
|
775
|
-
return
|
|
775
|
+
return chunkHISGJISX_cjs.onCallEvent("call.webinar", (m) => {
|
|
776
776
|
if (m.call_ext_id !== callExtId) return;
|
|
777
777
|
setState((s) => s ? { ...s, live: m.live, chat: m.chat } : s);
|
|
778
778
|
});
|
|
@@ -781,8 +781,8 @@ function useWebinar({
|
|
|
781
781
|
react.useEffect(() => {
|
|
782
782
|
if (!enabled) return;
|
|
783
783
|
const onData = (payload, participant, _kind, topic, _encryption, participantIdentity) => {
|
|
784
|
-
if (topic !==
|
|
785
|
-
const packet =
|
|
784
|
+
if (topic !== chunkHISGJISX_cjs.CALL_WEBINAR_TOPIC) return;
|
|
785
|
+
const packet = chunkHISGJISX_cjs.parseWebinarPacket(payload, !!(participant || participantIdentity));
|
|
786
786
|
if (!packet) return;
|
|
787
787
|
switch (packet.type) {
|
|
788
788
|
case "state":
|
|
@@ -803,7 +803,7 @@ function useWebinar({
|
|
|
803
803
|
return;
|
|
804
804
|
case "demoted":
|
|
805
805
|
setStageCheck(false);
|
|
806
|
-
|
|
806
|
+
chunkHISGJISX_cjs.markRejoining(callExtId);
|
|
807
807
|
if (fallback.current) clearTimeout(fallback.current);
|
|
808
808
|
fallback.current = setTimeout(() => void room.disconnect(), DEMOTE_REJOIN_FALLBACK_MS);
|
|
809
809
|
return;
|
|
@@ -830,12 +830,12 @@ function useWebinar({
|
|
|
830
830
|
[callExtId, linkVersion]
|
|
831
831
|
);
|
|
832
832
|
const stepDown = react.useCallback(async () => {
|
|
833
|
-
|
|
833
|
+
chunkHISGJISX_cjs.markRejoining(callExtId);
|
|
834
834
|
setStageCheck(false);
|
|
835
835
|
try {
|
|
836
836
|
await webinarApi().demote(callExtId, myIdentity, linkVersion);
|
|
837
837
|
} catch (err) {
|
|
838
|
-
|
|
838
|
+
chunkHISGJISX_cjs.markRejoining(callExtId, false);
|
|
839
839
|
failed("leave the stage")(err);
|
|
840
840
|
}
|
|
841
841
|
}, [callExtId, myIdentity, linkVersion]);
|
|
@@ -895,7 +895,7 @@ function useWebinar({
|
|
|
895
895
|
if (!callKey) throw new Error("This call has no key.");
|
|
896
896
|
await webinarApi().questions.ask(
|
|
897
897
|
callExtId,
|
|
898
|
-
await
|
|
898
|
+
await chunkHISGJISX_cjs.sealQuestionText(text, callKey),
|
|
899
899
|
linkVersion
|
|
900
900
|
);
|
|
901
901
|
}, "ask the question"),
|
|
@@ -909,7 +909,7 @@ function useWebinar({
|
|
|
909
909
|
await webinarApi().questions.update(
|
|
910
910
|
callExtId,
|
|
911
911
|
id,
|
|
912
|
-
{ answer: await
|
|
912
|
+
{ answer: await chunkHISGJISX_cjs.sealQuestionText(text, callKey) },
|
|
913
913
|
linkVersion
|
|
914
914
|
);
|
|
915
915
|
}, "answer the question"),
|
|
@@ -939,15 +939,15 @@ function useWebinar({
|
|
|
939
939
|
function useHostMuteNotice(callExtId) {
|
|
940
940
|
const room = componentsReact.useRoomContext();
|
|
941
941
|
react.useEffect(() => {
|
|
942
|
-
const notifyMuted =
|
|
942
|
+
const notifyMuted = chunkHISGJISX_cjs.createMutedNotifier((text) => chunkIX4HOS5Z_cjs.notify.info(text));
|
|
943
943
|
const onData = (payload, participant, _kind, topic, _encryption, participantIdentity) => {
|
|
944
|
-
if (topic !==
|
|
944
|
+
if (topic !== chunkHISGJISX_cjs.CALL_MODERATION_TOPIC) return;
|
|
945
945
|
if (participant || participantIdentity) return;
|
|
946
|
-
const notice =
|
|
946
|
+
const notice = chunkHISGJISX_cjs.mutedNoticeFromPacket(payload);
|
|
947
947
|
if (notice) notifyMuted(notice);
|
|
948
948
|
};
|
|
949
949
|
room.on(livekitClient.RoomEvent.DataReceived, onData);
|
|
950
|
-
const offWs =
|
|
950
|
+
const offWs = chunkHISGJISX_cjs.onCallEvent("call.muted", (message) => {
|
|
951
951
|
if (message.callExtId === callExtId) notifyMuted(message);
|
|
952
952
|
});
|
|
953
953
|
return () => {
|