@ezychat/web 0.1.76 → 0.1.78

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-CwS6ahLc.js → admin-Bw0RmdAy.js} +6 -1
  2. package/dist-lib/chunks/{admin-p6QRa2DG.js → admin-Vk_4QCBI.js} +6 -1
  3. package/dist-lib/chunks/{common-CjI5LeVc.js → common-BE996sRJ.js} +33 -0
  4. package/dist-lib/chunks/{common-DYK9ZVMh.js → common-CBTam36M.js} +33 -0
  5. package/dist-lib/chunks/{inbox-C9xTxE6Y.js → inbox-BP7OELj9.js} +7 -0
  6. package/dist-lib/chunks/{inbox-D-koJMyr.js → inbox-g6IVD36a.js} +7 -0
  7. package/dist-lib/ezychat-web.css +1 -1
  8. package/dist-lib/index.js +8543 -6416
  9. package/dist-lib/types/admin/UsageStatsSwitch.d.ts +7 -0
  10. package/dist-lib/types/admin/business-templates-data.d.ts +18 -0
  11. package/dist-lib/types/admin/business-templates.d.ts +3 -1
  12. package/dist-lib/types/admin/connectors/ConnectorDetailPage.d.ts +2 -1
  13. package/dist-lib/types/admin/connectors/ConnectorsGalleryPage.d.ts +2 -1
  14. package/dist-lib/types/admin/connectors/CreateSheetDialog.d.ts +29 -0
  15. package/dist-lib/types/admin/connectors/DriveSettingsCard.d.ts +14 -0
  16. package/dist-lib/types/admin/connectors/GoogleDriveAccountCard.d.ts +7 -0
  17. package/dist-lib/types/admin/connectors/SqlAccountCustomers.d.ts +4 -0
  18. package/dist-lib/types/admin/connectors/SqlAccountPage.d.ts +12 -0
  19. package/dist-lib/types/admin/connectors/SqlAccountSettings.d.ts +7 -0
  20. package/dist-lib/types/admin/connectors/catalog.d.ts +10 -7
  21. package/dist-lib/types/admin/connectors/connector-ui.d.ts +17 -1
  22. package/dist-lib/types/admin/connectors/google-connect.d.ts +5 -0
  23. package/dist-lib/types/admin/connectors/sheets-tabs.d.ts +4 -1
  24. package/dist-lib/types/api/ai-templates.d.ts +24 -0
  25. package/dist-lib/types/api/ai.d.ts +3 -0
  26. package/dist-lib/types/api/connectors.d.ts +132 -0
  27. package/dist-lib/types/api/queries.d.ts +5 -1
  28. package/dist-lib/types/api/sql-account.d.ts +105 -0
  29. package/dist-lib/types/i18n/resources.d.ts +408 -0
  30. package/dist-lib/types/inbox/MessageBubble.d.ts +5 -1
  31. package/dist-lib/types/inbox/MessageList.d.ts +8 -1
  32. package/dist-lib/types/inbox/useQuoteJump.d.ts +28 -0
  33. package/dist-lib/types/inbox/useSwipeReply.d.ts +1 -0
  34. package/dist-lib/types/lib/links.d.ts +1 -1
  35. package/dist-lib/types/lib/tips.d.ts +2 -2
  36. package/package.json +2 -2
