@arbidocs/react 0.5.86 → 0.5.88
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/README.md +2 -3
- package/dist/artifacts/index.cjs +46 -48
- package/dist/artifacts/index.cjs.map +1 -1
- package/dist/artifacts/index.js +7 -9
- package/dist/artifacts/index.js.map +1 -1
- package/dist/calls/livekit/index.cjs +60 -62
- package/dist/calls/livekit/index.cjs.map +1 -1
- package/dist/calls/livekit/index.js +6 -8
- package/dist/calls/livekit/index.js.map +1 -1
- package/dist/{chunk-Z3LLUO32.cjs → chunk-5NOZDH3F.cjs} +12 -2
- package/dist/chunk-5NOZDH3F.cjs.map +1 -0
- package/dist/{chunk-WQY3RQ6G.js → chunk-73ENECAT.js} +5 -6
- package/dist/{chunk-LUDIYWT7.cjs.map → chunk-73ENECAT.js.map} +1 -1
- package/dist/{chunk-2Y2WOIHH.cjs → chunk-AOPGD23L.cjs} +60 -148
- package/dist/chunk-AOPGD23L.cjs.map +1 -0
- package/dist/{chunk-G4Z3IP4J.js → chunk-BF5KW5ZI.js} +3 -17
- package/dist/chunk-BF5KW5ZI.js.map +1 -0
- package/dist/{chunk-TK7ERJPE.js → chunk-BFNY3RZG.js} +22 -12
- package/dist/chunk-BFNY3RZG.js.map +1 -0
- package/dist/{chunk-U4PWVSCT.cjs → chunk-C4WODQGO.cjs} +24 -11
- package/dist/chunk-C4WODQGO.cjs.map +1 -0
- package/dist/{chunk-E7VD5WNY.cjs → chunk-DS7NTSKH.cjs} +41 -74
- package/dist/chunk-DS7NTSKH.cjs.map +1 -0
- package/dist/{chunk-JT7PN7JH.js → chunk-DU2P354H.js} +6 -37
- package/dist/chunk-DU2P354H.js.map +1 -0
- package/dist/{chunk-TAVS54EN.cjs → chunk-GKWMT64A.cjs} +6 -6
- package/dist/{chunk-TAVS54EN.cjs.map → chunk-GKWMT64A.cjs.map} +1 -1
- package/dist/{chunk-AXKHDLBB.cjs → chunk-HEVPIVF2.cjs} +15 -15
- package/dist/{chunk-AXKHDLBB.cjs.map → chunk-HEVPIVF2.cjs.map} +1 -1
- package/dist/{chunk-XPLD4LFC.js → chunk-KTXZ222T.js} +6 -91
- package/dist/chunk-KTXZ222T.js.map +1 -0
- package/dist/{chunk-PXWKJI4K.cjs → chunk-LBAG7KL7.cjs} +35 -261
- package/dist/chunk-LBAG7KL7.cjs.map +1 -0
- package/dist/{chunk-CSPAEVZS.js → chunk-MS43RNXM.js} +5 -5
- package/dist/{chunk-CSPAEVZS.js.map → chunk-MS43RNXM.js.map} +1 -1
- package/dist/{chunk-OC7F5SNA.cjs → chunk-MXP4O4DI.cjs} +5 -5
- package/dist/{chunk-OC7F5SNA.cjs.map → chunk-MXP4O4DI.cjs.map} +1 -1
- package/dist/{chunk-ZWFMFOGP.cjs → chunk-NDIKMOBJ.cjs} +4 -4
- package/dist/{chunk-ZWFMFOGP.cjs.map → chunk-NDIKMOBJ.cjs.map} +1 -1
- package/dist/{chunk-XAEVT7ZM.js → chunk-NNAJLY6B.js} +34 -257
- package/dist/chunk-NNAJLY6B.js.map +1 -0
- package/dist/{chunk-LUDIYWT7.cjs → chunk-QLRDHLWR.cjs} +72 -73
- package/dist/chunk-QLRDHLWR.cjs.map +1 -0
- package/dist/{chunk-DZUBZ45Y.cjs → chunk-RLSBRZ6Z.cjs} +2 -17
- package/dist/chunk-RLSBRZ6Z.cjs.map +1 -0
- package/dist/{chunk-VGAA7AFS.js → chunk-S3OGDLDC.js} +4 -13
- package/dist/chunk-S3OGDLDC.js.map +1 -0
- package/dist/{chunk-NNWMHMEC.js → chunk-UW2SGTI5.js} +3 -3
- package/dist/{chunk-NNWMHMEC.js.map → chunk-UW2SGTI5.js.map} +1 -1
- package/dist/{chunk-QRCMKEE6.js → chunk-VSCU7K4V.js} +11 -3
- package/dist/chunk-VSCU7K4V.js.map +1 -0
- package/dist/{chunk-C44GO33B.js → chunk-WL2Y2T47.js} +3 -3
- package/dist/{chunk-C44GO33B.js.map → chunk-WL2Y2T47.js.map} +1 -1
- package/dist/{chunk-47YVW3J4.js → chunk-YQBDEOVE.js} +4 -4
- package/dist/{chunk-47YVW3J4.js.map → chunk-YQBDEOVE.js.map} +1 -1
- package/dist/{chunk-Q6U7ALNV.cjs → chunk-ZHXYFJIA.cjs} +44 -54
- package/dist/chunk-ZHXYFJIA.cjs.map +1 -0
- package/dist/document-tools/core.cjs +100 -110
- package/dist/document-tools/core.d.cts +3 -78
- package/dist/document-tools/core.d.ts +3 -78
- package/dist/document-tools/core.js +5 -7
- package/dist/document-tools/index.cjs +102 -112
- package/dist/document-tools/index.cjs.map +1 -1
- package/dist/document-tools/index.d.cts +2 -2
- package/dist/document-tools/index.d.ts +2 -2
- package/dist/document-tools/index.js +6 -8
- package/dist/document-tools/index.js.map +1 -1
- package/dist/index.cjs +1740 -2305
- package/dist/index.cjs.map +1 -1
- package/dist/{index.d-BDcwpFVa.d.cts → index.d-1_bJB-Yl.d.cts} +1 -58
- package/dist/{index.d-BDcwpFVa.d.ts → index.d-1_bJB-Yl.d.ts} +1 -58
- package/dist/{index.d-Deqz5-pF.d.ts → index.d-ChaR6kMc.d.cts} +1 -6
- package/dist/{index.d-Deqz5-pF.d.cts → index.d-ChaR6kMc.d.ts} +1 -6
- package/dist/index.d.cts +184 -1423
- package/dist/index.d.ts +184 -1423
- package/dist/index.js +281 -799
- package/dist/index.js.map +1 -1
- package/dist/{query-keys.d-Dm0NL9nr.d.cts → query-keys.d-D6SAUl7S.d.cts} +0 -9
- package/dist/{query-keys.d-Dm0NL9nr.d.ts → query-keys.d-D6SAUl7S.d.ts} +0 -9
- package/dist/shell/index.cjs +48 -53
- package/dist/shell/index.d.cts +1 -1
- package/dist/shell/index.d.ts +1 -1
- package/dist/shell/index.js +4 -5
- package/dist/ui/index.cjs +156 -169
- package/dist/ui/index.d.cts +1 -1
- package/dist/ui/index.d.ts +1 -1
- package/dist/ui/index.js +3 -4
- package/dist/viewers/index.cjs +0 -120
- package/dist/viewers/index.cjs.map +1 -1
- package/dist/viewers/index.d.cts +3 -40
- package/dist/viewers/index.d.ts +3 -40
- package/dist/viewers/index.js +1 -120
- package/dist/viewers/index.js.map +1 -1
- package/package.json +3 -3
- package/dist/chunk-2Y2WOIHH.cjs.map +0 -1
- package/dist/chunk-CPZ36AQS.js +0 -11
- package/dist/chunk-CPZ36AQS.js.map +0 -1
- package/dist/chunk-DZUBZ45Y.cjs.map +0 -1
- package/dist/chunk-E7VD5WNY.cjs.map +0 -1
- package/dist/chunk-G4Z3IP4J.js.map +0 -1
- package/dist/chunk-JT7PN7JH.js.map +0 -1
- package/dist/chunk-PXWKJI4K.cjs.map +0 -1
- package/dist/chunk-Q6U7ALNV.cjs.map +0 -1
- package/dist/chunk-QRCMKEE6.js.map +0 -1
- package/dist/chunk-RCKA7BEF.cjs +0 -14
- package/dist/chunk-RCKA7BEF.cjs.map +0 -1
- package/dist/chunk-TK7ERJPE.js.map +0 -1
- package/dist/chunk-U4PWVSCT.cjs.map +0 -1
- package/dist/chunk-VGAA7AFS.js.map +0 -1
- package/dist/chunk-VGMMK5OM.cjs +0 -26
- package/dist/chunk-VGMMK5OM.cjs.map +0 -1
- package/dist/chunk-VGO77X5U.js +0 -22
- package/dist/chunk-VGO77X5U.js.map +0 -1
- package/dist/chunk-WQY3RQ6G.js.map +0 -1
- package/dist/chunk-XAEVT7ZM.js.map +0 -1
- package/dist/chunk-XPLD4LFC.js.map +0 -1
- package/dist/chunk-Z3LLUO32.cjs.map +0 -1
|
@@ -1,16 +1,14 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
|
-
var
|
|
4
|
-
require('../../chunk-
|
|
5
|
-
require('../../chunk-
|
|
6
|
-
var
|
|
7
|
-
var chunkDZUBZ45Y_cjs = require('../../chunk-DZUBZ45Y.cjs');
|
|
3
|
+
var chunkQLRDHLWR_cjs = require('../../chunk-QLRDHLWR.cjs');
|
|
4
|
+
require('../../chunk-AOPGD23L.cjs');
|
|
5
|
+
var chunkC4WODQGO_cjs = require('../../chunk-C4WODQGO.cjs');
|
|
6
|
+
var chunkRLSBRZ6Z_cjs = require('../../chunk-RLSBRZ6Z.cjs');
|
|
8
7
|
require('../../chunk-N73IMVFF.cjs');
|
|
9
|
-
require('../../chunk-
|
|
8
|
+
require('../../chunk-NDIKMOBJ.cjs');
|
|
10
9
|
require('../../chunk-VOFNX4P6.cjs');
|
|
11
10
|
require('../../chunk-EEIYXVM4.cjs');
|
|
12
|
-
require('../../chunk-
|
|
13
|
-
require('../../chunk-RCKA7BEF.cjs');
|
|
11
|
+
require('../../chunk-5NOZDH3F.cjs');
|
|
14
12
|
require('../../chunk-S6A6FSG7.cjs');
|
|
15
13
|
var react = require('react');
|
|
16
14
|
var livekitClient = require('livekit-client');
|
|
@@ -85,7 +83,7 @@ function useMuteRequests() {
|
|
|
85
83
|
const onData = (payload, from, _kind, topic) => {
|
|
86
84
|
if (topic !== MUTE_REQUEST_TOPIC || !from) return;
|
|
87
85
|
const who = from.name || from.identity;
|
|
88
|
-
|
|
86
|
+
chunkRLSBRZ6Z_cjs.notify.info(`${who} asks you to mute your microphone`, {
|
|
89
87
|
action: {
|
|
90
88
|
label: "Mute",
|
|
91
89
|
onClick: () => void room.localParticipant.setMicrophoneEnabled(false)
|
|
@@ -101,7 +99,7 @@ function useMuteRequests() {
|
|
|
101
99
|
reliable: true,
|
|
102
100
|
topic: MUTE_REQUEST_TOPIC,
|
|
103
101
|
destinationIdentities: [identity]
|
|
104
|
-
}).then(() =>
|
|
102
|
+
}).then(() => chunkRLSBRZ6Z_cjs.notify.info("Asked to mute")).catch((err) => chunkRLSBRZ6Z_cjs.notify.error(`Could not ask: ${err.message}`));
|
|
105
103
|
}
|
|
106
104
|
var FINAL_SEGMENT_GRACE_MS = 3e4;
|
|
107
105
|
function mayStillSend(params) {
|
|
@@ -122,11 +120,11 @@ function useCallTranscriber({
|
|
|
122
120
|
const room = componentsReact.useRoomContext();
|
|
123
121
|
const { localParticipant } = componentsReact.useLocalParticipant();
|
|
124
122
|
const myIdentity = localParticipant.identity;
|
|
125
|
-
const arbi =
|
|
123
|
+
const arbi = chunkC4WODQGO_cjs.useArbi();
|
|
126
124
|
const queryClient = reactQuery.useQueryClient();
|
|
127
125
|
const profile = arbi.isLoggedIn ? arbi.user.profile() : null;
|
|
128
|
-
const myProfileName = profile &&
|
|
129
|
-
const deploymentAvailable =
|
|
126
|
+
const myProfileName = profile && chunkQLRDHLWR_cjs.toProfileView(profile).fullName || null;
|
|
127
|
+
const deploymentAvailable = chunkQLRDHLWR_cjs.useCallTranscriptionAvailable();
|
|
130
128
|
const available = deploymentAvailable && !!callKey;
|
|
131
129
|
const [state, setState] = react.useState(null);
|
|
132
130
|
const [creatorExtId, setCreatorExtId] = react.useState(null);
|
|
@@ -169,7 +167,7 @@ function useCallTranscriber({
|
|
|
169
167
|
};
|
|
170
168
|
}, [available, callExtId]);
|
|
171
169
|
react.useEffect(
|
|
172
|
-
() =>
|
|
170
|
+
() => chunkQLRDHLWR_cjs.onCallEvent("call.transcription", (message) => {
|
|
173
171
|
if (message.call_ext_id === callExtId) applyState(message);
|
|
174
172
|
}),
|
|
175
173
|
[callExtId, applyState]
|
|
@@ -185,7 +183,7 @@ function useCallTranscriber({
|
|
|
185
183
|
const persist = react.useCallback(
|
|
186
184
|
(segment, speakerNeedsProxy) => {
|
|
187
185
|
if (!callKey || persisted.current.has(segment.segmentId)) return;
|
|
188
|
-
const role =
|
|
186
|
+
const role = chunkQLRDHLWR_cjs.transcriptPersistRole({
|
|
189
187
|
myIdentity,
|
|
190
188
|
canPost: canPost && (segment.speakerIdentity !== myIdentity || selfPosts.current),
|
|
191
189
|
hasCallKey: true,
|
|
@@ -194,7 +192,7 @@ function useCallTranscriber({
|
|
|
194
192
|
});
|
|
195
193
|
if (!role) return;
|
|
196
194
|
persisted.current.add(segment.segmentId);
|
|
197
|
-
|
|
195
|
+
chunkQLRDHLWR_cjs.persistTranscriptSegment(arbi, queryClient, callExtId, callKey, segment).catch(
|
|
198
196
|
(err) => {
|
|
199
197
|
persisted.current.delete(segment.segmentId);
|
|
200
198
|
if (role === "own" && err?.status === 403) {
|
|
@@ -203,7 +201,7 @@ function useCallTranscriber({
|
|
|
203
201
|
console.warn("[calls] could not keep the transcript line", err);
|
|
204
202
|
if (!saveFailureShown.current) {
|
|
205
203
|
saveFailureShown.current = true;
|
|
206
|
-
|
|
204
|
+
chunkRLSBRZ6Z_cjs.notify.warning(
|
|
207
205
|
`Transcript lines are not being saved to the meeting chat: ${err?.message ?? "unknown error"}`
|
|
208
206
|
);
|
|
209
207
|
}
|
|
@@ -214,7 +212,7 @@ function useCallTranscriber({
|
|
|
214
212
|
);
|
|
215
213
|
react.useEffect(() => {
|
|
216
214
|
const onData = (payload, participant, _kind, topic, _encryption, participantIdentity) => {
|
|
217
|
-
if (topic ===
|
|
215
|
+
if (topic === chunkQLRDHLWR_cjs.CALL_TRANSCRIPTION_TOPIC) {
|
|
218
216
|
if (participant || participantIdentity) return;
|
|
219
217
|
try {
|
|
220
218
|
const next = browser.calls.transcriptionStateFrom(JSON.parse(new TextDecoder().decode(payload)));
|
|
@@ -223,10 +221,10 @@ function useCallTranscriber({
|
|
|
223
221
|
}
|
|
224
222
|
return;
|
|
225
223
|
}
|
|
226
|
-
if (topic !==
|
|
224
|
+
if (topic !== chunkQLRDHLWR_cjs.CALL_CAPTION_TOPIC || !callKey) return;
|
|
227
225
|
const identity = participant?.identity ?? participantIdentity;
|
|
228
226
|
if (!identity || identity === myIdentity) return;
|
|
229
|
-
void
|
|
227
|
+
void chunkQLRDHLWR_cjs.decodeCaptionPacket(payload, callKey).then((packet) => {
|
|
230
228
|
if (!packet || packet.identity !== identity) return;
|
|
231
229
|
const name = participant?.name || packet.name || identity;
|
|
232
230
|
const t = Math.min(packet.t, Date.now());
|
|
@@ -266,7 +264,7 @@ function useCallTranscriber({
|
|
|
266
264
|
})) {
|
|
267
265
|
return;
|
|
268
266
|
}
|
|
269
|
-
const segmentId =
|
|
267
|
+
const segmentId = chunkQLRDHLWR_cjs.newSegmentId();
|
|
270
268
|
const startedAt = new Date(segment.startedAt).toISOString();
|
|
271
269
|
let text;
|
|
272
270
|
try {
|
|
@@ -300,7 +298,7 @@ function useCallTranscriber({
|
|
|
300
298
|
});
|
|
301
299
|
try {
|
|
302
300
|
await localParticipant.publishData(
|
|
303
|
-
await
|
|
301
|
+
await chunkQLRDHLWR_cjs.encodeCaptionPacket(
|
|
304
302
|
{
|
|
305
303
|
v: 1,
|
|
306
304
|
segment_id: segmentId,
|
|
@@ -312,7 +310,7 @@ function useCallTranscriber({
|
|
|
312
310
|
},
|
|
313
311
|
callKey
|
|
314
312
|
),
|
|
315
|
-
{ reliable: true, topic:
|
|
313
|
+
{ reliable: true, topic: chunkQLRDHLWR_cjs.CALL_CAPTION_TOPIC }
|
|
316
314
|
);
|
|
317
315
|
} catch (err) {
|
|
318
316
|
console.warn("[calls] could not broadcast a caption", err);
|
|
@@ -348,7 +346,7 @@ function useCallTranscriber({
|
|
|
348
346
|
answer ?? (next ? { on: true, by_identity: myIdentity, by_name: localParticipant.name || null } : { on: false, by_identity: null, by_name: null })
|
|
349
347
|
);
|
|
350
348
|
} catch (err) {
|
|
351
|
-
|
|
349
|
+
chunkRLSBRZ6Z_cjs.notify.error(`Could not turn transcription ${next ? "on" : "off"}: ${err.message}`);
|
|
352
350
|
} finally {
|
|
353
351
|
setBusy(false);
|
|
354
352
|
}
|
|
@@ -393,7 +391,7 @@ function useCallRecorder({
|
|
|
393
391
|
isCreator,
|
|
394
392
|
linkVersion = null
|
|
395
393
|
}) {
|
|
396
|
-
const arbi =
|
|
394
|
+
const arbi = chunkC4WODQGO_cjs.useArbi();
|
|
397
395
|
const queryClient = reactQuery.useQueryClient();
|
|
398
396
|
const room = componentsReact.useRoomContext();
|
|
399
397
|
const { localParticipant } = componentsReact.useLocalParticipant();
|
|
@@ -410,7 +408,7 @@ function useCallRecorder({
|
|
|
410
408
|
const applyState = react.useCallback((next) => {
|
|
411
409
|
liveUpdate.current = true;
|
|
412
410
|
if (stateRef.current?.on && next && !next.on && next.reason === "storage_quota_exceeded") {
|
|
413
|
-
|
|
411
|
+
chunkRLSBRZ6Z_cjs.notify.warning("Recording stopped: the storage is full.");
|
|
414
412
|
}
|
|
415
413
|
stateRef.current = next;
|
|
416
414
|
setState(next);
|
|
@@ -427,14 +425,14 @@ function useCallRecorder({
|
|
|
427
425
|
};
|
|
428
426
|
}, [callExtId]);
|
|
429
427
|
react.useEffect(
|
|
430
|
-
() =>
|
|
428
|
+
() => chunkQLRDHLWR_cjs.onCallEvent("call.recording", (message) => {
|
|
431
429
|
if (message.call_ext_id === callExtId) applyState(message);
|
|
432
430
|
}),
|
|
433
431
|
[callExtId, applyState]
|
|
434
432
|
);
|
|
435
433
|
react.useEffect(() => {
|
|
436
434
|
const onData = (payload, participant, _kind, topic, _encryption, participantIdentity) => {
|
|
437
|
-
if (topic !==
|
|
435
|
+
if (topic !== chunkQLRDHLWR_cjs.CALL_RECORDING_TOPIC) return;
|
|
438
436
|
if (participant || participantIdentity) return;
|
|
439
437
|
try {
|
|
440
438
|
const next = browser.calls.recordingStateFrom(JSON.parse(new TextDecoder().decode(payload)));
|
|
@@ -455,13 +453,13 @@ function useCallRecorder({
|
|
|
455
453
|
try {
|
|
456
454
|
const row = call ?? await arbi.calls.get(callExtId);
|
|
457
455
|
if (!row.workspace_locked && !row.chat_ext_id && callKey) {
|
|
458
|
-
const ref = await
|
|
456
|
+
const ref = await chunkQLRDHLWR_cjs.ensureMeetingChat(arbi, queryClient, callExtId, callKey);
|
|
459
457
|
if (ref.kind === "chat") setCall({ ...row, chat_ext_id: ref.chatExtId });
|
|
460
458
|
}
|
|
461
459
|
const answer = await arbi.calls.recording.start(callExtId, mode);
|
|
462
460
|
if (answer) applyState(answer);
|
|
463
461
|
} catch (err) {
|
|
464
|
-
|
|
462
|
+
chunkRLSBRZ6Z_cjs.notify.error(`Could not start recording: ${err.message}`);
|
|
465
463
|
} finally {
|
|
466
464
|
setBusy(false);
|
|
467
465
|
}
|
|
@@ -500,7 +498,7 @@ function useCallRecorder({
|
|
|
500
498
|
const answer = await arbi.calls.recording.stop(callExtId);
|
|
501
499
|
applyState(answer ?? { ...state, on: false });
|
|
502
500
|
} catch (err) {
|
|
503
|
-
|
|
501
|
+
chunkRLSBRZ6Z_cjs.notify.error(`Could not stop recording: ${err.message}`);
|
|
504
502
|
} finally {
|
|
505
503
|
setBusy(false);
|
|
506
504
|
}
|
|
@@ -553,11 +551,11 @@ function useCallRecorder({
|
|
|
553
551
|
}
|
|
554
552
|
function useTrackUploader(recording, callKey, kind, mimeType) {
|
|
555
553
|
const { recordingExtId, call, startedAt, shouldCapture, markStopped, linkVersion } = recording;
|
|
556
|
-
const arbi =
|
|
554
|
+
const arbi = chunkC4WODQGO_cjs.useArbi();
|
|
557
555
|
const queryClient = reactQuery.useQueryClient();
|
|
558
556
|
return react.useMemo(() => {
|
|
559
557
|
if (!shouldCapture || !recordingExtId || !call) return null;
|
|
560
|
-
return
|
|
558
|
+
return chunkQLRDHLWR_cjs.trackUploaderFor({
|
|
561
559
|
arbi,
|
|
562
560
|
callExtId: call.external_id,
|
|
563
561
|
recordingExtId,
|
|
@@ -565,7 +563,7 @@ function useTrackUploader(recording, callKey, kind, mimeType) {
|
|
|
565
563
|
mimeType,
|
|
566
564
|
recordingStartedAt: startedAt,
|
|
567
565
|
linkVersion,
|
|
568
|
-
conversationKey: () =>
|
|
566
|
+
conversationKey: () => chunkQLRDHLWR_cjs.conversationKeyForCall(arbi, queryClient, call, { callKey }),
|
|
569
567
|
// The server stopped the recording at the quota (its state event says so too).
|
|
570
568
|
onStopped: () => markStopped()
|
|
571
569
|
});
|
|
@@ -593,9 +591,9 @@ function useInCallChat({
|
|
|
593
591
|
const room = componentsReact.useRoomContext();
|
|
594
592
|
const { localParticipant } = componentsReact.useLocalParticipant();
|
|
595
593
|
const myIdentity = localParticipant.identity;
|
|
596
|
-
const arbi =
|
|
594
|
+
const arbi = chunkC4WODQGO_cjs.useArbi();
|
|
597
595
|
const queryClient = reactQuery.useQueryClient();
|
|
598
|
-
const openMeetingChat =
|
|
596
|
+
const openMeetingChat = chunkC4WODQGO_cjs.useArbiHost().calls?.openMeetingChat;
|
|
599
597
|
const signedIn = arbi.isLoggedIn;
|
|
600
598
|
const persists = !!callKey && signedIn && !readOnly && persist;
|
|
601
599
|
const [live, setLive] = react.useState([]);
|
|
@@ -614,10 +612,10 @@ function useInCallChat({
|
|
|
614
612
|
react.useEffect(() => {
|
|
615
613
|
if (!callKey) return;
|
|
616
614
|
const onData = (payload, participant, _kind, topic, _encryption, participantIdentity) => {
|
|
617
|
-
if (topic !==
|
|
615
|
+
if (topic !== chunkQLRDHLWR_cjs.CALL_CHAT_TOPIC) return;
|
|
618
616
|
const identity = participant?.identity ?? participantIdentity;
|
|
619
617
|
if (!identity || identity === myIdentity) return;
|
|
620
|
-
void
|
|
618
|
+
void chunkQLRDHLWR_cjs.decodeCallChatPacket(payload, callKey).then((packet) => {
|
|
621
619
|
if (!packet) return;
|
|
622
620
|
const key = `${identity}:${packet.id}`;
|
|
623
621
|
if (seen.current.has(key)) return;
|
|
@@ -647,7 +645,7 @@ function useInCallChat({
|
|
|
647
645
|
if (!open || !canRead || historyRequested.current) return;
|
|
648
646
|
historyRequested.current = true;
|
|
649
647
|
setHistoryLoading(true);
|
|
650
|
-
|
|
648
|
+
chunkQLRDHLWR_cjs.loadMeetingHistory(arbi, queryClient, callExtId).then((result) => {
|
|
651
649
|
if (!result) return;
|
|
652
650
|
setMeetingChat(result.ref);
|
|
653
651
|
setHistory(result.messages);
|
|
@@ -658,13 +656,13 @@ function useInCallChat({
|
|
|
658
656
|
}, [open, canRead, callExtId]);
|
|
659
657
|
const send = react.useCallback(
|
|
660
658
|
async (raw) => {
|
|
661
|
-
const text = raw.trim().slice(0,
|
|
659
|
+
const text = raw.trim().slice(0, chunkQLRDHLWR_cjs.CALL_CHAT_MAX_CHARS);
|
|
662
660
|
if (!text || !callKey || readOnly) return;
|
|
663
|
-
const id =
|
|
661
|
+
const id = chunkQLRDHLWR_cjs.newPacketId();
|
|
664
662
|
const at = Date.now();
|
|
665
663
|
await localParticipant.publishData(
|
|
666
|
-
await
|
|
667
|
-
{ reliable: true, topic:
|
|
664
|
+
await chunkQLRDHLWR_cjs.encodeCallChatPacket({ v: 1, id, text, at }, callKey),
|
|
665
|
+
{ reliable: true, topic: chunkQLRDHLWR_cjs.CALL_CHAT_TOPIC }
|
|
668
666
|
);
|
|
669
667
|
setLive((prev) => [
|
|
670
668
|
...prev,
|
|
@@ -683,7 +681,7 @@ function useInCallChat({
|
|
|
683
681
|
(prev) => prev.map((l) => l.id === id && l.senderIdentity === myIdentity ? { ...l, status } : l)
|
|
684
682
|
);
|
|
685
683
|
try {
|
|
686
|
-
setMeetingChat(await
|
|
684
|
+
setMeetingChat(await chunkQLRDHLWR_cjs.persistMeetingMessage(arbi, queryClient, callExtId, callKey, text));
|
|
687
685
|
mark("saved");
|
|
688
686
|
} catch (err) {
|
|
689
687
|
console.warn("[calls] could not keep the message in the meeting chat", err);
|
|
@@ -695,15 +693,15 @@ function useInCallChat({
|
|
|
695
693
|
const openMeeting = react.useCallback(async () => {
|
|
696
694
|
if (!callKey) return;
|
|
697
695
|
try {
|
|
698
|
-
const ref = meetingChat ?? await
|
|
696
|
+
const ref = meetingChat ?? await chunkQLRDHLWR_cjs.ensureMeetingChat(arbi, queryClient, callExtId, callKey);
|
|
699
697
|
setMeetingChat(ref);
|
|
700
698
|
openMeetingChat?.(ref);
|
|
701
699
|
} catch (err) {
|
|
702
|
-
|
|
700
|
+
chunkRLSBRZ6Z_cjs.notify.error(`Could not open the meeting chat: ${err.message}`);
|
|
703
701
|
}
|
|
704
702
|
}, [callExtId, callKey, meetingChat]);
|
|
705
703
|
const lines = react.useMemo(
|
|
706
|
-
() =>
|
|
704
|
+
() => chunkQLRDHLWR_cjs.mergeChatLines(history, live, {
|
|
707
705
|
myIdentity,
|
|
708
706
|
nameOf: (identity) => identity === myIdentity ? localParticipant.name || "You" : room.remoteParticipants.get(identity)?.name || null
|
|
709
707
|
}),
|
|
@@ -725,7 +723,7 @@ function useInCallChat({
|
|
|
725
723
|
var DEMOTE_REJOIN_FALLBACK_MS = 5e3;
|
|
726
724
|
function failed(what) {
|
|
727
725
|
return (err) => {
|
|
728
|
-
|
|
726
|
+
chunkRLSBRZ6Z_cjs.notify.error(`Could not ${what}: ${err?.message ?? "unknown error"}`);
|
|
729
727
|
throw err;
|
|
730
728
|
};
|
|
731
729
|
}
|
|
@@ -735,7 +733,7 @@ function useWebinar({
|
|
|
735
733
|
linkVersion = null,
|
|
736
734
|
callKey
|
|
737
735
|
}) {
|
|
738
|
-
const arbi =
|
|
736
|
+
const arbi = chunkC4WODQGO_cjs.useArbi();
|
|
739
737
|
const webinarApi = react.useCallback(() => arbi.calls.webinar, [arbi]);
|
|
740
738
|
const enabled = !!roleHint;
|
|
741
739
|
const room = componentsReact.useRoomContext();
|
|
@@ -762,7 +760,7 @@ function useWebinar({
|
|
|
762
760
|
const n = ++questionsRead.current;
|
|
763
761
|
try {
|
|
764
762
|
const rows = await webinarApi().questions.list(callExtId, linkVersion);
|
|
765
|
-
const opened = await Promise.all(rows.map((q) =>
|
|
763
|
+
const opened = await Promise.all(rows.map((q) => chunkQLRDHLWR_cjs.openQuestion(q, callKey)));
|
|
766
764
|
if (n === questionsRead.current) setQuestions(opened);
|
|
767
765
|
} catch (err) {
|
|
768
766
|
console.warn("[calls] could not load the questions", err);
|
|
@@ -774,7 +772,7 @@ function useWebinar({
|
|
|
774
772
|
}, [refresh, refreshQuestions]);
|
|
775
773
|
react.useEffect(() => {
|
|
776
774
|
if (!enabled) return;
|
|
777
|
-
return
|
|
775
|
+
return chunkQLRDHLWR_cjs.onCallEvent("call.webinar", (m) => {
|
|
778
776
|
if (m.call_ext_id !== callExtId) return;
|
|
779
777
|
setState((s) => s ? { ...s, live: m.live, chat: m.chat } : s);
|
|
780
778
|
});
|
|
@@ -783,8 +781,8 @@ function useWebinar({
|
|
|
783
781
|
react.useEffect(() => {
|
|
784
782
|
if (!enabled) return;
|
|
785
783
|
const onData = (payload, participant, _kind, topic, _encryption, participantIdentity) => {
|
|
786
|
-
if (topic !==
|
|
787
|
-
const packet =
|
|
784
|
+
if (topic !== chunkQLRDHLWR_cjs.CALL_WEBINAR_TOPIC) return;
|
|
785
|
+
const packet = chunkQLRDHLWR_cjs.parseWebinarPacket(payload, !!(participant || participantIdentity));
|
|
788
786
|
if (!packet) return;
|
|
789
787
|
switch (packet.type) {
|
|
790
788
|
case "state":
|
|
@@ -805,7 +803,7 @@ function useWebinar({
|
|
|
805
803
|
return;
|
|
806
804
|
case "demoted":
|
|
807
805
|
setStageCheck(false);
|
|
808
|
-
|
|
806
|
+
chunkQLRDHLWR_cjs.markRejoining(callExtId);
|
|
809
807
|
if (fallback.current) clearTimeout(fallback.current);
|
|
810
808
|
fallback.current = setTimeout(() => void room.disconnect(), DEMOTE_REJOIN_FALLBACK_MS);
|
|
811
809
|
return;
|
|
@@ -832,12 +830,12 @@ function useWebinar({
|
|
|
832
830
|
[callExtId, linkVersion]
|
|
833
831
|
);
|
|
834
832
|
const stepDown = react.useCallback(async () => {
|
|
835
|
-
|
|
833
|
+
chunkQLRDHLWR_cjs.markRejoining(callExtId);
|
|
836
834
|
setStageCheck(false);
|
|
837
835
|
try {
|
|
838
836
|
await webinarApi().demote(callExtId, myIdentity, linkVersion);
|
|
839
837
|
} catch (err) {
|
|
840
|
-
|
|
838
|
+
chunkQLRDHLWR_cjs.markRejoining(callExtId, false);
|
|
841
839
|
failed("leave the stage")(err);
|
|
842
840
|
}
|
|
843
841
|
}, [callExtId, myIdentity, linkVersion]);
|
|
@@ -897,7 +895,7 @@ function useWebinar({
|
|
|
897
895
|
if (!callKey) throw new Error("This call has no key.");
|
|
898
896
|
await webinarApi().questions.ask(
|
|
899
897
|
callExtId,
|
|
900
|
-
await
|
|
898
|
+
await chunkQLRDHLWR_cjs.sealQuestionText(text, callKey),
|
|
901
899
|
linkVersion
|
|
902
900
|
);
|
|
903
901
|
}, "ask the question"),
|
|
@@ -911,7 +909,7 @@ function useWebinar({
|
|
|
911
909
|
await webinarApi().questions.update(
|
|
912
910
|
callExtId,
|
|
913
911
|
id,
|
|
914
|
-
{ answer: await
|
|
912
|
+
{ answer: await chunkQLRDHLWR_cjs.sealQuestionText(text, callKey) },
|
|
915
913
|
linkVersion
|
|
916
914
|
);
|
|
917
915
|
}, "answer the question"),
|
|
@@ -941,15 +939,15 @@ function useWebinar({
|
|
|
941
939
|
function useHostMuteNotice(callExtId) {
|
|
942
940
|
const room = componentsReact.useRoomContext();
|
|
943
941
|
react.useEffect(() => {
|
|
944
|
-
const notifyMuted =
|
|
942
|
+
const notifyMuted = chunkQLRDHLWR_cjs.createMutedNotifier((text) => chunkRLSBRZ6Z_cjs.notify.info(text));
|
|
945
943
|
const onData = (payload, participant, _kind, topic, _encryption, participantIdentity) => {
|
|
946
|
-
if (topic !==
|
|
944
|
+
if (topic !== chunkQLRDHLWR_cjs.CALL_MODERATION_TOPIC) return;
|
|
947
945
|
if (participant || participantIdentity) return;
|
|
948
|
-
const notice =
|
|
946
|
+
const notice = chunkQLRDHLWR_cjs.mutedNoticeFromPacket(payload);
|
|
949
947
|
if (notice) notifyMuted(notice);
|
|
950
948
|
};
|
|
951
949
|
room.on(livekitClient.RoomEvent.DataReceived, onData);
|
|
952
|
-
const offWs =
|
|
950
|
+
const offWs = chunkQLRDHLWR_cjs.onCallEvent("call.muted", (message) => {
|
|
953
951
|
if (message.callExtId === callExtId) notifyMuted(message);
|
|
954
952
|
});
|
|
955
953
|
return () => {
|