@ezychat/web 0.1.77 → 0.1.79
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-lib/chunks/{admin-BKiB8_GE.js → admin-D4nMrYTV.js} +49 -6
- package/dist-lib/chunks/{admin-DM8CrZrZ.js → admin-SGy97Cay.js} +47 -6
- package/dist-lib/chunks/{common-BB_u0f7c.js → common-BE996sRJ.js} +26 -0
- package/dist-lib/chunks/{common-6IvDd1Hx.js → common-CBTam36M.js} +26 -0
- package/dist-lib/chunks/{inbox-C9xTxE6Y.js → inbox-RAdHANUD.js} +96 -5
- package/dist-lib/chunks/{inbox-D-koJMyr.js → inbox-iUbtLuDB.js} +96 -5
- package/dist-lib/ezychat-web.css +1 -1
- package/dist-lib/index.js +10485 -6680
- package/dist-lib/public/badge-96.png +0 -0
- package/dist-lib/sw.ts +2 -1
- package/dist-lib/types/admin/AgentScheduledTasksCard.d.ts +10 -0
- package/dist-lib/types/admin/MemberChatsField.d.ts +11 -0
- package/dist-lib/types/admin/NewChatSection.d.ts +7 -0
- package/dist-lib/types/admin/ScheduledRunsDialog.d.ts +12 -0
- package/dist-lib/types/admin/ScheduledTaskDialog.d.ts +18 -0
- package/dist-lib/types/admin/business-templates-data.d.ts +18 -0
- package/dist-lib/types/admin/business-templates.d.ts +3 -1
- package/dist-lib/types/admin/connectors/ConnectorDetailPage.d.ts +2 -1
- package/dist-lib/types/admin/connectors/ConnectorsGalleryPage.d.ts +2 -1
- package/dist-lib/types/admin/connectors/CreateSheetDialog.d.ts +29 -0
- package/dist-lib/types/admin/connectors/DriveSettingsCard.d.ts +14 -0
- package/dist-lib/types/admin/connectors/GoogleDriveAccountCard.d.ts +7 -0
- package/dist-lib/types/admin/connectors/SqlAccountCustomers.d.ts +4 -0
- package/dist-lib/types/admin/connectors/SqlAccountPage.d.ts +12 -0
- package/dist-lib/types/admin/connectors/SqlAccountSettings.d.ts +7 -0
- package/dist-lib/types/admin/connectors/catalog.d.ts +10 -7
- package/dist-lib/types/admin/connectors/connector-ui.d.ts +17 -1
- package/dist-lib/types/admin/connectors/google-connect.d.ts +5 -0
- package/dist-lib/types/admin/connectors/sheets-tabs.d.ts +4 -1
- package/dist-lib/types/admin/scheduled-format.d.ts +16 -0
- package/dist-lib/types/api/ai-templates.d.ts +24 -0
- package/dist-lib/types/api/ai.d.ts +8 -1
- package/dist-lib/types/api/connectors.d.ts +132 -0
- package/dist-lib/types/api/inbox-mutations.d.ts +2 -0
- package/dist-lib/types/api/message-changes.d.ts +10 -2
- package/dist-lib/types/api/new-chat.d.ts +55 -0
- package/dist-lib/types/api/queries.d.ts +63 -8
- package/dist-lib/types/api/scheduled-tasks.d.ts +145 -0
- package/dist-lib/types/api/sql-account.d.ts +105 -0
- package/dist-lib/types/api/templates.d.ts +5 -1
- package/dist-lib/types/askezy/AskEzyButton.d.ts +1 -1
- package/dist-lib/types/auth/chat-scope.d.ts +7 -0
- package/dist-lib/types/i18n/resources.d.ts +640 -0
- package/dist-lib/types/inbox/MessageBubble.d.ts +5 -1
- package/dist-lib/types/inbox/MessageList.d.ts +8 -1
- package/dist-lib/types/inbox/NewChatDialog.d.ts +2 -0
- package/dist-lib/types/inbox/ReplyWindow.d.ts +16 -0
- package/dist-lib/types/inbox/useDirectory.d.ts +3 -0
- package/dist-lib/types/inbox/useQuoteJump.d.ts +28 -0
- package/dist-lib/types/inbox/useSwipeReply.d.ts +1 -0
- package/dist-lib/types/lib/tips.d.ts +1 -1
- package/package.json +2 -2
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
import type { NewChatBodyInput } from '@ezychat/shared';
|
|
2
|
+
/** New chat (docs/features/new-chat/design.md). */
|
|
3
|
+
export declare const newChatKey: readonly ["new-chat"];
|
|
4
|
+
/** May the signed-in user start new chats, from which inboxes, and the team's settings. */
|
|
5
|
+
export declare function useNewChatStatus(enabled?: boolean): import("@tanstack/react-query").UseQueryResult<{
|
|
6
|
+
allowed: boolean;
|
|
7
|
+
staffEnabled: boolean;
|
|
8
|
+
dailyLimit: number;
|
|
9
|
+
perUserPerHour: number;
|
|
10
|
+
inboxes: {
|
|
11
|
+
inboxId: number;
|
|
12
|
+
mode: "template" | "unsupported" | "check";
|
|
13
|
+
usedToday: number;
|
|
14
|
+
countryCode: string;
|
|
15
|
+
}[];
|
|
16
|
+
}, Error>;
|
|
17
|
+
/** Admins: the team-members switch and the daily limit (each audited before/after). */
|
|
18
|
+
export declare function useUpdateNewChatSettings(): import("@tanstack/react-query").UseMutationResult<{
|
|
19
|
+
allowed: boolean;
|
|
20
|
+
staffEnabled: boolean;
|
|
21
|
+
dailyLimit: number;
|
|
22
|
+
perUserPerHour: number;
|
|
23
|
+
inboxes: {
|
|
24
|
+
inboxId: number;
|
|
25
|
+
mode: "template" | "unsupported" | "check";
|
|
26
|
+
usedToday: number;
|
|
27
|
+
countryCode: string;
|
|
28
|
+
}[];
|
|
29
|
+
}, Error, {
|
|
30
|
+
staffEnabled?: boolean | undefined;
|
|
31
|
+
dailyLimit?: number | undefined;
|
|
32
|
+
}, unknown>;
|
|
33
|
+
/** Format, own number and an existing chat: never asks WhatsApp, not counted. */
|
|
34
|
+
export declare function useCheckNewChat(): import("@tanstack/react-query").UseMutationResult<{
|
|
35
|
+
next: "existing";
|
|
36
|
+
phone: string;
|
|
37
|
+
chatJid: string;
|
|
38
|
+
} | {
|
|
39
|
+
next: "check";
|
|
40
|
+
phone: string;
|
|
41
|
+
} | {
|
|
42
|
+
next: "template";
|
|
43
|
+
phone: string;
|
|
44
|
+
}, Error, {
|
|
45
|
+
inboxId: number;
|
|
46
|
+
phone: string;
|
|
47
|
+
}, unknown>;
|
|
48
|
+
/** Start: checks the number on WhatsApp, or sends the first template (Business API). */
|
|
49
|
+
export declare function useStartNewChat(): import("@tanstack/react-query").UseMutationResult<{
|
|
50
|
+
chatJid: string;
|
|
51
|
+
created: boolean;
|
|
52
|
+
}, Error, {
|
|
53
|
+
inboxId: number;
|
|
54
|
+
body: NewChatBodyInput;
|
|
55
|
+
}, unknown>;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { type InfiniteData, type QueryClient } from '@tanstack/react-query';
|
|
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';
|
|
2
|
+
import { type ReportPeriod, type CreateApiTokenBodyInput, type UpdateApiTokenBody, type Chat, type ChatListResponse, type ChatStatus, type DirectoryUser, type InboxStatusPayload, type SetMemberChatsBody, type Message, type MessageListResponse, type MessageLocateResponse, type PatchUserBody, type Settings, type WaStatus } from '@ezychat/shared';
|
|
3
3
|
export interface ChatFilters {
|
|
4
4
|
status?: ChatStatus;
|
|
5
5
|
assigned: 'me' | 'none' | 'any';
|
|
@@ -26,6 +26,7 @@ export declare const qk: {
|
|
|
26
26
|
quickReplies: readonly ["quick-replies"];
|
|
27
27
|
users: readonly ["users"];
|
|
28
28
|
directory: readonly ["users", "directory"];
|
|
29
|
+
memberChats: (userId: number) => readonly ["users", number, "chats"];
|
|
29
30
|
wa: readonly ["wa"];
|
|
30
31
|
inboxes: readonly ["inboxes"];
|
|
31
32
|
tunnel: readonly ["tunnel"];
|
|
@@ -72,6 +73,8 @@ export declare function useMe(): import("@tanstack/react-query").UseQueryResult<
|
|
|
72
73
|
aiAgentId?: number | undefined;
|
|
73
74
|
aiDeleted?: boolean | undefined;
|
|
74
75
|
inboxIds?: number[] | undefined;
|
|
76
|
+
chatScope?: "all" | "chosen" | undefined;
|
|
77
|
+
chatJids?: string[] | undefined;
|
|
75
78
|
} | null, Error>;
|
|
76
79
|
export declare function useSetupStatus(): import("@tanstack/react-query").UseQueryResult<{
|
|
77
80
|
needsSetup: boolean;
|
|
@@ -96,6 +99,8 @@ export declare function useLogin(): import("@tanstack/react-query").UseMutationR
|
|
|
96
99
|
aiAgentId?: number | undefined;
|
|
97
100
|
aiDeleted?: boolean | undefined;
|
|
98
101
|
inboxIds?: number[] | undefined;
|
|
102
|
+
chatScope?: "all" | "chosen" | undefined;
|
|
103
|
+
chatJids?: string[] | undefined;
|
|
99
104
|
} | null, Error, {
|
|
100
105
|
username: string;
|
|
101
106
|
password: string;
|
|
@@ -121,6 +126,8 @@ export declare function useSetMyLocale(): import("@tanstack/react-query").UseMut
|
|
|
121
126
|
aiAgentId?: number | undefined;
|
|
122
127
|
aiDeleted?: boolean | undefined;
|
|
123
128
|
inboxIds?: number[] | undefined;
|
|
129
|
+
chatScope?: "all" | "chosen" | undefined;
|
|
130
|
+
chatJids?: string[] | undefined;
|
|
124
131
|
}, Error, "en" | "ms" | "zh-CN" | null, unknown>;
|
|
125
132
|
export declare function useChangePassword(): import("@tanstack/react-query").UseMutationResult<unknown, Error, {
|
|
126
133
|
currentPassword: string;
|
|
@@ -138,7 +145,7 @@ export declare function useChats(filters: ChatFilters, opts?: {
|
|
|
138
145
|
jid: string;
|
|
139
146
|
inboxId: number;
|
|
140
147
|
waJid: string;
|
|
141
|
-
type: "
|
|
148
|
+
type: "dm" | "group";
|
|
142
149
|
name: string;
|
|
143
150
|
avatarUrl: string | null;
|
|
144
151
|
unreadCount: number;
|
|
@@ -159,7 +166,7 @@ export declare function useChat(jid: string | null | undefined): import("@tansta
|
|
|
159
166
|
jid: string;
|
|
160
167
|
inboxId: number;
|
|
161
168
|
waJid: string;
|
|
162
|
-
type: "
|
|
169
|
+
type: "dm" | "group";
|
|
163
170
|
name: string;
|
|
164
171
|
avatarUrl: string | null;
|
|
165
172
|
unreadCount: number;
|
|
@@ -282,9 +289,13 @@ export declare function useMessages(jid: string | null | undefined): import("@ta
|
|
|
282
289
|
language: string;
|
|
283
290
|
} | null | undefined;
|
|
284
291
|
viaAssistant?: boolean | undefined;
|
|
292
|
+
scheduledTask?: {
|
|
293
|
+
id: number;
|
|
294
|
+
name: string | null;
|
|
295
|
+
} | null | undefined;
|
|
285
296
|
transcript?: string | null | undefined;
|
|
286
297
|
transcriptLang?: string | null | undefined;
|
|
287
|
-
transcriptStatus?: "pending" | "failed" | "ok" | "
|
|
298
|
+
transcriptStatus?: "pending" | "failed" | "ok" | "skipped" | "too_long" | "unsupported" | null | undefined;
|
|
288
299
|
senderProfile?: {
|
|
289
300
|
chatJid: string;
|
|
290
301
|
name: string;
|
|
@@ -307,6 +318,8 @@ export declare function useMessages(jid: string | null | undefined): import("@ta
|
|
|
307
318
|
}[];
|
|
308
319
|
nextBefore: string | null;
|
|
309
320
|
}, unknown>, Error>;
|
|
321
|
+
/** Where a quoted message sits in its chat (`found: false`: not in our records for this chat). */
|
|
322
|
+
export declare function locateMessage(jid: string, id: string): Promise<MessageLocateResponse>;
|
|
310
323
|
/** Flatten MessagesData into ascending order. */
|
|
311
324
|
export declare function flattenMessages(data: MessagesData | undefined): Message[];
|
|
312
325
|
export interface SendTextInput {
|
|
@@ -352,9 +365,13 @@ export declare function useSendText(jid: string): import("@tanstack/react-query"
|
|
|
352
365
|
language: string;
|
|
353
366
|
} | null | undefined;
|
|
354
367
|
viaAssistant?: boolean | undefined;
|
|
368
|
+
scheduledTask?: {
|
|
369
|
+
id: number;
|
|
370
|
+
name: string | null;
|
|
371
|
+
} | null | undefined;
|
|
355
372
|
transcript?: string | null | undefined;
|
|
356
373
|
transcriptLang?: string | null | undefined;
|
|
357
|
-
transcriptStatus?: "pending" | "failed" | "ok" | "
|
|
374
|
+
transcriptStatus?: "pending" | "failed" | "ok" | "skipped" | "too_long" | "unsupported" | null | undefined;
|
|
358
375
|
senderProfile?: {
|
|
359
376
|
chatJid: string;
|
|
360
377
|
name: string;
|
|
@@ -418,9 +435,13 @@ export declare function useSendMedia(jid: string): import("@tanstack/react-query
|
|
|
418
435
|
language: string;
|
|
419
436
|
} | null | undefined;
|
|
420
437
|
viaAssistant?: boolean | undefined;
|
|
438
|
+
scheduledTask?: {
|
|
439
|
+
id: number;
|
|
440
|
+
name: string | null;
|
|
441
|
+
} | null | undefined;
|
|
421
442
|
transcript?: string | null | undefined;
|
|
422
443
|
transcriptLang?: string | null | undefined;
|
|
423
|
-
transcriptStatus?: "pending" | "failed" | "ok" | "
|
|
444
|
+
transcriptStatus?: "pending" | "failed" | "ok" | "skipped" | "too_long" | "unsupported" | null | undefined;
|
|
424
445
|
senderProfile?: {
|
|
425
446
|
chatJid: string;
|
|
426
447
|
name: string;
|
|
@@ -473,9 +494,13 @@ export declare function useRetryMessage(): import("@tanstack/react-query").UseMu
|
|
|
473
494
|
language: string;
|
|
474
495
|
} | null | undefined;
|
|
475
496
|
viaAssistant?: boolean | undefined;
|
|
497
|
+
scheduledTask?: {
|
|
498
|
+
id: number;
|
|
499
|
+
name: string | null;
|
|
500
|
+
} | null | undefined;
|
|
476
501
|
transcript?: string | null | undefined;
|
|
477
502
|
transcriptLang?: string | null | undefined;
|
|
478
|
-
transcriptStatus?: "pending" | "failed" | "ok" | "
|
|
503
|
+
transcriptStatus?: "pending" | "failed" | "ok" | "skipped" | "too_long" | "unsupported" | null | undefined;
|
|
479
504
|
senderProfile?: {
|
|
480
505
|
chatJid: string;
|
|
481
506
|
name: string;
|
|
@@ -519,7 +544,7 @@ export declare function usePatchChat(jid: string): import("@tanstack/react-query
|
|
|
519
544
|
jid: string;
|
|
520
545
|
inboxId: number;
|
|
521
546
|
waJid: string;
|
|
522
|
-
type: "
|
|
547
|
+
type: "dm" | "group";
|
|
523
548
|
name: string;
|
|
524
549
|
avatarUrl: string | null;
|
|
525
550
|
unreadCount: number;
|
|
@@ -671,6 +696,8 @@ export declare function useUsers(opts?: {
|
|
|
671
696
|
aiAgentId?: number | undefined;
|
|
672
697
|
aiDeleted?: boolean | undefined;
|
|
673
698
|
inboxIds?: number[] | undefined;
|
|
699
|
+
chatScope?: "all" | "chosen" | undefined;
|
|
700
|
+
chatJids?: string[] | undefined;
|
|
674
701
|
}[], Error>;
|
|
675
702
|
/** Public team-member fields every logged-in user may see (`GET /api/users/directory`). */
|
|
676
703
|
export type { DirectoryUser };
|
|
@@ -692,6 +719,7 @@ export declare function useUserDirectory(opts?: {
|
|
|
692
719
|
aiAgentId?: number | undefined;
|
|
693
720
|
aiDeleted?: boolean | undefined;
|
|
694
721
|
aiNoDirect?: boolean | undefined;
|
|
722
|
+
chatJids?: string[] | undefined;
|
|
695
723
|
}[], Error>;
|
|
696
724
|
export declare function useCreateUser(): import("@tanstack/react-query").UseMutationResult<{
|
|
697
725
|
id: number;
|
|
@@ -707,6 +735,8 @@ export declare function useCreateUser(): import("@tanstack/react-query").UseMuta
|
|
|
707
735
|
aiAgentId?: number | undefined;
|
|
708
736
|
aiDeleted?: boolean | undefined;
|
|
709
737
|
inboxIds?: number[] | undefined;
|
|
738
|
+
chatScope?: "all" | "chosen" | undefined;
|
|
739
|
+
chatJids?: string[] | undefined;
|
|
710
740
|
}, Error, {
|
|
711
741
|
username: string;
|
|
712
742
|
displayName: string;
|
|
@@ -727,10 +757,35 @@ export declare function usePatchUser(): import("@tanstack/react-query").UseMutat
|
|
|
727
757
|
aiAgentId?: number | undefined;
|
|
728
758
|
aiDeleted?: boolean | undefined;
|
|
729
759
|
inboxIds?: number[] | undefined;
|
|
760
|
+
chatScope?: "all" | "chosen" | undefined;
|
|
761
|
+
chatJids?: string[] | undefined;
|
|
730
762
|
}, Error, {
|
|
731
763
|
id: number;
|
|
732
764
|
patch: PatchUserBody;
|
|
733
765
|
}, unknown>;
|
|
766
|
+
/** Admins: an agent's "Chats this member can see" (`GET /api/users/:id/chats`). */
|
|
767
|
+
export declare function useMemberChats(userId: number, opts?: {
|
|
768
|
+
enabled?: boolean;
|
|
769
|
+
}): import("@tanstack/react-query").UseQueryResult<{
|
|
770
|
+
scope: "all" | "chosen";
|
|
771
|
+
chats: {
|
|
772
|
+
jid: string;
|
|
773
|
+
name: string;
|
|
774
|
+
type: "dm" | "group";
|
|
775
|
+
}[];
|
|
776
|
+
}, Error>;
|
|
777
|
+
/** Admins: replaces it (`PUT /api/users/:id/chats`); the members list and assign dropdowns follow. */
|
|
778
|
+
export declare function useSetMemberChats(): import("@tanstack/react-query").UseMutationResult<{
|
|
779
|
+
scope: "all" | "chosen";
|
|
780
|
+
chats: {
|
|
781
|
+
jid: string;
|
|
782
|
+
name: string;
|
|
783
|
+
type: "dm" | "group";
|
|
784
|
+
}[];
|
|
785
|
+
}, Error, {
|
|
786
|
+
userId: number;
|
|
787
|
+
body: SetMemberChatsBody;
|
|
788
|
+
}, unknown>;
|
|
734
789
|
export declare function useResetPassword(): import("@tanstack/react-query").UseMutationResult<{
|
|
735
790
|
password: string;
|
|
736
791
|
}, Error, number, unknown>;
|
|
@@ -0,0 +1,145 @@
|
|
|
1
|
+
import { type ScheduledTaskPatch } from '@ezychat/shared';
|
|
2
|
+
/**
|
|
3
|
+
* Scheduled tasks of one AI agent (design docs/features/scheduled-tasks/design.md, admins only):
|
|
4
|
+
* the list with the pause reason, the limit and the business time zone, and its changes. Every
|
|
5
|
+
* change reads the list again, so the next run and the last result come from the server.
|
|
6
|
+
*/
|
|
7
|
+
export declare const scheduledTasksKey: (agentId: number) => readonly ["scheduled-tasks", number];
|
|
8
|
+
export declare const scheduledRunsKey: (agentId: number, taskId: number) => readonly ["scheduled-tasks", number, "runs", number];
|
|
9
|
+
/** Read again every minute: the next run, the last result and the pause move by themselves. */
|
|
10
|
+
export declare const SCHEDULED_REFETCH_MS = 60000;
|
|
11
|
+
export declare function useScheduledTasks(agentId: number): import("@tanstack/react-query").UseQueryResult<{
|
|
12
|
+
tasks: {
|
|
13
|
+
chat: {
|
|
14
|
+
jid: string;
|
|
15
|
+
name: string;
|
|
16
|
+
type: "dm" | "group";
|
|
17
|
+
} | null;
|
|
18
|
+
nextRunAt: number | null;
|
|
19
|
+
lastRun: {
|
|
20
|
+
id: number;
|
|
21
|
+
at: number;
|
|
22
|
+
trigger: "schedule" | "run_now";
|
|
23
|
+
byUserName: string | null;
|
|
24
|
+
result: "failed" | "sent" | "skipped" | null;
|
|
25
|
+
reason: "window_closed" | "confidential_leak" | "ai_unavailable" | "lookup_failed" | "agent_off" | "ai_disconnected" | "wa_disconnected" | "access_closed" | "nothing_to_say" | "needs_team" | "missed" | "chat_gone" | "send_failed" | "interrupted" | null;
|
|
26
|
+
messageId: string | null;
|
|
27
|
+
} | null;
|
|
28
|
+
name: string;
|
|
29
|
+
enabled: boolean;
|
|
30
|
+
time: string;
|
|
31
|
+
dayRule: "custom" | "daily" | "weekdays";
|
|
32
|
+
days: number[];
|
|
33
|
+
chatJid: string;
|
|
34
|
+
instruction: string;
|
|
35
|
+
id: number;
|
|
36
|
+
agentId: number;
|
|
37
|
+
}[];
|
|
38
|
+
max: number;
|
|
39
|
+
paused: "agent_off" | "ai_disconnected" | "wa_disconnected" | "access_closed" | null;
|
|
40
|
+
timeZone: string;
|
|
41
|
+
inboxId: number | null;
|
|
42
|
+
}, Error>;
|
|
43
|
+
/** Adds a task (409 `scheduled_task_limit`, 400 `chat_not_in_inbox`). */
|
|
44
|
+
export declare function useCreateScheduledTask(agentId: number): import("@tanstack/react-query").UseMutationResult<{
|
|
45
|
+
chat: {
|
|
46
|
+
jid: string;
|
|
47
|
+
name: string;
|
|
48
|
+
type: "dm" | "group";
|
|
49
|
+
} | null;
|
|
50
|
+
nextRunAt: number | null;
|
|
51
|
+
lastRun: {
|
|
52
|
+
id: number;
|
|
53
|
+
at: number;
|
|
54
|
+
trigger: "schedule" | "run_now";
|
|
55
|
+
byUserName: string | null;
|
|
56
|
+
result: "failed" | "sent" | "skipped" | null;
|
|
57
|
+
reason: "window_closed" | "confidential_leak" | "ai_unavailable" | "lookup_failed" | "agent_off" | "ai_disconnected" | "wa_disconnected" | "access_closed" | "nothing_to_say" | "needs_team" | "missed" | "chat_gone" | "send_failed" | "interrupted" | null;
|
|
58
|
+
messageId: string | null;
|
|
59
|
+
} | null;
|
|
60
|
+
name: string;
|
|
61
|
+
enabled: boolean;
|
|
62
|
+
time: string;
|
|
63
|
+
dayRule: "custom" | "daily" | "weekdays";
|
|
64
|
+
days: number[];
|
|
65
|
+
chatJid: string;
|
|
66
|
+
instruction: string;
|
|
67
|
+
id: number;
|
|
68
|
+
agentId: number;
|
|
69
|
+
}, Error, {
|
|
70
|
+
name: string;
|
|
71
|
+
time: string;
|
|
72
|
+
dayRule: "custom" | "daily" | "weekdays";
|
|
73
|
+
chatJid: string;
|
|
74
|
+
instruction: string;
|
|
75
|
+
enabled?: boolean | undefined;
|
|
76
|
+
days?: number[] | undefined;
|
|
77
|
+
}, unknown>;
|
|
78
|
+
/** Changes a task; the row's on/off switch sends `{ enabled }` only. */
|
|
79
|
+
export declare function useUpdateScheduledTask(agentId: number): import("@tanstack/react-query").UseMutationResult<{
|
|
80
|
+
chat: {
|
|
81
|
+
jid: string;
|
|
82
|
+
name: string;
|
|
83
|
+
type: "dm" | "group";
|
|
84
|
+
} | null;
|
|
85
|
+
nextRunAt: number | null;
|
|
86
|
+
lastRun: {
|
|
87
|
+
id: number;
|
|
88
|
+
at: number;
|
|
89
|
+
trigger: "schedule" | "run_now";
|
|
90
|
+
byUserName: string | null;
|
|
91
|
+
result: "failed" | "sent" | "skipped" | null;
|
|
92
|
+
reason: "window_closed" | "confidential_leak" | "ai_unavailable" | "lookup_failed" | "agent_off" | "ai_disconnected" | "wa_disconnected" | "access_closed" | "nothing_to_say" | "needs_team" | "missed" | "chat_gone" | "send_failed" | "interrupted" | null;
|
|
93
|
+
messageId: string | null;
|
|
94
|
+
} | null;
|
|
95
|
+
name: string;
|
|
96
|
+
enabled: boolean;
|
|
97
|
+
time: string;
|
|
98
|
+
dayRule: "custom" | "daily" | "weekdays";
|
|
99
|
+
days: number[];
|
|
100
|
+
chatJid: string;
|
|
101
|
+
instruction: string;
|
|
102
|
+
id: number;
|
|
103
|
+
agentId: number;
|
|
104
|
+
}, Error, {
|
|
105
|
+
taskId: number;
|
|
106
|
+
patch: ScheduledTaskPatch;
|
|
107
|
+
}, unknown>;
|
|
108
|
+
export declare function useDeleteScheduledTask(agentId: number): import("@tanstack/react-query").UseMutationResult<unknown, Error, number, unknown>;
|
|
109
|
+
/** The task's last runs, newest first. */
|
|
110
|
+
export declare function useScheduledRuns(agentId: number, taskId: number): import("@tanstack/react-query").UseQueryResult<{
|
|
111
|
+
runs: {
|
|
112
|
+
id: number;
|
|
113
|
+
at: number;
|
|
114
|
+
trigger: "schedule" | "run_now";
|
|
115
|
+
byUserName: string | null;
|
|
116
|
+
result: "failed" | "sent" | "skipped" | null;
|
|
117
|
+
reason: "window_closed" | "confidential_leak" | "ai_unavailable" | "lookup_failed" | "agent_off" | "ai_disconnected" | "wa_disconnected" | "access_closed" | "nothing_to_say" | "needs_team" | "missed" | "chat_gone" | "send_failed" | "interrupted" | null;
|
|
118
|
+
messageId: string | null;
|
|
119
|
+
}[];
|
|
120
|
+
}, Error>;
|
|
121
|
+
/** Run now (429 `rate_limited`, 409 `scheduled_paused`): answers the run as recorded. */
|
|
122
|
+
export declare function useRunScheduledTask(agentId: number): import("@tanstack/react-query").UseMutationResult<{
|
|
123
|
+
run: {
|
|
124
|
+
id: number;
|
|
125
|
+
at: number;
|
|
126
|
+
trigger: "schedule" | "run_now";
|
|
127
|
+
byUserName: string | null;
|
|
128
|
+
result: "failed" | "sent" | "skipped" | null;
|
|
129
|
+
reason: "window_closed" | "confidential_leak" | "ai_unavailable" | "lookup_failed" | "agent_off" | "ai_disconnected" | "wa_disconnected" | "access_closed" | "nothing_to_say" | "needs_team" | "missed" | "chat_gone" | "send_failed" | "interrupted" | null;
|
|
130
|
+
messageId: string | null;
|
|
131
|
+
};
|
|
132
|
+
}, Error, number, unknown>;
|
|
133
|
+
/** Preview: one turn, nothing sent or stored. */
|
|
134
|
+
export declare function usePreviewScheduledTask(agentId: number): import("@tanstack/react-query").UseMutationResult<{
|
|
135
|
+
result: "sent" | "skipped";
|
|
136
|
+
text: string | null;
|
|
137
|
+
reason: "window_closed" | "confidential_leak" | "ai_unavailable" | "lookup_failed" | "agent_off" | "ai_disconnected" | "wa_disconnected" | "access_closed" | "nothing_to_say" | "needs_team" | "missed" | "chat_gone" | "send_failed" | "interrupted" | null;
|
|
138
|
+
lookups: {
|
|
139
|
+
title: string;
|
|
140
|
+
sourceLabel: string;
|
|
141
|
+
}[];
|
|
142
|
+
}, Error, {
|
|
143
|
+
chatJid: string;
|
|
144
|
+
instruction: string;
|
|
145
|
+
}, unknown>;
|
|
@@ -0,0 +1,105 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Admin → Connectors → SQL Account (admins only; design docs/features/sql-accounting/design.md).
|
|
3
|
+
* The keys never reach the browser: the server answers with the address and the key end only.
|
|
4
|
+
*/
|
|
5
|
+
export declare const sqlAccountKey: readonly ["connectors", "sql-account"];
|
|
6
|
+
export declare const sqlAgentKey: (agentId: number) => readonly ["connectors", "sql-account", "agent", number];
|
|
7
|
+
export declare const sqlCustomersKey: readonly ["connectors", "sql-account", "customers"];
|
|
8
|
+
export declare const sqlActivityKey: readonly ["connectors", "sql-account", "activity"];
|
|
9
|
+
export declare const sqlDebtorsKey: (q: string) => readonly ["connectors", "sql-account", "debtors", string];
|
|
10
|
+
export declare function useSqlAccount(enabled?: boolean): import("@tanstack/react-query").UseQueryResult<{
|
|
11
|
+
state: "connected" | "disconnected" | "unreachable" | "no_dns" | "private_ip" | "bad_keys" | "old_version" | "unexpected";
|
|
12
|
+
host: string | null;
|
|
13
|
+
keyEnd: string | null;
|
|
14
|
+
checkedAt: number | null;
|
|
15
|
+
matchByPhone: boolean;
|
|
16
|
+
phoneMatch: "unavailable" | "unknown" | "available" | "building";
|
|
17
|
+
}, Error>;
|
|
18
|
+
/** Checks the keys with SQL Account; they are saved only when SQL Account answered. */
|
|
19
|
+
export declare function useSqlConnect(): import("@tanstack/react-query").UseMutationResult<{
|
|
20
|
+
ok: boolean;
|
|
21
|
+
error: "connected" | "disconnected" | "unreachable" | "no_dns" | "private_ip" | "bad_keys" | "old_version" | "unexpected" | "key_format" | null;
|
|
22
|
+
status: {
|
|
23
|
+
state: "connected" | "disconnected" | "unreachable" | "no_dns" | "private_ip" | "bad_keys" | "old_version" | "unexpected";
|
|
24
|
+
host: string | null;
|
|
25
|
+
keyEnd: string | null;
|
|
26
|
+
checkedAt: number | null;
|
|
27
|
+
matchByPhone: boolean;
|
|
28
|
+
phoneMatch: "unavailable" | "unknown" | "available" | "building";
|
|
29
|
+
};
|
|
30
|
+
}, Error, {
|
|
31
|
+
accessKey: string;
|
|
32
|
+
secretKey: string;
|
|
33
|
+
}, unknown>;
|
|
34
|
+
/** Sends one check to SQL Account and answers the connection's state now. */
|
|
35
|
+
export declare function useSqlTest(): import("@tanstack/react-query").UseMutationResult<{
|
|
36
|
+
state: "connected" | "disconnected" | "unreachable" | "no_dns" | "private_ip" | "bad_keys" | "old_version" | "unexpected";
|
|
37
|
+
host: string | null;
|
|
38
|
+
keyEnd: string | null;
|
|
39
|
+
checkedAt: number | null;
|
|
40
|
+
matchByPhone: boolean;
|
|
41
|
+
phoneMatch: "unavailable" | "unknown" | "available" | "building";
|
|
42
|
+
}, Error, void, unknown>;
|
|
43
|
+
/** Deletes the keys from this computer (nothing changes in SQL Account). */
|
|
44
|
+
export declare function useSqlDisconnect(): import("@tanstack/react-query").UseMutationResult<{
|
|
45
|
+
state: "connected" | "disconnected" | "unreachable" | "no_dns" | "private_ip" | "bad_keys" | "old_version" | "unexpected";
|
|
46
|
+
host: string | null;
|
|
47
|
+
keyEnd: string | null;
|
|
48
|
+
checkedAt: number | null;
|
|
49
|
+
matchByPhone: boolean;
|
|
50
|
+
phoneMatch: "unavailable" | "unknown" | "available" | "building";
|
|
51
|
+
}, Error, void, unknown>;
|
|
52
|
+
/** "Match by phone number" (install-wide). */
|
|
53
|
+
export declare function useSqlMatch(): import("@tanstack/react-query").UseMutationResult<{
|
|
54
|
+
state: "connected" | "disconnected" | "unreachable" | "no_dns" | "private_ip" | "bad_keys" | "old_version" | "unexpected";
|
|
55
|
+
host: string | null;
|
|
56
|
+
keyEnd: string | null;
|
|
57
|
+
checkedAt: number | null;
|
|
58
|
+
matchByPhone: boolean;
|
|
59
|
+
phoneMatch: "unavailable" | "unknown" | "available" | "building";
|
|
60
|
+
}, Error, boolean, unknown>;
|
|
61
|
+
/** One AI agent's access per SQL Account object (the defaults until an admin saves them). */
|
|
62
|
+
export declare function useSqlAgentSettings(agentId: number | null, enabled?: boolean): import("@tanstack/react-query").UseQueryResult<{
|
|
63
|
+
access: Partial<Record<"customer" | "stockitem" | "customerinvoice" | "salesinvoice" | "salesquotation" | "salesorder" | "deliveryorder" | "customerpayment", "off" | "read" | "create">>;
|
|
64
|
+
showPrice: boolean;
|
|
65
|
+
stockDetail: "inStock" | "quantity";
|
|
66
|
+
}, Error>;
|
|
67
|
+
export declare function useSaveSqlAgentSettings(agentId: number): import("@tanstack/react-query").UseMutationResult<{
|
|
68
|
+
access: Partial<Record<"customer" | "stockitem" | "customerinvoice" | "salesinvoice" | "salesquotation" | "salesorder" | "deliveryorder" | "customerpayment", "off" | "read" | "create">>;
|
|
69
|
+
showPrice: boolean;
|
|
70
|
+
stockDetail: "inStock" | "quantity";
|
|
71
|
+
}, Error, {
|
|
72
|
+
access: Partial<Record<"customer" | "stockitem" | "customerinvoice" | "salesinvoice" | "salesquotation" | "salesorder" | "deliveryorder" | "customerpayment", "off" | "read" | "create">>;
|
|
73
|
+
showPrice: boolean;
|
|
74
|
+
stockDetail: "inStock" | "quantity";
|
|
75
|
+
}, unknown>;
|
|
76
|
+
/** Customers tab: direct chats and the SQL Account customer each is matched to. */
|
|
77
|
+
export declare function useSqlCustomers(enabled?: boolean): import("@tanstack/react-query").UseQueryResult<{
|
|
78
|
+
jid: string;
|
|
79
|
+
name: string;
|
|
80
|
+
kind: "phone" | "none" | "linked" | "several";
|
|
81
|
+
code: string | null;
|
|
82
|
+
sqlName: string | null;
|
|
83
|
+
}[], Error>;
|
|
84
|
+
/** SQL Account customers for the Link dialog (503 `sql_unavailable` while not connected). */
|
|
85
|
+
export declare function useSqlDebtors(q: string, enabled?: boolean): import("@tanstack/react-query").UseQueryResult<{
|
|
86
|
+
code: string;
|
|
87
|
+
name: string;
|
|
88
|
+
}[], Error>;
|
|
89
|
+
/** Links a chat to a customer code (checked with SQL Account; 400 `unknown_code`), or unlinks it. */
|
|
90
|
+
export declare function useSqlLink(): import("@tanstack/react-query").UseMutationResult<unknown, Error, {
|
|
91
|
+
jid: string;
|
|
92
|
+
code: string | null;
|
|
93
|
+
}, unknown>;
|
|
94
|
+
export declare function useSqlActivity(enabled?: boolean): import("@tanstack/react-query").UseQueryResult<{
|
|
95
|
+
id: number;
|
|
96
|
+
at: number;
|
|
97
|
+
agentId: number | null;
|
|
98
|
+
agentName: string | null;
|
|
99
|
+
chatJid: string | null;
|
|
100
|
+
chatName: string | null;
|
|
101
|
+
tool: "document" | "account" | "payments" | "stock" | "quotation";
|
|
102
|
+
result: "failed" | "done" | "refused";
|
|
103
|
+
reason: string | null;
|
|
104
|
+
dockey: number | null;
|
|
105
|
+
}[], Error>;
|
|
@@ -60,9 +60,13 @@ export declare function useSendTemplate(jid: string): import("@tanstack/react-qu
|
|
|
60
60
|
language: string;
|
|
61
61
|
} | null | undefined;
|
|
62
62
|
viaAssistant?: boolean | undefined;
|
|
63
|
+
scheduledTask?: {
|
|
64
|
+
id: number;
|
|
65
|
+
name: string | null;
|
|
66
|
+
} | null | undefined;
|
|
63
67
|
transcript?: string | null | undefined;
|
|
64
68
|
transcriptLang?: string | null | undefined;
|
|
65
|
-
transcriptStatus?: "pending" | "failed" | "ok" | "
|
|
69
|
+
transcriptStatus?: "pending" | "failed" | "ok" | "skipped" | "too_long" | "unsupported" | null | undefined;
|
|
66
70
|
senderProfile?: {
|
|
67
71
|
chatJid: string;
|
|
68
72
|
name: string;
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import type { User } from '@ezychat/shared';
|
|
2
|
+
/**
|
|
3
|
+
* An agent limited to chosen chats (`User.chatScope === 'chosen'`): no Ask Ezy (it reads across
|
|
4
|
+
* chats) and no chat opened or started from a group member. The server refuses both anyway.
|
|
5
|
+
*/
|
|
6
|
+
export declare function chosenChatsOnly(user: Pick<User, 'role' | 'chatScope'> | null | undefined): boolean;
|
|
7
|
+
export declare function useChosenChatsOnly(): boolean;
|