@@ -0,0 +1,7 @@
1
+ /**
2
+ * "Share anonymous usage stats" (design: docs/superpowers/specs/2026-11-04-usage-stats-design.md): on by default, saved
3
+ * at once (admins only). The "?" lists exactly what is sent and what never is.
4
+ */
5
+ export declare function UsageStatsSwitch(): import("react").JSX.Element;
6
+ /** Settings → General: the switch in its own card. */
7
+ export declare function UsageStatsCard(): import("react").JSX.Element;
@@ -1,3 +1,4 @@
1
+ import type { SheetLayoutInput } from '@ezychat/shared';
1
2
  /**
2
3
  * The templates built into this app (plain data, no React: `scripts/export-templates.mjs` reads it to
3
4
  * write the publishing repo's `templates/` folder). Texts live in the catalogs
@@ -15,6 +16,11 @@ export declare const GROUP_AGENT_DEFAULTS: {
15
16
  readonly answerGroups: true;
16
17
  readonly answerDirect: false;
17
18
  };
19
+ /**
20
+ * The Claims template's Google Sheets layout ("Create from Claims layout" on the Google Sheets
21
+ * page): one tab the agent adds claims to, with EzyChat's own columns where they help.
22
+ */
23
+ export declare const CLAIMS_SHEET_LAYOUT: SheetLayoutInput;
18
24
  export declare const BUSINESS_TEMPLATES: readonly [{
19
25
  readonly id: "clinic";
20
26
  readonly preset: "faq";
@@ -109,6 +115,18 @@ export declare const BUSINESS_TEMPLATES: readonly [{
109
115
  readonly answerGroups: true;
110
116
  readonly answerDirect: false;
111
117
  };
118
+ readonly sheet: {
119
+ name: string;
120
+ tabs: {
121
+ title: string;
122
+ columns: string[];
123
+ access?: "off" | "read" | "add" | undefined;
124
+ formulas?: {
125
+ cell: string;
126
+ formula: string;
127
+ }[] | undefined;
128
+ }[];
129
+ };
112
130
  }];
113
131
  export type BusinessTemplateId = (typeof BUSINESS_TEMPLATES)[number]['id'];
114
132
  /** The version of every built-in template (a list template replaces one only when higher). */
@@ -1,6 +1,6 @@
1
1
  import type { TFunction } from 'i18next';
2
2
  import { type LucideIcon } from 'lucide-react';
3
- import { type AgentTemplateCatalog, type AgentTemplateText, type AiAgentPreset, type AiContextTextBody } from '@ezychat/shared';
3
+ import { type AgentTemplateCatalog, type AgentTemplateText, type AiAgentPreset, type AiContextTextBody, type SheetLayoutInput } from '@ezychat/shared';
4
4
  export { BUSINESS_TEMPLATES, TEMPLATE_CATEGORIES, type BusinessTemplateId, type TemplateCategory, } from './business-templates-data';
5
5
  /**
6
6
  * Ready-made AI agents for common businesses. A template is the tested starting text of its agent
@@ -31,6 +31,8 @@ export interface GalleryTemplate {
31
31
  groupAgent: boolean;
32
32
  /** Names of the connectors the template recommends (list templates only). */
33
33
  connectors: string[];
34
+ /** Its Google Sheets layout ("Create from … layout" on the Google Sheets page), else null. */
35
+ sheet: SheetLayoutInput | null;
34
36
  }
35
37
  /** The app's own templates, texts from the catalogs. */
36
38
  export declare function builtinTemplates(t: TFunction<'admin'>): GalleryTemplate[];
@@ -1,7 +1,8 @@
1
1
  /**
2
2
  * `/admin/connectors/:id`: one page per connector. The app's own connectors come first: Google
3
3
  * Calendar has Overview (what it does, the Google account, your data), Settings (per AI agent),
4
- * Activity and Bookings tabs (`?tab=`, `&agent=`); Google Sheets the same without Bookings; the custom connector needs Enterprise. Every
4
+ * Activity and Bookings tabs (`?tab=`, `&agent=`); Google Sheets and Google Drive the same without Bookings;
5
+ * SQL Account has Overview, Connection, Settings, Customers and Activity; the custom connector needs Enterprise. Every
5
6
  * other page is built from the connector's entry in the connector list. A connector an extension
6
7
  * provides opens the extension's page.
7
8
  */
@@ -1,6 +1,7 @@
1
1
  /**
2
2
  * Admin → Connectors: a gallery of connectors from the connector list the server keeps (refreshed
3
- * when the page opens), plus the app's own built-in Google Calendar and the custom MCP connector.
3
+ * when the page opens), plus the app's own built-in connectors (Google Calendar, Google Sheets, SQL
4
+ * Account) and the custom MCP connector.
4
5
  * Each card opens the connector's own page (details, settings, activity), or the page an extension
5
6
  * provides. Connected ones come first; search and a category filter narrow the list.
6
7
  */
