@ezychat/web 0.1.85 → 0.1.86
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.
- package/dist-lib/chunks/{admin-BDciacjd.js → admin-CGWT-MJA.js} +20 -4
- package/dist-lib/chunks/{admin-Bcel7ZqO.js → admin-n8lWCbmd.js} +20 -4
- package/dist-lib/chunks/{common-C3KIPASu.js → common-BeKNf4n-.js} +9 -2
- package/dist-lib/chunks/{common-BAoxGts5.js → common-jotvJJL9.js} +9 -2
- package/dist-lib/chunks/{inbox-wUMY4TKD.js → inbox-D4VV1Cmg.js} +95 -2
- package/dist-lib/chunks/{inbox-HnJhomm8.js → inbox-_dK6whtW.js} +95 -2
- package/dist-lib/ezychat-web.css +1 -1
- package/dist-lib/index.js +9314 -8008
- package/dist-lib/types/admin/LiveTranslateSection.d.ts +6 -0
- package/dist-lib/types/admin/SendPermissionFields.d.ts +5 -2
- package/dist-lib/types/admin/TokenPermissionsDialog.d.ts +2 -2
- package/dist-lib/types/admin/connectors/connector-ui.d.ts +8 -0
- package/dist-lib/types/admin/connectors/google-connect.d.ts +1 -0
- package/dist-lib/types/api/connectors.d.ts +3 -0
- package/dist-lib/types/api/forward.d.ts +7 -0
- package/dist-lib/types/api/live-translate.d.ts +125 -0
- package/dist-lib/types/api/message-changes.d.ts +14 -0
- package/dist-lib/types/api/queries.d.ts +40 -1
- package/dist-lib/types/api/templates.d.ts +7 -0
- package/dist-lib/types/i18n/resources.d.ts +119 -0
- package/dist-lib/types/inbox/ChatListItem.d.ts +3 -1
- package/dist-lib/types/inbox/ConversationHeader.d.ts +4 -1
- package/dist-lib/types/inbox/LiveTranslate.d.ts +54 -0
- package/dist-lib/types/nav/MyLanguageField.d.ts +5 -0
- package/package.json +2 -2
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Settings → AI card. The team switch (on by default: all staff may use it; each person
|
|
3
|
+
* turns it on per chat) and a per-person daily limit (default 200). It uses the "Model for suggestions".
|
|
4
|
+
* Audited before/after as `settings.live_translate`.
|
|
5
|
+
*/
|
|
6
|
+
export declare function LiveTranslateSection(): import("react").JSX.Element;
|
|
@@ -2,10 +2,13 @@ export interface SendPermissions {
|
|
|
2
2
|
canSend: boolean;
|
|
3
3
|
/** Only meaningful while canSend is on; turning canSend off clears it. */
|
|
4
4
|
canNew: boolean;
|
|
5
|
+
/** Resolve and reopen chats (scope `inbox:manage`); independent of sending. */
|
|
6
|
+
canResolve: boolean;
|
|
5
7
|
}
|
|
6
8
|
/**
|
|
7
|
-
* "Can send WhatsApp messages" and, under it, "Can also message new numbers", each with its warning
|
|
8
|
-
* Shared by Create token and the Permissions dialog, so both show the same
|
|
9
|
+
* "Can send WhatsApp messages" and, under it, "Can also message new numbers", each with its warning,
|
|
10
|
+
* then "Can resolve chats". Shared by Create token and the Permissions dialog, so both show the same
|
|
11
|
+
* rules and texts.
|
|
9
12
|
*/
|
|
10
13
|
export declare function SendPermissionFields({ value, onChange, disabled, }: Readonly<{
|
|
11
14
|
value: SendPermissions;
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import type { ApiToken } from '@ezychat/shared';
|
|
2
2
|
/**
|
|
3
|
-
* The owner of a token changes whether its AI assistant may send,
|
|
4
|
-
* new token. The same options and warnings as Create token.
|
|
3
|
+
* The owner of a token changes whether its AI assistant may send, message new numbers and resolve
|
|
4
|
+
* chats, without a new token. The same options and warnings as Create token.
|
|
5
5
|
*/
|
|
6
6
|
export declare function TokenPermissionsDialog({ token, onClose, }: Readonly<{
|
|
7
7
|
token: ApiToken | null;
|
|
@@ -69,6 +69,14 @@ export declare function ToolSwitchRow({ id, label, hint, badge, tip, checked, di
|
|
|
69
69
|
* While Google's file picker is open in another window (Google Sheets, Google Drive): what is
|
|
70
70
|
* happening, a link to open it again (the browser may have blocked the window) and Cancel.
|
|
71
71
|
*/
|
|
72
|
+
/**
|
|
73
|
+
* Google sign-in and file picking finish in a browser on the computer that runs EzyChat. From
|
|
74
|
+
* another device (the tunnel address or the LAN) they never start: this says so, in plain words.
|
|
75
|
+
*/
|
|
76
|
+
export declare function RemoteOnlyNotice({ testId, textKey, }: Readonly<{
|
|
77
|
+
testId: string;
|
|
78
|
+
textKey: 'connectors.gc.remoteSignIn' | 'connectors.sheets.remotePick' | 'connectors.drive.remotePick';
|
|
79
|
+
}>): import("react").JSX.Element;
|
|
72
80
|
export declare function PickerWaiting({ testId, title, hint, url, blocked, openLabel, sameComputer, onCancel, }: Readonly<{
|
|
73
81
|
testId: string;
|
|
74
82
|
title: string;
|
|
@@ -62,6 +62,7 @@ export declare function GoogleAccountCard({ testId, icon: Icon, query, flow, dis
|
|
|
62
62
|
query: UseQueryResult<{
|
|
63
63
|
state: GoogleCalendarState;
|
|
64
64
|
account: string | null;
|
|
65
|
+
onThisComputer?: boolean;
|
|
65
66
|
}>;
|
|
66
67
|
flow: GoogleConnectFlow;
|
|
67
68
|
disconnect: UseMutationResult<unknown, Error, void>;
|
|
@@ -14,6 +14,7 @@ export declare function useGoogleCalendar(enabled?: boolean): import("@tanstack/
|
|
|
14
14
|
}[];
|
|
15
15
|
connectedAt: number | null;
|
|
16
16
|
problemSince: number | null;
|
|
17
|
+
onThisComputer: boolean;
|
|
17
18
|
}, Error>;
|
|
18
19
|
/** Starts Google's sign-in: the page opens `authorizationUrl` and polls the request. */
|
|
19
20
|
export declare function useGoogleCalendarConnect(): import("@tanstack/react-query").UseMutationResult<{
|
|
@@ -113,6 +114,7 @@ export declare function useGoogleSheets(enabled?: boolean): import("@tanstack/re
|
|
|
113
114
|
account: string | null;
|
|
114
115
|
connectedAt: number | null;
|
|
115
116
|
problemSince: number | null;
|
|
117
|
+
onThisComputer: boolean;
|
|
116
118
|
}, Error>;
|
|
117
119
|
/** Starts Google's sign-in for Google Sheets (its own sign-in, separate from the calendar's). */
|
|
118
120
|
export declare function useGoogleSheetsConnect(): import("@tanstack/react-query").UseMutationResult<{
|
|
@@ -249,6 +251,7 @@ export declare function useGoogleDrive(enabled?: boolean): import("@tanstack/rea
|
|
|
249
251
|
account: string | null;
|
|
250
252
|
connectedAt: number | null;
|
|
251
253
|
problemSince: number | null;
|
|
254
|
+
onThisComputer: boolean;
|
|
252
255
|
}, Error>;
|
|
253
256
|
/** Starts Google's sign-in for Google Drive (its own sign-in, separate from Calendar and Sheets). */
|
|
254
257
|
export declare function useGoogleDriveConnect(): import("@tanstack/react-query").UseMutationResult<{
|
|
@@ -69,6 +69,13 @@ export declare function useForwardMessage(): import("@tanstack/react-query").Use
|
|
|
69
69
|
deletedBy?: "phone" | "team" | "sender" | "group_admin" | null | undefined;
|
|
70
70
|
deletedByUserId?: number | null | undefined;
|
|
71
71
|
hidden?: boolean | undefined;
|
|
72
|
+
typed?: {
|
|
73
|
+
typedText: string;
|
|
74
|
+
typedLanguage: "en" | "ms" | "id" | "zh" | "ta" | "th" | "vi" | "ar" | "ja" | "ko";
|
|
75
|
+
sentLanguage: "en" | "ms" | "id" | "zh" | "ta" | "th" | "vi" | "ar" | "ja" | "ko";
|
|
76
|
+
edited: boolean;
|
|
77
|
+
} | null | undefined;
|
|
78
|
+
sentOriginal?: boolean | undefined;
|
|
72
79
|
}[];
|
|
73
80
|
}, Error, {
|
|
74
81
|
id: string;
|
|
@@ -0,0 +1,125 @@
|
|
|
1
|
+
import { TRANSLATE_LANGUAGES, type ChatTranslateState, type Message, type TranslateLanguage } from '@ezychat/shared';
|
|
2
|
+
export { TRANSLATE_LANGUAGES };
|
|
3
|
+
export type { TranslateLanguage };
|
|
4
|
+
/** Each language in its own name (the pickers show these). */
|
|
5
|
+
export declare const NATIVE: Record<"en" | "ms" | "id" | "zh" | "ta" | "th" | "vi" | "ar" | "ja" | "ko", string>;
|
|
6
|
+
export declare const statusKey: readonly ["live-translate", "status"];
|
|
7
|
+
export declare const chatStateKey: (jid: string) => readonly ["live-translate", "chat", string];
|
|
8
|
+
export declare const translationsKey: (jid: string, my: TranslateLanguage) => readonly ["live-translate", "translations", string, "en" | "ms" | "id" | "zh" | "ta" | "th" | "vi" | "ar" | "ja" | "ko"];
|
|
9
|
+
/** The admin switch, the limit, whether AI is connected and my use today. Refetched on focus: it is a counter. */
|
|
10
|
+
export declare function useLiveTranslateStatus(): import("@tanstack/react-query").UseQueryResult<{
|
|
11
|
+
enabled: boolean;
|
|
12
|
+
dailyLimit: number;
|
|
13
|
+
connected: boolean;
|
|
14
|
+
usedToday: number;
|
|
15
|
+
peopleToday?: number | undefined;
|
|
16
|
+
translationsToday?: number | undefined;
|
|
17
|
+
}, Error>;
|
|
18
|
+
/** Admins: the switch and the daily limit (Settings → AI). */
|
|
19
|
+
export declare function useSetLiveTranslateSettings(): import("@tanstack/react-query").UseMutationResult<{
|
|
20
|
+
enabled: boolean;
|
|
21
|
+
dailyLimit: number;
|
|
22
|
+
connected: boolean;
|
|
23
|
+
usedToday: number;
|
|
24
|
+
peopleToday?: number | undefined;
|
|
25
|
+
translationsToday?: number | undefined;
|
|
26
|
+
}, Error, Partial<{
|
|
27
|
+
enabled: boolean;
|
|
28
|
+
dailyLimit: number;
|
|
29
|
+
}>, unknown>;
|
|
30
|
+
/** My language and "Send without preview", read from `/api/me`. */
|
|
31
|
+
export declare function useMyTranslate(): {
|
|
32
|
+
myLanguage: "en" | "ms" | "id" | "zh" | "ta" | "th" | "vi" | "ar" | "ja" | "ko";
|
|
33
|
+
myLanguageSet: boolean;
|
|
34
|
+
sendWithoutPreview: boolean;
|
|
35
|
+
};
|
|
36
|
+
export declare function useSetMyTranslate(): import("@tanstack/react-query").UseMutationResult<unknown, Error, {
|
|
37
|
+
translateLanguage?: TranslateLanguage;
|
|
38
|
+
sendWithoutPreview?: boolean;
|
|
39
|
+
}, unknown>;
|
|
40
|
+
export declare function useChatTranslate(jid: string): import("@tanstack/react-query").UseQueryResult<{
|
|
41
|
+
on: boolean;
|
|
42
|
+
customerLanguage: "en" | "ms" | "id" | "zh" | "ta" | "th" | "vi" | "ar" | "ja" | "ko" | null;
|
|
43
|
+
detected: "en" | "ms" | "id" | "zh" | "ta" | "th" | "vi" | "ar" | "ja" | "ko" | null;
|
|
44
|
+
mixed: "en" | "ms" | "id" | "zh" | "ta" | "th" | "vi" | "ar" | "ja" | "ko" | null;
|
|
45
|
+
outgoingLanguage: "en" | "ms" | "id" | "zh" | "ta" | "th" | "vi" | "ar" | "ja" | "ko" | null;
|
|
46
|
+
outgoingDetected: "en" | "ms" | "id" | "zh" | "ta" | "th" | "vi" | "ar" | "ja" | "ko" | null;
|
|
47
|
+
}, Error>;
|
|
48
|
+
export declare function useSetChatTranslate(jid: string): import("@tanstack/react-query").UseMutationResult<{
|
|
49
|
+
on: boolean;
|
|
50
|
+
customerLanguage: "en" | "ms" | "id" | "zh" | "ta" | "th" | "vi" | "ar" | "ja" | "ko" | null;
|
|
51
|
+
detected: "en" | "ms" | "id" | "zh" | "ta" | "th" | "vi" | "ar" | "ja" | "ko" | null;
|
|
52
|
+
mixed: "en" | "ms" | "id" | "zh" | "ta" | "th" | "vi" | "ar" | "ja" | "ko" | null;
|
|
53
|
+
outgoingLanguage: "en" | "ms" | "id" | "zh" | "ta" | "th" | "vi" | "ar" | "ja" | "ko" | null;
|
|
54
|
+
outgoingDetected: "en" | "ms" | "id" | "zh" | "ta" | "th" | "vi" | "ar" | "ja" | "ko" | null;
|
|
55
|
+
}, Error, {
|
|
56
|
+
on?: boolean | undefined;
|
|
57
|
+
customerLanguage?: "en" | "ms" | "id" | "zh" | "ta" | "th" | "vi" | "ar" | "ja" | "ko" | null | undefined;
|
|
58
|
+
outgoingLanguage?: "en" | "ms" | "id" | "zh" | "ta" | "th" | "vi" | "ar" | "ja" | "ko" | null | undefined;
|
|
59
|
+
}, unknown>;
|
|
60
|
+
/** The customer's language: chosen by the team, else detected. */
|
|
61
|
+
export declare function customerLanguageOf(chat: ChatTranslateState | undefined): TranslateLanguage | null;
|
|
62
|
+
/** The language a reply goes out in: the customer's (a direct chat) or the group's one language. */
|
|
63
|
+
export declare function outgoingLanguageOf(chat: ChatTranslateState | undefined, isGroup: boolean): TranslateLanguage | null;
|
|
64
|
+
/** What a bubble shows for one message, from the server's answer (or why there is none). */
|
|
65
|
+
export type BubbleTranslation = {
|
|
66
|
+
kind: 'translated';
|
|
67
|
+
text: string;
|
|
68
|
+
from: TranslateLanguage;
|
|
69
|
+
} | {
|
|
70
|
+
kind: 'failed';
|
|
71
|
+
code: 'unsafe' | 'limit' | 'ai' | 'offline' | 'error';
|
|
72
|
+
from?: TranslateLanguage;
|
|
73
|
+
};
|
|
74
|
+
/** Everything a bubble needs, shared through the conversation. */
|
|
75
|
+
export interface ChatTranslateContextValue {
|
|
76
|
+
active: boolean;
|
|
77
|
+
my: TranslateLanguage;
|
|
78
|
+
showOriginals: boolean;
|
|
79
|
+
translations: Record<string, BubbleTranslation | null>;
|
|
80
|
+
pending: boolean;
|
|
81
|
+
retry(): void;
|
|
82
|
+
}
|
|
83
|
+
export declare const ChatTranslateContext: import("react").Context<ChatTranslateContextValue | null>;
|
|
84
|
+
export declare function useBubbleTranslation(m: Message): {
|
|
85
|
+
ctx: ChatTranslateContextValue;
|
|
86
|
+
tr: BubbleTranslation | null;
|
|
87
|
+
} | null;
|
|
88
|
+
/** Texts that need a translation: with a typed record the writer's own text is already known, so no call. */
|
|
89
|
+
export declare function needsTranslation(m: Message): boolean;
|
|
90
|
+
/**
|
|
91
|
+
* Translations of the loaded text messages, only while Live translate is on. The server caches them per message,
|
|
92
|
+
* revision and target language (a reload or a teammate with the same language costs nothing); here each answer is
|
|
93
|
+
* kept in the query cache so a message is asked for once. A failed ask is shown on the bubble and retried only by
|
|
94
|
+
* the person ("Try again"), never by itself.
|
|
95
|
+
*/
|
|
96
|
+
export declare function useChatTranslations(jid: string, messages: readonly Message[], my: TranslateLanguage, active: boolean): {
|
|
97
|
+
translations: Record<string, BubbleTranslation | null>;
|
|
98
|
+
pending: boolean;
|
|
99
|
+
retry: () => void;
|
|
100
|
+
};
|
|
101
|
+
/**
|
|
102
|
+
* The translated last message of each listed chat where my switch is on, from what this tab already holds
|
|
103
|
+
* (chats opened here). The list never asks the AI. Works without a query client (then nothing is translated).
|
|
104
|
+
*/
|
|
105
|
+
export declare function useCachedLastTranslations(chats: readonly {
|
|
106
|
+
jid: string;
|
|
107
|
+
lastMessagePreview: string | null;
|
|
108
|
+
}[]): ReadonlyMap<string, string>;
|
|
109
|
+
/** The text for the customer, checked on the server (protected items kept). Nothing is stored or sent. */
|
|
110
|
+
export declare function translateDraft(jid: string, body: {
|
|
111
|
+
text: string;
|
|
112
|
+
target: TranslateLanguage;
|
|
113
|
+
}): Promise<{
|
|
114
|
+
status: "ok";
|
|
115
|
+
translation: string;
|
|
116
|
+
from: "en" | "ms" | "id" | "zh" | "ta" | "th" | "vi" | "ar" | "ja" | "ko";
|
|
117
|
+
protected: string[];
|
|
118
|
+
draftId: string;
|
|
119
|
+
} | {
|
|
120
|
+
status: "refused";
|
|
121
|
+
item: string;
|
|
122
|
+
became: string;
|
|
123
|
+
}>;
|
|
124
|
+
/** Chat-level "Show originals", kept per chat for this browser tab. */
|
|
125
|
+
export declare function useShowOriginals(jid: string): readonly [boolean, import("react").Dispatch<import("react").SetStateAction<boolean>>];
|
|
@@ -79,6 +79,13 @@ export declare function useEditMessage(): import("@tanstack/react-query").UseMut
|
|
|
79
79
|
deletedBy?: "phone" | "team" | "sender" | "group_admin" | null | undefined;
|
|
80
80
|
deletedByUserId?: number | null | undefined;
|
|
81
81
|
hidden?: boolean | undefined;
|
|
82
|
+
typed?: {
|
|
83
|
+
typedText: string;
|
|
84
|
+
typedLanguage: "en" | "ms" | "id" | "zh" | "ta" | "th" | "vi" | "ar" | "ja" | "ko";
|
|
85
|
+
sentLanguage: "en" | "ms" | "id" | "zh" | "ta" | "th" | "vi" | "ar" | "ja" | "ko";
|
|
86
|
+
edited: boolean;
|
|
87
|
+
} | null | undefined;
|
|
88
|
+
sentOriginal?: boolean | undefined;
|
|
82
89
|
}, Error, {
|
|
83
90
|
id: string;
|
|
84
91
|
text: string;
|
|
@@ -148,6 +155,13 @@ export declare function useDeleteMessage(): import("@tanstack/react-query").UseM
|
|
|
148
155
|
deletedBy?: "phone" | "team" | "sender" | "group_admin" | null | undefined;
|
|
149
156
|
deletedByUserId?: number | null | undefined;
|
|
150
157
|
hidden?: boolean | undefined;
|
|
158
|
+
typed?: {
|
|
159
|
+
typedText: string;
|
|
160
|
+
typedLanguage: "en" | "ms" | "id" | "zh" | "ta" | "th" | "vi" | "ar" | "ja" | "ko";
|
|
161
|
+
sentLanguage: "en" | "ms" | "id" | "zh" | "ta" | "th" | "vi" | "ar" | "ja" | "ko";
|
|
162
|
+
edited: boolean;
|
|
163
|
+
} | null | undefined;
|
|
164
|
+
sentOriginal?: boolean | undefined;
|
|
151
165
|
}, Error, {
|
|
152
166
|
id: string;
|
|
153
167
|
scope: "everyone" | "me";
|
|
@@ -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 SetMemberChatsBody, type Message, type MessageListResponse, type MessageLocateResponse, 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 SetMemberChatsBody, type Message, type MessageListResponse, type MessageLocateResponse, type PatchUserBody, type Settings, type SendTranslation, type TranslateLanguage, type WaStatus } from '@ezychat/shared';
|
|
3
3
|
export interface ChatFilters {
|
|
4
4
|
status?: ChatStatus;
|
|
5
5
|
assigned: 'me' | 'none' | 'any';
|
|
@@ -123,6 +123,8 @@ export declare function useSetMyLocale(): import("@tanstack/react-query").UseMut
|
|
|
123
123
|
disabled: boolean;
|
|
124
124
|
createdAt: number;
|
|
125
125
|
locale: "en" | "ms" | "zh-CN" | null;
|
|
126
|
+
translateLanguage: "en" | "ms" | "id" | "zh" | "ta" | "th" | "vi" | "ar" | "ja" | "ko" | null;
|
|
127
|
+
sendWithoutPreview: boolean;
|
|
126
128
|
kind?: "ai" | "human" | undefined;
|
|
127
129
|
aiRole?: "sales" | undefined;
|
|
128
130
|
aiAgentId?: number | undefined;
|
|
@@ -337,6 +339,13 @@ export declare function useMessages(jid: string | null | undefined): import("@ta
|
|
|
337
339
|
deletedBy?: "phone" | "team" | "sender" | "group_admin" | null | undefined;
|
|
338
340
|
deletedByUserId?: number | null | undefined;
|
|
339
341
|
hidden?: boolean | undefined;
|
|
342
|
+
typed?: {
|
|
343
|
+
typedText: string;
|
|
344
|
+
typedLanguage: "en" | "ms" | "id" | "zh" | "ta" | "th" | "vi" | "ar" | "ja" | "ko";
|
|
345
|
+
sentLanguage: "en" | "ms" | "id" | "zh" | "ta" | "th" | "vi" | "ar" | "ja" | "ko";
|
|
346
|
+
edited: boolean;
|
|
347
|
+
} | null | undefined;
|
|
348
|
+
sentOriginal?: boolean | undefined;
|
|
340
349
|
}[];
|
|
341
350
|
nextBefore: string | null;
|
|
342
351
|
}, unknown>, Error>;
|
|
@@ -353,6 +362,12 @@ export interface SendTextInput {
|
|
|
353
362
|
shown?: string;
|
|
354
363
|
/** Generate with `newClientId()` (a random UUID). */
|
|
355
364
|
clientId: string;
|
|
365
|
+
/** Live translate: the checked translation being sent (the server keeps what was typed beside it). */
|
|
366
|
+
translation?: SendTranslation;
|
|
367
|
+
/** Live translate "Send original instead": the text goes out as typed. */
|
|
368
|
+
sentOriginal?: boolean;
|
|
369
|
+
/** Live translate: the language the text goes out in (for the pending bubble only). */
|
|
370
|
+
sentLanguage?: TranslateLanguage;
|
|
356
371
|
}
|
|
357
372
|
/** Optimistic text send: inserts a pending bubble immediately, reconciled by clientId. */
|
|
358
373
|
export declare function useSendText(jid: string): import("@tanstack/react-query").UseMutationResult<{
|
|
@@ -420,6 +435,13 @@ export declare function useSendText(jid: string): import("@tanstack/react-query"
|
|
|
420
435
|
deletedBy?: "phone" | "team" | "sender" | "group_admin" | null | undefined;
|
|
421
436
|
deletedByUserId?: number | null | undefined;
|
|
422
437
|
hidden?: boolean | undefined;
|
|
438
|
+
typed?: {
|
|
439
|
+
typedText: string;
|
|
440
|
+
typedLanguage: "en" | "ms" | "id" | "zh" | "ta" | "th" | "vi" | "ar" | "ja" | "ko";
|
|
441
|
+
sentLanguage: "en" | "ms" | "id" | "zh" | "ta" | "th" | "vi" | "ar" | "ja" | "ko";
|
|
442
|
+
edited: boolean;
|
|
443
|
+
} | null | undefined;
|
|
444
|
+
sentOriginal?: boolean | undefined;
|
|
423
445
|
}, Error, SendTextInput, {
|
|
424
446
|
clientId: string;
|
|
425
447
|
}>;
|
|
@@ -504,6 +526,13 @@ export declare function useSendMedia(jid: string): import("@tanstack/react-query
|
|
|
504
526
|
deletedBy?: "phone" | "team" | "sender" | "group_admin" | null | undefined;
|
|
505
527
|
deletedByUserId?: number | null | undefined;
|
|
506
528
|
hidden?: boolean | undefined;
|
|
529
|
+
typed?: {
|
|
530
|
+
typedText: string;
|
|
531
|
+
typedLanguage: "en" | "ms" | "id" | "zh" | "ta" | "th" | "vi" | "ar" | "ja" | "ko";
|
|
532
|
+
sentLanguage: "en" | "ms" | "id" | "zh" | "ta" | "th" | "vi" | "ar" | "ja" | "ko";
|
|
533
|
+
edited: boolean;
|
|
534
|
+
} | null | undefined;
|
|
535
|
+
sentOriginal?: boolean | undefined;
|
|
507
536
|
}, Error, SendMediaInput, void>;
|
|
508
537
|
export declare function useRetryMessage(): import("@tanstack/react-query").UseMutationResult<{
|
|
509
538
|
id: string;
|
|
@@ -570,6 +599,13 @@ export declare function useRetryMessage(): import("@tanstack/react-query").UseMu
|
|
|
570
599
|
deletedBy?: "phone" | "team" | "sender" | "group_admin" | null | undefined;
|
|
571
600
|
deletedByUserId?: number | null | undefined;
|
|
572
601
|
hidden?: boolean | undefined;
|
|
602
|
+
typed?: {
|
|
603
|
+
typedText: string;
|
|
604
|
+
typedLanguage: "en" | "ms" | "id" | "zh" | "ta" | "th" | "vi" | "ar" | "ja" | "ko";
|
|
605
|
+
sentLanguage: "en" | "ms" | "id" | "zh" | "ta" | "th" | "vi" | "ar" | "ja" | "ko";
|
|
606
|
+
edited: boolean;
|
|
607
|
+
} | null | undefined;
|
|
608
|
+
sentOriginal?: boolean | undefined;
|
|
573
609
|
}, Error, string, unknown>;
|
|
574
610
|
/**
|
|
575
611
|
* The linked number reacts to a message (`emoji` '' removes the reaction). The answer carries the
|
|
@@ -1071,6 +1107,7 @@ export declare function useApiTokens(): import("@tanstack/react-query").UseQuery
|
|
|
1071
1107
|
expiresAt: number | null;
|
|
1072
1108
|
canSend: boolean;
|
|
1073
1109
|
canMessageNewNumbers: boolean;
|
|
1110
|
+
canResolveChats: boolean;
|
|
1074
1111
|
connectedApp: boolean;
|
|
1075
1112
|
}[], Error>;
|
|
1076
1113
|
export interface CreateApiTokenVars {
|
|
@@ -1093,6 +1130,7 @@ export declare function useCreateApiToken(): import("@tanstack/react-query").Use
|
|
|
1093
1130
|
expiresAt: number | null;
|
|
1094
1131
|
canSend: boolean;
|
|
1095
1132
|
canMessageNewNumbers: boolean;
|
|
1133
|
+
canResolveChats: boolean;
|
|
1096
1134
|
connectedApp: boolean;
|
|
1097
1135
|
}, Error, CreateApiTokenVars, unknown>;
|
|
1098
1136
|
/** Changes whether a token may send (and message new numbers); only its owner may. */
|
|
@@ -1107,6 +1145,7 @@ export declare function useUpdateApiToken(): import("@tanstack/react-query").Use
|
|
|
1107
1145
|
expiresAt: number | null;
|
|
1108
1146
|
canSend: boolean;
|
|
1109
1147
|
canMessageNewNumbers: boolean;
|
|
1148
|
+
canResolveChats: boolean;
|
|
1110
1149
|
connectedApp: boolean;
|
|
1111
1150
|
}, Error, {
|
|
1112
1151
|
id: number;
|
|
@@ -93,6 +93,13 @@ export declare function useSendTemplate(jid: string): import("@tanstack/react-qu
|
|
|
93
93
|
deletedBy?: "phone" | "team" | "sender" | "group_admin" | null | undefined;
|
|
94
94
|
deletedByUserId?: number | null | undefined;
|
|
95
95
|
hidden?: boolean | undefined;
|
|
96
|
+
typed?: {
|
|
97
|
+
typedText: string;
|
|
98
|
+
typedLanguage: "en" | "ms" | "id" | "zh" | "ta" | "th" | "vi" | "ar" | "ja" | "ko";
|
|
99
|
+
sentLanguage: "en" | "ms" | "id" | "zh" | "ta" | "th" | "vi" | "ar" | "ja" | "ko";
|
|
100
|
+
edited: boolean;
|
|
101
|
+
} | null | undefined;
|
|
102
|
+
sentOriginal?: boolean | undefined;
|
|
96
103
|
}, Error, {
|
|
97
104
|
name: string;
|
|
98
105
|
language: string;
|
|
@@ -267,6 +267,13 @@ export declare const enResources: {
|
|
|
267
267
|
backTo: string;
|
|
268
268
|
more: string;
|
|
269
269
|
};
|
|
270
|
+
liveTranslate: {
|
|
271
|
+
label: string;
|
|
272
|
+
help: string;
|
|
273
|
+
default: string;
|
|
274
|
+
skipPreview: string;
|
|
275
|
+
skipPreviewHelp: string;
|
|
276
|
+
};
|
|
270
277
|
};
|
|
271
278
|
app: {
|
|
272
279
|
about: {
|
|
@@ -1925,6 +1932,99 @@ export declare const enResources: {
|
|
|
1925
1932
|
done: string;
|
|
1926
1933
|
isBlocked: string;
|
|
1927
1934
|
};
|
|
1935
|
+
liveTranslate: {
|
|
1936
|
+
button: string;
|
|
1937
|
+
buttonShort: string;
|
|
1938
|
+
buttonOn: string;
|
|
1939
|
+
buttonOff: string;
|
|
1940
|
+
composer: {
|
|
1941
|
+
placeholder: string;
|
|
1942
|
+
placeholderShort: string;
|
|
1943
|
+
};
|
|
1944
|
+
hint: {
|
|
1945
|
+
text: string;
|
|
1946
|
+
dismiss: string;
|
|
1947
|
+
};
|
|
1948
|
+
bar: {
|
|
1949
|
+
label: string;
|
|
1950
|
+
pair: string;
|
|
1951
|
+
groupPair: string;
|
|
1952
|
+
unknown: string;
|
|
1953
|
+
detected: string;
|
|
1954
|
+
showOriginals: string;
|
|
1955
|
+
languages: string;
|
|
1956
|
+
languagesTitle: string;
|
|
1957
|
+
customerWrites: string;
|
|
1958
|
+
auto: string;
|
|
1959
|
+
autoDetected: string;
|
|
1960
|
+
autoCommon: string;
|
|
1961
|
+
customerHelp: string;
|
|
1962
|
+
groupGets: string;
|
|
1963
|
+
groupHelp: string;
|
|
1964
|
+
youWrite: string;
|
|
1965
|
+
youHelp: string;
|
|
1966
|
+
usage: string;
|
|
1967
|
+
usageNoLimit: string;
|
|
1968
|
+
turnOff: string;
|
|
1969
|
+
noConnection: string;
|
|
1970
|
+
limit: string;
|
|
1971
|
+
same: string;
|
|
1972
|
+
notDetected: string;
|
|
1973
|
+
groupNote: string;
|
|
1974
|
+
offline: string;
|
|
1975
|
+
};
|
|
1976
|
+
bubble: {
|
|
1977
|
+
translatedFrom: string;
|
|
1978
|
+
showOriginal: string;
|
|
1979
|
+
hide: string;
|
|
1980
|
+
originalLabel: string;
|
|
1981
|
+
translating: string;
|
|
1982
|
+
retry: string;
|
|
1983
|
+
failed: {
|
|
1984
|
+
error: string;
|
|
1985
|
+
unsafe: string;
|
|
1986
|
+
limit: string;
|
|
1987
|
+
ai: string;
|
|
1988
|
+
offline: string;
|
|
1989
|
+
};
|
|
1990
|
+
sentIn: string;
|
|
1991
|
+
showSent: string;
|
|
1992
|
+
sentLabel: string;
|
|
1993
|
+
writtenIn: string;
|
|
1994
|
+
showTyped: string;
|
|
1995
|
+
typedLabel: string;
|
|
1996
|
+
typedEdited: string;
|
|
1997
|
+
sentOriginal: string;
|
|
1998
|
+
};
|
|
1999
|
+
preview: {
|
|
2000
|
+
title: string;
|
|
2001
|
+
close: string;
|
|
2002
|
+
youWrote: string;
|
|
2003
|
+
editMine: string;
|
|
2004
|
+
translateAgain: string;
|
|
2005
|
+
translating: string;
|
|
2006
|
+
sending: string;
|
|
2007
|
+
edit: string;
|
|
2008
|
+
done: string;
|
|
2009
|
+
editLabel: string;
|
|
2010
|
+
edited: string;
|
|
2011
|
+
kept: string;
|
|
2012
|
+
refusedTitle: string;
|
|
2013
|
+
refused: string;
|
|
2014
|
+
errors: {
|
|
2015
|
+
offline: string;
|
|
2016
|
+
noAi: string;
|
|
2017
|
+
limit: string;
|
|
2018
|
+
off: string;
|
|
2019
|
+
error: string;
|
|
2020
|
+
changed: string;
|
|
2021
|
+
expired: string;
|
|
2022
|
+
};
|
|
2023
|
+
retry: string;
|
|
2024
|
+
sendOriginal: string;
|
|
2025
|
+
send: string;
|
|
2026
|
+
};
|
|
2027
|
+
};
|
|
1928
2028
|
};
|
|
1929
2029
|
admin: {
|
|
1930
2030
|
title: string;
|
|
@@ -2272,6 +2372,7 @@ export declare const enResources: {
|
|
|
2272
2372
|
revoked: string;
|
|
2273
2373
|
canSendBadge: string;
|
|
2274
2374
|
canNewBadge: string;
|
|
2375
|
+
canResolveBadge: string;
|
|
2275
2376
|
signedInBadge: string;
|
|
2276
2377
|
tokenBadge: string;
|
|
2277
2378
|
};
|
|
@@ -2295,6 +2396,8 @@ export declare const enResources: {
|
|
|
2295
2396
|
canNewHint: string;
|
|
2296
2397
|
canNewWarningTitle: string;
|
|
2297
2398
|
canNewWarning: string;
|
|
2399
|
+
canResolve: string;
|
|
2400
|
+
canResolveHint: string;
|
|
2298
2401
|
};
|
|
2299
2402
|
created: {
|
|
2300
2403
|
title: string;
|
|
@@ -3792,6 +3895,7 @@ export declare const enResources: {
|
|
|
3792
3895
|
blocked: string;
|
|
3793
3896
|
openSignIn: string;
|
|
3794
3897
|
sameComputer: string;
|
|
3898
|
+
remoteSignIn: string;
|
|
3795
3899
|
cancelSignIn: string;
|
|
3796
3900
|
failed: {
|
|
3797
3901
|
denied: string;
|
|
@@ -4104,6 +4208,7 @@ export declare const enResources: {
|
|
|
4104
4208
|
expired: string;
|
|
4105
4209
|
};
|
|
4106
4210
|
pickSameComputer: string;
|
|
4211
|
+
remotePick: string;
|
|
4107
4212
|
tabsTitle: string;
|
|
4108
4213
|
tabsHint: string;
|
|
4109
4214
|
refresh: string;
|
|
@@ -4242,6 +4347,7 @@ export declare const enResources: {
|
|
|
4242
4347
|
pickBlocked: string;
|
|
4243
4348
|
openPicker: string;
|
|
4244
4349
|
pickSameComputer: string;
|
|
4350
|
+
remotePick: string;
|
|
4245
4351
|
pickError: {
|
|
4246
4352
|
cancelled: string;
|
|
4247
4353
|
failed: string;
|
|
@@ -5196,6 +5302,19 @@ export declare const enResources: {
|
|
|
5196
5302
|
limitBanTitle: string;
|
|
5197
5303
|
limitBanBody: string;
|
|
5198
5304
|
};
|
|
5305
|
+
liveTranslate: {
|
|
5306
|
+
title: string;
|
|
5307
|
+
description: string;
|
|
5308
|
+
enable: string;
|
|
5309
|
+
enableHelp: string;
|
|
5310
|
+
limit: string;
|
|
5311
|
+
limitHelp: string;
|
|
5312
|
+
privacy: string;
|
|
5313
|
+
usage_one: string;
|
|
5314
|
+
usage_other: string;
|
|
5315
|
+
noConnection: string;
|
|
5316
|
+
languages: string;
|
|
5317
|
+
};
|
|
5199
5318
|
};
|
|
5200
5319
|
errors: {
|
|
5201
5320
|
generic: string;
|
|
@@ -10,8 +10,10 @@ export interface ChatListItemProps {
|
|
|
10
10
|
inbox?: Pick<Inbox, 'name' | 'tone'>;
|
|
11
11
|
/** The chat's reply window has closed (WhatsApp Business API): only a template may be sent. */
|
|
12
12
|
windowClosed?: boolean;
|
|
13
|
+
/** Live translate on in this chat: the cached translation of the last message (the list never asks the AI). */
|
|
14
|
+
translatedPreview?: string | null;
|
|
13
15
|
}
|
|
14
16
|
export declare function GroupIcon({ className }: {
|
|
15
17
|
className?: string;
|
|
16
18
|
}): import("react").JSX.Element;
|
|
17
|
-
export declare function ChatListItem({ chat, active, assigneeName, assignedToMe, inbox, windowClosed, }: ChatListItemProps): import("react").JSX.Element;
|
|
19
|
+
export declare function ChatListItem({ chat, active, assigneeName, assignedToMe, inbox, windowClosed, translatedPreview, }: ChatListItemProps): import("react").JSX.Element;
|
|
@@ -1,6 +1,9 @@
|
|
|
1
1
|
import type { AiGroupChat, Chat, Inbox } from '@ezychat/shared';
|
|
2
2
|
import type { Directory } from './useDirectory';
|
|
3
3
|
export interface ConversationHeaderProps {
|
|
4
|
+
/** Live translate's button, once for a narrow header (beside the name) and once for a wide one (action row). */
|
|
5
|
+
translateNarrow?: React.ReactNode;
|
|
6
|
+
translateWide?: React.ReactNode;
|
|
4
7
|
chat: Chat;
|
|
5
8
|
directory: Directory;
|
|
6
9
|
onBack(): void;
|
|
@@ -28,4 +31,4 @@ export interface ConversationHeaderProps {
|
|
|
28
31
|
/** Admins only: the ⋮ menu with Delete chat (no menu without it). */
|
|
29
32
|
onDelete?(): void;
|
|
30
33
|
}
|
|
31
|
-
export declare function ConversationHeader({ chat, directory, onBack, onAssign, onToggleStatus, notesOpen, notesCount, onToggleNotes, showCustomer, customerOpen, onToggleCustomer, onOpenInfo, memberCount, inbox, groupAi, busy, onDelete, }: ConversationHeaderProps): import("react").JSX.Element;
|
|
34
|
+
export declare function ConversationHeader({ translateNarrow, translateWide, chat, directory, onBack, onAssign, onToggleStatus, notesOpen, notesCount, onToggleNotes, showCustomer, customerOpen, onToggleCustomer, onOpenInfo, memberCount, inbox, groupAi, busy, onDelete, }: ConversationHeaderProps): import("react").JSX.Element;
|
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
import { type TranslateLanguage as Lang } from '../api/live-translate';
|
|
2
|
+
import type { Message } from '@ezychat/shared';
|
|
3
|
+
/** Header button: turns Live translate on or off for this chat, for me only. Hidden while an admin has it off. */
|
|
4
|
+
export declare function TranslateHeaderButton({ jid, className }: {
|
|
5
|
+
jid: string;
|
|
6
|
+
className?: string;
|
|
7
|
+
}): import("react").JSX.Element | null;
|
|
8
|
+
/** The slim bar under the header while Live translate is on in this chat. */
|
|
9
|
+
export declare function TranslateBar({ jid, isGroup, showOriginals, onShowOriginals, }: {
|
|
10
|
+
jid: string;
|
|
11
|
+
isGroup: boolean;
|
|
12
|
+
showOriginals: boolean;
|
|
13
|
+
onShowOriginals(v: boolean): void;
|
|
14
|
+
}): import("react").JSX.Element | null;
|
|
15
|
+
/**
|
|
16
|
+
* Off, in a direct chat whose customer writes another language: a one-line hint above the composer. A hint only;
|
|
17
|
+
* Live translate never turns itself on.
|
|
18
|
+
*/
|
|
19
|
+
export declare function TranslateHint({ jid, isGroup }: {
|
|
20
|
+
jid: string;
|
|
21
|
+
isGroup: boolean;
|
|
22
|
+
}): import("react").JSX.Element | null;
|
|
23
|
+
/**
|
|
24
|
+
* The text of a bubble. On: the message in my language (what I typed for my own replies), with the other version
|
|
25
|
+
* one tap away. Off: the real message, plus "Written in …" on a reply that went through Live translate.
|
|
26
|
+
*/
|
|
27
|
+
export declare function BubbleText({ m, render, className, }: {
|
|
28
|
+
m: Message;
|
|
29
|
+
render(text: string): React.ReactNode;
|
|
30
|
+
className?: string;
|
|
31
|
+
}): import("react").JSX.Element;
|
|
32
|
+
/** What "Send" hands to the conversation: the checked text and the record the server keeps beside it. */
|
|
33
|
+
export interface PreviewSend {
|
|
34
|
+
text: string;
|
|
35
|
+
typedText: string;
|
|
36
|
+
edited: boolean;
|
|
37
|
+
draftId: string;
|
|
38
|
+
}
|
|
39
|
+
/**
|
|
40
|
+
* "Customer will get · 中文": the translation, the protected items kept, Send / Edit translation / Send original
|
|
41
|
+
* instead. With "Send without preview" on it sends as soon as the translation passes the check, and stays only when
|
|
42
|
+
* something went wrong. Nothing is sent until the person presses a send button (or chose to skip the preview).
|
|
43
|
+
*/
|
|
44
|
+
export declare function SendPreview({ jid, typed, my, customer, dailyLimit, autoSend, onSend, onSendOriginal, onDiscard, }: {
|
|
45
|
+
jid: string;
|
|
46
|
+
typed: string;
|
|
47
|
+
my: Lang;
|
|
48
|
+
customer: Lang;
|
|
49
|
+
dailyLimit: number;
|
|
50
|
+
autoSend: boolean;
|
|
51
|
+
onSend(send: PreviewSend): void;
|
|
52
|
+
onSendOriginal(text: string): void;
|
|
53
|
+
onDiscard(): void;
|
|
54
|
+
}): import("react").JSX.Element;
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Account → My language and "Send without preview" (off by default). My language defaults to
|
|
3
|
+
* the app language until the person picks one. Hidden while an admin has Live translate off.
|
|
4
|
+
*/
|
|
5
|
+
export declare function MyLanguageField(): import("react").JSX.Element | null;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@ezychat/web",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.86",
|
|
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.
|
|
43
|
+
"@ezychat/shared": "0.1.86",
|
|
44
44
|
"@fontsource-variable/inter": "^5.3.0",
|
|
45
45
|
"@tanstack/react-query": "^5.107.1",
|
|
46
46
|
"@types/react": "^19.3.0",
|