@ezychat/web 0.1.58 → 0.1.60

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.
Files changed (36) hide show
  1. package/dist-lib/chunks/admin-DPSjgyl3.js +869 -0
  2. package/dist-lib/chunks/admin-DiuGyOP6.js +868 -0
  3. package/dist-lib/chunks/{inbox-CostSOFa.js → inbox-42E4FML_.js} +4 -1
  4. package/dist-lib/chunks/{inbox-Dn_zMX5x.js → inbox-B0UJDCp0.js} +4 -1
  5. package/dist-lib/ezychat-web.css +1 -1
  6. package/dist-lib/index.js +12112 -7762
  7. package/dist-lib/types/admin/AdminLayout.d.ts +8 -0
  8. package/dist-lib/types/admin/PhraseDictionarySection.d.ts +6 -0
  9. package/dist-lib/types/admin/ReportCharts.d.ts +48 -0
  10. package/dist-lib/types/admin/ReportsPage.d.ts +13 -0
  11. package/dist-lib/types/admin/connectors/AgentConnectorsCard.d.ts +8 -0
  12. package/dist-lib/types/admin/connectors/AgentPicker.d.ts +9 -0
  13. package/dist-lib/types/admin/connectors/BookingSettingsCard.d.ts +13 -0
  14. package/dist-lib/types/admin/connectors/ConnectorDetailPage.d.ts +8 -0
  15. package/dist-lib/types/admin/connectors/ConnectorsGalleryPage.d.ts +7 -0
  16. package/dist-lib/types/admin/connectors/GoogleCalendarAccountCard.d.ts +7 -0
  17. package/dist-lib/types/admin/connectors/PartnerConnectionCard.d.ts +10 -0
  18. package/dist-lib/types/admin/connectors/PartnerConnectorPage.d.ts +8 -0
  19. package/dist-lib/types/admin/connectors/PartnerSettingsCard.d.ts +18 -0
  20. package/dist-lib/types/admin/connectors/catalog.d.ts +41 -0
  21. package/dist-lib/types/admin/connectors/connector-ui.d.ts +38 -0
  22. package/dist-lib/types/admin/connectors/list.d.ts +14 -0
  23. package/dist-lib/types/api/ai.d.ts +7 -1
  24. package/dist-lib/types/api/connector-list.d.ts +416 -0
  25. package/dist-lib/types/api/connectors.d.ts +106 -0
  26. package/dist-lib/types/api/queries.d.ts +60 -1
  27. package/dist-lib/types/api/reply-suggestions.d.ts +46 -0
  28. package/dist-lib/types/api/voice.d.ts +2 -2
  29. package/dist-lib/types/extensions/types.d.ts +7 -1
  30. package/dist-lib/types/i18n/resources.d.ts +539 -0
  31. package/dist-lib/types/inbox/Composer.d.ts +3 -1
  32. package/dist-lib/types/lib/format.d.ts +5 -0
  33. package/dist-lib/types/lib/links.d.ts +9 -0
  34. package/package.json +2 -2
  35. package/dist-lib/chunks/admin-B2CqmbDY.js +0 -727
  36. package/dist-lib/chunks/admin-BPz8x80r.js +0 -726
