@ezychat/web 0.1.70 → 0.1.71

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.
@@ -1,7 +1,7 @@
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=`); the custom connector needs Enterprise. Every
4
+ * Activity and Bookings tabs (`?tab=`, `&agent=`); Google Sheets the same without Bookings; the custom connector needs Enterprise. Every
5
5
  * other page is built from the connector's entry in the connector list. A connector an extension
6
6
  * provides opens the extension's page.
7
7
  */
@@ -0,0 +1,7 @@
1
+ /**
2
+ * The Google account Google Sheets uses (one per install, its own sign-in): connect, its state and
3
+ * Disconnect. Which spreadsheet each AI agent uses lives on the Settings tab.
4
+ */
5
+ export declare function GoogleSheetsAccountCard({ onOpenSettings, }: Readonly<{
6
+ onOpenSettings?: () => void;
7
+ }>): import("react").JSX.Element;
@@ -0,0 +1,13 @@
1
+ import { type GoogleSheetsStatus } from '@ezychat/shared';
2
+ /**
3
+ * Connectors → Google Sheets → Settings, for one AI agent: the spreadsheet (picked in Google's
4
+ * file picker), "Answer questions" with its tab (on by default) and "Save leads" with its tab (off until an
5
+ * admin turns it on).
6
+ */
7
+ export declare function SheetsSettingsCard({ agentId, name, status, onConnect, }: Readonly<{
8
+ agentId: number;
9
+ name: string;
10
+ status: GoogleSheetsStatus;
11
+ /** Shows the account card (Overview tab) to connect. */
12
+ onConnect: () => void;
13
+ }>): import("react").JSX.Element;
@@ -4,7 +4,7 @@ import type { ConnectorEntry, GoogleCalendarState } from '@ezychat/shared';
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 (its pages and tabs live in the app) and the custom MCP connector (Enterprise,
7
+ * Google Calendar and Google Sheets (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. */
18
- export type ConnectorTool = 'checkFree' | 'book';
19
- export declare const CONNECTOR_IDS: readonly ["google-calendar", "custom-mcp"];
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"];
20
20
  export type ConnectorId = (typeof CONNECTOR_IDS)[number];
21
21
  export interface CatalogConnector {
22
22
  id: ConnectorId;
@@ -38,4 +38,5 @@ 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'). */
41
42
  export declare function connectorStatus(c: CatalogConnector, google: GoogleCalendarState | undefined, extensionLink: string | undefined): ConnectorStatus;
@@ -1,3 +1,4 @@
1
+ import type { ReactNode } from 'react';
1
2
  import { type LucideIcon } from 'lucide-react';
2
3
  import { type ConnectorEntry } from '@ezychat/shared';
3
4
  import type { ConnectorStatus } from './catalog';
@@ -47,3 +48,18 @@ export declare function GoogleCalendarLink({ href, label, variant, }: {
47
48
  label: string;
48
49
  variant?: 'outline' | 'ghost';
49
50
  }): import("react").JSX.Element;
51
+ /**
52
+ * One switch of a connector's per-agent settings ("Check free times", "Answer questions from the sheet"): label, an
53
+ * optional badge (e.g. "Changes your calendar"), a hint and a 44 px switch target; `children` shows
54
+ * under it (e.g. the tab to read).
55
+ */
56
+ export declare function ToolSwitchRow({ id, label, hint, badge, checked, disabled, onCheckedChange, children, }: Readonly<{
57
+ id: string;
58
+ label: string;
59
+ hint: string;
60
+ badge?: string;
61
+ checked: boolean;
62
+ disabled?: boolean;
63
+ onCheckedChange: (checked: boolean) => void;
64
+ children?: ReactNode;
65
+ }>): import("react").JSX.Element;
@@ -0,0 +1,68 @@
1
+ import { type ReactNode } from 'react';
2
+ import { type QueryKey, type UseMutationResult, type UseQueryResult } from '@tanstack/react-query';
3
+ import { type LucideIcon } from 'lucide-react';
4
+ import type { GoogleCalendarConnectProgress, GoogleCalendarConnectStart, GoogleCalendarState } from '@ezychat/shared';
5
+ interface Signing {
6
+ requestId: string;
7
+ url: string;
8
+ /** The browser blocked the new window: the person opens the link themselves. */
9
+ blocked: boolean;
10
+ }
11
+ export interface GoogleConnectFlow {
12
+ connect: () => void;
13
+ cancel: () => void;
14
+ signing: Signing | null;
15
+ failed: GoogleCalendarConnectProgress['error'];
16
+ starting: boolean;
17
+ startError: Error | null;
18
+ progressError: Error | null;
19
+ }
20
+ /**
21
+ * Starts a Google sign-in of a core connector (Google Calendar, Google Sheets): a window opens
22
+ * inside the click (so the browser allows it), then goes to Google's page once the server answers;
23
+ * the page polls until Google sent the person back. The connector's own API hooks are passed in.
24
+ */
25
+ export declare function useGoogleConnectFlow(options: {
26
+ useStart: () => UseMutationResult<GoogleCalendarConnectStart, Error, void>;
27
+ useProgress: (requestId: string | null) => UseQueryResult<GoogleCalendarConnectProgress>;
28
+ statusKey: QueryKey;
29
+ connectedToast: string;
30
+ }): GoogleConnectFlow;
31
+ /** While Google's sign-in is open, and what went wrong after it. */
32
+ export declare function GoogleSigningIn({ flow }: Readonly<{
33
+ flow: GoogleConnectFlow;
34
+ }>): import("react").JSX.Element;
35
+ /** The texts that differ between the Google connectors (already translated). */
36
+ export interface GoogleAccountTexts {
37
+ description: string;
38
+ what: readonly string[];
39
+ connect: string;
40
+ connectHint: string;
41
+ expiredBody: string;
42
+ unavailableTitle: string;
43
+ unavailableBody: string;
44
+ perAgent: string;
45
+ disconnectTitle: string;
46
+ disconnectBody: string;
47
+ disconnected: string;
48
+ }
49
+ /**
50
+ * The Google account one core connector uses (one per install): connect, its state, the problem
51
+ * banners and Disconnect. `children` adds what only that connector shows while signed in (Google
52
+ * Calendar's calendars); `actions` sits next to Disconnect.
53
+ */
54
+ export declare function GoogleAccountCard({ testId, icon: Icon, query, flow, disconnect, texts, onOpenSettings, children, actions, }: Readonly<{
55
+ testId: string;
56
+ icon: LucideIcon;
57
+ query: UseQueryResult<{
58
+ state: GoogleCalendarState;
59
+ account: string | null;
60
+ }>;
61
+ flow: GoogleConnectFlow;
62
+ disconnect: UseMutationResult<unknown, Error, void>;
63
+ texts: GoogleAccountTexts;
64
+ onOpenSettings?: () => void;
65
+ children?: ReactNode;
66
+ actions?: ReactNode;
67
+ }>): import("react").JSX.Element;
68
+ export {};
@@ -104,3 +104,87 @@ export declare function useCalendarActivity(enabled?: boolean): import("@tanstac
104
104
  end: string | null;
105
105
  }[];
106
106
  }, Error>;
107
+ /** Admin → Connectors → Google Sheets (admins only). Tokens never reach the browser. */
108
+ export declare const googleSheetsKey: readonly ["connectors", "google-sheets"];
109
+ export declare const sheetsSettingsKey: (agentId: number) => readonly ["connectors", "google-sheets", "agent", number];
110
+ export declare const sheetsActivityKey: readonly ["connectors", "google-sheets", "activity"];
111
+ export declare function useGoogleSheets(enabled?: boolean): import("@tanstack/react-query").UseQueryResult<{
112
+ state: "unavailable" | "connected" | "expired" | "disconnected" | "not_configured";
113
+ account: string | null;
114
+ connectedAt: number | null;
115
+ problemSince: number | null;
116
+ }, Error>;
117
+ /** Starts Google's sign-in for Google Sheets (its own sign-in, separate from the calendar's). */
118
+ export declare function useGoogleSheetsConnect(): import("@tanstack/react-query").UseMutationResult<{
119
+ requestId: string;
120
+ authorizationUrl: string;
121
+ }, Error, void, unknown>;
122
+ /** Polls a Google Sheets sign-in every 2 s until it is done or failed. */
123
+ export declare function useGoogleSheetsProgress(requestId: string | null): import("@tanstack/react-query").UseQueryResult<{
124
+ status: "pending" | "failed" | "done";
125
+ error: "error" | "expired" | "denied" | null;
126
+ }, Error>;
127
+ export declare function useGoogleSheetsDisconnect(): import("@tanstack/react-query").UseMutationResult<unknown, Error, void, unknown>;
128
+ /** The spreadsheet behind a pasted link: its name and tabs (checked with Google). */
129
+ export declare function useSpreadsheetLookup(): import("@tanstack/react-query").UseMutationResult<{
130
+ id: string;
131
+ name: string;
132
+ tabs: {
133
+ title: string;
134
+ rows: number;
135
+ }[];
136
+ url: string;
137
+ }, Error, string, unknown>;
138
+ /** One AI agent's Google Sheets settings (the defaults until an admin saves them). */
139
+ export declare function useSheetsSettings(agentId: number | null, enabled?: boolean): import("@tanstack/react-query").UseQueryResult<{
140
+ spreadsheetId: string | null;
141
+ spreadsheetName: string | null;
142
+ lookupTab: string | null;
143
+ lookup: boolean;
144
+ leadsTab: string | null;
145
+ addLeads: boolean;
146
+ }, Error>;
147
+ export declare function useSaveSheetsSettings(agentId: number): import("@tanstack/react-query").UseMutationResult<{
148
+ spreadsheetId: string | null;
149
+ spreadsheetName: string | null;
150
+ lookupTab: string | null;
151
+ lookup: boolean;
152
+ leadsTab: string | null;
153
+ addLeads: boolean;
154
+ }, Error, {
155
+ spreadsheetId: string | null;
156
+ spreadsheetName: string | null;
157
+ lookupTab: string | null;
158
+ lookup: boolean;
159
+ leadsTab: string | null;
160
+ addLeads: boolean;
161
+ }, unknown>;
162
+ export declare function useSheetsActivity(enabled?: boolean): import("@tanstack/react-query").UseQueryResult<{
163
+ activity: {
164
+ id: number;
165
+ at: number;
166
+ kind: "failed" | "looked_up" | "lead_added";
167
+ agentId: number | null;
168
+ agentName: string;
169
+ chatJid: string | null;
170
+ customer: string;
171
+ }[];
172
+ }, Error>;
173
+ /** Opens Google's file picker (a page on the computer that runs EzyChat). */
174
+ export declare function useSheetsPicker(): import("@tanstack/react-query").UseMutationResult<{
175
+ requestId: string;
176
+ pickerUrl: string;
177
+ }, Error, void, unknown>;
178
+ /** Polls the picker every 2 s until the admin picked a sheet, cancelled, or it expired. */
179
+ export declare function useSheetsPickerProgress(requestId: string | null): import("@tanstack/react-query").UseQueryResult<{
180
+ status: "expired" | "pending" | "failed" | "done" | "cancelled";
181
+ sheet: {
182
+ id: string;
183
+ name: string;
184
+ tabs: {
185
+ title: string;
186
+ rows: number;
187
+ }[];
188
+ url: string;
189
+ } | null;
190
+ }, Error>;
@@ -2881,6 +2881,9 @@ export declare const enResources: {
2881
2881
  off: string;
2882
2882
  none: string;
2883
2883
  browse: string;
2884
+ sheetsReadAndLeads: string;
2885
+ sheetsRead: string;
2886
+ sheetsLeads: string;
2884
2887
  };
2885
2888
  settingsPointerTitle: string;
2886
2889
  settingsPointer: string;
@@ -2889,6 +2892,10 @@ export declare const enResources: {
2889
2892
  checkFreeHint: string;
2890
2893
  book: string;
2891
2894
  bookHint: string;
2895
+ readRows: string;
2896
+ readRowsHint: string;
2897
+ addLead: string;
2898
+ addLeadHint: string;
2892
2899
  };
2893
2900
  items: {
2894
2901
  "google-calendar": {
@@ -2903,6 +2910,12 @@ export declare const enResources: {
2903
2910
  long: string;
2904
2911
  privacy: string;
2905
2912
  };
2913
+ "google-sheets": {
2914
+ name: string;
2915
+ short: string;
2916
+ long: string;
2917
+ privacy: string;
2918
+ };
2906
2919
  };
2907
2920
  gc: {
2908
2921
  accountTitle: string;
@@ -3185,6 +3198,69 @@ export declare const enResources: {
3185
3198
  agentCardTools_one: string;
3186
3199
  agentCardTools_other: string;
3187
3200
  };
3201
+ gs: {
3202
+ accountDescription: string;
3203
+ what1: string;
3204
+ what2: string;
3205
+ what3: string;
3206
+ connect: string;
3207
+ connectHint: string;
3208
+ connectedToast: string;
3209
+ expiredBody: string;
3210
+ unavailableTitle: string;
3211
+ unavailableBody: string;
3212
+ perAgent: string;
3213
+ disconnectTitle: string;
3214
+ disconnectBody: string;
3215
+ disconnected: string;
3216
+ };
3217
+ sheets: {
3218
+ title: string;
3219
+ description: string;
3220
+ notConnected: string;
3221
+ spreadsheet: string;
3222
+ open: string;
3223
+ chooseTab: string;
3224
+ tabRequired: string;
3225
+ readHint: string;
3226
+ lookupTab: string;
3227
+ leadsHint: string;
3228
+ leadsTab: string;
3229
+ leadsTabHint: string;
3230
+ changesSheet: string;
3231
+ rulesTitle: string;
3232
+ rule1: string;
3233
+ rule2: string;
3234
+ rule3: string;
3235
+ rule4: string;
3236
+ save: string;
3237
+ saved: string;
3238
+ paused: {
3239
+ expired: string;
3240
+ unavailable: string;
3241
+ };
3242
+ pausedBody: string;
3243
+ choose: string;
3244
+ chooseAnother: string;
3245
+ chooseHint: string;
3246
+ sheetRequired: string;
3247
+ picking: string;
3248
+ pickingHint: string;
3249
+ pickBlocked: string;
3250
+ openPicker: string;
3251
+ pickError: {
3252
+ cancelled: string;
3253
+ failed: string;
3254
+ expired: string;
3255
+ };
3256
+ pickSameComputer: string;
3257
+ };
3258
+ sheetsAct: {
3259
+ hint: string;
3260
+ looked_up: string;
3261
+ lead_added: string;
3262
+ failed: string;
3263
+ };
3188
3264
  };
3189
3265
  reports: {
3190
3266
  title: string;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ezychat/web",
3
- "version": "0.1.70",
3
+ "version": "0.1.71",
4
4
  "type": "module",
5
5
  "description": "EzyChat core: the team inbox web app (React) as a library, with createInboxApp and its extension API.",
6
6
  "license": "MIT",
@@ -40,7 +40,7 @@
40
40
  "build:lib": "node ../../scripts/build-web-lib.mjs"
41
41
  },
42
42
  "dependencies": {
43
- "@ezychat/shared": "0.1.70",
43
+ "@ezychat/shared": "0.1.71",
44
44
  "@fontsource-variable/inter": "^5.3.0",
45
45
  "@tanstack/react-query": "^5.105.0",
46
46
  "@types/react": "^19.3.0",