@ezychat/web 0.1.80 → 0.1.83
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/{inbox-BIHKs_xm.js → inbox-DB-xoUgi.js} +20 -4
- package/dist-lib/chunks/{inbox-DaYVsh_k.js → inbox-iKAC249b.js} +20 -4
- package/dist-lib/ezychat-web.css +1 -1
- package/dist-lib/index.js +5741 -5549
- package/dist-lib/types/api/client.d.ts +5 -0
- package/dist-lib/types/api/queries.d.ts +5 -0
- package/dist-lib/types/api/safety.d.ts +18 -1
- package/dist-lib/types/i18n/resources.d.ts +16 -0
- package/dist-lib/types/inbox/BlockNumber.d.ts +7 -0
- package/dist-lib/types/inbox/MessageBubble.d.ts +7 -0
- package/dist-lib/types/lib/file-transfer.d.ts +14 -6
- package/dist-lib/types/lib/upload-progress.d.ts +6 -0
- package/package.json +6 -6
|
@@ -18,5 +18,10 @@ export interface ApiInit<T> {
|
|
|
18
18
|
* 401 additionally dispatches a `wati:unauthorized` window event.
|
|
19
19
|
*/
|
|
20
20
|
export declare function api<T = unknown>(path: string, init?: ApiInit<T>): Promise<T>;
|
|
21
|
+
/**
|
|
22
|
+
* POST a form to `/api${path}` with upload progress (fetch reports none): `onProgress` gets the share
|
|
23
|
+
* sent so far. Same answers and errors as `api()`.
|
|
24
|
+
*/
|
|
25
|
+
export declare function apiUpload<T = unknown>(path: string, form: FormData, onProgress: (share: number) => void): Promise<T>;
|
|
21
26
|
/** Friendly, translated message for any thrown error. */
|
|
22
27
|
export declare function errorMessage(e: unknown): string;
|
|
@@ -419,6 +419,11 @@ export interface SendMediaInput {
|
|
|
419
419
|
/** A video above the number's video limit goes as a file (a document, full quality). */
|
|
420
420
|
asFile?: boolean;
|
|
421
421
|
}
|
|
422
|
+
/**
|
|
423
|
+
* The error a failed upload's bubble keeps: WhatsApp's size refusals by code, a 413 that is not ours
|
|
424
|
+
* (Cloudflare's tunnel limit answers without our JSON) as `tunnel_too_large`, else the message.
|
|
425
|
+
*/
|
|
426
|
+
export declare function uploadFailure(e: unknown): string;
|
|
422
427
|
export declare function useSendMedia(jid: string): import("@tanstack/react-query").UseMutationResult<{
|
|
423
428
|
id: string;
|
|
424
429
|
chatJid: string;
|
|
@@ -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>;
|
|
@@ -769,6 +769,7 @@ export declare const enResources: {
|
|
|
769
769
|
remove: string;
|
|
770
770
|
caption: string;
|
|
771
771
|
too_large: string;
|
|
772
|
+
tunnel_limit: string;
|
|
772
773
|
empty: string;
|
|
773
774
|
too_many: string;
|
|
774
775
|
drop: string;
|
|
@@ -1022,7 +1023,9 @@ export declare const enResources: {
|
|
|
1022
1023
|
too_large: string;
|
|
1023
1024
|
too_large_as_video: string;
|
|
1024
1025
|
too_large_for_whatsapp: string;
|
|
1026
|
+
tunnel_too_large: string;
|
|
1025
1027
|
};
|
|
1028
|
+
uploading: string;
|
|
1026
1029
|
};
|
|
1027
1030
|
media: {
|
|
1028
1031
|
types: {
|
|
@@ -1822,6 +1825,19 @@ export declare const enResources: {
|
|
|
1822
1825
|
thisNumber: string;
|
|
1823
1826
|
loadFailed: string;
|
|
1824
1827
|
};
|
|
1828
|
+
block: {
|
|
1829
|
+
title: string;
|
|
1830
|
+
hint: string;
|
|
1831
|
+
button: string;
|
|
1832
|
+
cannot: string;
|
|
1833
|
+
confirmTitle: string;
|
|
1834
|
+
confirmBody: string;
|
|
1835
|
+
spam: string;
|
|
1836
|
+
spamHint: string;
|
|
1837
|
+
confirm: string;
|
|
1838
|
+
done: string;
|
|
1839
|
+
isBlocked: string;
|
|
1840
|
+
};
|
|
1825
1841
|
};
|
|
1826
1842
|
admin: {
|
|
1827
1843
|
title: 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;
|
|
@@ -44,3 +44,10 @@ export declare function MessageBubble({ message: m, showSender, outboundLabel, q
|
|
|
44
44
|
export declare const LARGE_FILE_BYTES: number;
|
|
45
45
|
/** Why a message was not sent, in plain words. */
|
|
46
46
|
export declare function failedReason(error: string | null, t: TFunction<['inbox', 'common']>): string;
|
|
47
|
+
/**
|
|
48
|
+
* The upload of a file this browser is sending: a bar and the percentage above the file's
|
|
49
|
+
* "Uploading …" placeholder, until it arrived.
|
|
50
|
+
*/
|
|
51
|
+
export declare function UploadingProgress({ clientId }: Readonly<{
|
|
52
|
+
clientId: string | null | undefined;
|
|
53
|
+
}>): React.JSX.Element | null;
|
|
@@ -9,22 +9,30 @@ export declare function hasFiles(dt: Pick<DataTransfer, 'types'> | null | undefi
|
|
|
9
9
|
export declare function filesFromTransfer(dt: Pick<DataTransfer, 'files'> | null | undefined, now?: () => Date): File[];
|
|
10
10
|
export type RejectedFile = {
|
|
11
11
|
file: File;
|
|
12
|
-
|
|
12
|
+
/** `tunnel_limit`: above what the Cloudflare tunnel passes (it works on this PC or the LAN). */
|
|
13
|
+
reason: 'too_large' | 'empty' | 'too_many' | 'tunnel_limit';
|
|
13
14
|
/** The limit a `too_large` file went over, in bytes. */
|
|
14
15
|
limit?: number;
|
|
15
16
|
};
|
|
16
17
|
/** What a chat's WhatsApp number takes, per kind of file (`InboxCapabilities.mediaLimits`). */
|
|
17
18
|
export type MediaLimits = Partial<Record<'video' | 'image' | 'audio' | 'document', number>>;
|
|
18
19
|
/**
|
|
19
|
-
* The largest file of this type the chat's number takes
|
|
20
|
-
*
|
|
21
|
-
*
|
|
20
|
+
* The largest file of this type the chat's number takes (`mediaLimits`), or undefined when it knows
|
|
21
|
+
* none: the app has no size cap of its own. A video is checked against the document limit only:
|
|
22
|
+
* above the video limit it goes as a file (`videoNeedsFile`).
|
|
22
23
|
*/
|
|
23
|
-
export declare function uploadLimitFor(mime: string, limits?: MediaLimits | null): number;
|
|
24
|
+
export declare function uploadLimitFor(mime: string, limits?: MediaLimits | null): number | undefined;
|
|
24
25
|
/** A video above the number's video limit (it can still go as a file, up to the document limit). */
|
|
25
26
|
export declare function videoNeedsFile(file: File, limits?: MediaLimits | null): boolean;
|
|
27
|
+
/**
|
|
28
|
+
* The app is open through the internet address (the Cloudflare tunnel), not on this computer or the
|
|
29
|
+
* local network: loopback, private IPv4, IPv6 literals, single-label and `.local` names are local.
|
|
30
|
+
*/
|
|
31
|
+
export declare function isTunnelHost(hostname: string): boolean;
|
|
26
32
|
/** Splits files into the ones that can be sent and the ones refused before any upload. */
|
|
27
|
-
export declare function checkAttachments(files: readonly File[], alreadyQueued: number, limits?: MediaLimits | null
|
|
33
|
+
export declare function checkAttachments(files: readonly File[], alreadyQueued: number, limits?: MediaLimits | null, opts?: {
|
|
34
|
+
tunnel?: boolean;
|
|
35
|
+
}): {
|
|
28
36
|
accepted: File[];
|
|
29
37
|
rejected: RejectedFile[];
|
|
30
38
|
};
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
/** The share of `clientId`'s file uploaded so far (0..1), or null to clear it. */
|
|
2
|
+
export declare function setUploadProgress(clientId: string, share: number | null): void;
|
|
3
|
+
/** The current share of `clientId`'s upload (0..1), or null. */
|
|
4
|
+
export declare function uploadProgressOf(clientId: string): number | null;
|
|
5
|
+
/** The upload progress of a message's file (0..1), or null when it is not uploading. */
|
|
6
|
+
export declare function useUploadProgress(clientId: string | null | undefined): number | null;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@ezychat/web",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.83",
|
|
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.83",
|
|
44
44
|
"@fontsource-variable/inter": "^5.3.0",
|
|
45
45
|
"@tanstack/react-query": "^5.105.0",
|
|
46
46
|
"@types/react": "^19.3.0",
|
|
@@ -60,8 +60,8 @@
|
|
|
60
60
|
"radix-ui": "^1.8.1",
|
|
61
61
|
"react": "^19.3.1",
|
|
62
62
|
"react-dom": "^19.3.1",
|
|
63
|
-
"react-i18next": "^17.1.
|
|
64
|
-
"react-router-dom": "^7.18.
|
|
63
|
+
"react-i18next": "^17.1.12",
|
|
64
|
+
"react-router-dom": "^7.18.5",
|
|
65
65
|
"socket.io-client": "^4.8.4",
|
|
66
66
|
"sonner": "^2.0.8",
|
|
67
67
|
"tailwind-merge": "^3.7.0",
|
|
@@ -69,13 +69,13 @@
|
|
|
69
69
|
"vaul": "^1.1.2"
|
|
70
70
|
},
|
|
71
71
|
"devDependencies": {
|
|
72
|
-
"@tailwindcss/vite": "^4.3.
|
|
72
|
+
"@tailwindcss/vite": "^4.3.4",
|
|
73
73
|
"@testing-library/dom": "^10.4.2",
|
|
74
74
|
"@testing-library/jest-dom": "^7.0.1",
|
|
75
75
|
"@testing-library/react": "^16.3.3",
|
|
76
76
|
"@testing-library/user-event": "^14.6.8",
|
|
77
77
|
"@types/nspell": "2.1.6",
|
|
78
|
-
"@vitejs/plugin-react": "^6.1
|
|
78
|
+
"@vitejs/plugin-react": "^6.2.1",
|
|
79
79
|
"dictionary-en-gb": "3.0.0",
|
|
80
80
|
"jsdom": "^30.1.3",
|
|
81
81
|
"tailwindcss": "^4.3.3",
|