@@ -0,0 +1,416 @@
1
+ import { ConnectorProblem } from '@ezychat/shared';
2
+ /**
3
+ * Admin → Connectors from the connector list (design docs/features/connector-list/design.md):
4
+ * the list the server keeps, and partner (MCP) connections. Admins only; keys, tokens and secrets
5
+ * never come back to the browser (only the key end).
6
+ */
7
+ export declare const connectorListKey: readonly ["connectors", "list"];
8
+ export declare const connectorAgentKey: (id: string, agentId: number) => readonly ["connectors", "mcp", string, "agent", number];
9
+ /** The list as the server keeps it (no download). */
10
+ export declare function useConnectorGallery(enabled?: boolean): import("@tanstack/react-query").UseQueryResult<{
11
+ status: {
12
+ state: "offline" | "loaded" | "rejected" | "builtin";
13
+ generatedAt: string | null;
14
+ sequence: number | null;
15
+ checkedAt: number | null;
16
+ appVersion: string;
17
+ hidden: number;
18
+ };
19
+ connectors: {
20
+ entry: {
21
+ id: string;
22
+ schemaVersion: 1;
23
+ minAppVersion: string;
24
+ kind: "mcp" | "builtin" | "coming_soon";
25
+ editions: ("lite" | "enterprise")[];
26
+ name: string;
27
+ summary: {
28
+ en: string;
29
+ ms?: string | undefined;
30
+ 'zh-CN'?: string | undefined;
31
+ };
32
+ description: {
33
+ en: string;
34
+ ms?: string | undefined;
35
+ 'zh-CN'?: string | undefined;
36
+ };
37
+ category: "custom" | "other" | "calendar" | "accounting" | "crm" | "spreadsheets" | "payments" | "online_shop";
38
+ builtinId?: string | undefined;
39
+ icon?: {
40
+ file: string;
41
+ sha256: string;
42
+ size: number;
43
+ } | undefined;
44
+ publisher?: string | undefined;
45
+ homepage?: string | undefined;
46
+ privacy?: {
47
+ en: string;
48
+ ms?: string | undefined;
49
+ 'zh-CN'?: string | undefined;
50
+ } | undefined;
51
+ mcp?: {
52
+ url: string;
53
+ } | undefined;
54
+ auth?: {
55
+ type: "oauth";
56
+ scopes: string[];
57
+ clientId?: string | undefined;
58
+ } | {
59
+ type: "oauth_own_app";
60
+ scopes: string[];
61
+ help?: string | undefined;
62
+ } | {
63
+ type: "api_key";
64
+ label: {
65
+ en: string;
66
+ ms?: string | undefined;
67
+ 'zh-CN'?: string | undefined;
68
+ };
69
+ header: {
70
+ name: string;
71
+ value: string;
72
+ };
73
+ help?: string | undefined;
74
+ } | {
75
+ type: "credentials";
76
+ fields: {
77
+ id: string;
78
+ label: {
79
+ en: string;
80
+ ms?: string | undefined;
81
+ 'zh-CN'?: string | undefined;
82
+ };
83
+ secret: boolean;
84
+ hint?: {
85
+ en: string;
86
+ ms?: string | undefined;
87
+ 'zh-CN'?: string | undefined;
88
+ } | undefined;
89
+ }[];
90
+ headers: {
91
+ name: string;
92
+ value: string;
93
+ }[];
94
+ help?: string | undefined;
95
+ } | {
96
+ type: "none";
97
+ } | undefined;
98
+ tools?: {
99
+ name: string;
100
+ title: {
101
+ en: string;
102
+ ms?: string | undefined;
103
+ 'zh-CN'?: string | undefined;
104
+ };
105
+ description: {
106
+ en: string;
107
+ ms?: string | undefined;
108
+ 'zh-CN'?: string | undefined;
109
+ };
110
+ access: "read" | "write";
111
+ instructions?: {
112
+ en: string;
113
+ ms?: string | undefined;
114
+ 'zh-CN'?: string | undefined;
115
+ } | undefined;
116
+ guards?: {
117
+ confirmFirst?: boolean | undefined;
118
+ valueFrom?: Record<string, string> | undefined;
119
+ fromCustomer?: string[] | undefined;
120
+ within?: Record<string, string> | undefined;
121
+ limits?: {
122
+ perChat?: number | undefined;
123
+ perDay?: number | undefined;
124
+ } | undefined;
125
+ } | undefined;
126
+ }[] | undefined;
127
+ skill?: {
128
+ en: string;
129
+ ms?: string | undefined;
130
+ 'zh-CN'?: string | undefined;
131
+ } | undefined;
132
+ settings?: {
133
+ id: string;
134
+ type: "number" | "days" | "text" | "select" | "toggle" | "timeRange" | "calendarPicker";
135
+ label: {
136
+ en: string;
137
+ ms?: string | undefined;
138
+ 'zh-CN'?: string | undefined;
139
+ };
140
+ hint?: {
141
+ en: string;
142
+ ms?: string | undefined;
143
+ 'zh-CN'?: string | undefined;
144
+ } | undefined;
145
+ options?: {
146
+ value: string;
147
+ label: {
148
+ en: string;
149
+ ms?: string | undefined;
150
+ 'zh-CN'?: string | undefined;
151
+ };
152
+ }[] | undefined;
153
+ default?: unknown;
154
+ from?: string | undefined;
155
+ required?: boolean | undefined;
156
+ }[] | undefined;
157
+ vote?: {
158
+ en: string;
159
+ ms?: string | undefined;
160
+ 'zh-CN'?: string | undefined;
161
+ } | undefined;
162
+ };
163
+ fit: "ok" | "enterprise" | "needsUpdate";
164
+ delisted: boolean;
165
+ connection: {
166
+ state: "connected" | "waiting" | "disconnected" | "unreachable" | "needs_sign_in";
167
+ account: string | null;
168
+ keyEnd: string | null;
169
+ connectedAt: number | null;
170
+ fields: Record<string, string>;
171
+ } | null;
172
+ }[];
173
+ }, Error>;
174
+ /** Downloads and checks the list now (gallery open, Check for new connectors). */
175
+ export declare function useRefreshConnectorList(): import("@tanstack/react-query").UseMutationResult<{
176
+ status: {
177
+ state: "offline" | "loaded" | "rejected" | "builtin";
178
+ generatedAt: string | null;
179
+ sequence: number | null;
180
+ checkedAt: number | null;
181
+ appVersion: string;
182
+ hidden: number;
183
+ };
184
+ connectors: {
185
+ entry: {
186
+ id: string;
187
+ schemaVersion: 1;
188
+ minAppVersion: string;
189
+ kind: "mcp" | "builtin" | "coming_soon";
190
+ editions: ("lite" | "enterprise")[];
191
+ name: string;
192
+ summary: {
193
+ en: string;
194
+ ms?: string | undefined;
195
+ 'zh-CN'?: string | undefined;
196
+ };
197
+ description: {
198
+ en: string;
199
+ ms?: string | undefined;
200
+ 'zh-CN'?: string | undefined;
201
+ };
202
+ category: "custom" | "other" | "calendar" | "accounting" | "crm" | "spreadsheets" | "payments" | "online_shop";
203
+ builtinId?: string | undefined;
204
+ icon?: {
205
+ file: string;
206
+ sha256: string;
207
+ size: number;
208
+ } | undefined;
209
+ publisher?: string | undefined;
210
+ homepage?: string | undefined;
211
+ privacy?: {
212
+ en: string;
213
+ ms?: string | undefined;
214
+ 'zh-CN'?: string | undefined;
215
+ } | undefined;
216
+ mcp?: {
217
+ url: string;
218
+ } | undefined;
219
+ auth?: {
220
+ type: "oauth";
221
+ scopes: string[];
222
+ clientId?: string | undefined;
223
+ } | {
224
+ type: "oauth_own_app";
225
+ scopes: string[];
226
+ help?: string | undefined;
227
+ } | {
228
+ type: "api_key";
229
+ label: {
230
+ en: string;
231
+ ms?: string | undefined;
232
+ 'zh-CN'?: string | undefined;
233
+ };
234
+ header: {
235
+ name: string;
236
+ value: string;
237
+ };
238
+ help?: string | undefined;
239
+ } | {
240
+ type: "credentials";
241
+ fields: {
242
+ id: string;
243
+ label: {
244
+ en: string;
245
+ ms?: string | undefined;
246
+ 'zh-CN'?: string | undefined;
247
+ };
248
+ secret: boolean;
249
+ hint?: {
250
+ en: string;
251
+ ms?: string | undefined;
252
+ 'zh-CN'?: string | undefined;
253
+ } | undefined;
254
+ }[];
255
+ headers: {
256
+ name: string;
257
+ value: string;
258
+ }[];
259
+ help?: string | undefined;
260
+ } | {
261
+ type: "none";
262
+ } | undefined;
263
+ tools?: {
264
+ name: string;
265
+ title: {
266
+ en: string;
267
+ ms?: string | undefined;
268
+ 'zh-CN'?: string | undefined;
269
+ };
270
+ description: {
271
+ en: string;
272
+ ms?: string | undefined;
273
+ 'zh-CN'?: string | undefined;
274
+ };
275
+ access: "read" | "write";
276
+ instructions?: {
277
+ en: string;
278
+ ms?: string | undefined;
279
+ 'zh-CN'?: string | undefined;
280
+ } | undefined;
281
+ guards?: {
282
+ confirmFirst?: boolean | undefined;
283
+ valueFrom?: Record<string, string> | undefined;
284
+ fromCustomer?: string[] | undefined;
285
+ within?: Record<string, string> | undefined;
286
+ limits?: {
287
+ perChat?: number | undefined;
288
+ perDay?: number | undefined;
289
+ } | undefined;
290
+ } | undefined;
291
+ }[] | undefined;
292
+ skill?: {
293
+ en: string;
294
+ ms?: string | undefined;
295
+ 'zh-CN'?: string | undefined;
296
+ } | undefined;
297
+ settings?: {
298
+ id: string;
299
+ type: "number" | "days" | "text" | "select" | "toggle" | "timeRange" | "calendarPicker";
300
+ label: {
301
+ en: string;
302
+ ms?: string | undefined;
303
+ 'zh-CN'?: string | undefined;
304
+ };
305
+ hint?: {
306
+ en: string;
307
+ ms?: string | undefined;
308
+ 'zh-CN'?: string | undefined;
309
+ } | undefined;
310
+ options?: {
311
+ value: string;
312
+ label: {
313
+ en: string;
314
+ ms?: string | undefined;
315
+ 'zh-CN'?: string | undefined;
316
+ };
317
+ }[] | undefined;
318
+ default?: unknown;
319
+ from?: string | undefined;
320
+ required?: boolean | undefined;
321
+ }[] | undefined;
322
+ vote?: {
323
+ en: string;
324
+ ms?: string | undefined;
325
+ 'zh-CN'?: string | undefined;
326
+ } | undefined;
327
+ };
328
+ fit: "ok" | "enterprise" | "needsUpdate";
329
+ delisted: boolean;
330
+ connection: {
331
+ state: "connected" | "waiting" | "disconnected" | "unreachable" | "needs_sign_in";
332
+ account: string | null;
333
+ keyEnd: string | null;
334
+ connectedAt: number | null;
335
+ fields: Record<string, string>;
336
+ } | null;
337
+ }[];
338
+ }, Error, void, unknown>;
339
+ /**
340
+ * Connects: OAuth answers with `authorizationUrl` + `requestId` (open it, then poll); the key and
341
+ * form sign-ins send their `fields` and answer with the connection.
342
+ */
343
+ export declare function useConnectorConnect(id: string): import("@tanstack/react-query").UseMutationResult<{
344
+ authorizationUrl: string | null;
345
+ requestId: string | null;
346
+ connection: {
347
+ state: "connected" | "waiting" | "disconnected" | "unreachable" | "needs_sign_in";
348
+ account: string | null;
349
+ keyEnd: string | null;
350
+ connectedAt: number | null;
351
+ fields: Record<string, string>;
352
+ };
353
+ }, Error, {
354
+ fields: Record<string, string>;
355
+ }, unknown>;
356
+ /** Polls an OAuth sign-in every 2 s until the partner sent the person back or it failed. */
357
+ export declare function useConnectorConnectProgress(id: string, requestId: string | null): import("@tanstack/react-query").UseQueryResult<{
358
+ status: "pending" | "failed" | "done";
359
+ problem: "expired" | "unreachable" | "refused" | "cancelled" | "not_https" | "private_address" | "missing_tools" | null;
360
+ }, Error>;
361
+ /** The connector problem an API error carries as its code (refused, unreachable, …), if any. */
362
+ export declare function connectorProblemOf(error: unknown): ConnectorProblem | null;
363
+ /**
364
+ * Tests the typed fields (before Save) or, with no fields, the saved connection. A failure the
365
+ * server names (`{ error: { code: <problem> } }`) comes back as a result, like `ok: false`.
366
+ */
367
+ export declare function useConnectorTest(id: string): import("@tanstack/react-query").UseMutationResult<{
368
+ ok: boolean;
369
+ tools: string[];
370
+ problem: "expired" | "unreachable" | "refused" | "cancelled" | "not_https" | "private_address" | "missing_tools" | null;
371
+ }, Error, {
372
+ fields: Record<string, string>;
373
+ }, unknown>;
374
+ export declare function useConnectorDisconnect(id: string): import("@tanstack/react-query").UseMutationResult<{
375
+ state: "connected" | "waiting" | "disconnected" | "unreachable" | "needs_sign_in";
376
+ account: string | null;
377
+ keyEnd: string | null;
378
+ connectedAt: number | null;
379
+ fields: Record<string, string>;
380
+ }, Error, void, unknown>;
381
+ /** One AI agent's settings values and tool switches for a partner connector. */
382
+ export declare function useConnectorAgentSettings(id: string, agentId: number, enabled?: boolean): import("@tanstack/react-query").UseQueryResult<{
383
+ settings: Record<string, unknown>;
384
+ tools: Record<string, boolean>;
385
+ }, Error>;
386
+ /** The same for several connectors at once (the agent page's Connectors card). */
387
+ export declare function useConnectorsAgentSettings(ids: readonly string[], agentId: number): import("@tanstack/react-query").UseQueryResult<{
388
+ settings: Record<string, unknown>;
389
+ tools: Record<string, boolean>;
390
+ }, Error>[];
391
+ export declare function useSaveConnectorAgentSettings(id: string, agentId: number): import("@tanstack/react-query").UseMutationResult<{
392
+ settings: Record<string, unknown>;
393
+ tools: Record<string, boolean>;
394
+ }, Error, {
395
+ settings: Record<string, unknown>;
396
+ tools: Record<string, boolean>;
397
+ }, unknown>;
398
+ /** What the AI looked up and did through the connector (never chat text). */
399
+ export declare function useConnectorActivity(id: string, enabled?: boolean): import("@tanstack/react-query").UseQueryResult<{
400
+ activity: {
401
+ id: number;
402
+ at: number;
403
+ kind: "failed" | "done" | "checked" | "refused";
404
+ agentName: string;
405
+ customer: string;
406
+ tool: string;
407
+ reason: "limit" | "unreachable" | "needs_sign_in" | "within" | "confirm_first" | "value_from" | "from_customer" | "partner_error" | null;
408
+ }[];
409
+ }, Error>;
410
+ /** The choices of a picker setting, read from the partner through its look-up tool. */
411
+ export declare function useConnectorChoices(id: string, settingId: string, agentId: number, enabled?: boolean): import("@tanstack/react-query").UseQueryResult<{
412
+ options: {
413
+ value: string;
414
+ label: string;
415
+ }[];
416
+ }, Error>;
@@ -0,0 +1,106 @@
1
+ /** Admin → Connectors → Google Calendar (admins only). Tokens never reach the browser. */
2
+ export declare const googleCalendarKey: readonly ["connectors", "google-calendar"];
3
+ export declare const bookingSettingsKey: (agentId: number) => readonly ["connectors", "google-calendar", "agent", number];
4
+ export declare const calendarActivityKey: readonly ["connectors", "google-calendar", "activity"];
5
+ export declare const calendarBookingsKey: readonly ["connectors", "google-calendar", "bookings"];
6
+ export declare function useGoogleCalendar(enabled?: boolean): import("@tanstack/react-query").UseQueryResult<{
7
+ state: "unavailable" | "connected" | "expired" | "disconnected" | "not_configured";
8
+ account: string | null;
9
+ calendars: {
10
+ id: string;
11
+ name: string;
12
+ primary: boolean;
13
+ readOnly: boolean;
14
+ }[];
15
+ connectedAt: number | null;
16
+ problemSince: number | null;
17
+ }, Error>;
18
+ /** Starts Google's sign-in: the page opens `authorizationUrl` and polls the request. */
19
+ export declare function useGoogleCalendarConnect(): import("@tanstack/react-query").UseMutationResult<{
20
+ requestId: string;
21
+ authorizationUrl: string;
22
+ }, Error, void, unknown>;
23
+ /** Polls a sign-in every 2 s until Google sent the person back (done) or it failed. */
24
+ export declare function useGoogleCalendarProgress(requestId: string | null): import("@tanstack/react-query").UseQueryResult<{
25
+ status: "pending" | "failed" | "done";
26
+ error: "error" | "expired" | "denied" | null;
27
+ }, Error>;
28
+ export declare function useGoogleCalendarDisconnect(): import("@tanstack/react-query").UseMutationResult<unknown, Error, void, unknown>;
29
+ /** One AI agent's booking settings (the defaults until an admin saves them). */
30
+ export declare function useBookingSettings(agentId: number | null, enabled?: boolean): import("@tanstack/react-query").UseQueryResult<{
31
+ calendarId: string | null;
32
+ checkFree: boolean;
33
+ book: boolean;
34
+ title: string;
35
+ lengthMin: number;
36
+ days: number[];
37
+ from: string;
38
+ to: string;
39
+ gapMin: number;
40
+ noticeHours: number;
41
+ maxDays: number;
42
+ }, Error>;
43
+ export declare function useSaveBookingSettings(agentId: number): import("@tanstack/react-query").UseMutationResult<{
44
+ calendarId: string | null;
45
+ checkFree: boolean;
46
+ book: boolean;
47
+ title: string;
48
+ lengthMin: number;
49
+ days: number[];
50
+ from: string;
51
+ to: string;
52
+ gapMin: number;
53
+ noticeHours: number;
54
+ maxDays: number;
55
+ }, Error, {
56
+ calendarId: string | null;
57
+ checkFree: boolean;
58
+ book: boolean;
59
+ title: string;
60
+ lengthMin: number;
61
+ days: number[];
62
+ from: string;
63
+ to: string;
64
+ gapMin: number;
65
+ noticeHours: number;
66
+ maxDays: number;
67
+ }, unknown>;
68
+ /** Bookings tab: the events the AI added (EzyChat's own records) and links into Google Calendar. */
69
+ export declare function useCalendarBookings(enabled?: boolean): import("@tanstack/react-query").UseQueryResult<{
70
+ upcoming: {
71
+ id: number;
72
+ agentId: number;
73
+ agentName: string;
74
+ chatJid: string;
75
+ customer: string;
76
+ start: string;
77
+ end: string;
78
+ createdAt: number;
79
+ eventUrl: string;
80
+ }[];
81
+ past: {
82
+ id: number;
83
+ agentId: number;
84
+ agentName: string;
85
+ chatJid: string;
86
+ customer: string;
87
+ start: string;
88
+ end: string;
89
+ createdAt: number;
90
+ eventUrl: string;
91
+ }[];
92
+ calendarUrl: string | null;
93
+ }, Error>;
94
+ export declare function useCalendarActivity(enabled?: boolean): import("@tanstack/react-query").UseQueryResult<{
95
+ activity: {
96
+ id: number;
97
+ at: number;
98
+ kind: "failed" | "checked" | "booked" | "handed_over";
99
+ agentId: number | null;
100
+ agentName: string;
101
+ chatJid: string | null;
102
+ customer: string;
103
+ start: string | null;
104
+ end: string | null;
105
+ }[];
106
+ }, Error>;
@@ -1,5 +1,5 @@
1
1
  import { type InfiniteData, type QueryClient } from '@tanstack/react-query';
