@arbidocs/react 0.4.129 → 0.4.131
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/artifacts/index.cjs +6 -6
- package/dist/artifacts/index.js +1 -1
- package/dist/{chunk-AFGE55RQ.cjs → chunk-UN3AZUXX.cjs} +2 -11
- package/dist/chunk-UN3AZUXX.cjs.map +1 -0
- package/dist/{chunk-5WXNTCI3.js → chunk-XV7EOUQM.js} +3 -11
- package/dist/chunk-XV7EOUQM.js.map +1 -0
- package/dist/index.cjs +243 -163
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +124 -74
- package/dist/index.d.ts +124 -74
- package/dist/index.js +132 -52
- package/dist/index.js.map +1 -1
- package/package.json +3 -3
- package/dist/chunk-5WXNTCI3.js.map +0 -1
- package/dist/chunk-AFGE55RQ.cjs.map +0 -1
package/dist/index.cjs
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
|
-
var
|
|
3
|
+
var chunkUN3AZUXX_cjs = require('./chunk-UN3AZUXX.cjs');
|
|
4
4
|
var chunkS7J5SCTZ_cjs = require('./chunk-S7J5SCTZ.cjs');
|
|
5
5
|
var chunk5DCRIWCA_cjs = require('./chunk-5DCRIWCA.cjs');
|
|
6
6
|
var chunkBOJHNPNJ_cjs = require('./chunk-BOJHNPNJ.cjs');
|
|
@@ -42,7 +42,7 @@ function useUpdateConversation() {
|
|
|
42
42
|
conversationId,
|
|
43
43
|
patch
|
|
44
44
|
}) => arbi.conversations.update(conversationId, patch),
|
|
45
|
-
onSuccess: () => qc.invalidateQueries({ queryKey:
|
|
45
|
+
onSuccess: () => qc.invalidateQueries({ queryKey: chunkUN3AZUXX_cjs.arbiQueryKeys.allConversations() })
|
|
46
46
|
});
|
|
47
47
|
}
|
|
48
48
|
function useCreateWork() {
|
|
@@ -50,7 +50,7 @@ function useCreateWork() {
|
|
|
50
50
|
const qc = reactQuery.useQueryClient();
|
|
51
51
|
return reactQuery.useMutation({
|
|
52
52
|
mutationFn: (body) => arbi.conversations.createWork(body),
|
|
53
|
-
onSuccess: () => qc.invalidateQueries({ queryKey:
|
|
53
|
+
onSuccess: () => qc.invalidateQueries({ queryKey: chunkUN3AZUXX_cjs.arbiQueryKeys.allConversations() })
|
|
54
54
|
});
|
|
55
55
|
}
|
|
56
56
|
function useRunConversation() {
|
|
@@ -58,7 +58,7 @@ function useRunConversation() {
|
|
|
58
58
|
const qc = reactQuery.useQueryClient();
|
|
59
59
|
return reactQuery.useMutation({
|
|
60
60
|
mutationFn: (conversationId) => arbi.conversations.runWithAuth(conversationId),
|
|
61
|
-
onSuccess: () => qc.invalidateQueries({ queryKey:
|
|
61
|
+
onSuccess: () => qc.invalidateQueries({ queryKey: chunkUN3AZUXX_cjs.arbiQueryKeys.allConversations() })
|
|
62
62
|
});
|
|
63
63
|
}
|
|
64
64
|
function useActOnStep() {
|
|
@@ -69,7 +69,7 @@ function useActOnStep() {
|
|
|
69
69
|
conversationId,
|
|
70
70
|
body
|
|
71
71
|
}) => arbi.conversations.actOnStep(conversationId, body),
|
|
72
|
-
onSuccess: () => qc.invalidateQueries({ queryKey:
|
|
72
|
+
onSuccess: () => qc.invalidateQueries({ queryKey: chunkUN3AZUXX_cjs.arbiQueryKeys.allConversations() })
|
|
73
73
|
});
|
|
74
74
|
}
|
|
75
75
|
function useSendBackStep() {
|
|
@@ -82,7 +82,7 @@ function useSendBackStep() {
|
|
|
82
82
|
to,
|
|
83
83
|
note
|
|
84
84
|
}) => arbi.conversations.sendBackStep(conversationId, step, { to, note }),
|
|
85
|
-
onSuccess: () => qc.invalidateQueries({ queryKey:
|
|
85
|
+
onSuccess: () => qc.invalidateQueries({ queryKey: chunkUN3AZUXX_cjs.arbiQueryKeys.allConversations() })
|
|
86
86
|
});
|
|
87
87
|
}
|
|
88
88
|
function usePlanWork() {
|
|
@@ -94,7 +94,7 @@ function usePlanWork() {
|
|
|
94
94
|
function useConversationPendingAuth(conversationId, options) {
|
|
95
95
|
const arbi = chunkXIDDXD5Y_cjs.useArbi();
|
|
96
96
|
return reactQuery.useQuery({
|
|
97
|
-
queryKey: [...
|
|
97
|
+
queryKey: [...chunkUN3AZUXX_cjs.arbiQueryKeys.allConversations(), conversationId ?? "", "pending-auth"],
|
|
98
98
|
queryFn: () => arbi.conversations.pendingAuth(conversationId),
|
|
99
99
|
enabled: (options?.enabled ?? true) && !!conversationId && arbi.isLoggedIn,
|
|
100
100
|
retry: false
|
|
@@ -103,7 +103,7 @@ function useConversationPendingAuth(conversationId, options) {
|
|
|
103
103
|
function useConversationActivity(conversationId, options) {
|
|
104
104
|
const arbi = chunkXIDDXD5Y_cjs.useArbi();
|
|
105
105
|
return reactQuery.useQuery({
|
|
106
|
-
queryKey: [...
|
|
106
|
+
queryKey: [...chunkUN3AZUXX_cjs.arbiQueryKeys.allConversations(), conversationId ?? "", "activity"],
|
|
107
107
|
queryFn: () => arbi.conversations.activity(conversationId),
|
|
108
108
|
enabled: (options?.enabled ?? true) && !!conversationId && arbi.isLoggedIn,
|
|
109
109
|
refetchInterval: options?.live ? 2500 : false
|
|
@@ -112,7 +112,7 @@ function useConversationActivity(conversationId, options) {
|
|
|
112
112
|
function useWorkflows(options) {
|
|
113
113
|
const arbi = chunkXIDDXD5Y_cjs.useArbi();
|
|
114
114
|
return reactQuery.useQuery({
|
|
115
|
-
queryKey:
|
|
115
|
+
queryKey: chunkUN3AZUXX_cjs.arbiQueryKeys.workflows(),
|
|
116
116
|
queryFn: () => arbi.workflows.list(),
|
|
117
117
|
refetchInterval: options?.live ? 15e3 : false,
|
|
118
118
|
enabled: options?.enabled ?? arbi.isLoggedIn
|
|
@@ -123,7 +123,7 @@ function useCreateWorkflow() {
|
|
|
123
123
|
const qc = reactQuery.useQueryClient();
|
|
124
124
|
return reactQuery.useMutation({
|
|
125
125
|
mutationFn: (body) => arbi.workflows.create(body),
|
|
126
|
-
onSuccess: () => qc.invalidateQueries({ queryKey:
|
|
126
|
+
onSuccess: () => qc.invalidateQueries({ queryKey: chunkUN3AZUXX_cjs.arbiQueryKeys.workflows() })
|
|
127
127
|
});
|
|
128
128
|
}
|
|
129
129
|
function useUpdateWorkflow() {
|
|
@@ -134,7 +134,7 @@ function useUpdateWorkflow() {
|
|
|
134
134
|
workflowId,
|
|
135
135
|
patch
|
|
136
136
|
}) => arbi.workflows.update(workflowId, patch),
|
|
137
|
-
onSuccess: () => qc.invalidateQueries({ queryKey:
|
|
137
|
+
onSuccess: () => qc.invalidateQueries({ queryKey: chunkUN3AZUXX_cjs.arbiQueryKeys.workflows() })
|
|
138
138
|
});
|
|
139
139
|
}
|
|
140
140
|
function useDeleteWorkflow() {
|
|
@@ -142,7 +142,7 @@ function useDeleteWorkflow() {
|
|
|
142
142
|
const qc = reactQuery.useQueryClient();
|
|
143
143
|
return reactQuery.useMutation({
|
|
144
144
|
mutationFn: (workflowId) => arbi.workflows.delete(workflowId),
|
|
145
|
-
onSuccess: () => qc.invalidateQueries({ queryKey:
|
|
145
|
+
onSuccess: () => qc.invalidateQueries({ queryKey: chunkUN3AZUXX_cjs.arbiQueryKeys.workflows() })
|
|
146
146
|
});
|
|
147
147
|
}
|
|
148
148
|
function useRunWorkflow() {
|
|
@@ -151,8 +151,8 @@ function useRunWorkflow() {
|
|
|
151
151
|
return reactQuery.useMutation({
|
|
152
152
|
mutationFn: (workflowId) => arbi.workflows.run(workflowId),
|
|
153
153
|
onSuccess: () => Promise.all([
|
|
154
|
-
qc.invalidateQueries({ queryKey:
|
|
155
|
-
qc.invalidateQueries({ queryKey:
|
|
154
|
+
qc.invalidateQueries({ queryKey: chunkUN3AZUXX_cjs.arbiQueryKeys.workflows() }),
|
|
155
|
+
qc.invalidateQueries({ queryKey: chunkUN3AZUXX_cjs.arbiQueryKeys.allConversations() })
|
|
156
156
|
])
|
|
157
157
|
});
|
|
158
158
|
}
|
|
@@ -161,13 +161,13 @@ function useCreateAgent() {
|
|
|
161
161
|
const qc = reactQuery.useQueryClient();
|
|
162
162
|
return reactQuery.useMutation({
|
|
163
163
|
mutationFn: (name) => arbi.agents.create(name),
|
|
164
|
-
onSuccess: () => qc.invalidateQueries({ queryKey:
|
|
164
|
+
onSuccess: () => qc.invalidateQueries({ queryKey: chunkUN3AZUXX_cjs.arbiQueryKeys.agents() })
|
|
165
165
|
});
|
|
166
166
|
}
|
|
167
167
|
function useAgentConfig(agentExtId, options) {
|
|
168
168
|
const arbi = chunkXIDDXD5Y_cjs.useArbi();
|
|
169
169
|
return reactQuery.useQuery({
|
|
170
|
-
queryKey:
|
|
170
|
+
queryKey: chunkUN3AZUXX_cjs.arbiQueryKeys.agentConfig(agentExtId),
|
|
171
171
|
queryFn: async () => agentExtId ? await arbi.agents.getConfig(agentExtId) : await arbi.agentConfig.get("default"),
|
|
172
172
|
enabled: (options?.enabled ?? true) && arbi.isLoggedIn
|
|
173
173
|
});
|
|
@@ -175,7 +175,7 @@ function useAgentConfig(agentExtId, options) {
|
|
|
175
175
|
function useAgentModels(options) {
|
|
176
176
|
const arbi = chunkXIDDXD5Y_cjs.useArbi();
|
|
177
177
|
return reactQuery.useQuery({
|
|
178
|
-
queryKey:
|
|
178
|
+
queryKey: chunkUN3AZUXX_cjs.arbiQueryKeys.models(),
|
|
179
179
|
queryFn: async () => (await arbi.agentConfig.getModels()).models.map((m) => m.model_name),
|
|
180
180
|
enabled: (options?.enabled ?? true) && arbi.isLoggedIn
|
|
181
181
|
});
|
|
@@ -198,17 +198,17 @@ function useSaveAgentConfig() {
|
|
|
198
198
|
});
|
|
199
199
|
},
|
|
200
200
|
onSuccess: (_saved, { agentExtId }) => Promise.all([
|
|
201
|
-
qc.invalidateQueries({ queryKey:
|
|
202
|
-
qc.invalidateQueries({ queryKey:
|
|
201
|
+
qc.invalidateQueries({ queryKey: chunkUN3AZUXX_cjs.arbiQueryKeys.configs() }),
|
|
202
|
+
qc.invalidateQueries({ queryKey: chunkUN3AZUXX_cjs.arbiQueryKeys.agentConfig(agentExtId) }),
|
|
203
203
|
// The agent list shows the pinned persona/model, so it refreshes too.
|
|
204
|
-
qc.invalidateQueries({ queryKey:
|
|
204
|
+
qc.invalidateQueries({ queryKey: chunkUN3AZUXX_cjs.arbiQueryKeys.agents() })
|
|
205
205
|
])
|
|
206
206
|
});
|
|
207
207
|
}
|
|
208
208
|
function useAgentWorkspaces(agentExtId, options) {
|
|
209
209
|
const arbi = chunkXIDDXD5Y_cjs.useArbi();
|
|
210
210
|
return reactQuery.useQuery({
|
|
211
|
-
queryKey:
|
|
211
|
+
queryKey: chunkUN3AZUXX_cjs.arbiQueryKeys.agentWorkspaces(agentExtId ?? ""),
|
|
212
212
|
queryFn: () => arbi.agents.listWorkspaces(agentExtId),
|
|
213
213
|
enabled: (options?.enabled ?? true) && !!agentExtId && arbi.isLoggedIn
|
|
214
214
|
});
|
|
@@ -229,7 +229,7 @@ function useGrantAgentAccess() {
|
|
|
229
229
|
if (!agent?.email) throw new Error("The agent's address is unknown.");
|
|
230
230
|
return arbi.workspaces.grantAccess({ workspaceId, emails: [agent.email] });
|
|
231
231
|
},
|
|
232
|
-
onSuccess: (_res, { agentExtId }) => qc.invalidateQueries({ queryKey:
|
|
232
|
+
onSuccess: (_res, { agentExtId }) => qc.invalidateQueries({ queryKey: chunkUN3AZUXX_cjs.arbiQueryKeys.agentWorkspaces(agentExtId) })
|
|
233
233
|
});
|
|
234
234
|
}
|
|
235
235
|
function useRevokeAgentAccess() {
|
|
@@ -248,13 +248,13 @@ function useRevokeAgentAccess() {
|
|
|
248
248
|
if (previous && previous !== workspaceId) await arbi.selectWorkspace(previous);
|
|
249
249
|
}
|
|
250
250
|
},
|
|
251
|
-
onSuccess: (_res, { agentExtId }) => qc.invalidateQueries({ queryKey:
|
|
251
|
+
onSuccess: (_res, { agentExtId }) => qc.invalidateQueries({ queryKey: chunkUN3AZUXX_cjs.arbiQueryKeys.agentWorkspaces(agentExtId) })
|
|
252
252
|
});
|
|
253
253
|
}
|
|
254
254
|
function useSkills(options) {
|
|
255
255
|
const arbi = chunkXIDDXD5Y_cjs.useArbi();
|
|
256
256
|
return reactQuery.useQuery({
|
|
257
|
-
queryKey: [...
|
|
257
|
+
queryKey: [...chunkUN3AZUXX_cjs.arbiQueryKeys.skills(), options?.includeHidden ?? false],
|
|
258
258
|
queryFn: () => arbi.assistant.listSkills({ includeHidden: options?.includeHidden }),
|
|
259
259
|
refetchInterval: options?.live ? 5e3 : false,
|
|
260
260
|
enabled: (options?.enabled ?? true) && arbi.isLoggedIn,
|
|
@@ -285,7 +285,7 @@ function useUploadSkillFiles() {
|
|
|
285
285
|
}
|
|
286
286
|
return results;
|
|
287
287
|
},
|
|
288
|
-
onSuccess: () => qc.invalidateQueries({ queryKey:
|
|
288
|
+
onSuccess: () => qc.invalidateQueries({ queryKey: chunkUN3AZUXX_cjs.arbiQueryKeys.skills() })
|
|
289
289
|
});
|
|
290
290
|
}
|
|
291
291
|
function useStartWorkQuery() {
|
|
@@ -312,7 +312,7 @@ function useStartWorkQuery() {
|
|
|
312
312
|
`The run ${response.id} started, but its thread is not available yet. Do not submit it again.`
|
|
313
313
|
);
|
|
314
314
|
},
|
|
315
|
-
onSuccess: () => qc.invalidateQueries({ queryKey:
|
|
315
|
+
onSuccess: () => qc.invalidateQueries({ queryKey: chunkUN3AZUXX_cjs.arbiQueryKeys.allConversations() })
|
|
316
316
|
});
|
|
317
317
|
}
|
|
318
318
|
function useAgentSession(agentId, options) {
|
|
@@ -476,8 +476,8 @@ function useArbiChat(options = {}) {
|
|
|
476
476
|
const recoveryIntervalMs = streamRecovery?.intervalMs ?? 3e3;
|
|
477
477
|
const recoveryTimeoutMs = streamRecovery?.timeoutMs ?? 12e4;
|
|
478
478
|
const arbi = chunkXIDDXD5Y_cjs.useArbi();
|
|
479
|
-
const { data: docs = [], isLoading: isLoadingDocuments, refetch } =
|
|
480
|
-
const ordinaryHistory =
|
|
479
|
+
const { data: docs = [], isLoading: isLoadingDocuments, refetch } = chunkUN3AZUXX_cjs.useDocuments(workspaceId);
|
|
480
|
+
const ordinaryHistory = chunkUN3AZUXX_cjs.useConversations(workspaceId, { enabled: !agentId, live: true });
|
|
481
481
|
const agentHistory = useAgentChats(agentId);
|
|
482
482
|
const stored = React.useMemo(
|
|
483
483
|
() => agentId ? (agentHistory.data ?? []).filter((chat) => chat.workspace_ext_id === workspaceId).map((chat) => ({
|
|
@@ -492,7 +492,7 @@ function useArbiChat(options = {}) {
|
|
|
492
492
|
);
|
|
493
493
|
const isLoadingThreads = agentId ? agentHistory.isLoading : ordinaryHistory.isLoading;
|
|
494
494
|
const refetchConversations = agentId ? agentHistory.refetch : ordinaryHistory.refetch;
|
|
495
|
-
const query =
|
|
495
|
+
const query = chunkUN3AZUXX_cjs.useAssistantQuery();
|
|
496
496
|
const { mutateAsync } = query;
|
|
497
497
|
const [stagedFiles, setStagedFiles] = React.useState([]);
|
|
498
498
|
const [threads, setThreads] = React.useState(() => [emptyThread()]);
|
|
@@ -552,7 +552,7 @@ function useArbiChat(options = {}) {
|
|
|
552
552
|
(conversation) => conversation.external_id === active.conversationId && conversation.status === "generating"
|
|
553
553
|
) || active.messages.some((message) => message.status === "streaming");
|
|
554
554
|
const needsLoad = !!active.conversationId && !active.isLoaded;
|
|
555
|
-
const loaded =
|
|
555
|
+
const loaded = chunkUN3AZUXX_cjs.useConversationThreads(workspaceId, active.conversationId ?? void 0, {
|
|
556
556
|
enabled: needsLoad || liveHistory && !isRunning && !isPostingComment,
|
|
557
557
|
live: liveHistory
|
|
558
558
|
});
|
|
@@ -1333,14 +1333,14 @@ function useArbiDocumentSync(workspaceId) {
|
|
|
1333
1333
|
if (!workspaceId) return;
|
|
1334
1334
|
if (client.isMessageType(msg, "batch_complete")) {
|
|
1335
1335
|
if (msg.workspace_ext_id !== workspaceId) return;
|
|
1336
|
-
void queryClient.invalidateQueries({ queryKey:
|
|
1337
|
-
void queryClient.invalidateQueries({ queryKey:
|
|
1336
|
+
void queryClient.invalidateQueries({ queryKey: chunkUN3AZUXX_cjs.arbiQueryKeys.documents(workspaceId) });
|
|
1337
|
+
void queryClient.invalidateQueries({ queryKey: chunkUN3AZUXX_cjs.arbiQueryKeys.tags(workspaceId) });
|
|
1338
1338
|
return;
|
|
1339
1339
|
}
|
|
1340
1340
|
if (client.isMessageType(msg, "task_update")) {
|
|
1341
1341
|
if (msg.workspace_ext_id !== workspaceId) return;
|
|
1342
1342
|
if (TERMINAL_STATUSES.has(msg.status)) {
|
|
1343
|
-
void queryClient.invalidateQueries({ queryKey:
|
|
1343
|
+
void queryClient.invalidateQueries({ queryKey: chunkUN3AZUXX_cjs.arbiQueryKeys.documents(workspaceId) });
|
|
1344
1344
|
}
|
|
1345
1345
|
}
|
|
1346
1346
|
});
|
|
@@ -1469,7 +1469,7 @@ function useShellWorkspaces(options) {
|
|
|
1469
1469
|
}
|
|
1470
1470
|
function useArbiShellWorkspaces(options = {}) {
|
|
1471
1471
|
const arbi = chunkXIDDXD5Y_cjs.useArbi();
|
|
1472
|
-
const query =
|
|
1472
|
+
const query = chunkUN3AZUXX_cjs.useWorkspaces();
|
|
1473
1473
|
const { select, ...rest } = options;
|
|
1474
1474
|
const defaultSelect = React.useCallback(
|
|
1475
1475
|
(workspace) => arbi.selectWorkspace(workspace.id),
|
|
@@ -1485,8 +1485,8 @@ function useArbiShellWorkspaces(options = {}) {
|
|
|
1485
1485
|
}
|
|
1486
1486
|
function invalidateTagData(qc, workspaceId) {
|
|
1487
1487
|
return Promise.all([
|
|
1488
|
-
qc.invalidateQueries({ queryKey:
|
|
1489
|
-
qc.invalidateQueries({ queryKey:
|
|
1488
|
+
qc.invalidateQueries({ queryKey: chunkUN3AZUXX_cjs.arbiQueryKeys.tags(workspaceId) }),
|
|
1489
|
+
qc.invalidateQueries({ queryKey: chunkUN3AZUXX_cjs.arbiQueryKeys.facts(workspaceId) })
|
|
1490
1490
|
]);
|
|
1491
1491
|
}
|
|
1492
1492
|
function useInvalidateTagData() {
|
|
@@ -1501,7 +1501,7 @@ function useTagKindSchema(kind, options) {
|
|
|
1501
1501
|
const arbi = chunkXIDDXD5Y_cjs.useArbi();
|
|
1502
1502
|
const workspaceId = arbi.getWorkspaceId() ?? "";
|
|
1503
1503
|
return reactQuery.useQuery({
|
|
1504
|
-
queryKey:
|
|
1504
|
+
queryKey: chunkUN3AZUXX_cjs.arbiQueryKeys.tagKind(workspaceId, kind ?? ""),
|
|
1505
1505
|
queryFn: () => arbi.tagKinds.get(kind),
|
|
1506
1506
|
enabled: (options?.enabled ?? true) && !!kind && !!workspaceId && arbi.hasWorkspace
|
|
1507
1507
|
});
|
|
@@ -1517,7 +1517,7 @@ function useUpdateTagKindSchema() {
|
|
|
1517
1517
|
onSuccess: (schema) => {
|
|
1518
1518
|
const workspaceId = arbi.getWorkspaceId();
|
|
1519
1519
|
if (!workspaceId) return;
|
|
1520
|
-
qc.setQueryData(
|
|
1520
|
+
qc.setQueryData(chunkUN3AZUXX_cjs.arbiQueryKeys.tagKind(workspaceId, schema.kind), schema);
|
|
1521
1521
|
return invalidateTagData(qc, workspaceId);
|
|
1522
1522
|
}
|
|
1523
1523
|
});
|
|
@@ -1536,7 +1536,7 @@ function useSetTagValues() {
|
|
|
1536
1536
|
function useFilteredProjects(filters, options) {
|
|
1537
1537
|
const arbi = chunkXIDDXD5Y_cjs.useArbi();
|
|
1538
1538
|
return reactQuery.useQuery({
|
|
1539
|
-
queryKey:
|
|
1539
|
+
queryKey: chunkUN3AZUXX_cjs.arbiQueryKeys.projectsFiltered(filters.stage, filters.leadUser),
|
|
1540
1540
|
queryFn: () => arbi.projects.list(filters),
|
|
1541
1541
|
enabled: options?.enabled ?? arbi.isLoggedIn
|
|
1542
1542
|
});
|
|
@@ -1549,14 +1549,14 @@ function useUpdateProjectFields() {
|
|
|
1549
1549
|
projectExtId,
|
|
1550
1550
|
patch
|
|
1551
1551
|
}) => arbi.projects.update(projectExtId, patch),
|
|
1552
|
-
onSuccess: () => qc.invalidateQueries({ queryKey:
|
|
1552
|
+
onSuccess: () => qc.invalidateQueries({ queryKey: chunkUN3AZUXX_cjs.arbiQueryKeys.projects() })
|
|
1553
1553
|
});
|
|
1554
1554
|
}
|
|
1555
1555
|
function useProjectEvents(projectExtId, options) {
|
|
1556
1556
|
const arbi = chunkXIDDXD5Y_cjs.useArbi();
|
|
1557
1557
|
return reactQuery.useQuery({
|
|
1558
1558
|
queryKey: [
|
|
1559
|
-
...
|
|
1559
|
+
...chunkUN3AZUXX_cjs.arbiQueryKeys.projectEvents(projectExtId ?? ""),
|
|
1560
1560
|
options?.kind ?? "all",
|
|
1561
1561
|
options?.limit ?? "default"
|
|
1562
1562
|
],
|
|
@@ -1567,7 +1567,7 @@ function useProjectEvents(projectExtId, options) {
|
|
|
1567
1567
|
function useConversationUsage(conversationId, options) {
|
|
1568
1568
|
const arbi = chunkXIDDXD5Y_cjs.useArbi();
|
|
1569
1569
|
return reactQuery.useQuery({
|
|
1570
|
-
queryKey:
|
|
1570
|
+
queryKey: chunkUN3AZUXX_cjs.arbiQueryKeys.conversationUsage(conversationId ?? ""),
|
|
1571
1571
|
queryFn: () => arbi.conversations.usage(conversationId),
|
|
1572
1572
|
enabled: (options?.enabled ?? true) && !!conversationId && arbi.isLoggedIn,
|
|
1573
1573
|
refetchInterval: options?.live ? 1e4 : false
|
|
@@ -1576,7 +1576,7 @@ function useConversationUsage(conversationId, options) {
|
|
|
1576
1576
|
function useProjectConversationUsage(projectExtId, monthsBack = 0, options) {
|
|
1577
1577
|
const arbi = chunkXIDDXD5Y_cjs.useArbi();
|
|
1578
1578
|
return reactQuery.useQuery({
|
|
1579
|
-
queryKey:
|
|
1579
|
+
queryKey: chunkUN3AZUXX_cjs.arbiQueryKeys.projectConversationUsage(projectExtId ?? "", monthsBack),
|
|
1580
1580
|
queryFn: () => arbi.projects.usageByConversation(projectExtId, monthsBack),
|
|
1581
1581
|
enabled: (options?.enabled ?? true) && !!projectExtId && arbi.isLoggedIn
|
|
1582
1582
|
});
|
|
@@ -1584,7 +1584,7 @@ function useProjectConversationUsage(projectExtId, monthsBack = 0, options) {
|
|
|
1584
1584
|
function useContacts(options) {
|
|
1585
1585
|
const arbi = chunkXIDDXD5Y_cjs.useArbi();
|
|
1586
1586
|
return reactQuery.useQuery({
|
|
1587
|
-
queryKey:
|
|
1587
|
+
queryKey: chunkUN3AZUXX_cjs.arbiQueryKeys.contacts(),
|
|
1588
1588
|
queryFn: () => arbi.contacts.list(),
|
|
1589
1589
|
enabled: (options?.enabled ?? true) && arbi.isLoggedIn
|
|
1590
1590
|
});
|
|
@@ -1599,7 +1599,7 @@ function usePendingContacts(options) {
|
|
|
1599
1599
|
}
|
|
1600
1600
|
function useInvalidateContacts() {
|
|
1601
1601
|
const qc = reactQuery.useQueryClient();
|
|
1602
|
-
return () => qc.invalidateQueries({ queryKey:
|
|
1602
|
+
return () => qc.invalidateQueries({ queryKey: chunkUN3AZUXX_cjs.arbiQueryKeys.contacts() });
|
|
1603
1603
|
}
|
|
1604
1604
|
function useInviteContacts() {
|
|
1605
1605
|
const arbi = chunkXIDDXD5Y_cjs.useArbi();
|
|
@@ -1633,6 +1633,91 @@ function useDeleteContact() {
|
|
|
1633
1633
|
onSuccess: () => invalidate()
|
|
1634
1634
|
});
|
|
1635
1635
|
}
|
|
1636
|
+
var AccountClientContext = React.createContext(null);
|
|
1637
|
+
function arbiProfile(arbi) {
|
|
1638
|
+
const profile = arbi.user.profile();
|
|
1639
|
+
return profile ? toProfileView(profile) : null;
|
|
1640
|
+
}
|
|
1641
|
+
function arbiAccountClient(arbi, overrides = {}) {
|
|
1642
|
+
return {
|
|
1643
|
+
profile: () => arbiProfile(arbi),
|
|
1644
|
+
onProfileChange: (listener) => arbi.user.onProfileChange(() => listener()),
|
|
1645
|
+
updateProfile: async (vars) => {
|
|
1646
|
+
await arbi.profile.update({
|
|
1647
|
+
...vars.givenName !== void 0 && { given_name: vars.givenName.trim() },
|
|
1648
|
+
...vars.familyName !== void 0 && { family_name: vars.familyName.trim() },
|
|
1649
|
+
...vars.picture !== void 0 && { picture: vars.picture }
|
|
1650
|
+
});
|
|
1651
|
+
},
|
|
1652
|
+
requestEmailChange: (newEmail) => arbi.account.requestEmailChange(newEmail),
|
|
1653
|
+
confirmEmailChange: async (newEmail, code) => {
|
|
1654
|
+
await arbi.account.confirmEmailChange(newEmail, code);
|
|
1655
|
+
},
|
|
1656
|
+
changePassword: (vars) => arbi.account.changePassword(vars),
|
|
1657
|
+
listSessions: () => arbi.sessions.list(),
|
|
1658
|
+
currentSessionId: () => arbi.sessions.currentId(),
|
|
1659
|
+
terminateSession: (sessionId) => arbi.sessions.terminate(sessionId),
|
|
1660
|
+
signOut: async ({ everywhere } = {}) => {
|
|
1661
|
+
if (everywhere) await arbi.sessions.logoutAll();
|
|
1662
|
+
else await arbi.logout();
|
|
1663
|
+
},
|
|
1664
|
+
requestDeletion: () => arbi.account.requestDeletion(),
|
|
1665
|
+
identity: {
|
|
1666
|
+
status: () => arbi.identity.status(),
|
|
1667
|
+
purchase: () => arbi.identity.purchase(),
|
|
1668
|
+
startSession: () => arbi.identity.startSession(),
|
|
1669
|
+
refresh: () => arbi.identity.refresh(),
|
|
1670
|
+
acceptName: () => arbi.identity.acceptName(),
|
|
1671
|
+
remove: () => arbi.identity.remove()
|
|
1672
|
+
},
|
|
1673
|
+
...overrides
|
|
1674
|
+
};
|
|
1675
|
+
}
|
|
1676
|
+
var NO_ACCOUNT_ERROR = "The account needs an <AccountClientProvider> or an <ArbiProvider> above it";
|
|
1677
|
+
var refuse = () => Promise.reject(new Error(NO_ACCOUNT_ERROR));
|
|
1678
|
+
var NO_ACCOUNT = {
|
|
1679
|
+
client: {
|
|
1680
|
+
profile: () => null,
|
|
1681
|
+
onProfileChange: () => () => {
|
|
1682
|
+
},
|
|
1683
|
+
updateProfile: refuse,
|
|
1684
|
+
requestEmailChange: refuse,
|
|
1685
|
+
confirmEmailChange: refuse,
|
|
1686
|
+
changePassword: refuse,
|
|
1687
|
+
listSessions: refuse,
|
|
1688
|
+
currentSessionId: () => null,
|
|
1689
|
+
terminateSession: refuse,
|
|
1690
|
+
signOut: refuse,
|
|
1691
|
+
requestDeletion: refuse,
|
|
1692
|
+
identity: {
|
|
1693
|
+
status: refuse,
|
|
1694
|
+
purchase: refuse,
|
|
1695
|
+
startSession: refuse,
|
|
1696
|
+
refresh: refuse,
|
|
1697
|
+
acceptName: refuse,
|
|
1698
|
+
remove: refuse
|
|
1699
|
+
}
|
|
1700
|
+
},
|
|
1701
|
+
enabled: false
|
|
1702
|
+
};
|
|
1703
|
+
function AccountClientProvider({
|
|
1704
|
+
client,
|
|
1705
|
+
enabled = true,
|
|
1706
|
+
children
|
|
1707
|
+
}) {
|
|
1708
|
+
const value = React.useMemo(() => ({ client, enabled }), [client, enabled]);
|
|
1709
|
+
return /* @__PURE__ */ jsxRuntime.jsx(AccountClientContext.Provider, { value, children });
|
|
1710
|
+
}
|
|
1711
|
+
function useAccountClient() {
|
|
1712
|
+
const provided = React.useContext(AccountClientContext);
|
|
1713
|
+
const arbi = React.useContext(chunkXIDDXD5Y_cjs.ArbiContext);
|
|
1714
|
+
const fallback = React.useMemo(() => arbi ? arbiAccountClient(arbi) : null, [arbi]);
|
|
1715
|
+
if (provided) return provided;
|
|
1716
|
+
if (!arbi || !fallback) return NO_ACCOUNT;
|
|
1717
|
+
return { client: fallback, enabled: arbi.isLoggedIn };
|
|
1718
|
+
}
|
|
1719
|
+
|
|
1720
|
+
// src/account/profile.ts
|
|
1636
1721
|
function toProfileView(profile) {
|
|
1637
1722
|
return {
|
|
1638
1723
|
...profile,
|
|
@@ -1640,34 +1725,31 @@ function toProfileView(profile) {
|
|
|
1640
1725
|
};
|
|
1641
1726
|
}
|
|
1642
1727
|
function useProfile(options) {
|
|
1643
|
-
const
|
|
1728
|
+
const { client, enabled } = useAccountClient();
|
|
1729
|
+
const qc = reactQuery.useQueryClient();
|
|
1730
|
+
React.useEffect(
|
|
1731
|
+
() => client.onProfileChange(() => qc.setQueryData(chunkUN3AZUXX_cjs.arbiQueryKeys.profile(), client.profile())),
|
|
1732
|
+
[client, qc]
|
|
1733
|
+
);
|
|
1644
1734
|
return reactQuery.useQuery({
|
|
1645
|
-
queryKey:
|
|
1646
|
-
queryFn: () =>
|
|
1647
|
-
|
|
1648
|
-
return profile ? toProfileView(profile) : null;
|
|
1649
|
-
},
|
|
1650
|
-
enabled: (options?.enabled ?? true) && arbi.isLoggedIn,
|
|
1735
|
+
queryKey: chunkUN3AZUXX_cjs.arbiQueryKeys.profile(),
|
|
1736
|
+
queryFn: () => client.profile(),
|
|
1737
|
+
enabled: (options?.enabled ?? true) && enabled,
|
|
1651
1738
|
staleTime: Infinity
|
|
1652
1739
|
});
|
|
1653
1740
|
}
|
|
1654
1741
|
function useUpdateProfile() {
|
|
1655
|
-
const
|
|
1742
|
+
const { client } = useAccountClient();
|
|
1656
1743
|
const qc = reactQuery.useQueryClient();
|
|
1657
1744
|
return reactQuery.useMutation({
|
|
1658
1745
|
mutationFn: async (vars) => {
|
|
1659
|
-
await
|
|
1660
|
-
|
|
1661
|
-
...vars.familyName !== void 0 && { family_name: vars.familyName.trim() },
|
|
1662
|
-
...vars.picture !== void 0 && { picture: vars.picture }
|
|
1663
|
-
});
|
|
1664
|
-
const profile = arbi.user.profile();
|
|
1665
|
-
return profile ? toProfileView(profile) : null;
|
|
1746
|
+
await client.updateProfile(vars);
|
|
1747
|
+
return client.profile();
|
|
1666
1748
|
},
|
|
1667
1749
|
onSuccess: (profile) => {
|
|
1668
|
-
qc.setQueryData(
|
|
1669
|
-
void qc.invalidateQueries({ queryKey:
|
|
1670
|
-
return qc.invalidateQueries({ queryKey:
|
|
1750
|
+
qc.setQueryData(chunkUN3AZUXX_cjs.arbiQueryKeys.profile(), profile);
|
|
1751
|
+
void qc.invalidateQueries({ queryKey: chunkUN3AZUXX_cjs.arbiQueryKeys.identity() });
|
|
1752
|
+
return qc.invalidateQueries({ queryKey: chunkUN3AZUXX_cjs.arbiQueryKeys.workspaces() });
|
|
1671
1753
|
}
|
|
1672
1754
|
});
|
|
1673
1755
|
}
|
|
@@ -1740,20 +1822,17 @@ function useAvatarCrop({
|
|
|
1740
1822
|
};
|
|
1741
1823
|
}
|
|
1742
1824
|
function useRequestEmailChange() {
|
|
1743
|
-
const
|
|
1825
|
+
const { client } = useAccountClient();
|
|
1744
1826
|
return reactQuery.useMutation({
|
|
1745
|
-
mutationFn: (newEmail) =>
|
|
1827
|
+
mutationFn: (newEmail) => client.requestEmailChange(newEmail)
|
|
1746
1828
|
});
|
|
1747
1829
|
}
|
|
1748
1830
|
function useConfirmEmailChange() {
|
|
1749
|
-
const
|
|
1831
|
+
const { client } = useAccountClient();
|
|
1750
1832
|
const qc = reactQuery.useQueryClient();
|
|
1751
1833
|
return reactQuery.useMutation({
|
|
1752
|
-
mutationFn: ({ newEmail, code }) =>
|
|
1753
|
-
onSuccess: () =>
|
|
1754
|
-
const profile = arbi.user.profile();
|
|
1755
|
-
qc.setQueryData(chunkAFGE55RQ_cjs.arbiQueryKeys.profile(), profile ? toProfileView(profile) : null);
|
|
1756
|
-
}
|
|
1834
|
+
mutationFn: ({ newEmail, code }) => client.confirmEmailChange(newEmail, code),
|
|
1835
|
+
onSuccess: () => qc.setQueryData(chunkUN3AZUXX_cjs.arbiQueryKeys.profile(), client.profile())
|
|
1757
1836
|
});
|
|
1758
1837
|
}
|
|
1759
1838
|
function useEmailChange({
|
|
@@ -1817,9 +1896,9 @@ function useEmailChange({
|
|
|
1817
1896
|
};
|
|
1818
1897
|
}
|
|
1819
1898
|
function usePasswordChange() {
|
|
1820
|
-
const
|
|
1899
|
+
const { client } = useAccountClient();
|
|
1821
1900
|
return reactQuery.useMutation({
|
|
1822
|
-
mutationFn: (vars) =>
|
|
1901
|
+
mutationFn: (vars) => client.changePassword(vars)
|
|
1823
1902
|
});
|
|
1824
1903
|
}
|
|
1825
1904
|
var DEFAULT_PASSWORD_CHANGE_FORM_MESSAGES = {
|
|
@@ -1921,7 +2000,7 @@ function toNotificationPreferences(stored, keys) {
|
|
|
1921
2000
|
function useUserSettings(options) {
|
|
1922
2001
|
const arbi = chunkXIDDXD5Y_cjs.useArbi();
|
|
1923
2002
|
return reactQuery.useQuery({
|
|
1924
|
-
queryKey:
|
|
2003
|
+
queryKey: chunkUN3AZUXX_cjs.arbiQueryKeys.userSettings(),
|
|
1925
2004
|
queryFn: () => arbi.settings.get(),
|
|
1926
2005
|
enabled: (options?.enabled ?? true) && arbi.isLoggedIn
|
|
1927
2006
|
});
|
|
@@ -1934,18 +2013,18 @@ function useNotificationPreferences(keys, options) {
|
|
|
1934
2013
|
const save = reactQuery.useMutation({
|
|
1935
2014
|
mutationFn: (patch) => arbi.settings.update({ email_notifications: patch }),
|
|
1936
2015
|
onMutate: async (patch) => {
|
|
1937
|
-
await qc.cancelQueries({ queryKey:
|
|
1938
|
-
const previous = qc.getQueryData(
|
|
2016
|
+
await qc.cancelQueries({ queryKey: chunkUN3AZUXX_cjs.arbiQueryKeys.userSettings() });
|
|
2017
|
+
const previous = qc.getQueryData(chunkUN3AZUXX_cjs.arbiQueryKeys.userSettings());
|
|
1939
2018
|
qc.setQueryData(
|
|
1940
|
-
|
|
2019
|
+
chunkUN3AZUXX_cjs.arbiQueryKeys.userSettings(),
|
|
1941
2020
|
(old) => old ? { ...old, email_notifications: { ...old.email_notifications, ...patch } } : old
|
|
1942
2021
|
);
|
|
1943
2022
|
return { previous };
|
|
1944
2023
|
},
|
|
1945
2024
|
onError: (_err, _patch, context) => {
|
|
1946
|
-
qc.setQueryData(
|
|
2025
|
+
qc.setQueryData(chunkUN3AZUXX_cjs.arbiQueryKeys.userSettings(), context?.previous);
|
|
1947
2026
|
},
|
|
1948
|
-
onSettled: () => qc.invalidateQueries({ queryKey:
|
|
2027
|
+
onSettled: () => qc.invalidateQueries({ queryKey: chunkUN3AZUXX_cjs.arbiQueryKeys.userSettings() })
|
|
1949
2028
|
});
|
|
1950
2029
|
const model = React.useMemo(() => toNotificationPreferences(stored, keys), [stored, keys]);
|
|
1951
2030
|
const setAll = React.useCallback(
|
|
@@ -1972,18 +2051,18 @@ function useRelevanceSave() {
|
|
|
1972
2051
|
return reactQuery.useMutation({
|
|
1973
2052
|
mutationFn: (patch) => arbi.settings.update(patch),
|
|
1974
2053
|
onMutate: async (patch) => {
|
|
1975
|
-
await qc.cancelQueries({ queryKey:
|
|
1976
|
-
const previous = qc.getQueryData(
|
|
2054
|
+
await qc.cancelQueries({ queryKey: chunkUN3AZUXX_cjs.arbiQueryKeys.userSettings() });
|
|
2055
|
+
const previous = qc.getQueryData(chunkUN3AZUXX_cjs.arbiQueryKeys.userSettings());
|
|
1977
2056
|
qc.setQueryData(
|
|
1978
|
-
|
|
2057
|
+
chunkUN3AZUXX_cjs.arbiQueryKeys.userSettings(),
|
|
1979
2058
|
(old) => old ? { ...old, ...patch } : old
|
|
1980
2059
|
);
|
|
1981
2060
|
return { previous };
|
|
1982
2061
|
},
|
|
1983
2062
|
onError: (_err, _patch, context) => {
|
|
1984
|
-
qc.setQueryData(
|
|
2063
|
+
qc.setQueryData(chunkUN3AZUXX_cjs.arbiQueryKeys.userSettings(), context?.previous);
|
|
1985
2064
|
},
|
|
1986
|
-
onSettled: () => qc.invalidateQueries({ queryKey:
|
|
2065
|
+
onSettled: () => qc.invalidateQueries({ queryKey: chunkUN3AZUXX_cjs.arbiQueryKeys.userSettings() })
|
|
1987
2066
|
});
|
|
1988
2067
|
}
|
|
1989
2068
|
function useWorkspaceNotificationLevel(workspaceId, options) {
|
|
@@ -1994,7 +2073,7 @@ function useWorkspaceNotificationLevel(workspaceId, options) {
|
|
|
1994
2073
|
const setLevel = React.useCallback(
|
|
1995
2074
|
(next) => {
|
|
1996
2075
|
if (!workspaceId) return;
|
|
1997
|
-
const current = qc.getQueryData(
|
|
2076
|
+
const current = qc.getQueryData(chunkUN3AZUXX_cjs.arbiQueryKeys.userSettings()) ?? settings.data;
|
|
1998
2077
|
save.mutate(browser.settings.workspaceLevelPatch(current, workspaceId, next));
|
|
1999
2078
|
},
|
|
2000
2079
|
[qc, save, settings.data, workspaceId]
|
|
@@ -2015,7 +2094,7 @@ function useFollowThread(conversationId, options) {
|
|
|
2015
2094
|
const setFollowing = React.useCallback(
|
|
2016
2095
|
(on) => {
|
|
2017
2096
|
if (!conversationId) return;
|
|
2018
|
-
const current = qc.getQueryData(
|
|
2097
|
+
const current = qc.getQueryData(chunkUN3AZUXX_cjs.arbiQueryKeys.userSettings()) ?? settings.data;
|
|
2019
2098
|
save.mutate({
|
|
2020
2099
|
followed_threads: browser.settings.withMembership(current?.followed_threads, conversationId, on)
|
|
2021
2100
|
});
|
|
@@ -2030,24 +2109,32 @@ function useFollowThread(conversationId, options) {
|
|
|
2030
2109
|
error: save.error
|
|
2031
2110
|
};
|
|
2032
2111
|
}
|
|
2112
|
+
function useSessions(options) {
|
|
2113
|
+
const { client, enabled } = useAccountClient();
|
|
2114
|
+
return reactQuery.useQuery({
|
|
2115
|
+
queryKey: chunkUN3AZUXX_cjs.arbiQueryKeys.sessions(),
|
|
2116
|
+
queryFn: () => client.listSessions(),
|
|
2117
|
+
enabled: (options?.enabled ?? true) && enabled
|
|
2118
|
+
});
|
|
2119
|
+
}
|
|
2033
2120
|
function useTerminateSession() {
|
|
2034
|
-
const
|
|
2121
|
+
const { client } = useAccountClient();
|
|
2035
2122
|
const qc = reactQuery.useQueryClient();
|
|
2036
2123
|
return reactQuery.useMutation({
|
|
2037
|
-
mutationFn: (sessionId) =>
|
|
2038
|
-
onSuccess: () => qc.invalidateQueries({ queryKey:
|
|
2124
|
+
mutationFn: (sessionId) => client.terminateSession(sessionId),
|
|
2125
|
+
onSuccess: () => qc.invalidateQueries({ queryKey: chunkUN3AZUXX_cjs.arbiQueryKeys.sessions() })
|
|
2039
2126
|
});
|
|
2040
2127
|
}
|
|
2041
|
-
function
|
|
2042
|
-
const
|
|
2128
|
+
function useSignOut() {
|
|
2129
|
+
const { client } = useAccountClient();
|
|
2043
2130
|
const qc = reactQuery.useQueryClient();
|
|
2044
2131
|
return reactQuery.useMutation({
|
|
2045
|
-
mutationFn: () =>
|
|
2046
|
-
|
|
2132
|
+
mutationFn: (options = {}) => client.signOut(options),
|
|
2133
|
+
onSettled: () => qc.clear()
|
|
2047
2134
|
});
|
|
2048
2135
|
}
|
|
2049
2136
|
function useCurrentSessionId() {
|
|
2050
|
-
return
|
|
2137
|
+
return useAccountClient().client.currentSessionId();
|
|
2051
2138
|
}
|
|
2052
2139
|
function parseDeleteAccountBlockers(error) {
|
|
2053
2140
|
const body = error?.apiError ?? error;
|
|
@@ -2062,8 +2149,8 @@ function parseDeleteAccountBlockers(error) {
|
|
|
2062
2149
|
return [];
|
|
2063
2150
|
}
|
|
2064
2151
|
function useDeleteAccount() {
|
|
2065
|
-
const
|
|
2066
|
-
return reactQuery.useMutation({ mutationFn: () =>
|
|
2152
|
+
const { client } = useAccountClient();
|
|
2153
|
+
return reactQuery.useMutation({ mutationFn: () => client.requestDeletion() });
|
|
2067
2154
|
}
|
|
2068
2155
|
function useDeleteAccountFlow({
|
|
2069
2156
|
userEmail,
|
|
@@ -2178,7 +2265,7 @@ function useIdentityVerificationFlow(api, {
|
|
|
2178
2265
|
const apiRef = React.useRef(api);
|
|
2179
2266
|
apiRef.current = api;
|
|
2180
2267
|
const query = reactQuery.useQuery({
|
|
2181
|
-
queryKey:
|
|
2268
|
+
queryKey: chunkUN3AZUXX_cjs.arbiQueryKeys.identity(),
|
|
2182
2269
|
queryFn: () => apiRef.current.status(),
|
|
2183
2270
|
enabled,
|
|
2184
2271
|
staleTime: 6e4
|
|
@@ -2196,7 +2283,7 @@ function useIdentityVerificationFlow(api, {
|
|
|
2196
2283
|
const lastVerified = React.useRef(void 0);
|
|
2197
2284
|
const apply = React.useCallback(
|
|
2198
2285
|
(next) => {
|
|
2199
|
-
qc.setQueryData(
|
|
2286
|
+
qc.setQueryData(chunkUN3AZUXX_cjs.arbiQueryKeys.identity(), next);
|
|
2200
2287
|
if (lastVerified.current !== void 0 && lastVerified.current !== next.verified) {
|
|
2201
2288
|
onVerifiedChange?.(next.verified);
|
|
2202
2289
|
}
|
|
@@ -2384,29 +2471,19 @@ function useIdentityVerificationFlow(api, {
|
|
|
2384
2471
|
};
|
|
2385
2472
|
}
|
|
2386
2473
|
function useIdentityVerification(options = {}) {
|
|
2387
|
-
const
|
|
2474
|
+
const { client, enabled } = useAccountClient();
|
|
2388
2475
|
const qc = reactQuery.useQueryClient();
|
|
2389
|
-
const
|
|
2390
|
-
|
|
2391
|
-
|
|
2392
|
-
|
|
2393
|
-
startSession: () => arbi.identity.startSession(),
|
|
2394
|
-
refresh: () => arbi.identity.refresh(),
|
|
2395
|
-
acceptName: () => arbi.identity.acceptName(),
|
|
2396
|
-
remove: () => arbi.identity.remove()
|
|
2397
|
-
}),
|
|
2398
|
-
[arbi]
|
|
2399
|
-
);
|
|
2400
|
-
const { onVerifiedChange, onNameAccepted } = options;
|
|
2401
|
-
return useIdentityVerificationFlow(api, {
|
|
2402
|
-
enabled: arbi.isLoggedIn,
|
|
2476
|
+
const { onVerifiedChange, onNameAccepted, formatPrice } = options;
|
|
2477
|
+
return useIdentityVerificationFlow(client.identity, {
|
|
2478
|
+
enabled,
|
|
2479
|
+
formatPrice,
|
|
2403
2480
|
onVerifiedChange: (verified) => {
|
|
2404
|
-
void qc.invalidateQueries({ queryKey:
|
|
2481
|
+
void qc.invalidateQueries({ queryKey: chunkUN3AZUXX_cjs.arbiQueryKeys.profile() });
|
|
2405
2482
|
onVerifiedChange?.(verified);
|
|
2406
2483
|
},
|
|
2407
2484
|
onNameAccepted: (name) => {
|
|
2408
|
-
void qc.invalidateQueries({ queryKey:
|
|
2409
|
-
void qc.invalidateQueries({ queryKey:
|
|
2485
|
+
void qc.invalidateQueries({ queryKey: chunkUN3AZUXX_cjs.arbiQueryKeys.profile() });
|
|
2486
|
+
void qc.invalidateQueries({ queryKey: chunkUN3AZUXX_cjs.arbiQueryKeys.workspaces() });
|
|
2410
2487
|
onNameAccepted?.(name);
|
|
2411
2488
|
}
|
|
2412
2489
|
});
|
|
@@ -2824,7 +2901,7 @@ function useMailDraftReplaced(draftId, onReplaced) {
|
|
|
2824
2901
|
}, [draftId]);
|
|
2825
2902
|
}
|
|
2826
2903
|
function useWorkspaceDocs(workspaceId) {
|
|
2827
|
-
const { data: docs = [], isLoading, isError } =
|
|
2904
|
+
const { data: docs = [], isLoading, isError } = chunkUN3AZUXX_cjs.useDocuments(workspaceId);
|
|
2828
2905
|
const docIds = React.useMemo(
|
|
2829
2906
|
() => docs.map((d) => d.external_id).filter((id) => !!id),
|
|
2830
2907
|
[docs]
|
|
@@ -2832,7 +2909,7 @@ function useWorkspaceDocs(workspaceId) {
|
|
|
2832
2909
|
return { wsId: workspaceId, docs, docIds, isLoading, isError, ready: docIds.length > 0 };
|
|
2833
2910
|
}
|
|
2834
2911
|
function useAiTask() {
|
|
2835
|
-
const mutation =
|
|
2912
|
+
const mutation = chunkUN3AZUXX_cjs.useAssistantQuery();
|
|
2836
2913
|
const [status, setStatus] = React.useState("idle");
|
|
2837
2914
|
const [text, setText] = React.useState("");
|
|
2838
2915
|
const [stepCount, setStepCount] = React.useState(0);
|
|
@@ -3452,8 +3529,8 @@ function DocumentReview({
|
|
|
3452
3529
|
onClose,
|
|
3453
3530
|
className
|
|
3454
3531
|
}) {
|
|
3455
|
-
const parsedQuery =
|
|
3456
|
-
const tagsQuery =
|
|
3532
|
+
const parsedQuery = chunkUN3AZUXX_cjs.useParsedDocument(docId, stage);
|
|
3533
|
+
const tagsQuery = chunkUN3AZUXX_cjs.useTags(workspaceId);
|
|
3457
3534
|
const tagNameById = React__default.default.useMemo(() => {
|
|
3458
3535
|
const map = /* @__PURE__ */ new Map();
|
|
3459
3536
|
for (const t of tagsQuery.data ?? []) {
|
|
@@ -3684,7 +3761,7 @@ function SemanticSearch({
|
|
|
3684
3761
|
const { results, status, error, search, isRunning, query } = useSemanticSearch(docIds);
|
|
3685
3762
|
const [value, setValue] = React.useState("");
|
|
3686
3763
|
const [selected, setSelected] = React.useState(null);
|
|
3687
|
-
const { data: docs = [] } =
|
|
3764
|
+
const { data: docs = [] } = chunkUN3AZUXX_cjs.useDocuments(workspaceId, { enabled: !!workspaceId });
|
|
3688
3765
|
const docMap = React.useMemo(() => {
|
|
3689
3766
|
const map = /* @__PURE__ */ new Map();
|
|
3690
3767
|
for (const d of docs) if (d.external_id) map.set(d.external_id, d);
|
|
@@ -4652,6 +4729,9 @@ function getNotificationTypeMeta(type) {
|
|
|
4652
4729
|
return { Icon: lucideReact.FileText, iconClassName: "text-primary", label: "Document" };
|
|
4653
4730
|
case "contact_accepted":
|
|
4654
4731
|
return { Icon: lucideReact.UserCheck, iconClassName: "text-green-500", label: "Invitation" };
|
|
4732
|
+
case "deployment_user_invited":
|
|
4733
|
+
case "deployment_user_registered":
|
|
4734
|
+
return { Icon: lucideReact.UserPlus, iconClassName: "text-primary", label: "Users" };
|
|
4655
4735
|
case "signup_reward":
|
|
4656
4736
|
return { Icon: lucideReact.PartyPopper, iconClassName: "text-green-600", label: "Signup bonus" };
|
|
4657
4737
|
case "referral_reward":
|
|
@@ -4783,7 +4863,7 @@ function ActivityFeed({
|
|
|
4783
4863
|
enabled,
|
|
4784
4864
|
"data-testid": testId = "activity-feed"
|
|
4785
4865
|
}) {
|
|
4786
|
-
const { data, isLoading, isError } =
|
|
4866
|
+
const { data, isLoading, isError } = chunkUN3AZUXX_cjs.useActivity({ limit, enabled });
|
|
4787
4867
|
if (isLoading) {
|
|
4788
4868
|
return /* @__PURE__ */ jsxRuntime.jsx("div", { className: chunkS6A6FSG7_cjs.cn("space-y-2", className), "data-testid": testId, "aria-busy": "true", children: Array.from({ length: 3 }).map((_, i) => /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex items-center gap-3 py-1.5", children: [
|
|
4789
4869
|
/* @__PURE__ */ jsxRuntime.jsx("div", { className: "h-4 w-4 shrink-0 animate-pulse rounded-full bg-muted" }),
|
|
@@ -4941,7 +5021,7 @@ function useDirectMessages(options) {
|
|
|
4941
5021
|
enabled
|
|
4942
5022
|
});
|
|
4943
5023
|
const contactsQuery = reactQuery.useQuery({
|
|
4944
|
-
queryKey:
|
|
5024
|
+
queryKey: chunkUN3AZUXX_cjs.arbiQueryKeys.contacts(),
|
|
4945
5025
|
queryFn: () => arbi.contacts.list(),
|
|
4946
5026
|
enabled
|
|
4947
5027
|
});
|
|
@@ -6133,10 +6213,10 @@ function DocumentTable({
|
|
|
6133
6213
|
extraColumns,
|
|
6134
6214
|
className
|
|
6135
6215
|
}) {
|
|
6136
|
-
const query =
|
|
6216
|
+
const query = chunkUN3AZUXX_cjs.useDocuments(workspaceId, { enabled: !documents });
|
|
6137
6217
|
const rows = documents ?? query.data ?? [];
|
|
6138
6218
|
const isLoading = !documents && query.isLoading;
|
|
6139
|
-
const tagsQuery =
|
|
6219
|
+
const tagsQuery = chunkUN3AZUXX_cjs.useTags(workspaceId);
|
|
6140
6220
|
const tagNameById = React__default.default.useMemo(() => {
|
|
6141
6221
|
const map = /* @__PURE__ */ new Map();
|
|
6142
6222
|
for (const t of tagsQuery.data ?? []) {
|
|
@@ -6317,7 +6397,7 @@ function DocumentCardMenu({
|
|
|
6317
6397
|
const invalidateDocuments = () => {
|
|
6318
6398
|
const workspaceId = arbi.getWorkspaceId();
|
|
6319
6399
|
if (workspaceId) {
|
|
6320
|
-
void queryClient.invalidateQueries({ queryKey:
|
|
6400
|
+
void queryClient.invalidateQueries({ queryKey: chunkUN3AZUXX_cjs.arbiQueryKeys.documents(workspaceId) });
|
|
6321
6401
|
}
|
|
6322
6402
|
};
|
|
6323
6403
|
const download = reactQuery.useMutation({
|
|
@@ -6416,10 +6496,10 @@ function DocumentGallery({
|
|
|
6416
6496
|
minTileWidth = 148,
|
|
6417
6497
|
className
|
|
6418
6498
|
}) {
|
|
6419
|
-
const query =
|
|
6499
|
+
const query = chunkUN3AZUXX_cjs.useDocuments(workspaceId, { enabled: !documents });
|
|
6420
6500
|
const rows = documents ?? query.data ?? [];
|
|
6421
6501
|
const isLoading = !documents && query.isLoading;
|
|
6422
|
-
const tagsQuery =
|
|
6502
|
+
const tagsQuery = chunkUN3AZUXX_cjs.useTags(workspaceId);
|
|
6423
6503
|
const tagNameById = React__default.default.useMemo(() => {
|
|
6424
6504
|
const map = /* @__PURE__ */ new Map();
|
|
6425
6505
|
for (const t of tagsQuery.data ?? []) {
|
|
@@ -6431,7 +6511,7 @@ function DocumentGallery({
|
|
|
6431
6511
|
() => rows.map((d) => d.external_id).filter((id) => !!id),
|
|
6432
6512
|
[rows]
|
|
6433
6513
|
);
|
|
6434
|
-
const thumbsQuery =
|
|
6514
|
+
const thumbsQuery = chunkUN3AZUXX_cjs.useThumbnails(docIds);
|
|
6435
6515
|
const thumbs = thumbsQuery.data ?? {};
|
|
6436
6516
|
const storeSelected = useArbiUiStore((s) => s.selectedDocIds);
|
|
6437
6517
|
const storeSetSelected = useArbiUiStore((s) => s.setSelectedDocIds);
|
|
@@ -6467,7 +6547,7 @@ function DocumentGallery({
|
|
|
6467
6547
|
setRenamingId(null);
|
|
6468
6548
|
const activeWorkspace = workspaceId ?? arbi.getWorkspaceId();
|
|
6469
6549
|
if (activeWorkspace) {
|
|
6470
|
-
void queryClient.invalidateQueries({ queryKey:
|
|
6550
|
+
void queryClient.invalidateQueries({ queryKey: chunkUN3AZUXX_cjs.arbiQueryKeys.documents(activeWorkspace) });
|
|
6471
6551
|
}
|
|
6472
6552
|
}
|
|
6473
6553
|
});
|
|
@@ -7085,119 +7165,115 @@ function hasVideoTrack(blob) {
|
|
|
7085
7165
|
|
|
7086
7166
|
Object.defineProperty(exports, "PROJECT_CREATION_DENIED_REASON", {
|
|
7087
7167
|
enumerable: true,
|
|
7088
|
-
get: function () { return
|
|
7168
|
+
get: function () { return chunkUN3AZUXX_cjs.PROJECT_CREATION_DENIED_REASON; }
|
|
7089
7169
|
});
|
|
7090
7170
|
Object.defineProperty(exports, "arbiQueryKeys", {
|
|
7091
7171
|
enumerable: true,
|
|
7092
|
-
get: function () { return
|
|
7172
|
+
get: function () { return chunkUN3AZUXX_cjs.arbiQueryKeys; }
|
|
7093
7173
|
});
|
|
7094
7174
|
Object.defineProperty(exports, "isUsageMetered", {
|
|
7095
7175
|
enumerable: true,
|
|
7096
|
-
get: function () { return
|
|
7176
|
+
get: function () { return chunkUN3AZUXX_cjs.isUsageMetered; }
|
|
7097
7177
|
});
|
|
7098
7178
|
Object.defineProperty(exports, "useActivity", {
|
|
7099
7179
|
enumerable: true,
|
|
7100
|
-
get: function () { return
|
|
7180
|
+
get: function () { return chunkUN3AZUXX_cjs.useActivity; }
|
|
7101
7181
|
});
|
|
7102
7182
|
Object.defineProperty(exports, "useAgents", {
|
|
7103
7183
|
enumerable: true,
|
|
7104
|
-
get: function () { return
|
|
7184
|
+
get: function () { return chunkUN3AZUXX_cjs.useAgents; }
|
|
7105
7185
|
});
|
|
7106
7186
|
Object.defineProperty(exports, "useAssistantQuery", {
|
|
7107
7187
|
enumerable: true,
|
|
7108
|
-
get: function () { return
|
|
7188
|
+
get: function () { return chunkUN3AZUXX_cjs.useAssistantQuery; }
|
|
7109
7189
|
});
|
|
7110
7190
|
Object.defineProperty(exports, "useCanCreateProjects", {
|
|
7111
7191
|
enumerable: true,
|
|
7112
|
-
get: function () { return
|
|
7192
|
+
get: function () { return chunkUN3AZUXX_cjs.useCanCreateProjects; }
|
|
7113
7193
|
});
|
|
7114
7194
|
Object.defineProperty(exports, "useConfigs", {
|
|
7115
7195
|
enumerable: true,
|
|
7116
|
-
get: function () { return
|
|
7196
|
+
get: function () { return chunkUN3AZUXX_cjs.useConfigs; }
|
|
7117
7197
|
});
|
|
7118
7198
|
Object.defineProperty(exports, "useConversationThreads", {
|
|
7119
7199
|
enumerable: true,
|
|
7120
|
-
get: function () { return
|
|
7200
|
+
get: function () { return chunkUN3AZUXX_cjs.useConversationThreads; }
|
|
7121
7201
|
});
|
|
7122
7202
|
Object.defineProperty(exports, "useConversations", {
|
|
7123
7203
|
enumerable: true,
|
|
7124
|
-
get: function () { return
|
|
7204
|
+
get: function () { return chunkUN3AZUXX_cjs.useConversations; }
|
|
7125
7205
|
});
|
|
7126
7206
|
Object.defineProperty(exports, "useCurrentUser", {
|
|
7127
7207
|
enumerable: true,
|
|
7128
|
-
get: function () { return
|
|
7208
|
+
get: function () { return chunkUN3AZUXX_cjs.useCurrentUser; }
|
|
7129
7209
|
});
|
|
7130
7210
|
Object.defineProperty(exports, "useDeleteAgents", {
|
|
7131
7211
|
enumerable: true,
|
|
7132
|
-
get: function () { return
|
|
7212
|
+
get: function () { return chunkUN3AZUXX_cjs.useDeleteAgents; }
|
|
7133
7213
|
});
|
|
7134
7214
|
Object.defineProperty(exports, "useDocuments", {
|
|
7135
7215
|
enumerable: true,
|
|
7136
|
-
get: function () { return
|
|
7216
|
+
get: function () { return chunkUN3AZUXX_cjs.useDocuments; }
|
|
7137
7217
|
});
|
|
7138
7218
|
Object.defineProperty(exports, "useFacts", {
|
|
7139
7219
|
enumerable: true,
|
|
7140
|
-
get: function () { return
|
|
7220
|
+
get: function () { return chunkUN3AZUXX_cjs.useFacts; }
|
|
7141
7221
|
});
|
|
7142
7222
|
Object.defineProperty(exports, "useFirmPool", {
|
|
7143
7223
|
enumerable: true,
|
|
7144
|
-
get: function () { return
|
|
7224
|
+
get: function () { return chunkUN3AZUXX_cjs.useFirmPool; }
|
|
7145
7225
|
});
|
|
7146
7226
|
Object.defineProperty(exports, "useHealth", {
|
|
7147
7227
|
enumerable: true,
|
|
7148
|
-
get: function () { return
|
|
7228
|
+
get: function () { return chunkUN3AZUXX_cjs.useHealth; }
|
|
7149
7229
|
});
|
|
7150
7230
|
Object.defineProperty(exports, "useParsedDocument", {
|
|
7151
7231
|
enumerable: true,
|
|
7152
|
-
get: function () { return
|
|
7232
|
+
get: function () { return chunkUN3AZUXX_cjs.useParsedDocument; }
|
|
7153
7233
|
});
|
|
7154
7234
|
Object.defineProperty(exports, "useProjectInvoices", {
|
|
7155
7235
|
enumerable: true,
|
|
7156
|
-
get: function () { return
|
|
7236
|
+
get: function () { return chunkUN3AZUXX_cjs.useProjectInvoices; }
|
|
7157
7237
|
});
|
|
7158
7238
|
Object.defineProperty(exports, "useProjectUsage", {
|
|
7159
7239
|
enumerable: true,
|
|
7160
|
-
get: function () { return
|
|
7240
|
+
get: function () { return chunkUN3AZUXX_cjs.useProjectUsage; }
|
|
7161
7241
|
});
|
|
7162
7242
|
Object.defineProperty(exports, "useProjects", {
|
|
7163
7243
|
enumerable: true,
|
|
7164
|
-
get: function () { return
|
|
7244
|
+
get: function () { return chunkUN3AZUXX_cjs.useProjects; }
|
|
7165
7245
|
});
|
|
7166
7246
|
Object.defineProperty(exports, "useProjectsUsage", {
|
|
7167
7247
|
enumerable: true,
|
|
7168
|
-
get: function () { return
|
|
7169
|
-
});
|
|
7170
|
-
Object.defineProperty(exports, "useSessions", {
|
|
7171
|
-
enumerable: true,
|
|
7172
|
-
get: function () { return chunkAFGE55RQ_cjs.useSessions; }
|
|
7248
|
+
get: function () { return chunkUN3AZUXX_cjs.useProjectsUsage; }
|
|
7173
7249
|
});
|
|
7174
7250
|
Object.defineProperty(exports, "useTags", {
|
|
7175
7251
|
enumerable: true,
|
|
7176
|
-
get: function () { return
|
|
7252
|
+
get: function () { return chunkUN3AZUXX_cjs.useTags; }
|
|
7177
7253
|
});
|
|
7178
7254
|
Object.defineProperty(exports, "useThumbnails", {
|
|
7179
7255
|
enumerable: true,
|
|
7180
|
-
get: function () { return
|
|
7256
|
+
get: function () { return chunkUN3AZUXX_cjs.useThumbnails; }
|
|
7181
7257
|
});
|
|
7182
7258
|
Object.defineProperty(exports, "useTopUpFirmPool", {
|
|
7183
7259
|
enumerable: true,
|
|
7184
|
-
get: function () { return
|
|
7260
|
+
get: function () { return chunkUN3AZUXX_cjs.useTopUpFirmPool; }
|
|
7185
7261
|
});
|
|
7186
7262
|
Object.defineProperty(exports, "useUserUsageToday", {
|
|
7187
7263
|
enumerable: true,
|
|
7188
|
-
get: function () { return
|
|
7264
|
+
get: function () { return chunkUN3AZUXX_cjs.useUserUsageToday; }
|
|
7189
7265
|
});
|
|
7190
7266
|
Object.defineProperty(exports, "useWorkspaceActivity", {
|
|
7191
7267
|
enumerable: true,
|
|
7192
|
-
get: function () { return
|
|
7268
|
+
get: function () { return chunkUN3AZUXX_cjs.useWorkspaceActivity; }
|
|
7193
7269
|
});
|
|
7194
7270
|
Object.defineProperty(exports, "useWorkspaceUsers", {
|
|
7195
7271
|
enumerable: true,
|
|
7196
|
-
get: function () { return
|
|
7272
|
+
get: function () { return chunkUN3AZUXX_cjs.useWorkspaceUsers; }
|
|
7197
7273
|
});
|
|
7198
7274
|
Object.defineProperty(exports, "useWorkspaces", {
|
|
7199
7275
|
enumerable: true,
|
|
7200
|
-
get: function () { return
|
|
7276
|
+
get: function () { return chunkUN3AZUXX_cjs.useWorkspaces; }
|
|
7201
7277
|
});
|
|
7202
7278
|
Object.defineProperty(exports, "cleanDraftMarkdown", {
|
|
7203
7279
|
enumerable: true,
|
|
@@ -8047,6 +8123,7 @@ Object.defineProperty(exports, "isMessageType", {
|
|
|
8047
8123
|
enumerable: true,
|
|
8048
8124
|
get: function () { return client.isMessageType; }
|
|
8049
8125
|
});
|
|
8126
|
+
exports.AccountClientProvider = AccountClientProvider;
|
|
8050
8127
|
exports.ActivityFeed = ActivityFeed;
|
|
8051
8128
|
exports.AiActionCard = AiActionCard;
|
|
8052
8129
|
exports.AiAnswer = AiAnswer;
|
|
@@ -8102,6 +8179,7 @@ exports.accountPath = accountPath;
|
|
|
8102
8179
|
exports.aliasTakenMessage = aliasTakenMessage;
|
|
8103
8180
|
exports.annotateThread = annotateThread;
|
|
8104
8181
|
exports.announceMailDraftReplaced = announceMailDraftReplaced;
|
|
8182
|
+
exports.arbiAccountClient = arbiAccountClient;
|
|
8105
8183
|
exports.arbiMailClient = arbiMailClient;
|
|
8106
8184
|
exports.captureFrameAsBlob = captureFrameAsBlob;
|
|
8107
8185
|
exports.createMailClient = createMailClient;
|
|
@@ -8138,6 +8216,7 @@ exports.toNotificationPreferences = toNotificationPreferences;
|
|
|
8138
8216
|
exports.toProfileView = toProfileView;
|
|
8139
8217
|
exports.toRedlineMarkdown = toRedlineMarkdown;
|
|
8140
8218
|
exports.toShellWorkspace = toShellWorkspace;
|
|
8219
|
+
exports.useAccountClient = useAccountClient;
|
|
8141
8220
|
exports.useActOnStep = useActOnStep;
|
|
8142
8221
|
exports.useAgentChats = useAgentChats;
|
|
8143
8222
|
exports.useAgentConfig = useAgentConfig;
|
|
@@ -8187,7 +8266,6 @@ exports.useIdentityVerification = useIdentityVerification;
|
|
|
8187
8266
|
exports.useIdentityVerificationFlow = useIdentityVerificationFlow;
|
|
8188
8267
|
exports.useInvalidateTagData = useInvalidateTagData;
|
|
8189
8268
|
exports.useInviteContacts = useInviteContacts;
|
|
8190
|
-
exports.useLogoutAllSessions = useLogoutAllSessions;
|
|
8191
8269
|
exports.useMailAccounts = useMailAccounts;
|
|
8192
8270
|
exports.useMailCache = useMailCache;
|
|
8193
8271
|
exports.useMailClient = useMailClient;
|
|
@@ -8219,8 +8297,10 @@ exports.useSaveMailDraft = useSaveMailDraft;
|
|
|
8219
8297
|
exports.useSemanticSearch = useSemanticSearch;
|
|
8220
8298
|
exports.useSendBackStep = useSendBackStep;
|
|
8221
8299
|
exports.useSendMail = useSendMail;
|
|
8300
|
+
exports.useSessions = useSessions;
|
|
8222
8301
|
exports.useSetTagValues = useSetTagValues;
|
|
8223
8302
|
exports.useShellWorkspaces = useShellWorkspaces;
|
|
8303
|
+
exports.useSignOut = useSignOut;
|
|
8224
8304
|
exports.useSkills = useSkills;
|
|
8225
8305
|
exports.useStartAgentSession = useStartAgentSession;
|
|
8226
8306
|
exports.useStartWorkQuery = useStartWorkQuery;
|