@ezychat/web 0.1.82 → 0.1.84

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.
@@ -0,0 +1,5 @@
1
+ /**
2
+ * Settings → AI: how long Ask Ezy may work on one question (5, 10, 15 or 30 minutes; default 15). Customer
3
+ * replies keep their own limit; the person can always press Stop in the panel.
4
+ */
5
+ export declare function AskEzySettingsSection(): import("react").JSX.Element;
@@ -1,4 +1,5 @@
1
1
  import type React from 'react';
2
+ import type { ReportTotals } from '@ezychat/shared';
2
3
  /**
3
4
  * Admin → Reports (design: docs/features/reports/design.md): how busy the WhatsApp numbers are
4
5
  * (busy days, busy times, new customers) and how fast the team and the AI answer, for 7, 30 or 90
@@ -6,6 +7,11 @@ import type React from 'react';
6
7
  * WhatsApp numbers the admin sees them all together or picks one.
7
8
  */
8
9
  export declare function ReportsPage(): React.JSX.Element;
10
+ /**
11
+ * Whole percent of closed AI chats the AI completed; null when none closed. Never rounds to 100 % while the team
12
+ * helped in one, or to 0 % while the AI completed one, so the headline never contradicts the parts below it.
13
+ */
14
+ export declare function completionRate(totals: ReportTotals): number | null;
9
15
  /** The two hours in a row with the most messages from customers; null when there are none. */
10
16
  export declare function busiestBlock(hours: number[][]): {
11
17
  wd: number;
@@ -122,6 +122,9 @@ export declare function useAiTry(): import("@tanstack/react-query").UseMutationR
122
122
  drive?: {
123
123
  action: "saved";
124
124
  } | undefined;
125
+ silent?: {
126
+ kind: "no_reply" | "finished";
127
+ } | undefined;
125
128
  notRun?: boolean | undefined;
126
129
  }[] | undefined;