2
- import { type CreateApiTokenBodyInput, type UpdateApiTokenBody, type Chat, type ChatListResponse, type ChatStatus, type DirectoryUser, type InboxStatusPayload, type Message, type MessageListResponse, type PatchUserBody, type Settings, type WaStatus } from '@ezychat/shared';
2
+ import { type ReportPeriod, type CreateApiTokenBodyInput, type UpdateApiTokenBody, type Chat, type ChatListResponse, type ChatStatus, type DirectoryUser, type InboxStatusPayload, type Message, type MessageListResponse, type PatchUserBody, type Settings, type WaStatus } from '@ezychat/shared';
3
3
  export interface ChatFilters {
4
4
  status?: ChatStatus;
5
5
  assigned: 'me' | 'none' | 'any';
@@ -15,6 +15,7 @@ export declare const qk: {
15
15
  chats: (f: ChatFilters) => readonly ["chats", ChatFilters];
16
16
  chatsAll: readonly ["chats"];
17
17
  openChatCount: readonly ["open-chat-count"];
18
+ report: (days: number) => readonly ["report", number];
18
19
  chat: (jid: string) => readonly ["chat", string];
19
20
  messages: (jid: string) => readonly ["messages", string];
20
21
  notes: (jid: string) => readonly ["notes", string];
@@ -174,6 +175,64 @@ export declare function useChat(jid: string | null | undefined): import("@tansta
174
175
  at: number;
175
176
  }[];
176
177
  }, Error>;
178
+ /** Admin → Reports for the last 7, 30 or 90 days (admins only). */
179
+ export declare function useReport(days: ReportPeriod): import("@tanstack/react-query").UseQueryResult<{
180
+ days: 7 | 30 | 90;
181
+ timeZone: string;
182
+ firstDate: string | null;
183
+ linkedDate: string | null;
184
+ totals: {
185
+ newCustomers: number;
186
+ messagesIn: number;
187
+ messagesOut: number;
188
+ activeChats: number;
189
+ medianFirstReplyMinutes: number | null;
190
+ missedLeads: number;
191
+ aiAnswered: number;
192
+ aiResolved: number;
193
+ aiHandoffs: number;
194
+ };
195
+ previous: {
196
+ newCustomers: number;
197
+ messagesIn: number;
198
+ messagesOut: number;
199
+ activeChats: number;
200
+ medianFirstReplyMinutes: number | null;
201
+ missedLeads: number;
202
+ aiAnswered: number;
203
+ aiResolved: number;
204
+ aiHandoffs: number;
205
+ } | null;
206
+ waitingAfterHandoff: {
207
+ count: number;
208
+ oldestAt: number | null;
209
+ };
210
+ daily: {
211
+ date: string;
212
+ inbound: number;
213
+ outbound: number;
214
+ newCustomers: number;
215
+ activeChats: number;
216
+ }[];
217
+ weekdays: {
218
+ weekday: number;
219
+ avgInbound: number;
220
+ avgChats: number;
221
+ }[];
222
+ hours: number[][];
223
+ handoffReasons: {
224
+ reason: string;
225
+ count: number;
226
+ }[];
227
+ team: {
228
+ userId: number | null;
229
+ name: string;
230
+ kind: "phone" | "human" | "ai";
231
+ chats: number;
232
+ replies: number;
233
+ medianReplyMinutes: number | null;
234
+ }[];
235
+ }, Error>;
177
236
  export declare function useOpenChatCount(): import("@tanstack/react-query").UseQueryResult<{
178
237
  openCount: number;
179
238
  }, Error>;
@@ -15,6 +15,52 @@ export declare function fetchSuggestions(jid: string, signal: AbortSignal): Prom
15
15
  noAnswer: boolean;
16
16
  handoffRule: string | null;
17
17
  }>;
