@arbidocs/react 0.5.167 → 0.5.169
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 +34 -34
- package/dist/automation/index.cjs +16 -0
- package/dist/automation/index.cjs.map +1 -0
- package/dist/automation/index.d.ts +8 -0
- package/dist/automation/index.js +12 -0
- package/dist/automation/index.js.map +7 -0
- package/dist/calls/livekit/index.cjs +44 -44
- package/dist/{chunk-HRQS27DO.cjs → chunk-3IBQW2UD.cjs} +27 -27
- package/dist/{chunk-HRQS27DO.cjs.map → chunk-3IBQW2UD.cjs.map} +1 -1
- package/dist/{chunk-4TWXQFHU.cjs → chunk-C5O4BH7B.cjs} +8 -8
- package/dist/{chunk-4TWXQFHU.cjs.map → chunk-C5O4BH7B.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-TX7UCN73.cjs → chunk-K6MO6YML.cjs} +6 -6
- package/dist/{chunk-TX7UCN73.cjs.map → chunk-K6MO6YML.cjs.map} +1 -1
- package/dist/{chunk-BI4SYRLX.cjs → chunk-NBES77PB.cjs} +5 -5
- package/dist/{chunk-BI4SYRLX.cjs.map → chunk-NBES77PB.cjs.map} +1 -1
- package/dist/{chunk-3DPOR5IR.cjs → chunk-UMQY6L7P.cjs} +5 -5
- package/dist/{chunk-3DPOR5IR.cjs.map → chunk-UMQY6L7P.cjs.map} +1 -1
- package/dist/document-tools/core.cjs +101 -101
- package/dist/document-tools/index.cjs +103 -103
- package/dist/index.cjs +1577 -1577
- package/dist/shell/index.cjs +40 -40
- package/package.json +8 -3
package/dist/artifacts/index.cjs
CHANGED
|
@@ -1,15 +1,15 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
3
|
var chunkQ7BGWKHP_cjs = require('../chunk-Q7BGWKHP.cjs');
|
|
4
|
-
var
|
|
4
|
+
var chunkEM6DP62E_cjs = require('../chunk-EM6DP62E.cjs');
|
|
5
|
+
var chunkNBES77PB_cjs = require('../chunk-NBES77PB.cjs');
|
|
5
6
|
var chunk3AADNIOK_cjs = require('../chunk-3AADNIOK.cjs');
|
|
6
7
|
var chunk5QOZLKAY_cjs = require('../chunk-5QOZLKAY.cjs');
|
|
7
8
|
require('../chunk-N73IMVFF.cjs');
|
|
8
|
-
var
|
|
9
|
-
var chunkVOFNX4P6_cjs = require('../chunk-VOFNX4P6.cjs');
|
|
10
|
-
var chunkEM6DP62E_cjs = require('../chunk-EM6DP62E.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');
|
|
@@ -275,19 +275,19 @@ function useArtifactText(docId, options) {
|
|
|
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
281
|
queryKey: [...chunk5QOZLKAY_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,17 +325,17 @@ function useArtifactText(docId, options) {
|
|
|
325
325
|
|
|
326
326
|
// src/artifacts/useArtifactSession.ts
|
|
327
327
|
function useArtifactVersions(workspaceId, docId) {
|
|
328
|
-
const plainId = docId ?
|
|
328
|
+
const plainId = docId ? chunkDQODLWFX_cjs.parseVersionRef(docId).docId : null;
|
|
329
329
|
const { data: documents } = chunkQ7BGWKHP_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 } = chunkNBES77PB_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
|
}
|
|
@@ -351,7 +351,7 @@ 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
|
);
|
|
@@ -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
|
},
|
|
@@ -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,
|
|
@@ -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);
|
|
@@ -635,71 +635,71 @@ Object.defineProperty(exports, "revertRedlineRegion", {
|
|
|
635
635
|
});
|
|
636
636
|
Object.defineProperty(exports, "cleanDraftMarkdown", {
|
|
637
637
|
enumerable: true,
|
|
638
|
-
get: function () { return
|
|
638
|
+
get: function () { return chunkDQODLWFX_cjs.cleanDraftMarkdown; }
|
|
639
639
|
});
|
|
640
640
|
Object.defineProperty(exports, "cleanDraftWithReport", {
|
|
641
641
|
enumerable: true,
|
|
642
|
-
get: function () { return
|
|
642
|
+
get: function () { return chunkDQODLWFX_cjs.cleanDraftWithReport; }
|
|
643
643
|
});
|
|
644
644
|
Object.defineProperty(exports, "documentVersions", {
|
|
645
645
|
enumerable: true,
|
|
646
|
-
get: function () { return
|
|
646
|
+
get: function () { return chunkDQODLWFX_cjs.documentVersions; }
|
|
647
647
|
});
|
|
648
648
|
Object.defineProperty(exports, "findVersion", {
|
|
649
649
|
enumerable: true,
|
|
650
|
-
get: function () { return
|
|
650
|
+
get: function () { return chunkDQODLWFX_cjs.findVersion; }
|
|
651
651
|
});
|
|
652
652
|
Object.defineProperty(exports, "flattenChunks", {
|
|
653
653
|
enumerable: true,
|
|
654
|
-
get: function () { return
|
|
654
|
+
get: function () { return chunkDQODLWFX_cjs.flattenChunks; }
|
|
655
655
|
});
|
|
656
656
|
Object.defineProperty(exports, "isDocumentId", {
|
|
657
657
|
enumerable: true,
|
|
658
|
-
get: function () { return
|
|
658
|
+
get: function () { return chunkDQODLWFX_cjs.isDocumentId; }
|
|
659
659
|
});
|
|
660
660
|
Object.defineProperty(exports, "parseVersionRef", {
|
|
661
661
|
enumerable: true,
|
|
662
|
-
get: function () { return
|
|
662
|
+
get: function () { return chunkDQODLWFX_cjs.parseVersionRef; }
|
|
663
663
|
});
|
|
664
664
|
Object.defineProperty(exports, "promoteBoldTitle", {
|
|
665
665
|
enumerable: true,
|
|
666
|
-
get: function () { return
|
|
666
|
+
get: function () { return chunkDQODLWFX_cjs.promoteBoldTitle; }
|
|
667
667
|
});
|
|
668
668
|
Object.defineProperty(exports, "repairParsedStructure", {
|
|
669
669
|
enumerable: true,
|
|
670
|
-
get: function () { return
|
|
670
|
+
get: function () { return chunkDQODLWFX_cjs.repairParsedStructure; }
|
|
671
671
|
});
|
|
672
672
|
Object.defineProperty(exports, "repairParsedTitle", {
|
|
673
673
|
enumerable: true,
|
|
674
|
-
get: function () { return
|
|
674
|
+
get: function () { return chunkDQODLWFX_cjs.repairParsedTitle; }
|
|
675
675
|
});
|
|
676
676
|
Object.defineProperty(exports, "savedFromId", {
|
|
677
677
|
enumerable: true,
|
|
678
|
-
get: function () { return
|
|
678
|
+
get: function () { return chunkDQODLWFX_cjs.savedFromId; }
|
|
679
679
|
});
|
|
680
680
|
Object.defineProperty(exports, "stripAgentPreamble", {
|
|
681
681
|
enumerable: true,
|
|
682
|
-
get: function () { return
|
|
682
|
+
get: function () { return chunkDQODLWFX_cjs.stripAgentPreamble; }
|
|
683
683
|
});
|
|
684
684
|
Object.defineProperty(exports, "toArtifactVersions", {
|
|
685
685
|
enumerable: true,
|
|
686
|
-
get: function () { return
|
|
686
|
+
get: function () { return chunkDQODLWFX_cjs.toArtifactVersions; }
|
|
687
687
|
});
|
|
688
688
|
Object.defineProperty(exports, "unescapeMarkdown", {
|
|
689
689
|
enumerable: true,
|
|
690
|
-
get: function () { return
|
|
690
|
+
get: function () { return chunkDQODLWFX_cjs.unescapeMarkdown; }
|
|
691
691
|
});
|
|
692
692
|
Object.defineProperty(exports, "unwrapCitationLinks", {
|
|
693
693
|
enumerable: true,
|
|
694
|
-
get: function () { return
|
|
694
|
+
get: function () { return chunkDQODLWFX_cjs.unwrapCitationLinks; }
|
|
695
695
|
});
|
|
696
696
|
Object.defineProperty(exports, "versionLabel", {
|
|
697
697
|
enumerable: true,
|
|
698
|
-
get: function () { return
|
|
698
|
+
get: function () { return chunkDQODLWFX_cjs.versionLabel; }
|
|
699
699
|
});
|
|
700
700
|
Object.defineProperty(exports, "versionRef", {
|
|
701
701
|
enumerable: true,
|
|
702
|
-
get: function () { return
|
|
702
|
+
get: function () { return chunkDQODLWFX_cjs.versionRef; }
|
|
703
703
|
});
|
|
704
704
|
Object.defineProperty(exports, "normalizeMarkdown", {
|
|
705
705
|
enumerable: true,
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
var react = require('react');
|
|
4
|
+
var automation = require('@arbidocs/sdk/automation');
|
|
5
|
+
|
|
6
|
+
// src/automation/index.ts
|
|
7
|
+
function useAutomation(options) {
|
|
8
|
+
return react.useMemo(
|
|
9
|
+
() => automation.createAutomationClient(options),
|
|
10
|
+
[options.baseUrl, options.getAccessToken, options.fetch]
|
|
11
|
+
);
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
exports.useAutomation = useAutomation;
|
|
15
|
+
//# sourceMappingURL=index.cjs.map
|
|
16
|
+
//# sourceMappingURL=index.cjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../src/automation/index.ts"],"names":["useMemo","createAutomationClient"],"mappings":";;;;;;AAIO,SAAS,cAAc,OAAA,EAAkC;AAC9D,EAAA,OAAOA,aAAA;AAAA,IACL,MAAMC,kCAAuB,OAAO,CAAA;AAAA,IACpC,CAAC,OAAA,CAAQ,OAAA,EAAS,OAAA,CAAQ,cAAA,EAAgB,QAAQ,KAAK;AAAA,GACzD;AACF","file":"index.cjs","sourcesContent":["import { useMemo } from 'react'\nimport { createAutomationClient, type AutomationClientOptions } from '@arbidocs/sdk/automation'\n\n/** Access the automation board with the host's refreshed administrator token. */\nexport function useAutomation(options: AutomationClientOptions) {\n return useMemo(\n () => createAutomationClient(options),\n [options.baseUrl, options.getAccessToken, options.fetch]\n )\n}\n"]}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { AutomationClientOptions } from '@arbidocs/sdk/automation';
|
|
2
|
+
|
|
3
|
+
/** Access the automation board with the host's refreshed administrator token. */
|
|
4
|
+
declare function useAutomation(options: AutomationClientOptions): {
|
|
5
|
+
request(method: string, path: string, body?: unknown, signal?: AbortSignal): Promise<unknown>;
|
|
6
|
+
};
|
|
7
|
+
|
|
8
|
+
export { useAutomation };
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { useMemo } from "react";
|
|
2
|
+
import { createAutomationClient } from "@arbidocs/sdk/automation";
|
|
3
|
+
function useAutomation(options) {
|
|
4
|
+
return useMemo(
|
|
5
|
+
() => createAutomationClient(options),
|
|
6
|
+
[options.baseUrl, options.getAccessToken, options.fetch]
|
|
7
|
+
);
|
|
8
|
+
}
|
|
9
|
+
export {
|
|
10
|
+
useAutomation
|
|
11
|
+
};
|
|
12
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../../src/automation/index.ts"],
|
|
4
|
+
"sourcesContent": ["import { useMemo } from 'react'\nimport { createAutomationClient, type AutomationClientOptions } from '@arbidocs/sdk/automation'\n\n/** Access the automation board with the host's refreshed administrator token. */\nexport function useAutomation(options: AutomationClientOptions) {\n return useMemo(\n () => createAutomationClient(options),\n [options.baseUrl, options.getAccessToken, options.fetch]\n )\n}\n"],
|
|
5
|
+
"mappings": "AAAA,SAAS,eAAe;AACxB,SAAS,8BAA4D;AAG9D,SAAS,cAAc,SAAkC;AAC9D,SAAO;AAAA,IACL,MAAM,uBAAuB,OAAO;AAAA,IACpC,CAAC,QAAQ,SAAS,QAAQ,gBAAgB,QAAQ,KAAK;AAAA,EACzD;AACF;",
|
|
6
|
+
"names": []
|
|
7
|
+
}
|
|
@@ -1,15 +1,15 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
|
-
var
|
|
4
|
-
require('../../chunk-
|
|
3
|
+
var chunkC5O4BH7B_cjs = require('../../chunk-C5O4BH7B.cjs');
|
|
4
|
+
require('../../chunk-EEIYXVM4.cjs');
|
|
5
|
+
require('../../chunk-NBES77PB.cjs');
|
|
5
6
|
var chunk5QOZLKAY_cjs = require('../../chunk-5QOZLKAY.cjs');
|
|
6
7
|
var chunk5ECKSF6H_cjs = require('../../chunk-5ECKSF6H.cjs');
|
|
7
8
|
require('../../chunk-N73IMVFF.cjs');
|
|
8
|
-
require('../../chunk-
|
|
9
|
-
require('../../chunk-VOFNX4P6.cjs');
|
|
10
|
-
require('../../chunk-EEIYXVM4.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');
|
|
@@ -123,8 +123,8 @@ function useCallTranscriber({
|
|
|
123
123
|
const arbi = chunk5QOZLKAY_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 && chunkC5O4BH7B_cjs.toProfileView(profile).fullName || null;
|
|
127
|
+
const deploymentAvailable = chunkC5O4BH7B_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
|
+
() => chunkC5O4BH7B_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 = chunkC5O4BH7B_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
|
+
chunkC5O4BH7B_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 === chunkC5O4BH7B_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 !== chunkC5O4BH7B_cjs.CALL_CAPTION_TOPIC || !callKey) return;
|
|
225
225
|
const identity = participant?.identity ?? participantIdentity;
|
|
226
226
|
if (!identity || identity === myIdentity) return;
|
|
227
|
-
void
|
|
227
|
+
void chunkC5O4BH7B_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 = chunkC5O4BH7B_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 chunkC5O4BH7B_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: chunkC5O4BH7B_cjs.CALL_CAPTION_TOPIC }
|
|
314
314
|
);
|
|
315
315
|
} catch (err) {
|
|
316
316
|
console.warn("[calls] could not broadcast a caption", err);
|
|
@@ -425,14 +425,14 @@ function useCallRecorder({
|
|
|
425
425
|
};
|
|
426
426
|
}, [callExtId]);
|
|
427
427
|
react.useEffect(
|
|
428
|
-
() =>
|
|
428
|
+
() => chunkC5O4BH7B_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 !== chunkC5O4BH7B_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 chunkC5O4BH7B_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);
|
|
@@ -555,7 +555,7 @@ function useTrackUploader(recording, callKey, kind, mimeType) {
|
|
|
555
555
|
const queryClient = reactQuery.useQueryClient();
|
|
556
556
|
return react.useMemo(() => {
|
|
557
557
|
if (!shouldCapture || !recordingExtId || !call) return null;
|
|
558
|
-
return
|
|
558
|
+
return chunkC5O4BH7B_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: () => chunkC5O4BH7B_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
|
});
|
|
@@ -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 !== chunkC5O4BH7B_cjs.CALL_CHAT_TOPIC) return;
|
|
616
616
|
const identity = participant?.identity ?? participantIdentity;
|
|
617
617
|
if (!identity || identity === myIdentity) return;
|
|
618
|
-
void
|
|
618
|
+
void chunkC5O4BH7B_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
|
+
chunkC5O4BH7B_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, chunkC5O4BH7B_cjs.CALL_CHAT_MAX_CHARS);
|
|
660
660
|
if (!text || !callKey || readOnly) return;
|
|
661
|
-
const id =
|
|
661
|
+
const id = chunkC5O4BH7B_cjs.newPacketId();
|
|
662
662
|
const at = Date.now();
|
|
663
663
|
await localParticipant.publishData(
|
|
664
|
-
await
|
|
665
|
-
{ reliable: true, topic:
|
|
664
|
+
await chunkC5O4BH7B_cjs.encodeCallChatPacket({ v: 1, id, text, at }, callKey),
|
|
665
|
+
{ reliable: true, topic: chunkC5O4BH7B_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 chunkC5O4BH7B_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 chunkC5O4BH7B_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
|
+
() => chunkC5O4BH7B_cjs.mergeChatLines(history, live, {
|
|
705
705
|
myIdentity,
|
|
706
706
|
nameOf: (identity) => identity === myIdentity ? localParticipant.name || "You" : room.remoteParticipants.get(identity)?.name || null
|
|
707
707
|
}),
|
|
@@ -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) => chunkC5O4BH7B_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 chunkC5O4BH7B_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 !== chunkC5O4BH7B_cjs.CALL_WEBINAR_TOPIC) return;
|
|
785
|
+
const packet = chunkC5O4BH7B_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
|
+
chunkC5O4BH7B_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
|
+
chunkC5O4BH7B_cjs.markRejoining(callExtId);
|
|
834
834
|
setStageCheck(false);
|
|
835
835
|
try {
|
|
836
836
|
await webinarApi().demote(callExtId, myIdentity, linkVersion);
|
|
837
837
|
} catch (err) {
|
|
838
|
-
|
|
838
|
+
chunkC5O4BH7B_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 chunkC5O4BH7B_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 chunkC5O4BH7B_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 = chunkC5O4BH7B_cjs.createMutedNotifier((text) => chunk5ECKSF6H_cjs.notify.info(text));
|
|
943
943
|
const onData = (payload, participant, _kind, topic, _encryption, participantIdentity) => {
|
|
944
|
-
if (topic !==
|
|
944
|
+
if (topic !== chunkC5O4BH7B_cjs.CALL_MODERATION_TOPIC) return;
|
|
945
945
|
if (participant || participantIdentity) return;
|
|
946
|
-
const notice =
|
|
946
|
+
const notice = chunkC5O4BH7B_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 = chunkC5O4BH7B_cjs.onCallEvent("call.muted", (message) => {
|
|
951
951
|
if (message.callExtId === callExtId) notifyMuted(message);
|
|
952
952
|
});
|
|
953
953
|
return () => {
|