127
130
  }, Error, {
@@ -57,6 +57,7 @@ export declare function patchMessageInCache(qc: QueryClient, chatJid: string, ma
57
57
  export declare function removeMessageFromCache(qc: QueryClient, chatJid: string, clientId: string): void;
58
58
  /** Replace a chat in every cached chat list and in its detail entry. */
59
59
  export declare function upsertChatInCache(qc: QueryClient, chat: Chat): void;
60
+ /** A random UUID, also on a plain-http LAN page (see `randomUuid`). */
60
61
  export declare function newClientId(): string;
61
62
  /** Current user, or `null` when not logged in (401 is not an error here). */
62
63
  export declare function useMe(): import("@tanstack/react-query").UseQueryResult<{
@@ -207,6 +208,10 @@ export declare function useReport(days: ReportPeriod, inbox?: number | null): im
207
208
  aiAnswered: number;
208
209
  aiResolved: number;
209
210
  aiHandoffs: number;
211
+ aiClosed: number;
212
+ aiCompleted: number;
213
+ aiClosedAfterHandoff: number;
214
+ aiClosedAfterReply: number;
210
215
  };
211
216
  previous: {
212
217
  newCustomers: number;
@@ -218,11 +223,16 @@ export declare function useReport(days: ReportPeriod, inbox?: number | null): im
218
223
  aiAnswered: number;
219
224
  aiResolved: number;
220
225
  aiHandoffs: number;
226
+ aiClosed: number;
227
+ aiCompleted: number;
228
+ aiClosedAfterHandoff: number;
229
+ aiClosedAfterReply: number;
221
230
  } | null;
222
231
  waitingAfterHandoff: {
223
232
  count: number;
224
233
  oldestAt: number | null;
225
234
  };
235
+ aiOpen: number;
226
236
  daily: {
227
237
  date: string;
228
238
  inbound: number;
@@ -336,7 +346,7 @@ export interface SendTextInput {
336
346
  mentions?: string[];
337
347
  /** The text as the box showed it (`@Name`), for the pending bubble until the server answers. */
338
348
  shown?: string;
339
- /** Generate with `newClientId()` (crypto.randomUUID). */
349
+ /** Generate with `newClientId()` (a random UUID). */
340
350
  clientId: string;
341
351
  }
342
352
  /** Optimistic text send: inserts a pending bubble immediately, reconciled by clientId. */
@@ -1,4 +1,4 @@
1
- import { type ReportPeriod, type SafetyAction, type SafetyActionBody } from '@ezychat/shared';
1
+ import { type ReportPeriod, type SafetyAction, type SafetyActionBody, type SafetyChatAction } from '@ezychat/shared';
2
2
  /**
3
3
  * WhatsApp Safety (docs/features/whatsapp-safety/design.md): Admin → Safety, the chat bar and
4
4
  * Admin → Reports → WhatsApp Safety. A message's own finding comes with the message (`safety`).
@@ -78,6 +78,7 @@ export declare function useSafetyChat(jid: string): import("@tanstack/react-quer
78
78
  } | null;
79
79
  maybeHacked: boolean;
80
80
  itemId: number | null;
81
+ canBlock: boolean;
81
82
  }, Error>;
82
83
  /** `inbox` null = every inbox together. */
83
84
  export declare function useSafetyReport(days: ReportPeriod, inbox?: number | null): import("@tanstack/react-query").UseQueryResult<{
@@ -203,3 +204,19 @@ export declare function useSafetyAction(): import("@tanstack/react-query").UseMu
203
204
  action: SafetyAction;
204
205
  body?: SafetyActionBody;
205
206
  }, unknown>;
207
+ /** Admins: block or unblock any direct chat's number (the Customer panel), flagged or not. */
208
+ export declare function useSafetyChatAction(jid: string): import("@tanstack/react-query").UseMutationResult<{
209
+ enabled: boolean;
210
+ scam: boolean;
211
+ blocked: {
212
+ by: string | null;
213
+ at: number;
214
+ auto: boolean;
215
+ } | null;
216
+ maybeHacked: boolean;
217
+ itemId: number | null;
218
+ canBlock: boolean;
219
+ }, Error, {
220
+ action: SafetyChatAction;
221
+ spam?: boolean;
222
+ }, unknown>;
@@ -5,6 +5,11 @@ export interface ChangeState {
5
5
  version?: number;
6
6
  busy?: boolean;
7
7
  error?: string | null;
8
+ /** New agent and scheduled task cards: what Apply made. */
9
+ agentId?: number;
10
+ taskId?: number;
11
+ nextRunAt?: number | null;
12
+ agentOn?: boolean;
8
13
  }
9
14
  export interface BlockContext {
10
15
  /** The chat the panel is scoped to (its summary shows "Back to chat" instead of "Open chat"). */
@@ -17,6 +22,16 @@ export interface BlockContext {
17
22
  onAskAgain: () => void;
18
23
  /** Wide screen: tests in change cards start open (on a phone they start folded). */
19
24
  wide: boolean;
25
+ /** Sends a question choice as the person's next message. */
26
+ onAsk: (text: string) => void;
27
+ /** The person's next message after this answer (a question's chosen choice), null while unanswered. */
28
+ answered: string | null;
29
+ /** Ezy is answering: choices wait. */
30
+ busy: boolean;
31
+ /** Cards whose Apply and Discard are the "Apply both" buttons under them. */
32
+ paired: ReadonlySet<string>;
33
+ /** A new agent and its task shown together: the task card's Undo removes both. */
34
+ linked: ReadonlySet<string>;
20
35
  }
21
36
  export declare function AskEzyBlock({ block, ctx }: {
22
37
  block: AskBlock;
@@ -0,0 +1,31 @@
1
+ import type { AskEzyBlock as AskBlock } from '@ezychat/shared';
2
+ import type { BlockContext } from './AskEzyBlocks';
3
+ type Question = Extract<AskBlock, {
4
+ type: 'question';
5
+ }>;
6
+ type AgentCard = Extract<AskBlock, {
7
+ type: 'agent_proposal';
8
+ }>;
9
+ type TaskCard = Extract<AskBlock, {
10
+ type: 'task_proposal';
11
+ }>;
12
+ /**
13
+ * Ask Ezy sets up agents and scheduled tasks (design docs/features/ask-ezy-setup/design.md): the question
14
+ * with choices, the New agent card and the Scheduled task card. Nothing is saved until Apply.
15
+ */
16
+ /** A note the server adds: a new agent came without its scheduled task, so Ezy asks what it should send. */
17
+ export declare function SetupNoteBlock(): import("react").JSX.Element;
18
+ /** One question with tappable choices; a tap sends the choice as the person's next message. */
19
+ export declare function QuestionBlock({ block, ctx }: {
20
+ block: Question;
21
+ ctx: BlockContext;
22
+ }): import("react").JSX.Element;
23
+ export declare function AgentProposalBlock({ block, ctx }: {
24
+ block: AgentCard;
25
+ ctx: BlockContext;
26
+ }): import("react").JSX.Element;
27
+ export declare function TaskProposalBlock({ block, ctx }: {
28
+ block: TaskCard;
29
+ ctx: BlockContext;
30
+ }): import("react").JSX.Element;
31
+ export {};
@@ -6,6 +6,18 @@ export type AskEzyChangeAction = 'apply' | 'discard' | 'undo';
6
6
  export declare const askEzyChange: (id: string, action: AskEzyChangeAction) => Promise<{
7
7
  status: "proposed" | "applied" | "discarded";
8
8
  version?: number | undefined;
9
+ related?: {
10
+ id: string;
11
+ status: "proposed" | "applied" | "discarded";
12
+ }[] | undefined;
13
+ agentId?: number | undefined;
14
+ taskId?: number | undefined;
15
+ nextRunAt?: number | null | undefined;
16
+ agentOn?: boolean | undefined;
17
+ failed?: {
18
+ code: string;
19
+ message: string;
20
+ } | undefined;
9
21
  }>;
10
22
  /**
11
23
  * Asks one question. The answer streams as NDJSON: `onStep` gets each tool Ezy used while it works; resolves
@@ -912,6 +912,8 @@ export declare const enResources: {
912
912
  aiGroupHandover: string;
913
913
  aiGroupHandoverNoReason: string;
914
914
  aiGroupPaused: string;
915
+ aiSilent: string;
916
+ aiSilentFinished: string;
915
917
  aiGroupMember: string;
916
918
  };
917
919
  messageList: {
@@ -1471,14 +1473,54 @@ export declare const enResources: {
1471
1473
  get_ai_context_item: string;
1472
1474
  get_ai_setup_history: string;
1473
1475
  get_ai_setup_version: string;
1476
+ edit_ai_setup_text: string;
1474
1477
  try_ai_reply_one: string;
1475
1478
  try_ai_reply_other: string;
1476
1479
  propose_ai_setup_change: string;
1477
1480
  other: string;
1481
+ list_scheduled_tasks_one: string;
1482
+ list_scheduled_tasks_other: string;
1483
+ propose_agent: string;
1484
+ propose_scheduled_task: string;
1485
+ propose_scheduled_task_edit: string;
1478
1486
  };
1479
1487
  summariseButton: string;
1480
1488
  readyWith: string;
1481
1489
  aboutChatSuffix: string;
1490
+ setup: {
1491
+ newAgent: string;
1492
+ scheduledTask: string;
1493
+ changeTag: string;
1494
+ type: string;
1495
+ number: string;
1496
+ does: string;
1497
+ agent: string;
1498
+ sendTo: string;
1499
+ when: string;
1500
+ instruction: string;
1501
+ preset: {
1502
+ sales: string;
1503
+ faq: string;
1504
+ custom: string;
1505
+ };
1506
+ startsOff: string;
1507
+ newSuffix: string;
1508
+ chatWithEnding: string;
1509
+ whenZone: string;
1510
+ whenNext: string;
1511
+ preview: string;
1512
+ applyBoth: string;
1513
+ created: string;
1514
+ saved: string;
1515
+ savedOff: string;
1516
+ openAgent: string;
1517
+ openTasks: string;
1518
+ chatUnnamed: string;
1519
+ chatNoName: string;
1520
+ agentStays: string;
1521
+ agentNeedsTask: string;
1522
+ previewNotReady: string;
1523
+ };
1482
1524
  };
1483
1525
  safety: {
1484
1526
  title: {
@@ -1825,6 +1867,19 @@ export declare const enResources: {
1825
1867
  thisNumber: string;
1826
1868
  loadFailed: string;
1827
1869
  };
1870
+ block: {
1871
+ title: string;
1872
+ hint: string;
1873
+ button: string;
1874
+ cannot: string;
1875
+ confirmTitle: string;
1876
+ confirmBody: string;
1877
+ spam: string;
1878
+ spamHint: string;
1879
+ confirm: string;
1880
+ done: string;
1881
+ isBlocked: string;
1882
+ };
1828
1883
  };
1829
1884
  admin: {
1830
1885
  title: string;
@@ -2296,6 +2351,16 @@ export declare const enResources: {
2296
2351
  modelFastHint: string;
2297
2352
  modelSlowHint: string;
2298
2353
  };
2354
+ askEzy: {
2355
+ title: string;
2356
+ description: string;
2357
+ timeout: string;
2358
+ timeoutHint: string;
2359
+ minutes_one: string;
2360
+ minutes_other: string;
2361
+ minutesDefault_one: string;
2362
+ minutesDefault_other: string;
2363
+ };
2299
2364
  phrases: {
2300
2365
  title: string;
2301
2366
  description: string;
@@ -4313,6 +4378,24 @@ export declare const enResources: {
4313
4378
  deltaDown_other: string;
4314
4379
  same_one: string;
4315
4380
  same_other: string;
4381
+ aiRateTitle: string;
4382
+ aiRateFinding: string;
4383
+ aiRateTipTitle: string;
4384
+ aiRateTipBody: string;
4385
+ aiRateTipStep1: string;
4386
+ aiRateTipStep2: string;
4387
+ aiRateTipStep3: string;
4388
+ aiRatePct: string;
4389
+ aiRateUp_one: string;
4390
+ aiRateUp_other: string;
4391
+ aiRateDown_one: string;
4392
+ aiRateDown_other: string;
4393
+ aiRateBar: string;
4394
+ aiRateCompleted: string;
4395
+ aiRateHelped: string;
4396
+ aiRateOpen: string;
4397
+ aiRateNone_one: string;
4398
+ aiRateNone_other: string;
4316
4399
  underMinute: string;
4317
4400
  minutes_one: string;
4318
4401
  minutes_other: string;
@@ -0,0 +1,7 @@
1
+ /**
2
+ * Admins: block or unblock a direct chat's number on WhatsApp from the Customer panel, for any chat
3
+ * (spam, harassment), not only one WhatsApp Safety flagged. Blocking can also mark the number as spam.
4
+ */
5
+ export declare function BlockNumber({ jid }: {
6
+ jid: string;
7
+ }): import("react").JSX.Element | null;
@@ -0,0 +1,8 @@
1
+ /**
2
+ * A random RFC 4122 version 4 UUID, for request and client ids the server checks with `z.uuid()`.
3
+ *
4
+ * `crypto.randomUUID` exists only in a secure context (https, localhost). The app is also opened over
5
+ * plain http on the LAN (`http://192.168.x.x:7420`), where browsers leave it out; `getRandomValues`
6
+ * is available there, so the UUID is built from it. Never `Math.random`.
7
+ */
8
+ export declare function randomUuid(): string;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ezychat/web",
3
- "version": "0.1.82",
3
+ "version": "0.1.84",
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.82",
43
+ "@ezychat/shared": "0.1.84",
44
44
  "@fontsource-variable/inter": "^5.3.0",
45
45
  "@tanstack/react-query": "^5.105.0",
46
46
  "@types/react": "^19.3.0",