@arbidocs/react 0.5.161 → 0.5.162

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.
@@ -1,7 +1,7 @@
1
1
  'use strict';
2
2
 
3
3
  var chunkV5WCKJEH_cjs = require('../chunk-V5WCKJEH.cjs');
4
- var chunk2MGJXBBJ_cjs = require('../chunk-2MGJXBBJ.cjs');
4
+ var chunkSUMXDNYG_cjs = require('../chunk-SUMXDNYG.cjs');
5
5
  var chunk3AADNIOK_cjs = require('../chunk-3AADNIOK.cjs');
6
6
  var chunkZZBCZRA5_cjs = require('../chunk-ZZBCZRA5.cjs');
7
7
  require('../chunk-N73IMVFF.cjs');
@@ -331,7 +331,7 @@ function useArtifactVersions(workspaceId, docId) {
331
331
  () => (documents ?? []).find((d) => d.external_id === plainId),
332
332
  [documents, plainId]
333
333
  );
334
- const { data: history } = chunk2MGJXBBJ_cjs.useDocumentVersionList(plainId, {
334
+ const { data: history } = chunkSUMXDNYG_cjs.useDocumentVersionList(plainId, {
335
335
  enabled: !!plainId && documents !== void 0 && !listed
336
336
  });
337
337
  return react.useMemo(
@@ -1,7 +1,7 @@
1
1
  'use strict';
2
2
 
3
- var chunkGVU3KYP3_cjs = require('../../chunk-GVU3KYP3.cjs');
4
- require('../../chunk-2MGJXBBJ.cjs');
3
+ var chunk42X5ZO7Y_cjs = require('../../chunk-42X5ZO7Y.cjs');
4
+ require('../../chunk-SUMXDNYG.cjs');
5
5
  var chunkZZBCZRA5_cjs = require('../../chunk-ZZBCZRA5.cjs');
6
6
  var chunk5ECKSF6H_cjs = require('../../chunk-5ECKSF6H.cjs');
7
7
  require('../../chunk-N73IMVFF.cjs');
@@ -123,8 +123,8 @@ function useCallTranscriber({
123
123
  const arbi = chunkZZBCZRA5_cjs.useArbi();
124
124
  const queryClient = reactQuery.useQueryClient();
125
125
  const profile = arbi.isLoggedIn ? arbi.user.profile() : null;
126
- const myProfileName = profile && chunkGVU3KYP3_cjs.toProfileView(profile).fullName || null;
127
- const deploymentAvailable = chunkGVU3KYP3_cjs.useCallTranscriptionAvailable();
126
+ const myProfileName = profile && chunk42X5ZO7Y_cjs.toProfileView(profile).fullName || null;
127
+ const deploymentAvailable = chunk42X5ZO7Y_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
- () => chunkGVU3KYP3_cjs.onCallEvent("call.transcription", (message) => {
170
+ () => chunk42X5ZO7Y_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 = chunkGVU3KYP3_cjs.transcriptPersistRole({
186
+ const role = chunk42X5ZO7Y_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
- chunkGVU3KYP3_cjs.persistTranscriptSegment(arbi, queryClient, callExtId, callKey, segment).catch(
195
+ chunk42X5ZO7Y_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 === chunkGVU3KYP3_cjs.CALL_TRANSCRIPTION_TOPIC) {
215
+ if (topic === chunk42X5ZO7Y_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 !== chunkGVU3KYP3_cjs.CALL_CAPTION_TOPIC || !callKey) return;
224
+ if (topic !== chunk42X5ZO7Y_cjs.CALL_CAPTION_TOPIC || !callKey) return;
225
225
  const identity = participant?.identity ?? participantIdentity;
226
226
  if (!identity || identity === myIdentity) return;
227
- void chunkGVU3KYP3_cjs.decodeCaptionPacket(payload, callKey).then((packet) => {
227
+ void chunk42X5ZO7Y_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 = chunkGVU3KYP3_cjs.newSegmentId();
267
+ const segmentId = chunk42X5ZO7Y_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 chunkGVU3KYP3_cjs.encodeCaptionPacket(
301
+ await chunk42X5ZO7Y_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: chunkGVU3KYP3_cjs.CALL_CAPTION_TOPIC }
313
+ { reliable: true, topic: chunk42X5ZO7Y_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
- () => chunkGVU3KYP3_cjs.onCallEvent("call.recording", (message) => {
428
+ () => chunk42X5ZO7Y_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 !== chunkGVU3KYP3_cjs.CALL_RECORDING_TOPIC) return;
435
+ if (topic !== chunk42X5ZO7Y_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 chunkGVU3KYP3_cjs.ensureMeetingChat(arbi, queryClient, callExtId, callKey);
456
+ const ref = await chunk42X5ZO7Y_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 chunkGVU3KYP3_cjs.trackUploaderFor({
558
+ return chunk42X5ZO7Y_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: () => chunkGVU3KYP3_cjs.conversationKeyForCall(arbi, queryClient, call, { callKey }),
566
+ conversationKey: () => chunk42X5ZO7Y_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 !== chunkGVU3KYP3_cjs.CALL_CHAT_TOPIC) return;
615
+ if (topic !== chunk42X5ZO7Y_cjs.CALL_CHAT_TOPIC) return;
616
616
  const identity = participant?.identity ?? participantIdentity;
617
617
  if (!identity || identity === myIdentity) return;
618
- void chunkGVU3KYP3_cjs.decodeCallChatPacket(payload, callKey).then((packet) => {
618
+ void chunk42X5ZO7Y_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
- chunkGVU3KYP3_cjs.loadMeetingHistory(arbi, queryClient, callExtId).then((result) => {
648
+ chunk42X5ZO7Y_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, chunkGVU3KYP3_cjs.CALL_CHAT_MAX_CHARS);
659
+ const text = raw.trim().slice(0, chunk42X5ZO7Y_cjs.CALL_CHAT_MAX_CHARS);
660
660
  if (!text || !callKey || readOnly) return;
661
- const id = chunkGVU3KYP3_cjs.newPacketId();
661
+ const id = chunk42X5ZO7Y_cjs.newPacketId();
662
662
  const at = Date.now();
663
663
  await localParticipant.publishData(
664
- await chunkGVU3KYP3_cjs.encodeCallChatPacket({ v: 1, id, text, at }, callKey),
665
- { reliable: true, topic: chunkGVU3KYP3_cjs.CALL_CHAT_TOPIC }
664
+ await chunk42X5ZO7Y_cjs.encodeCallChatPacket({ v: 1, id, text, at }, callKey),
665
+ { reliable: true, topic: chunk42X5ZO7Y_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 chunkGVU3KYP3_cjs.persistMeetingMessage(arbi, queryClient, callExtId, callKey, text));
684
+ setMeetingChat(await chunk42X5ZO7Y_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 chunkGVU3KYP3_cjs.ensureMeetingChat(arbi, queryClient, callExtId, callKey);
696
+ const ref = meetingChat ?? await chunk42X5ZO7Y_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
- () => chunkGVU3KYP3_cjs.mergeChatLines(history, live, {
704
+ () => chunk42X5ZO7Y_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) => chunkGVU3KYP3_cjs.openQuestion(q, callKey)));
763
+ const opened = await Promise.all(rows.map((q) => chunk42X5ZO7Y_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 chunkGVU3KYP3_cjs.onCallEvent("call.webinar", (m) => {
775
+ return chunk42X5ZO7Y_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 !== chunkGVU3KYP3_cjs.CALL_WEBINAR_TOPIC) return;
785
- const packet = chunkGVU3KYP3_cjs.parseWebinarPacket(payload, !!(participant || participantIdentity));
784
+ if (topic !== chunk42X5ZO7Y_cjs.CALL_WEBINAR_TOPIC) return;
785
+ const packet = chunk42X5ZO7Y_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
- chunkGVU3KYP3_cjs.markRejoining(callExtId);
806
+ chunk42X5ZO7Y_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
- chunkGVU3KYP3_cjs.markRejoining(callExtId);
833
+ chunk42X5ZO7Y_cjs.markRejoining(callExtId);
834
834
  setStageCheck(false);
835
835
  try {
836
836
  await webinarApi().demote(callExtId, myIdentity, linkVersion);
837
837
  } catch (err) {
838
- chunkGVU3KYP3_cjs.markRejoining(callExtId, false);
838
+ chunk42X5ZO7Y_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 chunkGVU3KYP3_cjs.sealQuestionText(text, callKey),
898
+ await chunk42X5ZO7Y_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 chunkGVU3KYP3_cjs.sealQuestionText(text, callKey) },
912
+ { answer: await chunk42X5ZO7Y_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 = chunkGVU3KYP3_cjs.createMutedNotifier((text) => chunk5ECKSF6H_cjs.notify.info(text));
942
+ const notifyMuted = chunk42X5ZO7Y_cjs.createMutedNotifier((text) => chunk5ECKSF6H_cjs.notify.info(text));
943
943
  const onData = (payload, participant, _kind, topic, _encryption, participantIdentity) => {
944
- if (topic !== chunkGVU3KYP3_cjs.CALL_MODERATION_TOPIC) return;
944
+ if (topic !== chunk42X5ZO7Y_cjs.CALL_MODERATION_TOPIC) return;
945
945
  if (participant || participantIdentity) return;
946
- const notice = chunkGVU3KYP3_cjs.mutedNoticeFromPacket(payload);
946
+ const notice = chunk42X5ZO7Y_cjs.mutedNoticeFromPacket(payload);
947
947
  if (notice) notifyMuted(notice);
948
948
  };
949
949
  room.on(livekitClient.RoomEvent.DataReceived, onData);
950
- const offWs = chunkGVU3KYP3_cjs.onCallEvent("call.muted", (message) => {
950
+ const offWs = chunk42X5ZO7Y_cjs.onCallEvent("call.muted", (message) => {
951
951
  if (message.callExtId === callExtId) notifyMuted(message);
952
952
  });
953
953
  return () => {
@@ -1,6 +1,7 @@
1
1
  import { useEffect, useMemo, useRef } from "react";
2
2
  import { useQueryClient } from "@tanstack/react-query";
3
3
  import { arbiQueryKeys } from "../hooks.js";
4
+ import { readConversationList } from "../conversation-list.js";
4
5
  import { useArbi } from "../useArbi.js";
5
6
  import { useCanEditShared, useUpdateConversation, useWorkflows } from "../workforce.js";
6
7
  function workflowRunTitle(workflowName, createdAt) {
@@ -33,7 +34,11 @@ function useWorkflowRunTitles(conversations, openId, workspaceId) {
33
34
  void (async () => {
34
35
  const fresh = await queryClient.fetchQuery({
35
36
  queryKey: arbiQueryKeys.conversations(workspaceId),
36
- queryFn: () => arbi.conversations.list({ workspaceId }),
37
+ queryFn: () => readConversationList(
38
+ queryClient,
39
+ workspaceId,
40
+ () => arbi.conversations.list({ workspaceId })
41
+ ),
37
42
  staleTime: 0
38
43
  });
39
44
  if (fresh.find((c) => c.external_id === openId)?.title) return;
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "version": 3,
3
3
  "sources": ["../../src/chat/workflow-run-titles.ts"],
4
- "sourcesContent": ["/**\n * A saved workflow's run (a thread its trigger or \"Run now\" started on the server) starts\n * untitled: the server holds no workspace key to write a title, and there is no question of the\n * person's to name it after. Thread lists name it after its workflow and the day it started, and\n * the open one is titled so on the server once, so every other list shows the same name.\n */\n\nimport { useEffect, useMemo, useRef } from 'react'\nimport { useQueryClient } from '@tanstack/react-query'\nimport { arbiQueryKeys } from '../hooks'\nimport { useArbi } from '../useArbi'\nimport { useCanEditShared, useUpdateConversation, useWorkflows } from '../workforce'\n\n/** An untitled run's name: the workflow and the day it started (\"Weekly review \u2014 28 Oct\"). */\nexport function workflowRunTitle(workflowName: string, createdAt: string): string {\n const day = new Date(createdAt).toLocaleDateString(undefined, { day: 'numeric', month: 'short' })\n return `${workflowName} \u2014 ${day}`\n}\n\n/** What a run's name is made from (a conversation list's row). */\nexport interface WorkflowRunRow {\n external_id: string\n title?: string | null\n workflow_ext_id?: string | null\n created_at?: string | null\n is_owner?: boolean\n is_shared?: boolean\n}\n\n/**\n * Names for the untitled saved-workflow runs among `conversations` (the list of `workspaceId`),\n * by id (runs of a workflow the caller cannot list keep no name). The open one (`openId`) is\n * titled with its name on the server, when the viewer may edit it (its owner, or an editor of a\n * shared one) and it is still untitled when the list is read again just before (a rename in\n * another tab wins).\n */\nexport function useWorkflowRunTitles(\n conversations: readonly WorkflowRunRow[],\n openId: string | null,\n workspaceId: string | undefined\n): Record<string, string> {\n const hasUntitledRun = conversations.some((c) => !c.title && c.workflow_ext_id && c.created_at)\n const { data: workflows } = useWorkflows({ enabled: hasUntitledRun })\n const titles = useMemo(() => {\n const names = new Map((workflows ?? []).map((w) => [w.external_id, w.name]))\n const out: Record<string, string> = {}\n for (const c of conversations) {\n const name = !c.title && c.workflow_ext_id ? names.get(c.workflow_ext_id) : undefined\n if (name && c.created_at) out[c.external_id] = workflowRunTitle(name, c.created_at)\n }\n return out\n }, [workflows, conversations])\n\n const arbi = useArbi()\n const queryClient = useQueryClient()\n const canEditShared = useCanEditShared()\n const { mutateAsync: rename } = useUpdateConversation()\n const titled = useRef(new Set<string>())\n const open = openId ? conversations.find((c) => c.external_id === openId) : undefined\n const openTitle = openId ? titles[openId] : undefined\n const mayEdit = !!open && (open.is_owner === true || (open.is_shared === true && canEditShared))\n useEffect(() => {\n if (!openId || !openTitle || !mayEdit || !workspaceId || titled.current.has(openId)) return\n titled.current.add(openId)\n void (async () => {\n // The list as the server has it now, not as cached: a title given meanwhile is kept.\n const fresh = await queryClient.fetchQuery({\n queryKey: arbiQueryKeys.conversations(workspaceId),\n queryFn: () => arbi.conversations.list({ workspaceId }),\n staleTime: 0,\n })\n if (fresh.find((c) => c.external_id === openId)?.title) return\n await rename({ conversationId: openId, patch: { title: openTitle } })\n })().catch(() => {\n // Naming is a courtesy: the list keeps showing the name either way.\n })\n }, [openId, openTitle, mayEdit, workspaceId, arbi, queryClient, rename])\n return titles\n}\n"],
5
- "mappings": "AAOA,SAAS,WAAW,SAAS,cAAc;AAC3C,SAAS,sBAAsB;AAC/B,SAAS,qBAAqB;AAC9B,SAAS,eAAe;AACxB,SAAS,kBAAkB,uBAAuB,oBAAoB;AAG/D,SAAS,iBAAiB,cAAsB,WAA2B;AAChF,QAAM,MAAM,IAAI,KAAK,SAAS,EAAE,mBAAmB,QAAW,EAAE,KAAK,WAAW,OAAO,QAAQ,CAAC;AAChG,SAAO,GAAG,YAAY,WAAM,GAAG;AACjC;AAmBO,SAAS,qBACd,eACA,QACA,aACwB;AACxB,QAAM,iBAAiB,cAAc,KAAK,CAAC,MAAM,CAAC,EAAE,SAAS,EAAE,mBAAmB,EAAE,UAAU;AAC9F,QAAM,EAAE,MAAM,UAAU,IAAI,aAAa,EAAE,SAAS,eAAe,CAAC;AACpE,QAAM,SAAS,QAAQ,MAAM;AAC3B,UAAM,QAAQ,IAAI,KAAK,aAAa,CAAC,GAAG,IAAI,CAAC,MAAM,CAAC,EAAE,aAAa,EAAE,IAAI,CAAC,CAAC;AAC3E,UAAM,MAA8B,CAAC;AACrC,eAAW,KAAK,eAAe;AAC7B,YAAM,OAAO,CAAC,EAAE,SAAS,EAAE,kBAAkB,MAAM,IAAI,EAAE,eAAe,IAAI;AAC5E,UAAI,QAAQ,EAAE,WAAY,KAAI,EAAE,WAAW,IAAI,iBAAiB,MAAM,EAAE,UAAU;AAAA,IACpF;AACA,WAAO;AAAA,EACT,GAAG,CAAC,WAAW,aAAa,CAAC;AAE7B,QAAM,OAAO,QAAQ;AACrB,QAAM,cAAc,eAAe;AACnC,QAAM,gBAAgB,iBAAiB;AACvC,QAAM,EAAE,aAAa,OAAO,IAAI,sBAAsB;AACtD,QAAM,SAAS,OAAO,oBAAI,IAAY,CAAC;AACvC,QAAM,OAAO,SAAS,cAAc,KAAK,CAAC,MAAM,EAAE,gBAAgB,MAAM,IAAI;AAC5E,QAAM,YAAY,SAAS,OAAO,MAAM,IAAI;AAC5C,QAAM,UAAU,CAAC,CAAC,SAAS,KAAK,aAAa,QAAS,KAAK,cAAc,QAAQ;AACjF,YAAU,MAAM;AACd,QAAI,CAAC,UAAU,CAAC,aAAa,CAAC,WAAW,CAAC,eAAe,OAAO,QAAQ,IAAI,MAAM,EAAG;AACrF,WAAO,QAAQ,IAAI,MAAM;AACzB,UAAM,YAAY;AAEhB,YAAM,QAAQ,MAAM,YAAY,WAAW;AAAA,QACzC,UAAU,cAAc,cAAc,WAAW;AAAA,QACjD,SAAS,MAAM,KAAK,cAAc,KAAK,EAAE,YAAY,CAAC;AAAA,QACtD,WAAW;AAAA,MACb,CAAC;AACD,UAAI,MAAM,KAAK,CAAC,MAAM,EAAE,gBAAgB,MAAM,GAAG,MAAO;AACxD,YAAM,OAAO,EAAE,gBAAgB,QAAQ,OAAO,EAAE,OAAO,UAAU,EAAE,CAAC;AAAA,IACtE,GAAG,EAAE,MAAM,MAAM;AAAA,IAEjB,CAAC;AAAA,EACH,GAAG,CAAC,QAAQ,WAAW,SAAS,aAAa,MAAM,aAAa,MAAM,CAAC;AACvE,SAAO;AACT;",
4
+ "sourcesContent": ["/**\n * A saved workflow's run (a thread its trigger or \"Run now\" started on the server) starts\n * untitled: the server holds no workspace key to write a title, and there is no question of the\n * person's to name it after. Thread lists name it after its workflow and the day it started, and\n * the open one is titled so on the server once, so every other list shows the same name.\n */\n\nimport { useEffect, useMemo, useRef } from 'react'\nimport { useQueryClient } from '@tanstack/react-query'\nimport { arbiQueryKeys } from '../hooks'\nimport { readConversationList } from '../conversation-list'\nimport { useArbi } from '../useArbi'\nimport { useCanEditShared, useUpdateConversation, useWorkflows } from '../workforce'\n\n/** An untitled run's name: the workflow and the day it started (\"Weekly review \u2014 28 Oct\"). */\nexport function workflowRunTitle(workflowName: string, createdAt: string): string {\n const day = new Date(createdAt).toLocaleDateString(undefined, { day: 'numeric', month: 'short' })\n return `${workflowName} \u2014 ${day}`\n}\n\n/** What a run's name is made from (a conversation list's row). */\nexport interface WorkflowRunRow {\n external_id: string\n title?: string | null\n workflow_ext_id?: string | null\n created_at?: string | null\n is_owner?: boolean\n is_shared?: boolean\n}\n\n/**\n * Names for the untitled saved-workflow runs among `conversations` (the list of `workspaceId`),\n * by id (runs of a workflow the caller cannot list keep no name). The open one (`openId`) is\n * titled with its name on the server, when the viewer may edit it (its owner, or an editor of a\n * shared one) and it is still untitled when the list is read again just before (a rename in\n * another tab wins).\n */\nexport function useWorkflowRunTitles(\n conversations: readonly WorkflowRunRow[],\n openId: string | null,\n workspaceId: string | undefined\n): Record<string, string> {\n const hasUntitledRun = conversations.some((c) => !c.title && c.workflow_ext_id && c.created_at)\n const { data: workflows } = useWorkflows({ enabled: hasUntitledRun })\n const titles = useMemo(() => {\n const names = new Map((workflows ?? []).map((w) => [w.external_id, w.name]))\n const out: Record<string, string> = {}\n for (const c of conversations) {\n const name = !c.title && c.workflow_ext_id ? names.get(c.workflow_ext_id) : undefined\n if (name && c.created_at) out[c.external_id] = workflowRunTitle(name, c.created_at)\n }\n return out\n }, [workflows, conversations])\n\n const arbi = useArbi()\n const queryClient = useQueryClient()\n const canEditShared = useCanEditShared()\n const { mutateAsync: rename } = useUpdateConversation()\n const titled = useRef(new Set<string>())\n const open = openId ? conversations.find((c) => c.external_id === openId) : undefined\n const openTitle = openId ? titles[openId] : undefined\n const mayEdit = !!open && (open.is_owner === true || (open.is_shared === true && canEditShared))\n useEffect(() => {\n if (!openId || !openTitle || !mayEdit || !workspaceId || titled.current.has(openId)) return\n titled.current.add(openId)\n void (async () => {\n // The list as the server has it now, not as cached: a title given meanwhile is kept.\n const fresh = await queryClient.fetchQuery({\n queryKey: arbiQueryKeys.conversations(workspaceId),\n queryFn: () =>\n readConversationList(queryClient, workspaceId, () =>\n arbi.conversations.list({ workspaceId })\n ),\n staleTime: 0,\n })\n if (fresh.find((c) => c.external_id === openId)?.title) return\n await rename({ conversationId: openId, patch: { title: openTitle } })\n })().catch(() => {\n // Naming is a courtesy: the list keeps showing the name either way.\n })\n }, [openId, openTitle, mayEdit, workspaceId, arbi, queryClient, rename])\n return titles\n}\n"],
5
+ "mappings": "AAOA,SAAS,WAAW,SAAS,cAAc;AAC3C,SAAS,sBAAsB;AAC/B,SAAS,qBAAqB;AAC9B,SAAS,4BAA4B;AACrC,SAAS,eAAe;AACxB,SAAS,kBAAkB,uBAAuB,oBAAoB;AAG/D,SAAS,iBAAiB,cAAsB,WAA2B;AAChF,QAAM,MAAM,IAAI,KAAK,SAAS,EAAE,mBAAmB,QAAW,EAAE,KAAK,WAAW,OAAO,QAAQ,CAAC;AAChG,SAAO,GAAG,YAAY,WAAM,GAAG;AACjC;AAmBO,SAAS,qBACd,eACA,QACA,aACwB;AACxB,QAAM,iBAAiB,cAAc,KAAK,CAAC,MAAM,CAAC,EAAE,SAAS,EAAE,mBAAmB,EAAE,UAAU;AAC9F,QAAM,EAAE,MAAM,UAAU,IAAI,aAAa,EAAE,SAAS,eAAe,CAAC;AACpE,QAAM,SAAS,QAAQ,MAAM;AAC3B,UAAM,QAAQ,IAAI,KAAK,aAAa,CAAC,GAAG,IAAI,CAAC,MAAM,CAAC,EAAE,aAAa,EAAE,IAAI,CAAC,CAAC;AAC3E,UAAM,MAA8B,CAAC;AACrC,eAAW,KAAK,eAAe;AAC7B,YAAM,OAAO,CAAC,EAAE,SAAS,EAAE,kBAAkB,MAAM,IAAI,EAAE,eAAe,IAAI;AAC5E,UAAI,QAAQ,EAAE,WAAY,KAAI,EAAE,WAAW,IAAI,iBAAiB,MAAM,EAAE,UAAU;AAAA,IACpF;AACA,WAAO;AAAA,EACT,GAAG,CAAC,WAAW,aAAa,CAAC;AAE7B,QAAM,OAAO,QAAQ;AACrB,QAAM,cAAc,eAAe;AACnC,QAAM,gBAAgB,iBAAiB;AACvC,QAAM,EAAE,aAAa,OAAO,IAAI,sBAAsB;AACtD,QAAM,SAAS,OAAO,oBAAI,IAAY,CAAC;AACvC,QAAM,OAAO,SAAS,cAAc,KAAK,CAAC,MAAM,EAAE,gBAAgB,MAAM,IAAI;AAC5E,QAAM,YAAY,SAAS,OAAO,MAAM,IAAI;AAC5C,QAAM,UAAU,CAAC,CAAC,SAAS,KAAK,aAAa,QAAS,KAAK,cAAc,QAAQ;AACjF,YAAU,MAAM;AACd,QAAI,CAAC,UAAU,CAAC,aAAa,CAAC,WAAW,CAAC,eAAe,OAAO,QAAQ,IAAI,MAAM,EAAG;AACrF,WAAO,QAAQ,IAAI,MAAM;AACzB,UAAM,YAAY;AAEhB,YAAM,QAAQ,MAAM,YAAY,WAAW;AAAA,QACzC,UAAU,cAAc,cAAc,WAAW;AAAA,QACjD,SAAS,MACP;AAAA,UAAqB;AAAA,UAAa;AAAA,UAAa,MAC7C,KAAK,cAAc,KAAK,EAAE,YAAY,CAAC;AAAA,QACzC;AAAA,QACF,WAAW;AAAA,MACb,CAAC;AACD,UAAI,MAAM,KAAK,CAAC,MAAM,EAAE,gBAAgB,MAAM,GAAG,MAAO;AACxD,YAAM,OAAO,EAAE,gBAAgB,QAAQ,OAAO,EAAE,OAAO,UAAU,EAAE,CAAC;AAAA,IACtE,GAAG,EAAE,MAAM,MAAM;AAAA,IAEjB,CAAC;AAAA,EACH,GAAG,CAAC,QAAQ,WAAW,SAAS,aAAa,MAAM,aAAa,MAAM,CAAC;AACvE,SAAO;AACT;",
6
6
  "names": []
7
7
  }
@@ -1,6 +1,6 @@
1
1
  'use strict';
2
2
 
3
- var chunk2MGJXBBJ_cjs = require('./chunk-2MGJXBBJ.cjs');
3
+ var chunkSUMXDNYG_cjs = require('./chunk-SUMXDNYG.cjs');
4
4
  var chunkZZBCZRA5_cjs = require('./chunk-ZZBCZRA5.cjs');
5
5
  var chunk5ECKSF6H_cjs = require('./chunk-5ECKSF6H.cjs');
6
6
  var chunkEEIYXVM4_cjs = require('./chunk-EEIYXVM4.cjs');
@@ -173,72 +173,6 @@ function createLocalFeatureStore({
173
173
  hydrated: () => ready
174
174
  };
175
175
  }
176
-
177
- // src/conversation-list.ts
178
- function isConversationListKey(queryKey) {
179
- return queryKey.length === 3 && queryKey[0] === "arbi" && queryKey[1] === "conversations";
180
- }
181
- var LISTS = {
182
- predicate: (query) => isConversationListKey(query.queryKey)
183
- };
184
- function writeList(queryClient, key, next) {
185
- const staleRead = queryClient.getQueryState(key)?.fetchStatus === "fetching";
186
- queryClient.setQueryData(key, next);
187
- if (staleRead) void queryClient.refetchQueries({ queryKey: key, exact: true });
188
- }
189
- function patchLists(queryClient, reducer) {
190
- for (const [key, old] of queryClient.getQueriesData(LISTS)) {
191
- if (!old) continue;
192
- const next = reducer(old);
193
- if (next !== old) writeList(queryClient, key, next);
194
- }
195
- }
196
- function patchConversationList(queryClient, workspaceId, reducer) {
197
- if (!workspaceId) return;
198
- const key = chunkZZBCZRA5_cjs.arbiQueryKeys.conversations(workspaceId);
199
- const current = queryClient.getQueryData(key) ?? [];
200
- const next = reducer(current);
201
- if (next !== current) writeList(queryClient, key, next);
202
- }
203
- function addConversationToList(queryClient, workspaceId, conversation) {
204
- patchConversationList(queryClient, workspaceId, (old) => [
205
- conversation,
206
- ...old.filter((c) => c.external_id !== conversation.external_id)
207
- ]);
208
- }
209
- function patchConversation(queryClient, conversationId, update2) {
210
- patchLists(queryClient, (old) => {
211
- if (!old.some((c) => c.external_id === conversationId)) return old;
212
- return old.map(
213
- (c) => c.external_id === conversationId ? typeof update2 === "function" ? update2(c) : { ...c, ...update2 } : c
214
- );
215
- });
216
- }
217
- function removeConversationFromLists(queryClient, conversationId) {
218
- patchLists(
219
- queryClient,
220
- (old) => old.some((c) => c.external_id === conversationId) ? old.filter((c) => c.external_id !== conversationId) : old
221
- );
222
- }
223
- function invalidateConversationLists(queryClient) {
224
- return queryClient.invalidateQueries(LISTS);
225
- }
226
- function findConversation(queryClient, conversationId) {
227
- if (!conversationId) return void 0;
228
- for (const [, list] of queryClient.getQueriesData(LISTS)) {
229
- const row = list?.find((c) => c.external_id === conversationId);
230
- if (row) return row;
231
- }
232
- return void 0;
233
- }
234
- function isConversationShared(queryClient, conversationId) {
235
- return findConversation(queryClient, conversationId)?.is_shared ?? false;
236
- }
237
- function invalidateConversationDetails(queryClient, conversationId) {
238
- return queryClient.invalidateQueries({
239
- predicate: ({ queryKey }) => queryKey[0] === "arbi" && queryKey[1] === "conversations" && queryKey[2] === conversationId && queryKey[3] !== "threads"
240
- });
241
- }
242
176
  function myChatId(arbi) {
243
177
  try {
244
178
  return arbi.user.identity()?.externalId ?? null;
@@ -400,6 +334,10 @@ async function applyChatUpdated(arbi, queryClient, chatExtId, message) {
400
334
  function applyAgentDmStatus(queryClient, status) {
401
335
  if (!["queued", "working", "done", "failed"].includes(status.status)) return;
402
336
  queryClient.setQueryData(chunkZZBCZRA5_cjs.arbiQueryKeys.agentDmStatus(status.agent_ext_id), status);
337
+ if (status.status === "done" || status.status === "failed") {
338
+ void queryClient.invalidateQueries({ queryKey: chunkZZBCZRA5_cjs.calendarQueryKeys.all() });
339
+ void queryClient.invalidateQueries({ queryKey: chunkZZBCZRA5_cjs.callQueryKeys.all() });
340
+ }
403
341
  }
404
342
  async function applyChatEvent(arbi, queryClient, event) {
405
343
  const e = event;
@@ -1099,7 +1037,7 @@ function arbiAccountClient(arbi, overrides = {}) {
1099
1037
  if (everywhere) await arbi.sessions.logoutAll();
1100
1038
  else await arbi.logout();
1101
1039
  } finally {
1102
- chunk2MGJXBBJ_cjs.clearSealedDrafts();
1040
+ chunkSUMXDNYG_cjs.clearSealedDrafts();
1103
1041
  chunk5ECKSF6H_cjs.clearChatArtifacts();
1104
1042
  await wipeOfflineMail().catch(() => {
1105
1043
  });
@@ -1293,7 +1231,7 @@ function ensureMeetingChat(arbi, queryClient, callExtId, callKey) {
1293
1231
  if (!ref) throw new Error("The server did not return a meeting chat");
1294
1232
  if (ref.kind === "chat")
1295
1233
  void queryClient.invalidateQueries({ queryKey: chunkZZBCZRA5_cjs.arbiQueryKeys.chatList() });
1296
- else void invalidateConversationLists(queryClient);
1234
+ else void chunkSUMXDNYG_cjs.invalidateConversationLists(queryClient);
1297
1235
  return ref;
1298
1236
  })();
1299
1237
  pending.set(callExtId, run);
@@ -2449,7 +2387,7 @@ function useSaveToThread() {
2449
2387
  return react.useMemo(() => {
2450
2388
  const thenRefresh = async (run) => {
2451
2389
  const result = await run;
2452
- void invalidateConversationLists(queryClient);
2390
+ void chunkSUMXDNYG_cjs.invalidateConversationLists(queryClient);
2453
2391
  return result;
2454
2392
  };
2455
2393
  return {
@@ -2733,7 +2671,7 @@ function isWorkspaceGuestOf(workspaces, workspaceExtId, me) {
2733
2671
  function useMeetingReadOnly(lockedWorkspaceExtId) {
2734
2672
  const arbi = chunkZZBCZRA5_cjs.useArbi();
2735
2673
  const me = arbi.isLoggedIn ? arbi.user.identity()?.externalId ?? null : null;
2736
- const { data: workspaces } = chunk2MGJXBBJ_cjs.useWorkspaces({
2674
+ const { data: workspaces } = chunkSUMXDNYG_cjs.useWorkspaces({
2737
2675
  enabled: !!lockedWorkspaceExtId && arbi.isLoggedIn
2738
2676
  });
2739
2677
  return isWorkspaceGuestOf(
@@ -2808,7 +2746,6 @@ exports.TrackUploader = TrackUploader;
2808
2746
  exports.UPLOAD_ATTEMPTS = UPLOAD_ATTEMPTS;
2809
2747
  exports.UPLOAD_BACKOFF_MS = UPLOAD_BACKOFF_MS;
2810
2748
  exports.acceptRing = acceptRing;
2811
- exports.addConversationToList = addConversationToList;
2812
2749
  exports.allRecordSizes = allRecordSizes;
2813
2750
  exports.appendToThread = appendToThread;
2814
2751
  exports.applyAgentDmStatus = applyAgentDmStatus;
@@ -2858,7 +2795,6 @@ exports.entitlementRefusal = entitlementRefusal;
2858
2795
  exports.extensionFor = extensionFor;
2859
2796
  exports.fetchPart = fetchPart;
2860
2797
  exports.fileSafe = fileSafe;
2861
- exports.findConversation = findConversation;
2862
2798
  exports.floatToWav = floatToWav;
2863
2799
  exports.formatTranscriptMarkdown = formatTranscriptMarkdown;
2864
2800
  exports.getMeta = getMeta;
@@ -2869,10 +2805,6 @@ exports.hasRecord = hasRecord;
2869
2805
  exports.hasRecordingTranscript = hasRecordingTranscript;
2870
2806
  exports.inOfflineWindow = inOfflineWindow;
2871
2807
  exports.invalidateCall = invalidateCall;
2872
- exports.invalidateConversationDetails = invalidateConversationDetails;
2873
- exports.invalidateConversationLists = invalidateConversationLists;
2874
- exports.isConversationListKey = isConversationListKey;
2875
- exports.isConversationShared = isConversationShared;
2876
2808
  exports.isRecordingOver = isRecordingOver;
2877
2809
  exports.isRecordingSegmentId = isRecordingSegmentId;
2878
2810
  exports.isRetryable = isRetryable;
@@ -2905,8 +2837,6 @@ exports.parseWebinarPacket = parseWebinarPacket;
2905
2837
  exports.partKey = partKey;
2906
2838
  exports.partOffsetMs = partOffsetMs;
2907
2839
  exports.partsDue = partsDue;
2908
- exports.patchConversation = patchConversation;
2909
- exports.patchConversationList = patchConversationList;
2910
2840
  exports.persistMeetingMessage = persistMeetingMessage;
2911
2841
  exports.persistTranscriptSegment = persistTranscriptSegment;
2912
2842
  exports.playheadAt = playheadAt;
@@ -2920,7 +2850,6 @@ exports.recordsInBucket = recordsInBucket;
2920
2850
  exports.recordsOfKind = recordsOfKind;
2921
2851
  exports.rejoinAsAudience = rejoinAsAudience;
2922
2852
  exports.removeChat = removeChat;
2923
- exports.removeConversationFromLists = removeConversationFromLists;
2924
2853
  exports.resetCallSession = resetCallSession;
2925
2854
  exports.resolveMeetingChat = resolveMeetingChat;
2926
2855
  exports.saveRecordingFilesToThread = saveRecordingFilesToThread;
@@ -2995,5 +2924,5 @@ exports.useUserSettings = useUserSettings;
2995
2924
  exports.wipeOfflineMail = wipeOfflineMail;
2996
2925
  exports.wrapTrackKey = wrapTrackKey;
2997
2926
  exports.writeSamples = writeSamples;
2998
- //# sourceMappingURL=chunk-GVU3KYP3.cjs.map
2999
- //# sourceMappingURL=chunk-GVU3KYP3.cjs.map
2927
+ //# sourceMappingURL=chunk-42X5ZO7Y.cjs.map
2928
+ //# sourceMappingURL=chunk-42X5ZO7Y.cjs.map