@arbidocs/react 0.5.164 → 0.5.166
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/ai/MessageArtifactCard.js +16 -0
- package/dist/ai/MessageArtifactCard.js.map +2 -2
- package/dist/artifacts/artifact-kind.js +12 -1
- package/dist/artifacts/artifact-kind.js.map +2 -2
- package/dist/artifacts/index.cjs +26 -15
- package/dist/artifacts/index.cjs.map +1 -1
- package/dist/artifacts/index.d.ts +3 -20
- package/dist/artifacts/index.js +3 -1
- package/dist/artifacts/index.js.map +2 -2
- package/dist/calls/livekit/index.cjs +48 -48
- package/dist/chat/ChatBubble.js +56 -65
- package/dist/chat/ChatBubble.js.map +2 -2
- package/dist/chat/open-document.js +4 -1
- package/dist/chat/open-document.js.map +2 -2
- package/dist/{chunk-6HJZCIND.cjs → chunk-3DPOR5IR.cjs} +6 -3
- package/dist/chunk-3DPOR5IR.cjs.map +1 -0
- package/dist/{chunk-42X5ZO7Y.cjs → chunk-4TWXQFHU.cjs} +69 -69
- package/dist/{chunk-42X5ZO7Y.cjs.map → chunk-4TWXQFHU.cjs.map} +1 -1
- package/dist/{chunk-ZZBCZRA5.cjs → chunk-5QOZLKAY.cjs} +5 -2
- package/dist/chunk-5QOZLKAY.cjs.map +1 -0
- package/dist/{chunk-SUMXDNYG.cjs → chunk-BI4SYRLX.cjs} +70 -63
- package/dist/chunk-BI4SYRLX.cjs.map +1 -0
- package/dist/{chunk-ZBI5AMZC.cjs → chunk-HRQS27DO.cjs} +37 -37
- package/dist/{chunk-ZBI5AMZC.cjs.map → chunk-HRQS27DO.cjs.map} +1 -1
- package/dist/{chunk-V5WCKJEH.cjs → chunk-Q7BGWKHP.cjs} +44 -44
- package/dist/{chunk-V5WCKJEH.cjs.map → chunk-Q7BGWKHP.cjs.map} +1 -1
- package/dist/{chunk-6TJL4Z2F.cjs → chunk-TX7UCN73.cjs} +10 -10
- package/dist/{chunk-6TJL4Z2F.cjs.map → chunk-TX7UCN73.cjs.map} +1 -1
- package/dist/{chunk-WJIRX5MS.cjs → chunk-W4W75MSO.cjs} +134 -25
- package/dist/chunk-W4W75MSO.cjs.map +1 -0
- package/dist/chunk-WABJGKVA.cjs +246 -0
- package/dist/chunk-WABJGKVA.cjs.map +1 -0
- package/dist/databases.js.map +2 -2
- package/dist/directmessages/DmComposer.js +26 -10
- package/dist/directmessages/DmComposer.js.map +2 -2
- package/dist/directmessages/index.js +2 -0
- package/dist/directmessages/index.js.map +2 -2
- package/dist/directmessages/useChats.js +11 -0
- package/dist/directmessages/useChats.js.map +2 -2
- package/dist/document-tools/core.cjs +100 -100
- package/dist/document-tools/core.d.ts +2 -2
- package/dist/document-tools/index.cjs +102 -102
- package/dist/document-tools/index.d.ts +2 -2
- package/dist/entities/DocumentEntity.js +8 -3
- package/dist/entities/DocumentEntity.js.map +2 -2
- package/dist/entities/EntityActionsMenu.js +53 -0
- package/dist/entities/EntityActionsMenu.js.map +7 -0
- package/dist/entities/EntityPill.js +50 -16
- package/dist/entities/EntityPill.js.map +2 -2
- package/dist/entities/ProjectEntity.js +4 -0
- package/dist/entities/ProjectEntity.js.map +2 -2
- package/dist/entities/TagEntity.js +1 -0
- package/dist/entities/TagEntity.js.map +2 -2
- package/dist/entities/UserEntity.js +25 -3
- package/dist/entities/UserEntity.js.map +2 -2
- package/dist/entities/links.js +9 -0
- package/dist/entities/links.js.map +7 -0
- package/dist/entities/reference-data.js +56 -0
- package/dist/entities/reference-data.js.map +7 -0
- package/dist/{file-shares.d-Bwy9k3Db.d.ts → file-shares.d-Dlt7pKRi.d.ts} +3 -0
- package/dist/host/config.js.map +2 -2
- package/dist/index.cjs +1836 -1748
- package/dist/index.cjs.map +1 -1
- package/dist/{index.d-Dy_Pz6Vl.d.ts → index.d-BaZUctD1.d.ts} +34 -10
- package/dist/index.d.ts +164 -20
- package/dist/index.js +5 -0
- package/dist/index.js.map +2 -2
- package/dist/query-keys.js +3 -0
- package/dist/query-keys.js.map +2 -2
- package/dist/session/conversation-panels.js +5 -3
- package/dist/session/conversation-panels.js.map +2 -2
- package/dist/session/layout.js +5 -0
- package/dist/session/layout.js.map +2 -2
- package/dist/shell/index.cjs +37 -37
- package/dist/{stored-markdown.d-Bp18vrbr.d.ts → stored-markdown.d-BLQPny3e.d.ts} +21 -1
- package/dist/ui/index.cjs +155 -151
- package/dist/ui/index.d.ts +1 -1
- package/dist/ui/index.js +2 -0
- package/dist/ui/index.js.map +2 -2
- package/dist/viewers/AudioViewer.js +13 -3
- package/dist/viewers/AudioViewer.js.map +2 -2
- package/dist/viewers/MediaTranscriptPlayer.js +171 -0
- package/dist/viewers/MediaTranscriptPlayer.js.map +7 -0
- package/dist/viewers/VideoViewer.js +4 -11
- package/dist/viewers/VideoViewer.js.map +2 -2
- package/dist/viewers/index.cjs +8 -4
- package/dist/viewers/index.d.ts +17 -3
- package/dist/viewers/index.js +2 -0
- package/dist/viewers/index.js.map +2 -2
- package/package.json +3 -3
- package/dist/chunk-6HJZCIND.cjs.map +0 -1
- package/dist/chunk-SUMXDNYG.cjs.map +0 -1
- package/dist/chunk-TMPDW7J5.cjs +0 -79
- package/dist/chunk-TMPDW7J5.cjs.map +0 -1
- package/dist/chunk-WJIRX5MS.cjs.map +0 -1
- package/dist/chunk-ZZBCZRA5.cjs.map +0 -1
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../src/artifacts/index.ts"],
|
|
4
|
-
"sourcesContent": ["// @arbidocs/react/artifacts: edit an artifact, save it as a new version, compare versions.\n// SDK-free core (edit session, redline engine, version lineage) plus the SDK binding hooks.\nexport {\n buildHybridRedlineMarkdown,\n buildHybridRedlineWithRegions,\n revertRedlineRegion,\n type RedlineRegion,\n type RedlineWithRegions,\n type RegionKind,\n} from './redline-diff'\nexport { normalizeMarkdown } from './normalize-markdown'\nexport { mainThreadRedlineEngine, type RedlineEngine } from './redline-engine'\nexport {\n useRedline,\n type RedlineState,\n type UseRedlineOptions,\n type UseRedlineResult,\n} from './useRedline'\nexport {\n documentVersions,\n findVersion,\n parseVersionRef,\n savedFromId,\n toArtifactVersions,\n versionLabel,\n versionRef,\n isDocumentId,\n flattenChunks,\n type ArtifactVersion,\n type DocVersionEntry,\n type VersionedDoc,\n} from './versions'\nexport {\n useArtifactEditSession,\n type ArtifactEditSession,\n type ArtifactEditSessionOptions,\n type ArtifactSaveResult,\n} from './useArtifactEditSession'\nexport {\n useArtifactSession,\n useArtifactVersions,\n useSaveArtifactVersion,\n type ArtifactSession,\n type ArtifactSessionOptions,\n type ArtifactSessionView,\n type SaveArtifactVersionInput,\n} from './useArtifactSession'\nexport {\n DEFAULT_ARTIFACT_TEXT_RETRY,\n useArtifactText,\n type ArtifactText,\n type ArtifactTextRetry,\n type ArtifactTextStatus,\n} from './useArtifactText'\nexport { useArtifactSource } from './useArtifactSource'\nexport {\n cleanDraftMarkdown,\n cleanDraftWithReport,\n type DraftCleanReport,\n type DraftCleanStage,\n promoteBoldTitle,\n repairParsedStructure,\n repairParsedTitle,\n stripAgentPreamble,\n unescapeMarkdown,\n unwrapCitationLinks,\n} from '../ai/stored-markdown'\nexport { renderArtifactMarkdown, type ArtifactRedlineComponents } from './renderArtifactMarkdown'\nexport {\n useStreamedArtifact,\n type StreamedArtifact,\n type StreamedArtifactPhase,\n type UseStreamedArtifactOptions,\n} from './useStreamedArtifact'\nexport {\n artifactKindFromFileName,\n artifactKindFromMode,\n viewerTabForArtifactMode,\n type ArtifactPreviewKind,\n} from './artifact-kind'\n"],
|
|
5
|
-
"mappings": "AAEA;AAAA,EACE;AAAA,EACA;AAAA,EACA;AAAA,OAIK;AACP,SAAS,yBAAyB;AAClC,SAAS,+BAAmD;AAC5D;AAAA,EACE;AAAA,OAIK;AACP;AAAA,EACE;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,OAIK;AACP;AAAA,EACE;AAAA,OAIK;AACP;AAAA,EACE;AAAA,EACA;AAAA,EACA;AAAA,OAKK;AACP;AAAA,EACE;AAAA,EACA;AAAA,OAIK;AACP,SAAS,yBAAyB;AAClC;AAAA,EACE;AAAA,EACA;AAAA,EAGA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,OACK;AACP,SAAS,8BAA8D;AACvE;AAAA,EACE;AAAA,OAIK;AACP;AAAA,EACE;AAAA,EACA;AAAA,EACA;AAAA,
|
|
4
|
+
"sourcesContent": ["// @arbidocs/react/artifacts: edit an artifact, save it as a new version, compare versions.\n// SDK-free core (edit session, redline engine, version lineage) plus the SDK binding hooks.\nexport {\n buildHybridRedlineMarkdown,\n buildHybridRedlineWithRegions,\n revertRedlineRegion,\n type RedlineRegion,\n type RedlineWithRegions,\n type RegionKind,\n} from './redline-diff'\nexport { normalizeMarkdown } from './normalize-markdown'\nexport { mainThreadRedlineEngine, type RedlineEngine } from './redline-engine'\nexport {\n useRedline,\n type RedlineState,\n type UseRedlineOptions,\n type UseRedlineResult,\n} from './useRedline'\nexport {\n documentVersions,\n findVersion,\n parseVersionRef,\n savedFromId,\n toArtifactVersions,\n versionLabel,\n versionRef,\n isDocumentId,\n flattenChunks,\n type ArtifactVersion,\n type DocVersionEntry,\n type VersionedDoc,\n} from './versions'\nexport {\n useArtifactEditSession,\n type ArtifactEditSession,\n type ArtifactEditSessionOptions,\n type ArtifactSaveResult,\n} from './useArtifactEditSession'\nexport {\n useArtifactSession,\n useArtifactVersions,\n useSaveArtifactVersion,\n type ArtifactSession,\n type ArtifactSessionOptions,\n type ArtifactSessionView,\n type SaveArtifactVersionInput,\n} from './useArtifactSession'\nexport {\n DEFAULT_ARTIFACT_TEXT_RETRY,\n useArtifactText,\n type ArtifactText,\n type ArtifactTextRetry,\n type ArtifactTextStatus,\n} from './useArtifactText'\nexport { useArtifactSource } from './useArtifactSource'\nexport {\n cleanDraftMarkdown,\n cleanDraftWithReport,\n type DraftCleanReport,\n type DraftCleanStage,\n promoteBoldTitle,\n repairParsedStructure,\n repairParsedTitle,\n stripAgentPreamble,\n unescapeMarkdown,\n unwrapCitationLinks,\n} from '../ai/stored-markdown'\nexport { renderArtifactMarkdown, type ArtifactRedlineComponents } from './renderArtifactMarkdown'\nexport {\n useStreamedArtifact,\n type StreamedArtifact,\n type StreamedArtifactPhase,\n type UseStreamedArtifactOptions,\n} from './useStreamedArtifact'\nexport {\n artifactKindFromFileName,\n artifactKindFromMode,\n viewerTabForArtifactMode,\n savedArtifactMode,\n type ArtifactDisplayMode,\n type ArtifactPreviewKind,\n} from './artifact-kind'\n"],
|
|
5
|
+
"mappings": "AAEA;AAAA,EACE;AAAA,EACA;AAAA,EACA;AAAA,OAIK;AACP,SAAS,yBAAyB;AAClC,SAAS,+BAAmD;AAC5D;AAAA,EACE;AAAA,OAIK;AACP;AAAA,EACE;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,OAIK;AACP;AAAA,EACE;AAAA,OAIK;AACP;AAAA,EACE;AAAA,EACA;AAAA,EACA;AAAA,OAKK;AACP;AAAA,EACE;AAAA,EACA;AAAA,OAIK;AACP,SAAS,yBAAyB;AAClC;AAAA,EACE;AAAA,EACA;AAAA,EAGA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,OACK;AACP,SAAS,8BAA8D;AACvE;AAAA,EACE;AAAA,OAIK;AACP;AAAA,EACE;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,OAGK;",
|
|
6
6
|
"names": []
|
|
7
7
|
}
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
|
-
var
|
|
4
|
-
require('../../chunk-
|
|
5
|
-
var
|
|
3
|
+
var chunk4TWXQFHU_cjs = require('../../chunk-4TWXQFHU.cjs');
|
|
4
|
+
require('../../chunk-BI4SYRLX.cjs');
|
|
5
|
+
var chunk5QOZLKAY_cjs = require('../../chunk-5QOZLKAY.cjs');
|
|
6
6
|
var chunk5ECKSF6H_cjs = require('../../chunk-5ECKSF6H.cjs');
|
|
7
7
|
require('../../chunk-N73IMVFF.cjs');
|
|
8
8
|
require('../../chunk-KULS4YWP.cjs');
|
|
@@ -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 = 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 && chunk4TWXQFHU_cjs.toProfileView(profile).fullName || null;
|
|
127
|
+
const deploymentAvailable = chunk4TWXQFHU_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
|
+
() => chunk4TWXQFHU_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 = chunk4TWXQFHU_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
|
+
chunk4TWXQFHU_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 === chunk4TWXQFHU_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 !== chunk4TWXQFHU_cjs.CALL_CAPTION_TOPIC || !callKey) return;
|
|
225
225
|
const identity = participant?.identity ?? participantIdentity;
|
|
226
226
|
if (!identity || identity === myIdentity) return;
|
|
227
|
-
void
|
|
227
|
+
void chunk4TWXQFHU_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 = chunk4TWXQFHU_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 chunk4TWXQFHU_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: chunk4TWXQFHU_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 = chunk5QOZLKAY_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
|
+
() => chunk4TWXQFHU_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 !== chunk4TWXQFHU_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 chunk4TWXQFHU_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 = chunk5QOZLKAY_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 chunk4TWXQFHU_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: () => chunk4TWXQFHU_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 = chunk5QOZLKAY_cjs.useArbi();
|
|
595
595
|
const queryClient = reactQuery.useQueryClient();
|
|
596
|
-
const openMeetingChat =
|
|
596
|
+
const openMeetingChat = chunk5QOZLKAY_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 !== chunk4TWXQFHU_cjs.CALL_CHAT_TOPIC) return;
|
|
616
616
|
const identity = participant?.identity ?? participantIdentity;
|
|
617
617
|
if (!identity || identity === myIdentity) return;
|
|
618
|
-
void
|
|
618
|
+
void chunk4TWXQFHU_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
|
+
chunk4TWXQFHU_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, chunk4TWXQFHU_cjs.CALL_CHAT_MAX_CHARS);
|
|
660
660
|
if (!text || !callKey || readOnly) return;
|
|
661
|
-
const id =
|
|
661
|
+
const id = chunk4TWXQFHU_cjs.newPacketId();
|
|
662
662
|
const at = Date.now();
|
|
663
663
|
await localParticipant.publishData(
|
|
664
|
-
await
|
|
665
|
-
{ reliable: true, topic:
|
|
664
|
+
await chunk4TWXQFHU_cjs.encodeCallChatPacket({ v: 1, id, text, at }, callKey),
|
|
665
|
+
{ reliable: true, topic: chunk4TWXQFHU_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 chunk4TWXQFHU_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 chunk4TWXQFHU_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
|
+
() => chunk4TWXQFHU_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 = chunk5QOZLKAY_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) => chunk4TWXQFHU_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 chunk4TWXQFHU_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 !== chunk4TWXQFHU_cjs.CALL_WEBINAR_TOPIC) return;
|
|
785
|
+
const packet = chunk4TWXQFHU_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
|
+
chunk4TWXQFHU_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
|
+
chunk4TWXQFHU_cjs.markRejoining(callExtId);
|
|
834
834
|
setStageCheck(false);
|
|
835
835
|
try {
|
|
836
836
|
await webinarApi().demote(callExtId, myIdentity, linkVersion);
|
|
837
837
|
} catch (err) {
|
|
838
|
-
|
|
838
|
+
chunk4TWXQFHU_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 chunk4TWXQFHU_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 chunk4TWXQFHU_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 = chunk4TWXQFHU_cjs.createMutedNotifier((text) => chunk5ECKSF6H_cjs.notify.info(text));
|
|
943
943
|
const onData = (payload, participant, _kind, topic, _encryption, participantIdentity) => {
|
|
944
|
-
if (topic !==
|
|
944
|
+
if (topic !== chunk4TWXQFHU_cjs.CALL_MODERATION_TOPIC) return;
|
|
945
945
|
if (participant || participantIdentity) return;
|
|
946
|
-
const notice =
|
|
946
|
+
const notice = chunk4TWXQFHU_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 = chunk4TWXQFHU_cjs.onCallEvent("call.muted", (message) => {
|
|
951
951
|
if (message.callExtId === callExtId) notifyMuted(message);
|
|
952
952
|
});
|
|
953
953
|
return () => {
|
package/dist/chat/ChatBubble.js
CHANGED
|
@@ -10,6 +10,8 @@ const TypingIndicator = memo(function TypingIndicator2() {
|
|
|
10
10
|
] }) }) });
|
|
11
11
|
});
|
|
12
12
|
const ChatBubble = memo(function ChatBubble2({
|
|
13
|
+
appearance = "standard",
|
|
14
|
+
compact = false,
|
|
13
15
|
message,
|
|
14
16
|
timestamp,
|
|
15
17
|
isSent,
|
|
@@ -20,6 +22,8 @@ const ChatBubble = memo(function ChatBubble2({
|
|
|
20
22
|
id,
|
|
21
23
|
isLastOfRun = true,
|
|
22
24
|
senderName,
|
|
25
|
+
senderBadge,
|
|
26
|
+
avatar,
|
|
23
27
|
classNames,
|
|
24
28
|
renderMessage = (m) => m,
|
|
25
29
|
formatTimestamp = (t) => t,
|
|
@@ -30,21 +34,10 @@ const ChatBubble = memo(function ChatBubble2({
|
|
|
30
34
|
const [isFocused, setIsFocused] = useState(false);
|
|
31
35
|
const showActions = isHovered || isFocused;
|
|
32
36
|
if (deleted) {
|
|
33
|
-
return /* @__PURE__ */ jsx(
|
|
34
|
-
"div",
|
|
35
|
-
{
|
|
36
|
-
id,
|
|
37
|
-
"data-testid": testId,
|
|
38
|
-
className: `flex w-full ${isSent ? "justify-end" : "justify-start"} mb-2`,
|
|
39
|
-
children: /* @__PURE__ */ jsx("div", { className: "text-sm text-muted-foreground italic px-3 py-1", children: "Message deleted" })
|
|
40
|
-
}
|
|
41
|
-
);
|
|
37
|
+
return /* @__PURE__ */ jsx("div", { id, "data-testid": testId, className: "flex w-full justify-start mb-2", children: /* @__PURE__ */ jsx("div", { className: "text-sm text-muted-foreground italic px-3 py-1", children: "Message deleted" }) });
|
|
42
38
|
}
|
|
43
|
-
const
|
|
44
|
-
|
|
45
|
-
isSent && isLastOfRun && "rounded-br-sm",
|
|
46
|
-
!isSent && isLastOfRun && "rounded-bl-sm"
|
|
47
|
-
);
|
|
39
|
+
const floating = appearance === "floating";
|
|
40
|
+
const bubbleRadius = "rounded-lg";
|
|
48
41
|
const bubbleSurface = isSent ? cn("bg-ai-accent-soft text-foreground chat-bubble-sent", classNames?.ownBubble) : cn("border border-border bg-card text-card-foreground", classNames?.peerBubble);
|
|
49
42
|
const copyLinkButton = onCopyLink && /* @__PURE__ */ jsx(
|
|
50
43
|
"button",
|
|
@@ -66,75 +59,73 @@ const ChatBubble = memo(function ChatBubble2({
|
|
|
66
59
|
id,
|
|
67
60
|
"data-testid": testId,
|
|
68
61
|
className: cn(
|
|
69
|
-
"flex w-full items-
|
|
70
|
-
|
|
71
|
-
|
|
62
|
+
"relative flex w-full min-w-0 items-start gap-2",
|
|
63
|
+
floating && "rounded-[24px] border border-foreground/[0.06] bg-card shadow-[0_2px_8px_rgba(16,19,42,0.05)]",
|
|
64
|
+
floating && (compact ? "items-center px-3.5 py-2" : "px-4 py-3.5"),
|
|
65
|
+
!floating && (isLastOfRun ? "mb-2" : "mb-0.5")
|
|
72
66
|
),
|
|
73
67
|
onMouseEnter: () => setIsHovered(true),
|
|
74
68
|
onMouseLeave: () => setIsHovered(false),
|
|
75
69
|
children: [
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
onDelete && /* @__PURE__ */ jsx(
|
|
79
|
-
"button",
|
|
80
|
-
{
|
|
81
|
-
onClick: onDelete,
|
|
82
|
-
onFocus: () => setIsFocused(true),
|
|
83
|
-
onBlur: () => setIsFocused(false),
|
|
84
|
-
className: cn(
|
|
85
|
-
"self-end p-1 transition-opacity focus:outline-none focus-visible:ring-1 focus-visible:ring-ring rounded",
|
|
86
|
-
showActions ? "opacity-100 text-destructive" : "opacity-0 text-muted-foreground"
|
|
87
|
-
),
|
|
88
|
-
"aria-label": "Delete message",
|
|
89
|
-
children: /* @__PURE__ */ jsx(Trash2, { className: "w-3.5 h-3.5" })
|
|
90
|
-
}
|
|
91
|
-
)
|
|
92
|
-
] }),
|
|
93
|
-
/* @__PURE__ */ jsx("div", { className: "flex flex-col max-w-[80%] md:max-w-[60%]", children: /* @__PURE__ */ jsxs(
|
|
70
|
+
avatar && /* @__PURE__ */ jsx("div", { className: cn("shrink-0", !compact && "pt-1"), children: avatar }),
|
|
71
|
+
/* @__PURE__ */ jsx("div", { className: "flex min-w-0 flex-1 flex-col", children: /* @__PURE__ */ jsxs(
|
|
94
72
|
"div",
|
|
95
73
|
{
|
|
96
74
|
className: cn(
|
|
97
|
-
"
|
|
98
|
-
bubbleRadius,
|
|
99
|
-
bubbleSurface
|
|
75
|
+
"break-words",
|
|
76
|
+
floating ? "min-w-0 flex-1" : cn("px-3.5 py-2 shadow-sm transition-shadow", bubbleRadius, bubbleSurface)
|
|
100
77
|
),
|
|
101
78
|
children: [
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
79
|
+
floating && !compact && senderName && /* @__PURE__ */ jsxs("div", { className: "mb-1 flex items-center gap-2 text-[11px] font-medium tracking-[0.01em] text-muted-foreground", children: [
|
|
80
|
+
senderName,
|
|
81
|
+
senderBadge
|
|
82
|
+
] }),
|
|
83
|
+
compact ? /* @__PURE__ */ jsx("div", { className: "truncate text-[13px] leading-5 text-muted-foreground", title: message, children: message }) : (message || !attachments) && /* @__PURE__ */ jsx(
|
|
105
84
|
"div",
|
|
106
85
|
{
|
|
107
86
|
className: cn(
|
|
108
|
-
"
|
|
109
|
-
|
|
87
|
+
"text-sm [&_.markdown-content]:space-y-1.5 [&_pre]:max-w-full [&_pre]:overflow-x-auto",
|
|
88
|
+
floating && "leading-[1.65] [&_.markdown-content]:leading-[1.65]",
|
|
89
|
+
floating && isSent && "text-[13px] text-muted-foreground"
|
|
110
90
|
),
|
|
111
|
-
children:
|
|
112
|
-
senderName && /* @__PURE__ */ jsx("span", { className: "text-xs font-medium leading-none opacity-90", children: senderName }),
|
|
113
|
-
/* @__PURE__ */ jsx("span", { className: "text-xs leading-none opacity-70", children: formatTimestamp(timestamp) }),
|
|
114
|
-
isSent && (read ? /* @__PURE__ */ jsx(CheckCheck, { className: "w-3.5 h-3.5 flex-shrink-0 opacity-80" }) : /* @__PURE__ */ jsx(Check, { className: "w-3.5 h-3.5 flex-shrink-0 opacity-60" }))
|
|
115
|
-
]
|
|
91
|
+
children: renderMessage(message)
|
|
116
92
|
}
|
|
117
|
-
)
|
|
93
|
+
),
|
|
94
|
+
attachments && /* @__PURE__ */ jsx("div", { className: cn(message && "mt-1.5"), children: attachments }),
|
|
95
|
+
!floating && isLastOfRun && /* @__PURE__ */ jsxs("div", { className: cn("flex items-center gap-1.5 mt-0.5", "justify-start"), children: [
|
|
96
|
+
senderName && /* @__PURE__ */ jsx("span", { className: "text-xs font-medium leading-none opacity-90", children: senderName }),
|
|
97
|
+
/* @__PURE__ */ jsx("span", { className: "text-xs leading-none opacity-70", children: formatTimestamp(timestamp) }),
|
|
98
|
+
isSent && (read ? /* @__PURE__ */ jsx(CheckCheck, { className: "w-3.5 h-3.5 flex-shrink-0 opacity-80" }) : /* @__PURE__ */ jsx(Check, { className: "w-3.5 h-3.5 flex-shrink-0 opacity-60" }))
|
|
99
|
+
] })
|
|
118
100
|
]
|
|
119
101
|
}
|
|
120
102
|
) }),
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
103
|
+
(onDelete || copyLinkButton) && /* @__PURE__ */ jsxs(
|
|
104
|
+
"div",
|
|
105
|
+
{
|
|
106
|
+
className: cn(
|
|
107
|
+
"absolute right-1 top-1 flex items-center gap-0.5 rounded",
|
|
108
|
+
showActions && "bg-background/90"
|
|
109
|
+
),
|
|
110
|
+
children: [
|
|
111
|
+
onDelete && /* @__PURE__ */ jsx(
|
|
112
|
+
"button",
|
|
113
|
+
{
|
|
114
|
+
onClick: onDelete,
|
|
115
|
+
onFocus: () => setIsFocused(true),
|
|
116
|
+
onBlur: () => setIsFocused(false),
|
|
117
|
+
className: cn(
|
|
118
|
+
"self-end p-1 transition-opacity focus:outline-none focus-visible:ring-1 focus-visible:ring-ring rounded",
|
|
119
|
+
showActions ? "opacity-100 text-destructive" : "opacity-0 text-muted-foreground"
|
|
120
|
+
),
|
|
121
|
+
"aria-label": "Delete message",
|
|
122
|
+
children: /* @__PURE__ */ jsx(Trash2, { className: "w-3.5 h-3.5" })
|
|
123
|
+
}
|
|
131
124
|
),
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
copyLinkButton
|
|
137
|
-
] })
|
|
125
|
+
copyLinkButton
|
|
126
|
+
]
|
|
127
|
+
}
|
|
128
|
+
)
|
|
138
129
|
]
|
|
139
130
|
}
|
|
140
131
|
);
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../src/chat/ChatBubble.tsx"],
|
|
4
|
-
"sourcesContent": ["/**\n * Chat Bubble Component\n * iMessage / WhatsApp-style message bubble with read receipts and\n * consecutive-message grouping.\n *\n * Promoted from the ARBI app. To keep `@arbidocs/react` light (peers react /\n * react-dom only), the two host-owned concerns \u2014 rendering the message body\n * (the app's heavy markdown renderer) and formatting the timestamp \u2014 are\n * injected via the optional `renderMessage` / `formatTimestamp` props. Both\n * default to plain text so the component works standalone; the ARBI app shim\n * wires in `<MarkdownRenderer>` and `formatFriendlyDate` for identical output.\n */\n\nimport { memo, useState, type ReactNode } from 'react'\nimport { Trash2, Check, CheckCheck, Link } from 'lucide-react'\nimport { cn } from '../lib/utils'\n\n/** Animated typing indicator (three bouncing dots) */\nexport const TypingIndicator = memo(function TypingIndicator() {\n return (\n <div className=\"flex w-full justify-start mb-2\" data-testid=\"dm-typing-indicator\">\n <div className=\"bg-card border border-primary rounded-2xl rounded-bl-md px-4 py-2.5\">\n <div className=\"flex gap-1 items-center\">\n <span className=\"w-1.5 h-1.5 rounded-full bg-muted-foreground animate-bounce [animation-delay:0ms]\" />\n <span className=\"w-1.5 h-1.5 rounded-full bg-muted-foreground animate-bounce [animation-delay:150ms]\" />\n <span className=\"w-1.5 h-1.5 rounded-full bg-muted-foreground animate-bounce [animation-delay:300ms]\" />\n </div>\n </div>\n </div>\n )\n})\n\nexport interface ChatBubbleProps {\n message: string\n timestamp: string\n isSent: boolean\n deleted?: boolean\n read?: boolean\n onDelete?: () => void\n /**\n * Copy a shareable deep link to this exact message. Optional \u2014 the host\n * builds the URL (it knows the workspace/deployment domain, the light\n * package doesn't), this just renders the affordance and calls back.\n */\n onCopyLink?: () => void\n /** Stable DOM anchor for scroll-to-message (a notification deep link, a\n * \"jump to this message\" action). Typically the message's external id. */\n id?: string\n /** Last bubble in a same-sender run; shows the timestamp and read receipt. */\n isLastOfRun?: boolean\n /**\n * Who sent it. Rendered in the meta row on the last bubble of a run, so a\n * thread that needs attribution (a group, or a rail-less list where the peer\n * isn't in a header) gets it without a row per message.\n */\n senderName?: string\n /** Per-slot brand overrides, so a consumer pins its accent in one place. */\n classNames?: {\n /** The current user's own bubble. */\n ownBubble?: string\n /** The peer's bubble. */\n peerBubble?: string\n }\n /**\n * Render the message body. Injected by the host so the light package doesn't\n * depend on the app's markdown renderer. Defaults to plain text.\n */\n renderMessage?: (message: string) => ReactNode\n /**\n * Format the timestamp shown on the last bubble of a run. Defaults to the\n * raw string.\n */\n formatTimestamp?: (timestamp: string) => string\n /**\n * Rendered inside the bubble under the text \u2014 e.g. a message's attached\n * files. The host owns fetching and decrypting them. A message with\n * attachments and no text shows only these.\n */\n attachments?: ReactNode\n /** Marks the message row, including the deleted tombstone. */\n 'data-testid'?: string\n}\n\nexport const ChatBubble = memo(function ChatBubble({\n message,\n timestamp,\n isSent,\n deleted,\n read,\n onDelete,\n onCopyLink,\n id,\n isLastOfRun = true,\n senderName,\n classNames,\n renderMessage = (m) => m,\n formatTimestamp = (t) => t,\n attachments,\n 'data-testid': testId,\n}: ChatBubbleProps) {\n const [isHovered, setIsHovered] = useState(false)\n const [isFocused, setIsFocused] = useState(false)\n const showActions = isHovered || isFocused\n\n // No \"edited\" indicator: `updated_at` is also bumped by read-state\n // patches, so we can't tell a real content edit from a recipient\n // marking the message as read. The created_at timestamp is the only\n // honest signal we can show here.\n\n if (deleted) {\n return (\n <div
|
|
5
|
-
"mappings": "AAsBQ,SACE,KADF;AATR,SAAS,MAAM,gBAAgC;AAC/C,SAAS,QAAQ,OAAO,YAAY,YAAY;AAChD,SAAS,UAAU;AAGZ,MAAM,kBAAkB,KAAK,SAASA,mBAAkB;AAC7D,SACE,oBAAC,SAAI,WAAU,kCAAiC,eAAY,uBAC1D,8BAAC,SAAI,WAAU,uEACb,+BAAC,SAAI,WAAU,2BACb;AAAA,wBAAC,UAAK,WAAU,qFAAoF;AAAA,IACpG,oBAAC,UAAK,WAAU,uFAAsF;AAAA,IACtG,oBAAC,UAAK,WAAU,uFAAsF;AAAA,KACxG,GACF,GACF;AAEJ,CAAC;
|
|
4
|
+
"sourcesContent": ["/**\n * Chat Bubble Component\n * iMessage / WhatsApp-style message bubble with read receipts and\n * consecutive-message grouping.\n *\n * Promoted from the ARBI app. To keep `@arbidocs/react` light (peers react /\n * react-dom only), the two host-owned concerns \u2014 rendering the message body\n * (the app's heavy markdown renderer) and formatting the timestamp \u2014 are\n * injected via the optional `renderMessage` / `formatTimestamp` props. Both\n * default to plain text so the component works standalone; the ARBI app shim\n * wires in `<MarkdownRenderer>` and `formatFriendlyDate` for identical output.\n */\n\nimport { memo, useState, type ReactNode } from 'react'\nimport { Trash2, Check, CheckCheck, Link } from 'lucide-react'\nimport { cn } from '../lib/utils'\n\n/** Animated typing indicator (three bouncing dots) */\nexport const TypingIndicator = memo(function TypingIndicator() {\n return (\n <div className=\"flex w-full justify-start mb-2\" data-testid=\"dm-typing-indicator\">\n <div className=\"bg-card border border-primary rounded-2xl rounded-bl-md px-4 py-2.5\">\n <div className=\"flex gap-1 items-center\">\n <span className=\"w-1.5 h-1.5 rounded-full bg-muted-foreground animate-bounce [animation-delay:0ms]\" />\n <span className=\"w-1.5 h-1.5 rounded-full bg-muted-foreground animate-bounce [animation-delay:150ms]\" />\n <span className=\"w-1.5 h-1.5 rounded-full bg-muted-foreground animate-bounce [animation-delay:300ms]\" />\n </div>\n </div>\n </div>\n )\n})\n\nexport interface ChatBubbleProps {\n appearance?: 'standard' | 'floating'\n /** Single-line query preview once its answer has arrived. */\n compact?: boolean\n message: string\n timestamp: string\n isSent: boolean\n deleted?: boolean\n read?: boolean\n onDelete?: () => void\n /**\n * Copy a shareable deep link to this exact message. Optional \u2014 the host\n * builds the URL (it knows the workspace/deployment domain, the light\n * package doesn't), this just renders the affordance and calls back.\n */\n onCopyLink?: () => void\n /** Stable DOM anchor for scroll-to-message (a notification deep link, a\n * \"jump to this message\" action). Typically the message's external id. */\n id?: string\n /** Last bubble in a same-sender run; shows the timestamp and read receipt. */\n isLastOfRun?: boolean\n /**\n * Who sent it. Rendered in the meta row on the last bubble of a run, so a\n * thread that needs attribution (a group, or a rail-less list where the peer\n * isn't in a header) gets it without a row per message.\n */\n senderName?: string\n senderBadge?: ReactNode\n /** Sender identity, shown on the same side for both participants. */\n avatar?: ReactNode\n /** Per-slot brand overrides, so a consumer pins its accent in one place. */\n classNames?: {\n /** The current user's own bubble. */\n ownBubble?: string\n /** The peer's bubble. */\n peerBubble?: string\n }\n /**\n * Render the message body. Injected by the host so the light package doesn't\n * depend on the app's markdown renderer. Defaults to plain text.\n */\n renderMessage?: (message: string) => ReactNode\n /**\n * Format the timestamp shown on the last bubble of a run. Defaults to the\n * raw string.\n */\n formatTimestamp?: (timestamp: string) => string\n /**\n * Rendered inside the bubble under the text \u2014 e.g. a message's attached\n * files. The host owns fetching and decrypting them. A message with\n * attachments and no text shows only these.\n */\n attachments?: ReactNode\n /** Marks the message row, including the deleted tombstone. */\n 'data-testid'?: string\n}\n\nexport const ChatBubble = memo(function ChatBubble({\n appearance = 'standard',\n compact = false,\n message,\n timestamp,\n isSent,\n deleted,\n read,\n onDelete,\n onCopyLink,\n id,\n isLastOfRun = true,\n senderName,\n senderBadge,\n avatar,\n classNames,\n renderMessage = (m) => m,\n formatTimestamp = (t) => t,\n attachments,\n 'data-testid': testId,\n}: ChatBubbleProps) {\n const [isHovered, setIsHovered] = useState(false)\n const [isFocused, setIsFocused] = useState(false)\n const showActions = isHovered || isFocused\n\n // No \"edited\" indicator: `updated_at` is also bumped by read-state\n // patches, so we can't tell a real content edit from a recipient\n // marking the message as read. The created_at timestamp is the only\n // honest signal we can show here.\n\n if (deleted) {\n return (\n <div id={id} data-testid={testId} className=\"flex w-full justify-start mb-2\">\n <div className=\"text-sm text-muted-foreground italic px-3 py-1\">Message deleted</div>\n </div>\n )\n }\n\n const floating = appearance === 'floating'\n const bubbleRadius = 'rounded-lg'\n\n // Own messages sit on a soft brand tint rather than full `primary`: a\n // saturated block per message shouts on a long thread, and a light surface\n // means markdown needs no colour inversion.\n //\n // The tint is `ai-accent-soft`, NOT `accent`. Plenty of themes set `accent`\n // equal to `muted` and a hair off `background` \u2014 ARBI's differ by 3% \u2014 so an\n // accent bubble there is invisible against the thread. `ai-accent-soft` is\n // part of the AI-accent contract every consuming app defines explicitly, so\n // it is a tint by construction.\n const bubbleSurface = isSent\n ? cn('bg-ai-accent-soft text-foreground chat-bubble-sent', classNames?.ownBubble)\n : cn('border border-border bg-card text-card-foreground', classNames?.peerBubble)\n\n const copyLinkButton = onCopyLink && (\n <button\n onClick={onCopyLink}\n onFocus={() => setIsFocused(true)}\n onBlur={() => setIsFocused(false)}\n className={cn(\n 'self-end p-1 transition-opacity focus:outline-none focus-visible:ring-1 focus-visible:ring-ring rounded',\n showActions ? 'opacity-100 text-foreground' : 'opacity-0 text-muted-foreground'\n )}\n aria-label=\"Copy link to this message\"\n >\n <Link className=\"w-3.5 h-3.5\" />\n </button>\n )\n\n return (\n <div\n id={id}\n data-testid={testId}\n className={cn(\n 'relative flex w-full min-w-0 items-start gap-2',\n floating &&\n 'rounded-[24px] border border-foreground/[0.06] bg-card shadow-[0_2px_8px_rgba(16,19,42,0.05)]',\n floating && (compact ? 'items-center px-3.5 py-2' : 'px-4 py-3.5'),\n !floating && (isLastOfRun ? 'mb-2' : 'mb-0.5')\n )}\n onMouseEnter={() => setIsHovered(true)}\n onMouseLeave={() => setIsHovered(false)}\n >\n {avatar && <div className={cn('shrink-0', !compact && 'pt-1')}>{avatar}</div>}\n\n <div className=\"flex min-w-0 flex-1 flex-col\">\n <div\n className={cn(\n 'break-words',\n floating\n ? 'min-w-0 flex-1'\n : cn('px-3.5 py-2 shadow-sm transition-shadow', bubbleRadius, bubbleSurface)\n )}\n >\n {floating && !compact && senderName && (\n <div className=\"mb-1 flex items-center gap-2 text-[11px] font-medium tracking-[0.01em] text-muted-foreground\">\n {senderName}\n {senderBadge}\n </div>\n )}\n {compact ? (\n <div className=\"truncate text-[13px] leading-5 text-muted-foreground\" title={message}>\n {message}\n </div>\n ) : (\n (message || !attachments) && (\n <div\n className={cn(\n 'text-sm [&_.markdown-content]:space-y-1.5 [&_pre]:max-w-full [&_pre]:overflow-x-auto',\n floating && 'leading-[1.65] [&_.markdown-content]:leading-[1.65]',\n floating && isSent && 'text-[13px] text-muted-foreground'\n )}\n >\n {renderMessage(message)}\n </div>\n )\n )}\n {attachments && <div className={cn(message && 'mt-1.5')}>{attachments}</div>}\n\n {/* Sender + timestamp + read receipt, only on the last bubble of the\n run \u2014 a meta row per message is noise in a 1:1 thread. */}\n {!floating && isLastOfRun && (\n <div className={cn('flex items-center gap-1.5 mt-0.5', 'justify-start')}>\n {senderName && (\n <span className=\"text-xs font-medium leading-none opacity-90\">{senderName}</span>\n )}\n <span className=\"text-xs leading-none opacity-70\">{formatTimestamp(timestamp)}</span>\n {isSent &&\n (read ? (\n <CheckCheck className=\"w-3.5 h-3.5 flex-shrink-0 opacity-80\" />\n ) : (\n <Check className=\"w-3.5 h-3.5 flex-shrink-0 opacity-60\" />\n ))}\n </div>\n )}\n </div>\n </div>\n\n {/* Message actions share the same position in either direction. */}\n {(onDelete || copyLinkButton) && (\n <div\n className={cn(\n 'absolute right-1 top-1 flex items-center gap-0.5 rounded',\n showActions && 'bg-background/90'\n )}\n >\n {onDelete && (\n <button\n onClick={onDelete}\n onFocus={() => setIsFocused(true)}\n onBlur={() => setIsFocused(false)}\n className={cn(\n 'self-end p-1 transition-opacity focus:outline-none focus-visible:ring-1 focus-visible:ring-ring rounded',\n showActions ? 'opacity-100 text-destructive' : 'opacity-0 text-muted-foreground'\n )}\n aria-label=\"Delete message\"\n >\n <Trash2 className=\"w-3.5 h-3.5\" />\n </button>\n )}\n {copyLinkButton}\n </div>\n )}\n </div>\n )\n})\n"],
|
|
5
|
+
"mappings": "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",
|
|
6
6
|
"names": ["TypingIndicator", "ChatBubble"]
|
|
7
7
|
}
|
|
@@ -1,7 +1,10 @@
|
|
|
1
1
|
import { useEffect, useRef, useSyncExternalStore } from "react";
|
|
2
2
|
import { parseVersionRef } from "../artifacts/versions.js";
|
|
3
3
|
function opensInWord(doc) {
|
|
4
|
-
|
|
4
|
+
if (!doc) return false;
|
|
5
|
+
const name = (doc.file_name ?? "").toLowerCase();
|
|
6
|
+
if (name.endsWith(".docx")) return true;
|
|
7
|
+
return doc.wp_type === "artifact" && (!/\.[a-z0-9]+$/.test(name) || /\.(md|markdown|txt|html|htm|jsx)$/.test(name));
|
|
5
8
|
}
|
|
6
9
|
const isSlideDeck = (doc) => !!doc?.file_name?.toLowerCase().endsWith(".pptx");
|
|
7
10
|
function savedDocumentIdFor(input) {
|