@ezychat/web 0.0.0-stage → 0.1.39

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 (186) hide show
  1. package/dist-lib/assets/font-1be3448e292f.woff2 +0 -0
  2. package/dist-lib/assets/font-3100e775e861.woff2 +0 -0
  3. package/dist-lib/assets/font-34b9c504cab7.woff2 +0 -0
  4. package/dist-lib/assets/font-5c66f9e07e90.woff2 +0 -0
  5. package/dist-lib/assets/font-6e9e020a25f9.woff2 +0 -0
  6. package/dist-lib/assets/font-71d5ee93cc1e.woff2 +0 -0
  7. package/dist-lib/assets/font-ca157063339a.woff2 +0 -0
  8. package/dist-lib/chunks/admin-BPgvUcQO.js +602 -0
  9. package/dist-lib/chunks/admin-B_hIZ1Sp.js +603 -0
  10. package/dist-lib/chunks/app-C2A7ZZsu.js +97 -0
  11. package/dist-lib/chunks/app-RX8Fy2Oz.js +97 -0
  12. package/dist-lib/chunks/auth-Cif_yktU.js +127 -0
  13. package/dist-lib/chunks/auth-DJBQd10l.js +127 -0
  14. package/dist-lib/chunks/common-BwLWsyiW.js +80 -0
  15. package/dist-lib/chunks/common-CDytP7HK.js +80 -0
  16. package/dist-lib/chunks/errors-BIyy5VTn.js +39 -0
  17. package/dist-lib/chunks/errors-CEweqDjm.js +39 -0
  18. package/dist-lib/chunks/inbox-IiNeuwOm.js +487 -0
  19. package/dist-lib/chunks/inbox-VvClcCZP.js +487 -0
  20. package/dist-lib/chunks/registerSW-Gn8zt2XY.js +16 -0
  21. package/dist-lib/ezychat-web.css +2 -0
  22. package/dist-lib/index.js +16732 -0
  23. package/dist-lib/public/apple-touch-icon.png +0 -0
  24. package/dist-lib/public/brand/ezychat-logo.png +0 -0
  25. package/dist-lib/public/favicon.ico +0 -0
  26. package/dist-lib/public/icon-192.png +0 -0
  27. package/dist-lib/public/icon-512.png +0 -0
  28. package/dist-lib/public/icon-maskable-512.png +0 -0
  29. package/dist-lib/public/illustrations/empty-inbox.png +0 -0
  30. package/dist-lib/public/illustrations/link-whatsapp.png +0 -0
  31. package/dist-lib/public/illustrations/no-results.png +0 -0
  32. package/dist-lib/public/illustrations/tunnel.png +0 -0
  33. package/dist-lib/public/illustrations/welcome.png +0 -0
  34. package/dist-lib/public/share-app.svg +16 -0
  35. package/dist-lib/sw.ts +71 -0
  36. package/dist-lib/types/App.d.ts +2 -0
  37. package/dist-lib/types/access/AccessGate.d.ts +24 -0
  38. package/dist-lib/types/access/BannerSlot.d.ts +35 -0
  39. package/dist-lib/types/access/events.d.ts +16 -0
  40. package/dist-lib/types/admin/AdminLayout.d.ts +36 -0
  41. package/dist-lib/types/admin/AiConnectionBanner.d.ts +7 -0
  42. package/dist-lib/types/admin/AiConnectionSection.d.ts +3 -0
  43. package/dist-lib/types/admin/AiContextPanel.d.ts +11 -0
  44. package/dist-lib/types/admin/AiEditDialog.d.ts +13 -0
  45. package/dist-lib/types/admin/AiMemberPage.d.ts +1 -0
  46. package/dist-lib/types/admin/AiQuickConnect.d.ts +22 -0
  47. package/dist-lib/types/admin/AiTryIt.d.ts +8 -0
  48. package/dist-lib/types/admin/AiVoiceSection.d.ts +2 -0
  49. package/dist-lib/types/admin/AuditPage.d.ts +1 -0
  50. package/dist-lib/types/admin/CloudflareSetup.d.ts +5 -0
  51. package/dist-lib/types/admin/CreateTokenDialog.d.ts +13 -0
  52. package/dist-lib/types/admin/CustomerEnrichmentSection.d.ts +1 -0
  53. package/dist-lib/types/admin/EnrichmentAuditScore.d.ts +4 -0
  54. package/dist-lib/types/admin/IntegrationsSection.d.ts +7 -0
  55. package/dist-lib/types/admin/MembersPage.d.ts +2 -0
  56. package/dist-lib/types/admin/QuickRepliesPage.d.ts +2 -0
  57. package/dist-lib/types/admin/ResolveAllChatsCard.d.ts +1 -0
  58. package/dist-lib/types/admin/SettingsPage.d.ts +2 -0
  59. package/dist-lib/types/admin/TokenConnectSteps.d.ts +12 -0
  60. package/dist-lib/types/admin/TunnelPage.d.ts +1 -0
  61. package/dist-lib/types/admin/WhatsAppPage.d.ts +11 -0
  62. package/dist-lib/types/admin/adminUi.d.ts +62 -0
  63. package/dist-lib/types/admin/ai-status.d.ts +12 -0
  64. package/dist-lib/types/admin/audit-actions.d.ts +10 -0
  65. package/dist-lib/types/admin/line-diff.d.ts +26 -0
  66. package/dist-lib/types/admin/use-chatgpt-sign-in.d.ts +14 -0
  67. package/dist-lib/types/api/ai.d.ts +174 -0
  68. package/dist-lib/types/api/client.d.ts +22 -0
  69. package/dist-lib/types/api/enrichment.d.ts +8 -0
  70. package/dist-lib/types/api/queries.d.ts +664 -0
  71. package/dist-lib/types/api/resume-reconnect.d.ts +15 -0
  72. package/dist-lib/types/api/socket.d.ts +19 -0
  73. package/dist-lib/types/api/voice.d.ts +33 -0
  74. package/dist-lib/types/auth/AuthProvider.d.ts +15 -0
  75. package/dist-lib/types/auth/AuthShell.d.ts +28 -0
  76. package/dist-lib/types/auth/ChangePasswordPage.d.ts +2 -0
  77. package/dist-lib/types/auth/LoginPage.d.ts +2 -0
  78. package/dist-lib/types/auth/RequireAuth.d.ts +12 -0
  79. package/dist-lib/types/auth/UserMenu.d.ts +5 -0
  80. package/dist-lib/types/components/app/AboutDialog.d.ts +7 -0
  81. package/dist-lib/types/components/app/AppCredits.d.ts +8 -0
  82. package/dist-lib/types/components/app/DesktopUpdates.d.ts +3 -0
  83. package/dist-lib/types/components/app/DevBuildBadge.d.ts +5 -0
  84. package/dist-lib/types/components/app/ErrorBoundary.d.ts +23 -0
  85. package/dist-lib/types/components/app/FeatureRequestAction.d.ts +7 -0
  86. package/dist-lib/types/components/app/SearchField.d.ts +7 -0
  87. package/dist-lib/types/components/app/SegmentedControl.d.ts +19 -0
  88. package/dist-lib/types/components/app/ShareAppAction.d.ts +5 -0
  89. package/dist-lib/types/components/app/index.d.ts +81 -0
  90. package/dist-lib/types/components/ui/alert-dialog.d.ts +18 -0
  91. package/dist-lib/types/components/ui/avatar.d.ts +11 -0
  92. package/dist-lib/types/components/ui/badge.d.ts +9 -0
  93. package/dist-lib/types/components/ui/button.d.ts +10 -0
  94. package/dist-lib/types/components/ui/card.d.ts +9 -0
  95. package/dist-lib/types/components/ui/checkbox.d.ts +4 -0
  96. package/dist-lib/types/components/ui/command.d.ts +18 -0
  97. package/dist-lib/types/components/ui/dialog.d.ts +17 -0
  98. package/dist-lib/types/components/ui/drawer.d.ts +13 -0
  99. package/dist-lib/types/components/ui/dropdown-menu.d.ts +25 -0
  100. package/dist-lib/types/components/ui/input.d.ts +3 -0
  101. package/dist-lib/types/components/ui/label.d.ts +4 -0
  102. package/dist-lib/types/components/ui/popover.d.ts +10 -0
  103. package/dist-lib/types/components/ui/progress.d.ts +4 -0
  104. package/dist-lib/types/components/ui/radio-group.d.ts +5 -0
  105. package/dist-lib/types/components/ui/scroll-area.d.ts +5 -0
  106. package/dist-lib/types/components/ui/select.d.ts +15 -0
  107. package/dist-lib/types/components/ui/separator.d.ts +4 -0
  108. package/dist-lib/types/components/ui/sheet.d.ts +14 -0
  109. package/dist-lib/types/components/ui/skeleton.d.ts +2 -0
  110. package/dist-lib/types/components/ui/sonner.d.ts +4 -0
  111. package/dist-lib/types/components/ui/switch.d.ts +6 -0
  112. package/dist-lib/types/components/ui/table.d.ts +10 -0
  113. package/dist-lib/types/components/ui/tabs.d.ts +11 -0
  114. package/dist-lib/types/components/ui/textarea.d.ts +3 -0
  115. package/dist-lib/types/components/ui/tooltip.d.ts +7 -0
  116. package/dist-lib/types/create-app.d.ts +20 -0
  117. package/dist-lib/types/extensions/context.d.ts +8 -0
  118. package/dist-lib/types/extensions/i18n.d.ts +15 -0
  119. package/dist-lib/types/extensions/index.d.ts +4 -0
  120. package/dist-lib/types/extensions/routes.d.ts +12 -0
  121. package/dist-lib/types/extensions/types.d.ts +116 -0
  122. package/dist-lib/types/i18n/LanguageSelect.d.ts +4 -0
  123. package/dist-lib/types/i18n/LocaleSync.d.ts +2 -0
  124. package/dist-lib/types/i18n/date-locale.d.ts +5 -0
  125. package/dist-lib/types/i18n/index.d.ts +17 -0
  126. package/dist-lib/types/i18n/locale-store.d.ts +26 -0
  127. package/dist-lib/types/i18n/resources.d.ts +1711 -0
  128. package/dist-lib/types/i18n/use-change-locale.d.ts +9 -0
  129. package/dist-lib/types/inbox/ChatAvatar.d.ts +13 -0
  130. package/dist-lib/types/inbox/ChatFilters.d.ts +6 -0
  131. package/dist-lib/types/inbox/ChatList.d.ts +9 -0
  132. package/dist-lib/types/inbox/ChatListItem.d.ts +13 -0
  133. package/dist-lib/types/inbox/Composer.d.ts +30 -0
  134. package/dist-lib/types/inbox/Conversation.d.ts +7 -0
  135. package/dist-lib/types/inbox/ConversationHeader.d.ts +25 -0
  136. package/dist-lib/types/inbox/CustomerPanel.d.ts +32 -0
  137. package/dist-lib/types/inbox/EmojiPicker.d.ts +6 -0
  138. package/dist-lib/types/inbox/EventItem.d.ts +14 -0
  139. package/dist-lib/types/inbox/GettingStartedCard.d.ts +10 -0
  140. package/dist-lib/types/inbox/GroupPanel.d.ts +19 -0
  141. package/dist-lib/types/inbox/InboxPage.d.ts +2 -0
  142. package/dist-lib/types/inbox/MediaView.d.ts +8 -0
  143. package/dist-lib/types/inbox/MessageBubble.d.ts +31 -0
  144. package/dist-lib/types/inbox/MessageList.d.ts +21 -0
  145. package/dist-lib/types/inbox/NotesPanel.d.ts +15 -0
  146. package/dist-lib/types/inbox/PanelHeader.d.ts +13 -0
  147. package/dist-lib/types/inbox/ProfileImageContext.d.ts +5 -0
  148. package/dist-lib/types/inbox/QuickReplyPicker.d.ts +18 -0
  149. package/dist-lib/types/inbox/ReconnectBanner.d.ts +8 -0
  150. package/dist-lib/types/inbox/TagInput.d.ts +14 -0
  151. package/dist-lib/types/inbox/TypingIndicator.d.ts +6 -0
  152. package/dist-lib/types/inbox/VoiceNote.d.ts +36 -0
  153. package/dist-lib/types/inbox/WaBanner.d.ts +9 -0
  154. package/dist-lib/types/inbox/chat-title.d.ts +4 -0
  155. package/dist-lib/types/inbox/navigation-guard.d.ts +17 -0
  156. package/dist-lib/types/inbox/timeline.d.ts +26 -0
  157. package/dist-lib/types/inbox/useCanonicalChatRedirect.d.ts +2 -0
  158. package/dist-lib/types/inbox/useDirectory.d.ts +21 -0
  159. package/dist-lib/types/inbox/useSwipeReply.d.ts +11 -0
  160. package/dist-lib/types/index.d.ts +43 -0
  161. package/dist-lib/types/lib/ai-handoff.d.ts +4 -0
  162. package/dist-lib/types/lib/app-links.d.ts +9 -0
  163. package/dist-lib/types/lib/desktop-updates.d.ts +15 -0
  164. package/dist-lib/types/lib/error-reporter.d.ts +6 -0
  165. package/dist-lib/types/lib/format.d.ts +20 -0
  166. package/dist-lib/types/lib/jid.d.ts +15 -0
  167. package/dist-lib/types/lib/links.d.ts +40 -0
  168. package/dist-lib/types/lib/share-app.d.ts +18 -0
  169. package/dist-lib/types/lib/theme.d.ts +29 -0
  170. package/dist-lib/types/lib/use-media-query.d.ts +2 -0
  171. package/dist-lib/types/lib/utils.d.ts +2 -0
  172. package/dist-lib/types/lib/version.d.ts +12 -0
  173. package/dist-lib/types/lib/voice-recorder.d.ts +26 -0
  174. package/dist-lib/types/pwa/InstallHint.d.ts +9 -0
  175. package/dist-lib/types/pwa/PushToggle.d.ts +20 -0
  176. package/dist-lib/types/pwa/desktop-notifications.d.ts +18 -0
  177. package/dist-lib/types/pwa/push.d.ts +13 -0
  178. package/dist-lib/types/setup/AiAssistantStep.d.ts +9 -0
  179. package/dist-lib/types/setup/SetupWizard.d.ts +3 -0
  180. package/dist-lib/types/setup/WaLinkStep.d.ts +8 -0
  181. package/dist-lib/types/setup/agent-name.d.ts +8 -0
  182. package/dist-lib/types/setup/connected-label.d.ts +7 -0
  183. package/dist-lib/types/setup/username.d.ts +9 -0
  184. package/dist-lib/types/wa/PhoneLink.d.ts +4 -0
  185. package/package.json +81 -4
  186. package/README.md +0 -3
