@ezychat/web 0.1.79 → 0.1.82
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-iUbtLuDB.js → inbox-Dou5URiO.js} +100 -4
- package/dist-lib/chunks/{inbox-RAdHANUD.js → inbox-DtH27Ic2.js} +100 -4
- package/dist-lib/ezychat-web.css +1 -1
- package/dist-lib/index.js +7753 -7109
- package/dist-lib/types/api/client.d.ts +5 -0
- package/dist-lib/types/api/forward.d.ts +76 -0
- package/dist-lib/types/api/inbox-mutations.d.ts +14 -0
- package/dist-lib/types/api/message-changes.d.ts +14 -0
- package/dist-lib/types/api/queries.d.ts +42 -0
- package/dist-lib/types/api/templates.d.ts +7 -0
- package/dist-lib/types/i18n/resources.d.ts +98 -0
- package/dist-lib/types/inbox/Composer.d.ts +4 -1
- package/dist-lib/types/inbox/ForwardDialog.d.ts +11 -0
- package/dist-lib/types/inbox/MediaView.d.ts +3 -0
- package/dist-lib/types/inbox/MessageActions.d.ts +7 -2
- package/dist-lib/types/inbox/MessageBubble.d.ts +11 -0
- package/dist-lib/types/inbox/ReactionPicker.d.ts +3 -1
- package/dist-lib/types/inbox/message-changes.d.ts +12 -0
- package/dist-lib/types/lib/file-transfer.d.ts +22 -2
- 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;
|
|
@@ -0,0 +1,76 @@
|
|
|
1
|
+
import { type ForwardMessageBody } from '@ezychat/shared';
|
|
2
|
+
/**
|
|
3
|
+
* Forward one message to 1–5 existing chats (docs/features/forward-message/design.md). The server
|
|
4
|
+
* checks every chat before anything is sent and answers the copies, one per chat.
|
|
5
|
+
*/
|
|
6
|
+
export declare function useForwardMessage(): import("@tanstack/react-query").UseMutationResult<{
|
|
7
|
+
messages: {
|
|
8
|
+
id: string;
|
|
9
|
+
chatJid: string;
|
|
10
|
+
senderJid: string | null;
|
|
11
|
+
senderName: string | null;
|
|
12
|
+
fromMe: boolean;
|
|
13
|
+
sentByUserId: number | null;
|
|
14
|
+
type: "text" | "image" | "video" | "audio" | "document" | "sticker" | "system";
|
|
15
|
+
body: string | null;
|
|
16
|
+
mediaUrl: string | null;
|
|
17
|
+
mediaMime: string | null;
|
|
18
|
+
mediaName: string | null;
|
|
19
|
+
mediaStatus: "none" | "pending" | "failed" | "ok";
|
|
20
|
+
quotedId: string | null;
|
|
21
|
+
status: "pending" | "failed" | "sent" | "delivered" | "read";
|
|
22
|
+
error: string | null;
|
|
23
|
+
timestamp: number;
|
|
24
|
+
clientId: string | null;
|
|
25
|
+
reactions: {
|
|
26
|
+
emoji: string;
|
|
27
|
+
senderJid: string | null;
|
|
28
|
+
fromMe: boolean;
|
|
29
|
+
at: number;
|
|
30
|
+
sentByUserId: number | null;
|
|
31
|
+
senderName?: string | null | undefined;
|
|
32
|
+
}[];
|
|
33
|
+
voiceNote?: boolean | undefined;
|
|
34
|
+
template?: {
|
|
35
|
+
name: string;
|
|
36
|
+
language: string;
|
|
37
|
+
} | null | undefined;
|
|
38
|
+
viaAssistant?: boolean | undefined;
|
|
39
|
+
forwarded?: {
|
|
40
|
+
manyTimes: boolean;
|
|
41
|
+
} | null | undefined;
|
|
42
|
+
mediaSize?: number | null | undefined;
|
|
43
|
+
mediaWidth?: number | null | undefined;
|
|
44
|
+
mediaHeight?: number | null | undefined;
|
|
45
|
+
mediaThumbUrl?: string | null | undefined;
|
|
46
|
+
scheduledTask?: {
|
|
47
|
+
id: number;
|
|
48
|
+
name: string | null;
|
|
49
|
+
} | null | undefined;
|
|
50
|
+
transcript?: string | null | undefined;
|
|
51
|
+
transcriptLang?: string | null | undefined;
|
|
52
|
+
transcriptStatus?: "pending" | "failed" | "ok" | "skipped" | "too_long" | "unsupported" | null | undefined;
|
|
53
|
+
senderProfile?: {
|
|
54
|
+
chatJid: string;
|
|
55
|
+
name: string;
|
|
56
|
+
} | null | undefined;
|
|
57
|
+
safety?: {
|
|
58
|
+
itemId: number;
|
|
59
|
+
level: "none" | "warning" | "high";
|
|
60
|
+
rules: ("exeInZip" | "executable" | "doubleExtension" | "scamNumber" | "cantInspect" | "macroFile" | "unlockCodeInMessage" | "openOnComputer" | "lookalikeLink" | "financeUrgency" | "firstFile")[];
|
|
61
|
+
aiReason: string | null;
|
|
62
|
+
locked: boolean;
|
|
63
|
+
deletedBy: string | null;
|
|
64
|
+
status: "open" | "safe" | "reported" | "blocked" | "cleared";
|
|
65
|
+
} | null | undefined;
|
|
66
|
+
editedAt?: number | null | undefined;
|
|
67
|
+
editCount?: number | undefined;
|
|
68
|
+
deletedAt?: number | null | undefined;
|
|
69
|
+
deletedBy?: "phone" | "team" | "sender" | "group_admin" | null | undefined;
|
|
70
|
+
deletedByUserId?: number | null | undefined;
|
|
71
|
+
hidden?: boolean | undefined;
|
|
72
|
+
}[];
|
|
73
|
+
}, Error, {
|
|
74
|
+
id: string;
|
|
75
|
+
body: ForwardMessageBody;
|
|
76
|
+
}, unknown>;
|
|
@@ -29,6 +29,13 @@ export declare function useCreateInbox(): import("@tanstack/react-query").UseMut
|
|
|
29
29
|
editMessage?: boolean | undefined;
|
|
30
30
|
deleteForEveryone?: boolean | undefined;
|
|
31
31
|
deleteForMe?: boolean | undefined;
|
|
32
|
+
mediaLimits?: {
|
|
33
|
+
video?: number | undefined;
|
|
34
|
+
image?: number | undefined;
|
|
35
|
+
audio?: number | undefined;
|
|
36
|
+
document?: number | undefined;
|
|
37
|
+
} | undefined;
|
|
38
|
+
forwardedMark?: boolean | undefined;
|
|
32
39
|
};
|
|
33
40
|
memberIds?: number[] | undefined;
|
|
34
41
|
}, Error, {
|
|
@@ -65,6 +72,13 @@ export declare function useUpdateInbox(): import("@tanstack/react-query").UseMut
|
|
|
65
72
|
editMessage?: boolean | undefined;
|
|
66
73
|
deleteForEveryone?: boolean | undefined;
|
|
67
74
|
deleteForMe?: boolean | undefined;
|
|
75
|
+
mediaLimits?: {
|
|
76
|
+
video?: number | undefined;
|
|
77
|
+
image?: number | undefined;
|
|
78
|
+
audio?: number | undefined;
|
|
79
|
+
document?: number | undefined;
|
|
80
|
+
} | undefined;
|
|
81
|
+
forwardedMark?: boolean | undefined;
|
|
68
82
|
};
|
|
69
83
|
memberIds?: number[] | undefined;
|
|
70
84
|
}, Error, {
|
|
@@ -46,6 +46,13 @@ export declare function useEditMessage(): import("@tanstack/react-query").UseMut
|
|
|
46
46
|
language: string;
|
|
47
47
|
} | null | undefined;
|
|
48
48
|
viaAssistant?: boolean | undefined;
|
|
49
|
+
forwarded?: {
|
|
50
|
+
manyTimes: boolean;
|
|
51
|
+
} | null | undefined;
|
|
52
|
+
mediaSize?: number | null | undefined;
|
|
53
|
+
mediaWidth?: number | null | undefined;
|
|
54
|
+
mediaHeight?: number | null | undefined;
|
|
55
|
+
mediaThumbUrl?: string | null | undefined;
|
|
49
56
|
scheduledTask?: {
|
|
50
57
|
id: number;
|
|
51
58
|
name: string | null;
|
|
@@ -108,6 +115,13 @@ export declare function useDeleteMessage(): import("@tanstack/react-query").UseM
|
|
|
108
115
|
language: string;
|
|
109
116
|
} | null | undefined;
|
|
110
117
|
viaAssistant?: boolean | undefined;
|
|
118
|
+
forwarded?: {
|
|
119
|
+
manyTimes: boolean;
|
|
120
|
+
} | null | undefined;
|
|
121
|
+
mediaSize?: number | null | undefined;
|
|
122
|
+
mediaWidth?: number | null | undefined;
|
|
123
|
+
mediaHeight?: number | null | undefined;
|
|
124
|
+
mediaThumbUrl?: string | null | undefined;
|
|
111
125
|
scheduledTask?: {
|
|
112
126
|
id: number;
|
|
113
127
|
name: string | null;
|
|
@@ -289,6 +289,13 @@ export declare function useMessages(jid: string | null | undefined): import("@ta
|
|
|
289
289
|
language: string;
|
|
290
290
|
} | null | undefined;
|
|
291
291
|
viaAssistant?: boolean | undefined;
|
|
292
|
+
forwarded?: {
|
|
293
|
+
manyTimes: boolean;
|
|
294
|
+
} | null | undefined;
|
|
295
|
+
mediaSize?: number | null | undefined;
|
|
296
|
+
mediaWidth?: number | null | undefined;
|
|
297
|
+
mediaHeight?: number | null | undefined;
|
|
298
|
+
mediaThumbUrl?: string | null | undefined;
|
|
292
299
|
scheduledTask?: {
|
|
293
300
|
id: number;
|
|
294
301
|
name: string | null;
|
|
@@ -365,6 +372,13 @@ export declare function useSendText(jid: string): import("@tanstack/react-query"
|
|
|
365
372
|
language: string;
|
|
366
373
|
} | null | undefined;
|
|
367
374
|
viaAssistant?: boolean | undefined;
|
|
375
|
+
forwarded?: {
|
|
376
|
+
manyTimes: boolean;
|
|
377
|
+
} | null | undefined;
|
|
378
|
+
mediaSize?: number | null | undefined;
|
|
379
|
+
mediaWidth?: number | null | undefined;
|
|
380
|
+
mediaHeight?: number | null | undefined;
|
|
381
|
+
mediaThumbUrl?: string | null | undefined;
|
|
368
382
|
scheduledTask?: {
|
|
369
383
|
id: number;
|
|
370
384
|
name: string | null;
|
|
@@ -402,7 +416,14 @@ export interface SendMediaInput {
|
|
|
402
416
|
quotedId?: string;
|
|
403
417
|
/** A recorded Ogg/Opus voice note: sent as a WhatsApp voice note, never with a caption. */
|
|
404
418
|
voiceNote?: boolean;
|
|
419
|
+
/** A video above the number's video limit goes as a file (a document, full quality). */
|
|
420
|
+
asFile?: boolean;
|
|
405
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;
|
|
406
427
|
export declare function useSendMedia(jid: string): import("@tanstack/react-query").UseMutationResult<{
|
|
407
428
|
id: string;
|
|
408
429
|
chatJid: string;
|
|
@@ -435,6 +456,13 @@ export declare function useSendMedia(jid: string): import("@tanstack/react-query
|
|
|
435
456
|
language: string;
|
|
436
457
|
} | null | undefined;
|
|
437
458
|
viaAssistant?: boolean | undefined;
|
|
459
|
+
forwarded?: {
|
|
460
|
+
manyTimes: boolean;
|
|
461
|
+
} | null | undefined;
|
|
462
|
+
mediaSize?: number | null | undefined;
|
|
463
|
+
mediaWidth?: number | null | undefined;
|
|
464
|
+
mediaHeight?: number | null | undefined;
|
|
465
|
+
mediaThumbUrl?: string | null | undefined;
|
|
438
466
|
scheduledTask?: {
|
|
439
467
|
id: number;
|
|
440
468
|
name: string | null;
|
|
@@ -494,6 +522,13 @@ export declare function useRetryMessage(): import("@tanstack/react-query").UseMu
|
|
|
494
522
|
language: string;
|
|
495
523
|
} | null | undefined;
|
|
496
524
|
viaAssistant?: boolean | undefined;
|
|
525
|
+
forwarded?: {
|
|
526
|
+
manyTimes: boolean;
|
|
527
|
+
} | null | undefined;
|
|
528
|
+
mediaSize?: number | null | undefined;
|
|
529
|
+
mediaWidth?: number | null | undefined;
|
|
530
|
+
mediaHeight?: number | null | undefined;
|
|
531
|
+
mediaThumbUrl?: string | null | undefined;
|
|
497
532
|
scheduledTask?: {
|
|
498
533
|
id: number;
|
|
499
534
|
name: string | null;
|
|
@@ -840,6 +875,13 @@ export declare function useInboxes(opts?: {
|
|
|
840
875
|
editMessage?: boolean | undefined;
|
|
841
876
|
deleteForEveryone?: boolean | undefined;
|
|
842
877
|
deleteForMe?: boolean | undefined;
|
|
878
|
+
mediaLimits?: {
|
|
879
|
+
video?: number | undefined;
|
|
880
|
+
image?: number | undefined;
|
|
881
|
+
audio?: number | undefined;
|
|
882
|
+
document?: number | undefined;
|
|
883
|
+
} | undefined;
|
|
884
|
+
forwardedMark?: boolean | undefined;
|
|
843
885
|
};
|
|
844
886
|
memberIds?: number[] | undefined;
|
|
845
887
|
}[];
|
|
@@ -60,6 +60,13 @@ export declare function useSendTemplate(jid: string): import("@tanstack/react-qu
|
|
|
60
60
|
language: string;
|
|
61
61
|
} | null | undefined;
|
|
62
62
|
viaAssistant?: boolean | undefined;
|
|
63
|
+
forwarded?: {
|
|
64
|
+
manyTimes: boolean;
|
|
65
|
+
} | null | undefined;
|
|
66
|
+
mediaSize?: number | null | undefined;
|
|
67
|
+
mediaWidth?: number | null | undefined;
|
|
68
|
+
mediaHeight?: number | null | undefined;
|
|
69
|
+
mediaThumbUrl?: string | null | undefined;
|
|
63
70
|
scheduledTask?: {
|
|
64
71
|
id: number;
|
|
65
72
|
name: string | null;
|
|
@@ -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;
|
|
@@ -797,6 +798,7 @@ export declare const enResources: {
|
|
|
797
798
|
unavailable: string;
|
|
798
799
|
unavailableHint: string;
|
|
799
800
|
};
|
|
801
|
+
sentAsFile: string;
|
|
800
802
|
};
|
|
801
803
|
quickReplies: {
|
|
802
804
|
title: string;
|
|
@@ -1017,6 +1019,13 @@ export declare const enResources: {
|
|
|
1017
1019
|
};
|
|
1018
1020
|
scheduled: string;
|
|
1019
1021
|
scheduledNamed: string;
|
|
1022
|
+
uploadErrors: {
|
|
1023
|
+
too_large: string;
|
|
1024
|
+
too_large_as_video: string;
|
|
1025
|
+
too_large_for_whatsapp: string;
|
|
1026
|
+
tunnel_too_large: string;
|
|
1027
|
+
};
|
|
1028
|
+
uploading: string;
|
|
1020
1029
|
};
|
|
1021
1030
|
media: {
|
|
1022
1031
|
types: {
|
|
@@ -1727,6 +1736,95 @@ export declare const enResources: {
|
|
|
1727
1736
|
};
|
|
1728
1737
|
usageNoLimit: string;
|
|
1729
1738
|
};
|
|
1739
|
+
forward: {
|
|
1740
|
+
action: string;
|
|
1741
|
+
lockedReason: string;
|
|
1742
|
+
forwarded: string;
|
|
1743
|
+
forwardedMany: string;
|
|
1744
|
+
title: string;
|
|
1745
|
+
description: string;
|
|
1746
|
+
manyTimesNote: string;
|
|
1747
|
+
count: string;
|
|
1748
|
+
full: string;
|
|
1749
|
+
remove: string;
|
|
1750
|
+
search: string;
|
|
1751
|
+
listLabel: string;
|
|
1752
|
+
loading: string;
|
|
1753
|
+
emptyTitle: string;
|
|
1754
|
+
emptyQuery: string;
|
|
1755
|
+
emptyNone: string;
|
|
1756
|
+
windowClosedRow: string;
|
|
1757
|
+
otherInbox: string;
|
|
1758
|
+
cancel: string;
|
|
1759
|
+
send: string;
|
|
1760
|
+
sendCount_one: string;
|
|
1761
|
+
sendCount_other: string;
|
|
1762
|
+
sending: string;
|
|
1763
|
+
sentOne: string;
|
|
1764
|
+
sentMany_one: string;
|
|
1765
|
+
sentMany_other: string;
|
|
1766
|
+
openChat: string;
|
|
1767
|
+
problems: {
|
|
1768
|
+
wa_disconnected: {
|
|
1769
|
+
title: string;
|
|
1770
|
+
body: string;
|
|
1771
|
+
};
|
|
1772
|
+
window_closed: {
|
|
1773
|
+
title: string;
|
|
1774
|
+
body: string;
|
|
1775
|
+
};
|
|
1776
|
+
safety_locked: {
|
|
1777
|
+
title: string;
|
|
1778
|
+
body: string;
|
|
1779
|
+
};
|
|
1780
|
+
rate_limited: {
|
|
1781
|
+
title: string;
|
|
1782
|
+
body: string;
|
|
1783
|
+
};
|
|
1784
|
+
media_unavailable: {
|
|
1785
|
+
title: string;
|
|
1786
|
+
body: string;
|
|
1787
|
+
};
|
|
1788
|
+
message_deleted: {
|
|
1789
|
+
title: string;
|
|
1790
|
+
body: string;
|
|
1791
|
+
};
|
|
1792
|
+
other: {
|
|
1793
|
+
title: string;
|
|
1794
|
+
body: string;
|
|
1795
|
+
};
|
|
1796
|
+
too_large_as_video: {
|
|
1797
|
+
title: string;
|
|
1798
|
+
body: string;
|
|
1799
|
+
};
|
|
1800
|
+
too_large_for_whatsapp: {
|
|
1801
|
+
title: string;
|
|
1802
|
+
body: string;
|
|
1803
|
+
};
|
|
1804
|
+
message_not_sent: {
|
|
1805
|
+
title: string;
|
|
1806
|
+
body: string;
|
|
1807
|
+
};
|
|
1808
|
+
inbox_removed: {
|
|
1809
|
+
title: string;
|
|
1810
|
+
body: string;
|
|
1811
|
+
};
|
|
1812
|
+
forward_many_times: {
|
|
1813
|
+
title: string;
|
|
1814
|
+
body: string;
|
|
1815
|
+
};
|
|
1816
|
+
};
|
|
1817
|
+
largeNote: string;
|
|
1818
|
+
sendAs: string;
|
|
1819
|
+
asVideo: string;
|
|
1820
|
+
asFile: string;
|
|
1821
|
+
sendAsHint: string;
|
|
1822
|
+
videoTooBig: string;
|
|
1823
|
+
tooBigRow: string;
|
|
1824
|
+
sendingLarge: string;
|
|
1825
|
+
thisNumber: string;
|
|
1826
|
+
loadFailed: string;
|
|
1827
|
+
};
|
|
1730
1828
|
};
|
|
1731
1829
|
admin: {
|
|
1732
1830
|
title: string;
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import type React from 'react';
|
|
2
2
|
import { type GroupMember, type QuickReply, type ReplyPhraseListItem, type FixEnglishStatus } from '@ezychat/shared';
|
|
3
|
+
import { type MediaLimits } from '../lib/file-transfer';
|
|
3
4
|
/** Lets the conversation hand files dropped anywhere on it to the composer. */
|
|
4
5
|
export interface ComposerHandle {
|
|
5
6
|
addFiles(files: readonly File[]): void;
|
|
@@ -65,6 +66,8 @@ export interface ComposerProps {
|
|
|
65
66
|
error: boolean;
|
|
66
67
|
onOpen(): void;
|
|
67
68
|
} | null;
|
|
69
|
+
/** What this chat's WhatsApp number takes per kind of file (bytes); absent = the upload limit. */
|
|
70
|
+
mediaLimits?: MediaLimits | null;
|
|
68
71
|
/**
|
|
69
72
|
* Fix English (docs/features/grammar-fix/design.md): spelling and grammar marks in this chat
|
|
70
73
|
* (any chat type; null or a status with both checks off = nothing shown).
|
|
@@ -79,4 +82,4 @@ export interface ComposerProps {
|
|
|
79
82
|
onAddWord(word: string): Promise<unknown>;
|
|
80
83
|
} | null;
|
|
81
84
|
}
|
|
82
|
-
export declare function Composer({ quickReplies, onSend, onAttach, onVoiceNote, onTyping, confirmSend, disabled, placeholder, replyTo, onCancelReply, aiSuggest, askEzy, fixEnglish, mentions, ref, }: ComposerProps): React.JSX.Element;
|
|
85
|
+
export declare function Composer({ quickReplies, onSend, onAttach, onVoiceNote, onTyping, confirmSend, disabled, placeholder, replyTo, onCancelReply, aiSuggest, askEzy, fixEnglish, mentions, mediaLimits, ref, }: ComposerProps): React.JSX.Element;
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { type Message } from '@ezychat/shared';
|
|
2
|
+
/** Server refusals shown as a banner. */
|
|
3
|
+
export type ForwardProblem = 'wa_disconnected' | 'window_closed' | 'safety_locked' | 'rate_limited' | 'media_unavailable' | 'message_deleted' | 'message_not_sent' | 'inbox_removed' | 'forward_many_times' | 'too_large_as_video' | 'too_large_for_whatsapp' | 'other';
|
|
4
|
+
/** The banner for a refused forward: the server's code, or `other`. */
|
|
5
|
+
export declare function forwardProblemOf(err: unknown): ForwardProblem;
|
|
6
|
+
export declare function ForwardDialog({ message, sourceInboxId, onClose, }: Readonly<{
|
|
7
|
+
message: Message;
|
|
8
|
+
/** The inbox of the chat the message is in (for the "own number" note). */
|
|
9
|
+
sourceInboxId: number;
|
|
10
|
+
onClose(): void;
|
|
11
|
+
}>): import("react").JSX.Element;
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import type React from 'react';
|
|
2
|
+
import { type CSSProperties } from 'react';
|
|
2
3
|
import type { Message } from '@ezychat/shared';
|
|
3
4
|
export interface MediaViewProps {
|
|
4
5
|
message: Message;
|
|
@@ -7,5 +8,7 @@ export interface MediaViewProps {
|
|
|
7
8
|
}
|
|
8
9
|
/** The file name a media file gets when dragged or saved out of the app. */
|
|
9
10
|
export declare function mediaFileName(m: Pick<Message, 'id' | 'type' | 'mediaName' | 'mediaMime'>): string;
|
|
11
|
+
/** The space an image takes in the chat, so nothing moves when its file arrives; undefined when its size is not known. */
|
|
12
|
+
export declare function imageBox(width: number | null | undefined, height: number | null | undefined): CSSProperties | undefined;
|
|
10
13
|
/** Renders the media part of a message (image, sticker, video, audio, document). */
|
|
11
14
|
export declare function MediaView({ message: m, onLoad }: MediaViewProps): React.JSX.Element;
|
|
@@ -4,13 +4,18 @@ import type { Directory } from './useDirectory';
|
|
|
4
4
|
/**
|
|
5
5
|
* The ⋮ button next to a message (hover or focus on desktop, like Reply; touch screens reach the
|
|
6
6
|
* same actions from the press-and-hold bar). Shown only when the user may do something with the
|
|
7
|
-
* message
|
|
7
|
+
* message: Forward first (every message that can be forwarded), then Edit and Delete. Edit stays
|
|
8
|
+
* visible, disabled, once its 15 minutes are over; Forward stays visible, disabled, for a file
|
|
9
|
+
* WhatsApp Safety locked.
|
|
8
10
|
*/
|
|
9
|
-
export declare function MessageMoreMenu({ rights, disabledReason, onEdit, onDelete, }: {
|
|
11
|
+
export declare function MessageMoreMenu({ rights, disabledReason, onEdit, onDelete, onForward, forwardLocked, }: {
|
|
10
12
|
rights: MessageRights;
|
|
11
13
|
disabledReason: string | null;
|
|
12
14
|
onEdit(): void;
|
|
13
15
|
onDelete(): void;
|
|
16
|
+
/** Set when the message can be forwarded. */
|
|
17
|
+
onForward?(): void;
|
|
18
|
+
forwardLocked?: boolean;
|
|
14
19
|
}): import("react").JSX.Element | null;
|
|
15
20
|
/** Edit a sent text or caption. WhatsApp shows the customer "Edited". */
|
|
16
21
|
export declare function EditMessageDialog({ message, onClose, }: {
|
|
@@ -40,3 +40,14 @@ export declare function StatusTicks({ status }: {
|
|
|
40
40
|
status: Message['status'];
|
|
41
41
|
}): React.JSX.Element;
|
|
42
42
|
export declare function MessageBubble({ message: m, showSender, outboundLabel, quoted, onRetry, retrying, onMediaLoad, directory, onReply, onReact, reactDisabledReason, contactName, changes, onOpenQuote, highlighted, }: MessageBubbleProps): React.JSX.Element;
|
|
43
|
+
/** From this size a file shows that it is still uploading, and Forward warns before sending it. */
|
|
44
|
+
export declare const LARGE_FILE_BYTES: number;
|
|
45
|
+
/** Why a message was not sent, in plain words. */
|
|
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;
|
|
@@ -17,6 +17,8 @@ export interface ReactionPickerProps {
|
|
|
17
17
|
disabledReason: string | null;
|
|
18
18
|
/** Touch screens open the bar by press-and-hold, so it offers Reply as well. */
|
|
19
19
|
onReply?(): void;
|
|
20
|
+
/** …and Forward, for a message that can be forwarded now. */
|
|
21
|
+
onForward?(): void;
|
|
20
22
|
/** …and Copy text, for a message with text. */
|
|
21
23
|
onCopy?(): void;
|
|
22
24
|
/** …and Edit / Delete, when the signed-in user may change the message now. */
|
|
@@ -28,4 +30,4 @@ export interface ReactionPickerProps {
|
|
|
28
30
|
* reaction per number, so the whole team shares the linked number's reaction: a new emoji replaces
|
|
29
31
|
* it, the same emoji again removes it.
|
|
30
32
|
*/
|
|
31
|
-
export declare function ReactionPicker({ out, current, currentBy, open, onOpenChange, onReact, disabledReason, onReply, onCopy, onEdit, onDelete, }: ReactionPickerProps): import("react").JSX.Element;
|
|
33
|
+
export declare function ReactionPicker({ out, current, currentBy, open, onOpenChange, onReact, disabledReason, onReply, onForward, onCopy, onEdit, onDelete, }: ReactionPickerProps): import("react").JSX.Element;
|
|
@@ -26,6 +26,16 @@ export declare function messageRights(m: Message, user: {
|
|
|
26
26
|
} | null, caps: Pick<InboxCapabilities, 'editMessage' | 'deleteForEveryone' | 'deleteForMe'>, now: number): MessageRights;
|
|
27
27
|
/** Anything to offer in the message's menu. */
|
|
28
28
|
export declare function hasActions(r: MessageRights): boolean;
|
|
29
|
+
/**
|
|
30
|
+
* A message that may be forwarded (the server's rule): one WhatsApp has (not `local-`, not pending
|
|
31
|
+
* or failed), not a system line, not deleted for everyone or hidden for the team.
|
|
32
|
+
*/
|
|
33
|
+
export declare function forwardable(m: Message): boolean;
|
|
34
|
+
/**
|
|
35
|
+
* Forward stays in the menu but disabled for a file WhatsApp Safety rated High (locked, released or
|
|
36
|
+
* deleted), admins too: the server refuses it the same way (409 `safety_locked`).
|
|
37
|
+
*/
|
|
38
|
+
export declare function forwardLocked(m: Message): boolean;
|
|
29
39
|
/** Handlers and rights the conversation gives each bubble. */
|
|
30
40
|
export interface MessageChangeProps {
|
|
31
41
|
rightsOf(m: Message): MessageRights;
|
|
@@ -33,6 +43,8 @@ export interface MessageChangeProps {
|
|
|
33
43
|
disabledReason: string | null;
|
|
34
44
|
onEdit(m: Message): void;
|
|
35
45
|
onDelete(m: Message): void;
|
|
46
|
+
/** Forward a copy to other chats (⋮ menu first item; under Reply in the press-and-hold bar). */
|
|
47
|
+
onForward?(m: Message): void;
|
|
36
48
|
/** Admins may read the original of a deleted message. */
|
|
37
49
|
isAdmin: boolean;
|
|
38
50
|
}
|
|
@@ -9,10 +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';
|
|
14
|
+
/** The limit a `too_large` file went over, in bytes. */
|
|
15
|
+
limit?: number;
|
|
13
16
|
};
|
|
17
|
+
/** What a chat's WhatsApp number takes, per kind of file (`InboxCapabilities.mediaLimits`). */
|
|
18
|
+
export type MediaLimits = Partial<Record<'video' | 'image' | 'audio' | 'document', number>>;
|
|
19
|
+
/**
|
|
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`).
|
|
23
|
+
*/
|
|
24
|
+
export declare function uploadLimitFor(mime: string, limits?: MediaLimits | null): number | undefined;
|
|
25
|
+
/** A video above the number's video limit (it can still go as a file, up to the document limit). */
|
|
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;
|
|
14
32
|
/** Splits files into the ones that can be sent and the ones refused before any upload. */
|
|
15
|
-
export declare function checkAttachments(files: readonly File[], alreadyQueued: number
|
|
33
|
+
export declare function checkAttachments(files: readonly File[], alreadyQueued: number, limits?: MediaLimits | null, opts?: {
|
|
34
|
+
tunnel?: boolean;
|
|
35
|
+
}): {
|
|
16
36
|
accepted: File[];
|
|
17
37
|
rejected: RejectedFile[];
|
|
18
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.82",
|
|
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.82",
|
|
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",
|