@@ -0,0 +1,29 @@
1
+ import { SheetLayout, type SheetLayoutTab, type SheetTabAccess } from '@ezychat/shared';
2
+ interface DraftTab {
3
+ key: number;
4
+ title: string;
5
+ /** Column names as typed, separated by commas. */
6
+ columns: string;
7
+ access: SheetTabAccess;
8
+ /** A template layout's formulas (kept as they are; not edited here). */
9
+ formulas?: SheetLayoutTab['formulas'];
10
+ }
11
+ interface Draft {
12
+ name: string;
13
+ tabs: DraftTab[];
14
+ }
15
+ /** The draft as the server's layout, or null when a box is missing or a tab name is repeated. */
16
+ export declare function draftLayout(draft: Draft): SheetLayout | null;
17
+ /**
18
+ * Connectors → Google Sheets → Settings → "Create a new sheet" (docs/connector-design.md, Part E): a new
19
+ * spreadsheet in the connected Google account, blank or from a template's layout, saved as the
20
+ * agent's spreadsheet with each tab's access. Admins only; the AI never creates a sheet.
21
+ */
22
+ export declare function CreateSheetDialog({ agentId, name, open, onOpenChange, onCreated, }: Readonly<{
23
+ agentId: number;
24
+ name: string;
25
+ open: boolean;
26
+ onOpenChange: (open: boolean) => void;
27
+ onCreated: () => void;
28
+ }>): import("react").JSX.Element;
29
+ export {};
@@ -0,0 +1,14 @@
1
+ import { type GoogleDriveStatus } from '@ezychat/shared';
2
+ /**
3
+ * Connectors → Google Drive → Settings, for one AI agent (design
4
+ * docs/features/google-drive/design.md): the folder (picked in Google's file picker), Save files,
5
+ * Read files with the files the admin picked. The connector only grants access: what to save or
6
+ * read, and when, is in the agent's instructions (docs/connector-design.md), linked at the end.
7
+ */
8
+ export declare function DriveSettingsCard({ agentId, name, status, onConnect, }: Readonly<{
9
+ agentId: number;
10
+ name: string;
11
+ status: GoogleDriveStatus;
12
+ /** Shows the account card (Overview tab). */
13
+ onConnect: () => void;
14
+ }>): import("react").JSX.Element | null;
@@ -0,0 +1,7 @@
1
+ /**
2
+ * The Google account Google Drive uses (one per install, its own sign-in): connect, its state and
3
+ * Disconnect. Each AI agent's folder and files live on the Settings tab.
4
+ */
5
+ export declare function GoogleDriveAccountCard({ onOpenSettings, }: Readonly<{
6
+ onOpenSettings?: () => void;
7
+ }>): import("react").JSX.Element;
@@ -0,0 +1,4 @@
1
+ /** Customers tab: each direct chat and the SQL Account customer it is matched to. */
2
+ export declare function SqlCustomers(): import("react").JSX.Element;
3
+ /** Activity tab: what the AI did with SQL Account (who and when, never amounts or documents). */
4
+ export declare function SqlActivityList(): import("react").JSX.Element;
@@ -0,0 +1,12 @@
1
+ import { type ConnectorEntry, type SqlAccountProblem, type SqlAccountState } from '@ezychat/shared';
2
+ /** A state that is neither connected nor disconnected: what went wrong. */
3
+ export declare function sqlProblem(state: SqlAccountState | null | undefined): SqlAccountProblem | null;
4
+ /**
5
+ * `/admin/connectors/sql-account` (design docs/features/sql-accounting/design.md): built into the
6
+ * app. Works only with SQL Account's API service (API Link); each AI agent's access is chosen per
7
+ * SQL Account object (Off / Read / Read + create). Tabs: Overview, Connection, Settings, Customers,
8
+ * Activity (`?tab=`, `&agent=`).
9
+ */
10
+ export declare function SqlAccountTabs({ entry }: Readonly<{
11
+ entry: ConnectorEntry | null;
12
+ }>): import("react").JSX.Element;
@@ -0,0 +1,7 @@
1
+ import { type SqlAccountStatus } from '@ezychat/shared';
2
+ /** Settings tab: one AI agent at a time (`&agent=<id>`), like Google Calendar and Sheets. */
3
+ export declare function SqlAgentsSettings(): import("react").JSX.Element;
4
+ /** "Who is this customer in SQL Account?": the match rules and Match by phone number. */
5
+ export declare function SqlMatchCard({ status }: Readonly<{
6
+ status: SqlAccountStatus;
7
+ }>): import("react").JSX.Element;
@@ -1,10 +1,10 @@
1
1
  import { type LucideIcon } from 'lucide-react';