18
+ /** The chat's phrase list, matched in the composer on every key (empty while suggestions are off). */
19
+ export declare function usePhraseList(jid: string | null, enabled: boolean): import("@tanstack/react-query").UseQueryResult<{
20
+ phrases: {
21
+ id: number;
22
+ text: string;
23
+ language: "en" | "ms" | "zh";
24
+ }[];
25
+ }, Error>;
26
+ /** Tab / Accept (true) or Esc (false) on a phrase's grey text: it moves up or down the list. */
27
+ export declare function sendPhraseFeedback(jid: string, id: number, accepted: boolean): void;
28
+ export declare const phrasesAdminKey: readonly ["ai", "phrasesAdmin"];
29
+ /** Admins: the phrase list and its status for one agent (default: the agent of inbox 1). */
30
+ export declare function usePhrasesAdmin(agentId: number | null): import("@tanstack/react-query").UseQueryResult<{
31
+ agentId: number | null;
32
+ status: {
33
+ state: "error" | "ready" | "empty" | "building";
34
+ count: number;
35
+ languages: {
36
+ language: "en" | "ms" | "zh";
37
+ count: number;
38
+ }[];
39
+ updatedAt: number | null;
40
+ trigger: "context" | "manual" | "start" | "replies" | "weekly" | null;
41
+ newReplies: number;
42
+ nextAfterReplies: number;
43
+ aiCallsToday: number;
44
+ aiCallsLimit: number;
45
+ };
46
+ phrases: {
47
+ id: number;
48
+ text: string;
49
+ language: "en" | "ms" | "zh";
50
+ source: "admin" | "context" | "team";
51
+ uses: number;
52
+ fact: boolean;
53
+ }[];
54
+ }, Error>;
55
+ export declare const suggestModelKey: readonly ["ai", "suggestModel"];
56
+ /** Admins: the model for suggestions, its choices and what calls use now. */
57
+ export declare function useSuggestModel(enabled: boolean): import("@tanstack/react-query").UseQueryResult<{
58
+ model: string;
59
+ fastModel: string;
60
+ agentModel: string;
61
+ models: string[];
62
+ resolved: string;
63
+ }, Error>;
18
64
  /** The rest of the sentence being typed, or null. */
19
65
  export declare function fetchCompletion(jid: string, text: string, signal: AbortSignal): Promise<{
20
66
  completion: string | null;
@@ -7,7 +7,7 @@ export declare function useVoiceStatus(): import("@tanstack/react-query").UseQue
7
7
  state: "error" | "not_installed" | "downloading" | "installed";
8
8
  receivedBytes: number;
9
9
  totalBytes: number;
10
- error: "network" | "unknown" | "disk_space" | "verification" | "redirect" | "write" | null;
10
+ error: "network" | "unknown" | "write" | "disk_space" | "verification" | "redirect" | null;
11
11
  };
12
12
  cloudAvailable: boolean;
13
13
  }, Error>;
@@ -27,7 +27,7 @@ export declare function useVoiceAction(): import("@tanstack/react-query").UseMut
27
27
  state: "error" | "not_installed" | "downloading" | "installed";
28
28
  receivedBytes: number;
29
29
  totalBytes: number;
30
- error: "network" | "unknown" | "disk_space" | "verification" | "redirect" | "write" | null;
30
+ error: "network" | "unknown" | "write" | "disk_space" | "verification" | "redirect" | null;
31
31
  };
32
32
  cloudAvailable: boolean;
33
33
  }, Error, VoiceAction, unknown>;