@ezychat/web 0.1.57 → 0.1.58

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: the team-wide switch for AI reply suggestions. On by default on a new install with
3
+ * an AI connection, off after an update (a note says so); disabled without a connection.
4
+ */
5
+ export declare function ReplySuggestionsSection(): import("react").JSX.Element;
@@ -0,0 +1,21 @@
1
+ /** The team-wide switch and what the composer shows (any signed-in user may read it). */
2
+ export declare const replySuggestionsKey: readonly ["ai", "replySuggestions"];
3
+ export declare function useReplySuggestionsStatus(enabled?: boolean): import("@tanstack/react-query").UseQueryResult<{
4
+ enabled: boolean;
5
+ connected: boolean;
6
+ state: "unavailable" | "on" | "off";
7
+ upgraded: boolean;
8
+ }, Error>;
9
+ /** Up to 2 drafts for a direct chat (nothing is sent). */
10
+ export declare function fetchSuggestions(jid: string, signal: AbortSignal): Promise<{
11
+ suggestions: {
12
+ label: string;
13
+ text: string;
14
+ }[];
15
+ noAnswer: boolean;
16
+ handoffRule: string | null;
17
+ }>;
18
+ /** The rest of the sentence being typed, or null. */
19
+ export declare function fetchCompletion(jid: string, text: string, signal: AbortSignal): Promise<{
20
+ completion: string | null;
21
+ }>;
@@ -465,6 +465,23 @@ export declare const enResources: {
465
465
  cancel: string;
466
466
  previewUnavailable: string;
467
467
  };
468
+ suggest: {
469
+ button: string;
470
+ region: string;
471
+ loading: string;
472
+ retry: string;
473
+ close: string;
474
+ noAnswer: string;
475
+ addContext: string;
476
+ handoff: string;
477
+ replaceTitle: string;
478
+ replace: string;
479
+ keep: string;
480
+ accept: string;
481
+ tabHint: string;
482
+ completionStatus: string;
483
+ unavailable: string;
484
+ };
468
485
  };
469
486
  quickReplies: {
470
487
  title: string;
@@ -1335,6 +1352,14 @@ export declare const enResources: {
1335
1352
  title: string;
1336
1353
  description: string;
1337
1354
  };
1355
+ replySuggestions: {
1356
+ title: string;
1357
+ description: string;
1358
+ enable: string;
1359
+ cost: string;
1360
+ noConnection: string;
1361
+ upgraded: string;
1362
+ };
1338
1363
  };
1339
1364
  resolveAll: {
1340
1365
  title: string;
@@ -1,5 +1,5 @@
1
1
  import type React from 'react';
2
- import type { QuickReply } from '@ezychat/shared';
2
+ import { type QuickReply } from '@ezychat/shared';
3
3
  export interface ComposerProps {
4
4
  quickReplies: QuickReply[];
5
5
  onSend(text: string): void;
@@ -26,5 +26,15 @@ export interface ComposerProps {
26
26
  preview: string;
27
27
  } | null;
28
28
  onCancelReply?(): void;
29
+ /**
30
+ * AI reply suggestions in this chat (direct chats only; null = off). `unavailable` shows the
31
+ * button disabled. The chips clear when `lastCustomerMessageId` changes (a new customer message).
32
+ */
33
+ aiSuggest?: {
34
+ chatJid: string;
35
+ lastCustomerMessageId: string | null;
36
+ isAdmin: boolean;
37
+ state: 'on' | 'unavailable';
38
+ } | null;
29
39
  }
30
- export declare function Composer({ quickReplies, onSend, onAttach, onVoiceNote, onTyping, confirmSend, disabled, placeholder, replyTo, onCancelReply, }: ComposerProps): React.JSX.Element;
40
+ export declare function Composer({ quickReplies, onSend, onAttach, onVoiceNote, onTyping, confirmSend, disabled, placeholder, replyTo, onCancelReply, aiSuggest, }: ComposerProps): React.JSX.Element;
@@ -0,0 +1,23 @@
1
+ import type React from 'react';
2
+ import type { ReplySuggestion, ReplySuggestionsResult } from '@ezychat/shared';
3
+ export type SuggestionStrip = {
4
+ phase: 'loading';
5
+ } | {
6
+ phase: 'ready';
7
+ result: ReplySuggestionsResult;
8
+ } | {
9
+ phase: 'error';
10
+ message: string;
11
+ };
12
+ /**
13
+ * AI reply suggestions: the strip above the composer after "Suggest reply". Up to two
14
+ * chips (a short label; a tap puts the full draft in the composer), or a note when the business
15
+ * context has no answer or a hand-off rule matches. The strip scrolls inside itself, never the page.
16
+ */
17
+ export declare function ReplySuggestions({ strip, isAdmin, onPick, onRetry, onClose, }: {
18
+ strip: SuggestionStrip;
19
+ isAdmin: boolean;
20
+ onPick(suggestion: ReplySuggestion): void;
21
+ onRetry(): void;
22
+ onClose(): void;
23
+ }): React.JSX.Element;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ezychat/web",
3
- "version": "0.1.57",
3
+ "version": "0.1.58",
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.57",
43
+ "@ezychat/shared": "0.1.58",
44
44
  "@fontsource-variable/inter": "^5.3.0",
45
45
  "@tanstack/react-query": "^5.104.5",
46
46
  "@types/react": "^19.3.0",