2
- import type { ConnectorEntry, GoogleCalendarState } from '@ezychat/shared';
2
+ import type { ConnectorEntry, GoogleCalendarState, SqlAccountState } from '@ezychat/shared';
3
3
  /**
4
4
  * Admin → Connectors: what the app itself provides next to the connector list (design
5
5
  * docs/features/connector-list/design.md). The list (server, `GET /api/connectors/list`) gives
6
6
  * every partner and coming-soon connector; the app keeps only its own features here: the built-in
7
- * Google Calendar and Google Sheets (their pages and tabs live in the app) and the custom MCP connector (Enterprise,
7
+ * Google Calendar, Google Sheets, Google Drive and SQL Account (their pages and tabs live in the app) and the custom MCP connector (Enterprise,
8
8
  * linked by its web extension through `connectorLinks`). Texts are catalog keys under
9
9
  * `connectors.items.<id>` and `connectors.tools.<tool>` (admin namespace).
10
10
  */
@@ -14,9 +14,9 @@ export type ConnectorCategory = (typeof CONNECTOR_CATEGORIES)[number];
14
14
  export declare const LIST_CATEGORY: Record<ConnectorEntry['category'], ConnectorCategory>;
15
15
  /** The icon of a list entry without its own icon file. */
16
16
  export declare const CATEGORY_ICON: Record<ConnectorCategory, LucideIcon>;
17
- /** What the AI may do with the built-in Google Calendar and Google Sheets. */
18
- export type ConnectorTool = 'checkFree' | 'book' | 'readRows' | 'addLead';
19
- export declare const CONNECTOR_IDS: readonly ["google-calendar", "google-sheets", "custom-mcp"];
17
+ /** What the AI may do with the built-in Google Calendar, Google Sheets and Google Drive. */
18
+ export type ConnectorTool = 'checkFree' | 'book' | 'readRows' | 'addLead' | 'save' | 'find' | 'read';
19
+ export declare const CONNECTOR_IDS: readonly ["google-calendar", "google-sheets", "sql-account", "google-drive", "custom-mcp"];
20
20
  export type ConnectorId = (typeof CONNECTOR_IDS)[number];