@@ -0,0 +1,664 @@
1
+ import { type InfiniteData, type QueryClient } from '@tanstack/react-query';
2
+ import { type CreateApiTokenBodyInput, type Chat, type ChatListResponse, type ChatStatus, type Message, type MessageListResponse, type PatchUserBody, type Settings, type User } from '@ezychat/shared';
3
+ export interface ChatFilters {
4
+ status?: ChatStatus;
5
+ assigned: 'me' | 'none' | 'any';
6
+ q?: string;
7
+ /** customer tag filter */
8
+ tag?: string;
9
+ }
10
+ export declare const qk: {
11
+ me: readonly ["me"];
12
+ setupStatus: readonly ["setup-status"];
13
+ chats: (f: ChatFilters) => readonly ["chats", ChatFilters];
14
+ chatsAll: readonly ["chats"];
15
+ openChatCount: readonly ["open-chat-count"];
16
+ chat: (jid: string) => readonly ["chat", string];
17
+ messages: (jid: string) => readonly ["messages", string];
18
+ notes: (jid: string) => readonly ["notes", string];
19
+ customerProfile: (jid: string) => readonly ["customer-profile", string];
20
+ groupMembers: (jid: string) => readonly ["group-members", string];
21
+ memberAbout: (groupJid: string, member: string) => readonly ["member-about", string, string];
22
+ customerTags: (q: string) => readonly ["customer-tags", string];
23
+ quickReplies: readonly ["quick-replies"];
24
+ users: readonly ["users"];
25
+ directory: readonly ["users", "directory"];
26
+ wa: readonly ["wa"];
27
+ tunnel: readonly ["tunnel"];
28
+ cloudflareSetup: readonly ["cloudflare-setup"];
29
+ settings: readonly ["settings"];
30
+ audit: readonly ["audit"];
31
+ mcpSettings: readonly ["integrations", "mcp"];
32
+ apiTokens: readonly ["integrations", "tokens"];
33
+ };
34
+ export type ChatsData = InfiniteData<ChatListResponse, string | null>;
35
+ /** pages[0] holds the NEWEST messages; each page's `messages` are in ascending time order. */
36
+ export type MessagesData = InfiniteData<MessageListResponse, string | null>;
37
+ /**
38
+ * A direct chat's profile name changed: relabel that customer's cached group messages
39
+ * (the server attaches `senderProfile` only when messages are loaded or arrive).
40
+ */
41
+ export declare function patchSenderProfilesInCache(qc: QueryClient, chat: Chat): void;
42
+ /** Same URL the server builds for a message's media (`mediaUrlFor` in messages/repo.ts). */
43
+ export declare function mediaUrlFor(id: string): string;
44
+ /** Insert or replace a message in the messages cache of its chat. */
45
+ export declare function upsertMessageInCache(qc: QueryClient, m: Message): void;
46
+ /** Patch a message (located by id, or by clientId / `local-<clientId>`) in a chat's messages cache. */
47
+ export declare function patchMessageInCache(qc: QueryClient, chatJid: string, match: {
48
+ id: string;
49
+ clientId: string | null;
50
+ }, patch: Partial<Message>): void;
51
+ /** Remove a message (by id or `local-<clientId>`) from a chat's messages cache. */
52
+ export declare function removeMessageFromCache(qc: QueryClient, chatJid: string, clientId: string): void;
53
+ /** Replace a chat in every cached chat list and in its detail entry. */
54
+ export declare function upsertChatInCache(qc: QueryClient, chat: Chat): void;
55
+ export declare function newClientId(): string;
56
+ /** Current user, or `null` when not logged in (401 is not an error here). */
57
+ export declare function useMe(): import("@tanstack/react-query").UseQueryResult<{
58
+ id: number;
59
+ username: string;
60
+ displayName: string;
61
+ role: "admin" | "agent";
62
+ mustChangePassword: boolean;
63
+ disabled: boolean;
64
+ createdAt: number;
65
+ locale: "en" | "ms" | "zh-CN" | null;
66
+ kind?: "human" | "ai" | undefined;
67
+ aiRole?: "sales" | undefined;
68
+ } | null, Error>;
69
+ export declare function useSetupStatus(): import("@tanstack/react-query").UseQueryResult<{
70
+ needsSetup: boolean;
71
+ }, Error>;
72
+ /** Create the first admin (server logs them in). */
73
+ export declare function useSetupAdmin(): import("@tanstack/react-query").UseMutationResult<unknown, Error, {
74
+ username: string;
75
+ displayName: string;
76
+ password: string;
77
+ }, unknown>;
78
+ export declare function useLogin(): import("@tanstack/react-query").UseMutationResult<{
79
+ id: number;
80
+ username: string;
81
+ displayName: string;
82
+ role: "admin" | "agent";
83
+ mustChangePassword: boolean;
84
+ disabled: boolean;
85
+ createdAt: number;
86
+ locale: "en" | "ms" | "zh-CN" | null;
87
+ kind?: "human" | "ai" | undefined;
88
+ aiRole?: "sales" | undefined;
89
+ } | null, Error, {
90
+ username: string;
91
+ password: string;
92
+ }, unknown>;
93
+ /**
94
+ * Best-effort removal of this browser's push subscription (server row + browser subscription).
95
+ * Never throws: logout / session revocation must proceed regardless.
96
+ */
97
+ export declare function dropPushSubscription(): Promise<void>;
98
+ export declare function useLogout(): import("@tanstack/react-query").UseMutationResult<void, Error, void, unknown>;
99
+ /** Saves the signed-in user's language preference (null = follow the browser). */
100
+ export declare function useSetMyLocale(): import("@tanstack/react-query").UseMutationResult<{
101
+ id: number;
102
+ username: string;
103
+ displayName: string;
104
+ role: "admin" | "agent";
105
+ mustChangePassword: boolean;
106
+ disabled: boolean;
107
+ createdAt: number;
108
+ locale: "en" | "ms" | "zh-CN" | null;
109
+ kind?: "human" | "ai" | undefined;
110
+ aiRole?: "sales" | undefined;
111
+ }, Error, "en" | "ms" | "zh-CN" | null, unknown>;
112
+ export declare function useChangePassword(): import("@tanstack/react-query").UseMutationResult<unknown, Error, {
113
+ currentPassword: string;
114
+ newPassword: string;
115
+ }, unknown>;
116
+ export declare function useChats(filters: ChatFilters): import("@tanstack/react-query").UseInfiniteQueryResult<InfiniteData<{
117
+ chats: {
118
+ jid: string;
119
+ type: "dm" | "group";
120
+ name: string;
121
+ avatarUrl: string | null;
122
+ unreadCount: number;
123
+ lastMessageAt: number | null;
124
+ lastMessagePreview: string | null;
125
+ status: "open" | "resolved";
126
+ assignedTo: number | null;
127
+ updatedAt: number;
128
+ phone: string | null;
129
+ tags?: string[] | undefined;
130
+ whatsappName?: string | null | undefined;
131
+ }[];
132
+ nextCursor: string | null;
133
+ }, unknown>, Error>;
134
+ export declare function useChat(jid: string | null | undefined): import("@tanstack/react-query").UseQueryResult<{
135
+ chat: {
136
+ jid: string;
137
+ type: "dm" | "group";
138
+ name: string;
139
+ avatarUrl: string | null;
140
+ unreadCount: number;
141
+ lastMessageAt: number | null;
142
+ lastMessagePreview: string | null;
143
+ status: "open" | "resolved";
144
+ assignedTo: number | null;
145
+ updatedAt: number;
146
+ phone: string | null;
147
+ tags?: string[] | undefined;
148
+ whatsappName?: string | null | undefined;
149
+ };
150
+ events: {
151
+ id: number;
152
+ chatJid: string;
153
+ type: "resolved" | "assigned" | "unassigned" | "reopened" | "ai_tool_used";
154
+ actorId: number | null;
155
+ payload: Record<string, unknown>;
156
+ at: number;
157
+ }[];
158
+ }, Error>;
159
+ export declare function useOpenChatCount(): import("@tanstack/react-query").UseQueryResult<{
160
+ openCount: number;
161
+ }, Error>;
162
+ export declare function useResolveAllChats(): import("@tanstack/react-query").UseMutationResult<{
163
+ resolvedCount: number;
164
+ }, Error, void, unknown>;
165
+ /** Infinite message history; `fetchNextPage()` loads OLDER messages (pages[1..] are older). */
166
+ export declare function useMessages(jid: string | null | undefined): import("@tanstack/react-query").UseInfiniteQueryResult<InfiniteData<{
167
+ messages: {
168
+ id: string;
169
+ chatJid: string;
170
+ senderJid: string | null;
171
+ senderName: string | null;
172
+ fromMe: boolean;
173
+ sentByUserId: number | null;
174
+ type: "text" | "image" | "video" | "audio" | "document" | "sticker" | "system";
175
+ body: string | null;
176
+ mediaUrl: string | null;
177
+ mediaMime: string | null;
178
+ mediaName: string | null;
179
+ mediaStatus: "none" | "pending" | "failed" | "ok";
180
+ quotedId: string | null;
181
+ status: "pending" | "failed" | "sent" | "delivered" | "read";
182
+ error: string | null;
183
+ timestamp: number;
184
+ clientId: string | null;
185
+ voiceNote?: boolean | undefined;
186
+ transcript?: string | null | undefined;
187
+ transcriptLang?: string | null | undefined;
188
+ transcriptStatus?: "pending" | "failed" | "ok" | "too_long" | "unsupported" | "skipped" | null | undefined;
189
+ senderProfile?: {
190
+ chatJid: string;
191
+ name: string;
192
+ } | null | undefined;
193
+ }[];
194
+ nextBefore: string | null;
195
+ }, unknown>, Error>;
196
+ /** Flatten MessagesData into ascending order. */
197
+ export declare function flattenMessages(data: MessagesData | undefined): Message[];
198
+ export interface SendTextInput {
199
+ text: string;
200
+ quotedId?: string;
201
+ /** Generate with `newClientId()` (crypto.randomUUID). */
202
+ clientId: string;
203
+ }
204
+ /** Optimistic text send: inserts a pending bubble immediately, reconciled by clientId. */
205
+ export declare function useSendText(jid: string): import("@tanstack/react-query").UseMutationResult<{
206
+ id: string;
207
+ chatJid: string;
208
+ senderJid: string | null;
209
+ senderName: string | null;
210
+ fromMe: boolean;
211
+ sentByUserId: number | null;
212
+ type: "text" | "image" | "video" | "audio" | "document" | "sticker" | "system";
213
+ body: string | null;
214
+ mediaUrl: string | null;
215
+ mediaMime: string | null;
216
+ mediaName: string | null;
217
+ mediaStatus: "none" | "pending" | "failed" | "ok";
218
+ quotedId: string | null;
219
+ status: "pending" | "failed" | "sent" | "delivered" | "read";
220
+ error: string | null;
221
+ timestamp: number;
222
+ clientId: string | null;
223
+ voiceNote?: boolean | undefined;
224
+ transcript?: string | null | undefined;
225
+ transcriptLang?: string | null | undefined;
226
+ transcriptStatus?: "pending" | "failed" | "ok" | "too_long" | "unsupported" | "skipped" | null | undefined;
227
+ senderProfile?: {
228
+ chatJid: string;
229
+ name: string;
230
+ } | null | undefined;
231
+ }, Error, SendTextInput, {
232
+ clientId: string;
233
+ }>;
234
+ export interface SendMediaInput {
235
+ file: File;
236
+ caption?: string;
237
+ clientId: string;
238
+ /** Reply to this message (WhatsApp shows it as a quote). */
239
+ quotedId?: string;
240
+ /** A recorded Ogg/Opus voice note: sent as a WhatsApp voice note, never with a caption. */
241
+ voiceNote?: boolean;
242
+ }
243
+ export declare function useSendMedia(jid: string): import("@tanstack/react-query").UseMutationResult<{
244
+ id: string;
245
+ chatJid: string;
246
+ senderJid: string | null;
247
+ senderName: string | null;
248
+ fromMe: boolean;
249
+ sentByUserId: number | null;
250
+ type: "text" | "image" | "video" | "audio" | "document" | "sticker" | "system";
251
+ body: string | null;
252
+ mediaUrl: string | null;
253
+ mediaMime: string | null;
254
+ mediaName: string | null;
255
+ mediaStatus: "none" | "pending" | "failed" | "ok";
256
+ quotedId: string | null;
257
+ status: "pending" | "failed" | "sent" | "delivered" | "read";
258
+ error: string | null;
259
+ timestamp: number;
260
+ clientId: string | null;
261
+ voiceNote?: boolean | undefined;
262
+ transcript?: string | null | undefined;
263
+ transcriptLang?: string | null | undefined;
264
+ transcriptStatus?: "pending" | "failed" | "ok" | "too_long" | "unsupported" | "skipped" | null | undefined;
265
+ senderProfile?: {
266
+ chatJid: string;
267
+ name: string;
268
+ } | null | undefined;
269
+ }, Error, SendMediaInput, void>;
270
+ export declare function useRetryMessage(): import("@tanstack/react-query").UseMutationResult<{
271
+ id: string;
272
+ chatJid: string;
273
+ senderJid: string | null;
274
+ senderName: string | null;
275
+ fromMe: boolean;
276
+ sentByUserId: number | null;
277
+ type: "text" | "image" | "video" | "audio" | "document" | "sticker" | "system";
278
+ body: string | null;
279
+ mediaUrl: string | null;
280
+ mediaMime: string | null;
281
+ mediaName: string | null;
282
+ mediaStatus: "none" | "pending" | "failed" | "ok";
283
+ quotedId: string | null;
284
+ status: "pending" | "failed" | "sent" | "delivered" | "read";
285
+ error: string | null;
286
+ timestamp: number;
287
+ clientId: string | null;
288
+ voiceNote?: boolean | undefined;
289
+ transcript?: string | null | undefined;
290
+ transcriptLang?: string | null | undefined;
291
+ transcriptStatus?: "pending" | "failed" | "ok" | "too_long" | "unsupported" | "skipped" | null | undefined;
292
+ senderProfile?: {
293
+ chatJid: string;
294
+ name: string;
295
+ } | null | undefined;
296
+ }, Error, string, unknown>;
297
+ export declare function usePatchChat(jid: string): import("@tanstack/react-query").UseMutationResult<{
298
+ jid: string;
299
+ type: "dm" | "group";
300
+ name: string;
301
+ avatarUrl: string | null;
302
+ unreadCount: number;
303
+ lastMessageAt: number | null;
304
+ lastMessagePreview: string | null;
305
+ status: "open" | "resolved";
306
+ assignedTo: number | null;
307
+ updatedAt: number;
308
+ phone: string | null;
309
+ tags?: string[] | undefined;
310
+ whatsappName?: string | null | undefined;
311
+ }, Error, {
312
+ assignedTo?: number | null | undefined;
313
+ status?: "open" | "resolved" | undefined;
314
+ }, unknown>;
315
+ export declare function useMarkRead(jid: string): import("@tanstack/react-query").UseMutationResult<unknown, Error, void, void>;
316
+ export declare function useNotes(jid: string | null | undefined): import("@tanstack/react-query").UseQueryResult<{
317
+ id: number;
318
+ chatJid: string;
319
+ userId: number;
320
+ body: string;
321
+ createdAt: number;
322
+ }[], Error>;
323
+ export declare function useAddNote(jid: string): import("@tanstack/react-query").UseMutationResult<{
324
+ id: number;
325
+ chatJid: string;
326
+ userId: number;
327
+ body: string;
328
+ createdAt: number;
329
+ }, Error, string, unknown>;
330
+ /** Members of a group chat (read from WhatsApp by the server, cached there for a few minutes). */
331
+ export declare function useGroupMembers(jid: string | null | undefined, enabled?: boolean): import("@tanstack/react-query").UseQueryResult<{
332
+ group: {
333
+ jid: string;
334
+ name: string | null;
335
+ description: string | null;
336
+ createdAt: number | null;
337
+ createdBy: {
338
+ jid: string;
339
+ name: string | null;
340
+ phone: string | null;
341
+ } | null;
342
+ size: number;
343
+ adminCount: number;
344
+ };
345
+ members: {
346
+ jid: string;
347
+ phone: string | null;
348
+ lid: string | null;
349
+ name: string | null;
350
+ username: string | null;
351
+ role: "admin" | "member" | "superadmin";
352
+ isMe: boolean;
353
+ chatJid: string | null;
354
+ }[];
355
+ fetchedAt: number;
356
+ }, Error>;
357
+ /** A member's WhatsApp About text, fetched only when their details are opened. */
358
+ export declare function useMemberAbout(groupJid: string, member: string | null): import("@tanstack/react-query").UseQueryResult<{
359
+ about: string | null;
360
+ }, Error>;
361
+ /** Open (or create) the direct chat with a group member. */
362
+ export declare function useStartMemberChat(groupJid: string): import("@tanstack/react-query").UseMutationResult<{
363
+ chatJid: string;
364
+ }, Error, string, unknown>;
365
+ export declare function useCustomerProfile(jid: string | null | undefined): import("@tanstack/react-query").UseQueryResult<{
366
+ profile: {
367
+ id: string | null;
368
+ name: string | null;
369
+ company: string | null;
370
+ email: string | null;
371
+ otherPhone: string | null;
372
+ address: string | null;
373
+ tags: string[];
374
+ updatedAt: number | null;
375
+ updatedBy: number | null;
376
+ };
377
+ whatsappName: string | null;
378
+ whatsappPhone?: string | null | undefined;
379
+ whatsapp?: {
380
+ pushName: string | null;
381
+ savedName: string | null;
382
+ phone: string | null;
383
+ lid: string | null;
384
+ } | undefined;
385
+ }, Error>;
386
+ export declare function useSaveCustomerProfile(jid: string): import("@tanstack/react-query").UseMutationResult<{
387
+ profile: {
388
+ id: string | null;
389
+ name: string | null;
390
+ company: string | null;
391
+ email: string | null;
392
+ otherPhone: string | null;
393
+ address: string | null;
394
+ tags: string[];
395
+ updatedAt: number | null;
396
+ updatedBy: number | null;
397
+ };
398
+ whatsappName: string | null;
399
+ whatsappPhone?: string | null | undefined;
400
+ whatsapp?: {
401
+ pushName: string | null;
402
+ savedName: string | null;
403
+ phone: string | null;
404
+ lid: string | null;
405
+ } | undefined;
406
+ }, Error, {
407
+ name: string;
408
+ company: string;
409
+ email: string;
410
+ otherPhone: string;
411
+ address: string;
412
+ tags: string[];
413
+ }, unknown>;
414
+ export declare function useCustomerTags(q: string): import("@tanstack/react-query").UseQueryResult<string[], Error>;
415
+ export declare function useQuickReplies(): import("@tanstack/react-query").UseQueryResult<{
416
+ id: number;
417
+ shortcut: string;
418
+ body: string;
419
+ updatedAt: number;
420
+ }[], Error>;
421
+ /** Create (no id) or update (with id). */
422
+ export declare function useSaveQuickReply(): import("@tanstack/react-query").UseMutationResult<{
423
+ id: number;
424
+ shortcut: string;
425
+ body: string;
426
+ updatedAt: number;
427
+ }, Error, {
428
+ shortcut: string;
429
+ body: string;
430
+ } & {
431
+ id?: number;
432
+ }, unknown>;
433
+ export declare function useDeleteQuickReply(): import("@tanstack/react-query").UseMutationResult<unknown, Error, number, unknown>;
434
+ export declare function useUsers(opts?: {
435
+ enabled?: boolean;
436
+ }): import("@tanstack/react-query").UseQueryResult<{
437
+ id: number;
438
+ username: string;
439
+ displayName: string;
440
+ role: "admin" | "agent";
441
+ mustChangePassword: boolean;
442
+ disabled: boolean;
443
+ createdAt: number;
444
+ locale: "en" | "ms" | "zh-CN" | null;
445
+ kind?: "human" | "ai" | undefined;
446
+ aiRole?: "sales" | undefined;
447
+ }[], Error>;
448
+ /** Public team-member fields every logged-in user may see (`GET /api/users/directory`). */
449
+ export type DirectoryUser = Pick<User, 'id' | 'displayName' | 'role' | 'disabled' | 'kind' | 'aiRole'>;
450
+ /**
451
+ * Team directory for every role (agents included). Needs the server route
452
+ * `GET /api/users/directory`; when it is missing (404) or forbidden, resolves to an empty list
453
+ * so the UI falls back to "Agent #<id>" instead of erroring.
454
+ */
455
+ export declare function useUserDirectory(opts?: {
456
+ enabled?: boolean;
457
+ }): import("@tanstack/react-query").UseQueryResult<DirectoryUser[], Error>;
458
+ export declare function useCreateUser(): import("@tanstack/react-query").UseMutationResult<{
459
+ id: number;
460
+ username: string;
461
+ displayName: string;
462
+ role: "admin" | "agent";
463
+ mustChangePassword: boolean;
464
+ disabled: boolean;
465
+ createdAt: number;
466
+ locale: "en" | "ms" | "zh-CN" | null;
467
+ kind?: "human" | "ai" | undefined;
468
+ aiRole?: "sales" | undefined;
469
+ }, Error, {
470
+ username: string;
471
+ displayName: string;
472
+ role: "admin" | "agent";
473
+ password: string;
474
+ }, unknown>;
475
+ export declare function usePatchUser(): import("@tanstack/react-query").UseMutationResult<{
476
+ id: number;
477
+ username: string;
478
+ displayName: string;
479
+ role: "admin" | "agent";
480
+ mustChangePassword: boolean;
481
+ disabled: boolean;
482
+ createdAt: number;
483
+ locale: "en" | "ms" | "zh-CN" | null;
484
+ kind?: "human" | "ai" | undefined;
485
+ aiRole?: "sales" | undefined;
486
+ }, Error, {
487
+ id: number;
488
+ patch: PatchUserBody;
489
+ }, unknown>;
490
+ export declare function useResetPassword(): import("@tanstack/react-query").UseMutationResult<{
491
+ password: string;
492
+ }, Error, number, unknown>;
493
+ export declare function useRevokeSessions(): import("@tanstack/react-query").UseMutationResult<unknown, Error, number, unknown>;
494
+ export declare function useWaStatus(opts?: {
495
+ enabled?: boolean;
496
+ }): import("@tanstack/react-query").UseQueryResult<{
497
+ state: "open" | "qr" | "disconnected" | "connecting" | "logged_out" | "replaced" | "blocked";
498
+ me: {
499
+ jid: string;
500
+ name: string | null;
501
+ } | null;
502
+ qr: string | null;
503
+ lastError: string | null;
504
+ }, Error>;
505
+ export type WaAction = 'logout' | 'relink' | 'takeover';
506
+ export declare function useWaAction(): import("@tanstack/react-query").UseMutationResult<unknown, Error, WaAction, unknown>;
507
+ /** Link by phone number: returns the 8-character code to enter in WhatsApp → Linked devices. */
508
+ export declare function useRequestPairingCode(): import("@tanstack/react-query").UseMutationResult<{
509
+ code: string;
510
+ }, Error, string, unknown>;
511
+ export declare function useTunnel(opts?: {
512
+ enabled?: boolean;
513
+ }): import("@tanstack/react-query").UseQueryResult<{
514
+ mode: "off" | "quick" | "named";
515
+ state: "error" | "stopped" | "starting" | "running";
516
+ url: string | null;
517
+ hostname: string | null;
518
+ lastError: string | null;
519
+ logTail: string[];
520
+ }, Error>;
521
+ /** Poll only while Cloudflare is signing in or provisioning an inbox address. */
522
+ export declare function useCloudflareSetupStatus(): import("@tanstack/react-query").UseQueryResult<{
523
+ state: "connected" | "error" | "signed_out" | "signing_in" | "awaiting_approval";
524
+ loginUrl: string | null;
525
+ error: string | null;
526
+ domains: {
527
+ id: string;
528
+ name: string;
529
+ accountName: string | null;
530
+ }[];
531
+ busy: boolean;
532
+ managed: {
533
+ id: string;
534
+ name: string;
535
+ hostname: string;
536
+ } | null;
537
+ }, Error>;
538
+ export type CloudflareAccountAction = 'login' | 'login/cancel' | 'refresh';
539
+ /** Account actions all return the same public setup state; credentials stay on the server. */
540
+ export declare function useCloudflareAccountAction(): import("@tanstack/react-query").UseMutationResult<{
541
+ state: "connected" | "error" | "signed_out" | "signing_in" | "awaiting_approval";
542
+ loginUrl: string | null;
543
+ error: string | null;
544
+ domains: {
545
+ id: string;
546
+ name: string;
547
+ accountName: string | null;
548
+ }[];
549
+ busy: boolean;
550
+ managed: {
551
+ id: string;
552
+ name: string;
553
+ hostname: string;
554
+ } | null;
555
+ }, Error, CloudflareAccountAction, unknown>;
556
+ export declare function useCreateCloudflareTunnel(): import("@tanstack/react-query").UseMutationResult<{
557
+ mode: "off" | "quick" | "named";
558
+ state: "error" | "stopped" | "starting" | "running";
559
+ url: string | null;
560
+ hostname: string | null;
561
+ lastError: string | null;
562
+ logTail: string[];
563
+ }, Error, {
564
+ domainId: string;
565
+ subdomain: string;
566
+ tunnelName: string;
567
+ }, unknown>;
568
+ export declare function useStartTunnel(): import("@tanstack/react-query").UseMutationResult<{
569
+ mode: "off" | "quick" | "named";
570
+ state: "error" | "stopped" | "starting" | "running";
571
+ url: string | null;
572
+ hostname: string | null;
573
+ lastError: string | null;
574
+ logTail: string[];
575
+ }, Error, {
576
+ mode: "quick" | "named";
577
+ token?: string | undefined;
578
+ hostname?: string | undefined;
579
+ }, unknown>;
580
+ export declare function useStopTunnel(): import("@tanstack/react-query").UseMutationResult<{
581
+ mode: "off" | "quick" | "named";
582
+ state: "error" | "stopped" | "starting" | "running";
583
+ url: string | null;
584
+ hostname: string | null;
585
+ lastError: string | null;
586
+ logTail: string[];
587
+ }, Error, void, unknown>;
588
+ export declare function useSettings(): import("@tanstack/react-query").UseQueryResult<{
589
+ port: number;
590
+ lanEnabled: boolean;
591
+ historyDays: number;
592
+ namedTunnelHostname: string | null;
593
+ hasTunnelToken: boolean;
594
+ }, Error>;
595
+ export interface PatchSettingsResult {
596
+ settings: Settings;
597
+ restartRequired: boolean;
598
+ }
599
+ export declare function usePatchSettings(): import("@tanstack/react-query").UseMutationResult<PatchSettingsResult, Error, {
600
+ port?: number | undefined;
601
+ lanEnabled?: boolean | undefined;
602
+ historyDays?: number | undefined;
603
+ namedTunnelHostname?: string | null | undefined;
604
+ }, unknown>;
605
+ /** Audit log, newest first; `fetchNextPage()` loads older entries (cursor = last entry id). */
606
+ export declare function useAudit(limit?: number): import("@tanstack/react-query").UseInfiniteQueryResult<InfiniteData<{
607
+ entries: {
608
+ id: number;
609
+ userId: number | null;
610
+ action: string;
611
+ ip: string | null;
612
+ meta: Record<string, unknown>;
613
+ at: number;
614
+ apiToken?: {
615
+ name: string;
616
+ prefix: string;
617
+ } | null | undefined;
618
+ }[];
619
+ }, unknown>, Error>;
620
+ export declare function useMcpSettings(): import("@tanstack/react-query").UseQueryResult<{
621
+ enabled: boolean;
622
+ endpointPath: string;
623
+ publicUrl: string | null;
624
+ localUrl: string;
625
+ }, Error>;
626
+ export declare function usePatchMcpSettings(): import("@tanstack/react-query").UseMutationResult<{
627
+ enabled: boolean;
628
+ endpointPath: string;
629
+ publicUrl: string | null;
630
+ localUrl: string;
631
+ }, Error, {
632
+ enabled: boolean;
633
+ }, unknown>;
634
+ export declare function useApiTokens(): import("@tanstack/react-query").UseQueryResult<{
635
+ id: number;
636
+ userId: number;
637
+ userName: string;
638
+ name: string;
639
+ prefix: string;
640
+ createdAt: number;
641
+ lastUsedAt: number | null;
642
+ expiresAt: number | null;
643
+ }[], Error>;
644
+ export interface CreateApiTokenVars {
645
+ body: CreateApiTokenBodyInput;
646
+ /**
647
+ * Receives the one-time secret. It is handed straight to the caller's component state and is
648
+ * never the mutation's result, so it stays out of the react-query caches.
649
+ */
650
+ onSecret: (secret: string) => void;
651
+ }
652
+ /** Creates a token; the mutation result is the token metadata only (see `onSecret`). */
653
+ export declare function useCreateApiToken(): import("@tanstack/react-query").UseMutationResult<{
654
+ id: number;
655
+ userId: number;
656
+ userName: string;
657
+ name: string;
658
+ prefix: string;
659
+ createdAt: number;
660
+ lastUsedAt: number | null;
661
+ expiresAt: number | null;
662
+ }, Error, CreateApiTokenVars, unknown>;
663
+ /** Revokes a token; one that is already gone (404) counts as revoked. */
664
+ export declare function useRevokeApiToken(): import("@tanstack/react-query").UseMutationResult<void, Error, number, unknown>;
@@ -0,0 +1,15 @@
1
+ import type { Socket } from 'socket.io-client';
2
+ type ResumeSocket = Pick<Socket, 'active' | 'connected'> & {
3
+ io: {
4
+ engine?: {
5
+ readyState: string;
6
+ };
7
+ };
8
+ connect(): unknown;
9
+ disconnect(): unknown;
10
+ on(event: 'connect' | 'disconnect', listener: () => void): unknown;
11
+ off(event: 'connect' | 'disconnect', listener: () => void): unknown;
12
+ };
13
+ /** Reconnect a live session when its page resumes, without background wake-ups. */
14
+ export declare function registerResumeReconnect(socket: ResumeSocket): () => void;
15
+ export {};