21
21
  export interface CatalogConnector {
22
22
  id: ConnectorId;
@@ -38,5 +38,8 @@ export declare function findConnector(id: string | undefined): CatalogConnector
38
38
  * `delisted`: connected, but no longer in the connector list (it keeps working).
39
39
  */
40
40
  export type ConnectorStatus = 'connected' | 'attention' | 'notConnected' | 'comingSoon' | 'enterprise' | 'linked' | 'needsUpdate' | 'delisted';
41
- /** `google`: the sign-in state of this connector (Google Calendar's or Google Sheets'). */
42
- export declare function connectorStatus(c: CatalogConnector, google: GoogleCalendarState | undefined, extensionLink: string | undefined): ConnectorStatus;
41
+ /**
42
+ * `state`: the connection state of this connector (Google Calendar's, Sheets' or Drive's sign-in, or
43
+ * SQL Account's connection).
44
+ */
45
+ export declare function connectorStatus(c: CatalogConnector, state: GoogleCalendarState | SqlAccountState | undefined, extensionLink: string | undefined): ConnectorStatus;
@@ -53,13 +53,29 @@ export declare function GoogleCalendarLink({ href, label, variant, }: {
53
53
  * optional badge (e.g. "Changes your calendar"), a hint and a 44 px switch target; `children` shows
54
54
  * under it (e.g. the tab to read).
55
55
  */
56
- export declare function ToolSwitchRow({ id, label, hint, badge, checked, disabled, onCheckedChange, children, }: Readonly<{
56
+ export declare function ToolSwitchRow({ id, label, hint, badge, tip, checked, disabled, onCheckedChange, children, }: Readonly<{
57
57
  id: string;
58
58
  label: string;
59
59
  hint: string;
60
60
  badge?: string;
61
+ /** An InfoTip after the label (what a risky switch does). */
62
+ tip?: ReactNode;
61
63
  checked: boolean;
62
64
  disabled?: boolean;
63
65
  onCheckedChange: (checked: boolean) => void;
64
66
  children?: ReactNode;
65
67
  }>): import("react").JSX.Element;
68
+ /**
69
+ * While Google's file picker is open in another window (Google Sheets, Google Drive): what is
70
+ * happening, a link to open it again (the browser may have blocked the window) and Cancel.
71
+ */
72
+ export declare function PickerWaiting({ testId, title, hint, url, blocked, openLabel, sameComputer, onCancel, }: Readonly<{
73
+ testId: string;
74
+ title: string;
75
+ hint: string;
76
+ url: string;
77
+ blocked: boolean;
78
+ openLabel: string;
79
+ sameComputer: string;
80
+ onCancel: () => void;
81
+ }>): import("react").JSX.Element;
@@ -46,6 +46,11 @@ export interface GoogleAccountTexts {
46
46
  disconnectBody: string;
47
47
  disconnected: string;
48
48
  }
49
+ /**
50
+ * The account card texts of a Google connector whose catalog keys follow one pattern
51
+ * (`connectors.<prefix>.description`, `what1`–`what3`, …): Google Sheets `gs`, Google Drive `gd`.
52
+ */
53
+ export declare function googleAccountTexts(t: (key: string) => string, prefix: 'gs' | 'gd'): GoogleAccountTexts;
49
54
  /**
50
55
  * The Google account one core connector uses (one per install): connect, its state, the problem
51
56
  * banners and Disconnect. `children` adds what only that connector shows while signed in (Google
@@ -15,7 +15,10 @@ export interface TabMarks {
15
15
  * marked when there is nothing to compare with (first read, another spreadsheet).
16
16
  */
17
17
  export declare function diffTabs(before: SpreadsheetInfo | null, after: SpreadsheetInfo): Map<string, TabMarks>;
18
- /** The tabs that are not off, sorted by title (a tab that is not listed is off). */
18
+ /**
19
+ * The tabs that are not off, sorted by title (a tab that is not listed is off). The permission
20
+ * switches are kept only on Add rows and only when on (as the server saves them).
21
+ */
19
22
  export declare const normalizeTabs: (tabs: readonly SheetTabSetting[]) => SheetTabSetting[];
20
23
  /**
21
24
  * The tabs to save: with the spreadsheet's tabs known, a tab Google no longer lists and a tab
@@ -66,6 +66,18 @@ export declare function useTemplateCatalog(enabled?: boolean): import("@tanstack
66
66
  answerGroups?: boolean | undefined;
67
67
  } | undefined;
68
68
  recommendedConnectors?: string[] | undefined;
69
+ sheet?: {
70
+ name: string;
71
+ tabs: {
72
+ title: string;
73
+ columns: string[];
74
+ access: "off" | "read" | "add";
75
+ formulas?: {
76
+ cell: string;
77
+ formula: string;
78
+ }[] | undefined;
79
+ }[];
80
+ } | undefined;
69
81
  };
70
82
  connectors: {
71
83
  id: string;
@@ -136,6 +148,18 @@ export declare function useRefreshTemplates(): import("@tanstack/react-query").U
136
148
  answerGroups?: boolean | undefined;
137
149
  } | undefined;
138
150
  recommendedConnectors?: string[] | undefined;
151
+ sheet?: {
152
+ name: string;
153
+ tabs: {
154
+ title: string;
155
+ columns: string[];
156
+ access: "off" | "read" | "add";
157
+ formulas?: {
158
+ cell: string;
159
+ formula: string;
160
+ }[] | undefined;
161
+ }[];
162
+ } | undefined;
139
163
  };
140
164
  connectors: {
141
165
  id: string;
@@ -117,6 +117,9 @@ export declare function useAiTry(): import("@tanstack/react-query").UseMutationR
117
117
  action: "row_added";
118
118
  tab: string;
119
119
  } | undefined;
120
+ drive?: {
121
+ action: "saved";
122
+ } | undefined;
120
123
  notRun?: boolean | undefined;
121
124
  }[] | undefined;
122
125
  }, Error, {
@@ -144,6 +144,8 @@ export declare function useSheetsSettings(agentId: number | null, enabled?: bool
144
144
  tabs: {
145
145
  title: string;
146
146
  access: "off" | "read" | "add";
147
+ aiValues?: boolean | undefined;
148
+ formulas?: boolean | undefined;
147
149
  }[];
148
150
  }, Error>;
149
151
  export declare function useSaveSheetsSettings(agentId: number): import("@tanstack/react-query").UseMutationResult<{
@@ -152,6 +154,8 @@ export declare function useSaveSheetsSettings(agentId: number): import("@tanstac
152
154
  tabs: {
153
155
  title: string;
154
156
  access: "off" | "read" | "add";
157
+ aiValues?: boolean | undefined;
158
+ formulas?: boolean | undefined;
155
159
  }[];
156
160
  }, Error, {
157
161
  spreadsheetId: string | null;
@@ -159,6 +163,33 @@ export declare function useSaveSheetsSettings(agentId: number): import("@tanstac
159
163
  tabs: {
160
164
  title: string;
161
165
  access: "off" | "read" | "add";
166
+ aiValues?: boolean | undefined;
167
+ formulas?: boolean | undefined;
168
+ }[];
169
+ }, unknown>;
170
+ /**
171
+ * Creates a new spreadsheet in the connected Google account from `layout` and saves it as the
172
+ * agent's (admins). 400 `formula_blocked` when a formula reaches outside the sheet.
173
+ */
174
+ export declare function useCreateSheet(agentId: number): import("@tanstack/react-query").UseMutationResult<{
175
+ spreadsheetId: string | null;
176
+ spreadsheetName: string | null;
177
+ tabs: {
178
+ title: string;
179
+ access: "off" | "read" | "add";
180
+ aiValues?: boolean | undefined;
181
+ formulas?: boolean | undefined;
182
+ }[];
183
+ }, Error, {
184
+ name: string;
185
+ tabs: {
186
+ title: string;
187
+ columns: string[];
188
+ access: "off" | "read" | "add";
189
+ formulas?: {
190
+ cell: string;
191
+ formula: string;
192
+ }[] | undefined;
162
193
  }[];
163
194
  }, unknown>;
164
195
  /**
@@ -209,3 +240,104 @@ export declare function useSheetsPickerProgress(requestId: string | null): impor
209
240
  url: string;
210
241
  } | null;
211
242
  }, Error>;
243
+ /** Admin → Connectors → Google Drive (admins only). Tokens never reach the browser. */
244
+ export declare const googleDriveKey: readonly ["connectors", "google-drive"];
245
+ export declare const driveSettingsKey: (agentId: number) => readonly ["connectors", "google-drive", "agent", number];
246
+ export declare const driveActivityKey: readonly ["connectors", "google-drive", "activity"];
247
+ export declare function useGoogleDrive(enabled?: boolean): import("@tanstack/react-query").UseQueryResult<{
248
+ state: "unavailable" | "connected" | "expired" | "disconnected" | "not_configured";
249
+ account: string | null;
250
+ connectedAt: number | null;
251
+ problemSince: number | null;
252
+ }, Error>;
253
+ /** Starts Google's sign-in for Google Drive (its own sign-in, separate from Calendar and Sheets). */
254
+ export declare function useGoogleDriveConnect(): import("@tanstack/react-query").UseMutationResult<{
255
+ requestId: string;
256
+ authorizationUrl: string;
257
+ }, Error, void, unknown>;
258
+ /** Polls a Google Drive sign-in every 2 s until it is done or failed. */
259
+ export declare function useGoogleDriveProgress(requestId: string | null): import("@tanstack/react-query").UseQueryResult<{
260
+ status: "pending" | "failed" | "done";
261
+ error: "error" | "expired" | "denied" | null;
262
+ }, Error>;
263
+ export declare function useGoogleDriveDisconnect(): import("@tanstack/react-query").UseMutationResult<unknown, Error, void, unknown>;
264
+ /** One AI agent's Google Drive settings (the defaults until an admin saves them). */
265
+ export declare function useDriveSettings(agentId: number | null, enabled?: boolean): import("@tanstack/react-query").UseQueryResult<{
266
+ folder: {
267
+ id: string;
268
+ name: string;
269
+ } | null;
270
+ save: boolean;
271
+ read: boolean;
272
+ files: {
273
+ id: string;
274
+ name: string;
275
+ mimeType: string;
276
+ kind: "text" | "pdf" | "other" | "sheet" | "word" | "doc";
277
+ }[];
278
+ }, Error>;
279
+ export declare function useSaveDriveSettings(agentId: number): import("@tanstack/react-query").UseMutationResult<{
280
+ folder: {
281
+ id: string;
282
+ name: string;
283
+ } | null;
284
+ save: boolean;
285
+ read: boolean;
286
+ files: {
287
+ id: string;
288
+ name: string;
289
+ mimeType: string;
290
+ kind: "text" | "pdf" | "other" | "sheet" | "word" | "doc";
291
+ }[];
292
+ }, Error, {
293
+ folder: {
294
+ id: string;
295
+ name: string;
296
+ } | null;
297
+ save: boolean;
298
+ read: boolean;
299
+ files: {
300
+ id: string;
301
+ name: string;
302
+ mimeType: string;
303
+ kind: "text" | "pdf" | "other" | "sheet" | "word" | "doc";
304
+ }[];
305
+ }, unknown>;
306
+ export declare function useDriveActivity(enabled?: boolean): import("@tanstack/react-query").UseQueryResult<{
307
+ activity: {
308
+ id: number;
309
+ at: number;
310
+ kind: "failed" | "read" | "skipped" | "saved";
311
+ agentId: number | null;
312
+ agentName: string;
313
+ chatJid: string | null;
314
+ customer: string;
315
+ group: string | null;
316
+ reason: "unavailable" | "safety" | "size" | null;
317
+ }[];
318
+ }, Error>;
319
+ /**
320
+ * Opens Google's file picker (a page on the computer that runs EzyChat): one folder, or files
321
+ * (opened in the agent's folder).
322
+ */
323
+ export declare function useDrivePicker(): import("@tanstack/react-query").UseMutationResult<{
324
+ requestId: string;
325
+ pickerUrl: string;
326
+ }, Error, {
327
+ kind: "files" | "folder";
328
+ folderId?: string | undefined;
329
+ }, unknown>;
330
+ /** Polls the picker every 2 s until the admin picked, cancelled, or it expired. */
331
+ export declare function useDrivePickerProgress(requestId: string | null): import("@tanstack/react-query").UseQueryResult<{
332
+ status: "expired" | "pending" | "failed" | "done" | "cancelled";
333
+ folder: {
334
+ id: string;
335
+ name: string;
336
+ } | null;
337
+ files: {
338
+ id: string;
339
+ name: string;
340
+ mimeType: string;
341
+ kind: "text" | "pdf" | "other" | "sheet" | "word" | "doc";
342
+ }[];
343
+ }, Error>;
@@ -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 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';
@@ -307,6 +307,8 @@ export declare function useMessages(jid: string | null | undefined): import("@ta
307
307
  }[];
308
308
  nextBefore: string | null;
309
309
  }, unknown>, Error>;
310
+ /** Where a quoted message sits in its chat (`found: false`: not in our records for this chat). */
311
+ export declare function locateMessage(jid: string, id: string): Promise<MessageLocateResponse>;
310
312
  /** Flatten MessagesData into ascending order. */
311
313
  export declare function flattenMessages(data: MessagesData | undefined): Message[];
312
314
  export interface SendTextInput {
@@ -887,6 +889,7 @@ export declare function useSettings(): import("@tanstack/react-query").UseQueryR
887
889
  historyDays: number;
888
890
  namedTunnelHostname: string | null;
889
891
  hasTunnelToken: boolean;
892
+ usageStats: boolean;
890
893
  }, Error>;
891
894
  export interface PatchSettingsResult {
892
895
  settings: Settings;
@@ -897,6 +900,7 @@ export declare function usePatchSettings(): import("@tanstack/react-query").UseM
897
900
  lanEnabled?: boolean | undefined;
898
901
  historyDays?: number | undefined;
899
902
  namedTunnelHostname?: string | null | undefined;
903
+ usageStats?: boolean | undefined;
900
904
  }, unknown>;
901
905
  /** Audit log, newest first; `fetchNextPage()` loads older entries (cursor = last entry id). */
902
906
  export declare function useAudit(limit?: number): import("@tanstack/react-query").UseInfiniteQueryResult<InfiniteData<{
@@ -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>;