@ezychat/web 0.1.49 → 0.1.51
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-CDIMFu6e.js → admin-Bn_TTlyR.js} +1 -1
- package/dist-lib/chunks/{admin-jyVpLxrw.js → admin-Pg8YjwbY.js} +1 -1
- package/dist-lib/chunks/{inbox-DtLIGOCo.js → inbox-DYWiuDED.js} +20 -1
- package/dist-lib/chunks/{inbox-u9BCZ1IH.js → inbox-D_Tk700t.js} +20 -1
- package/dist-lib/ezychat-web.css +1 -1
- package/dist-lib/index.js +4001 -3692
- package/dist-lib/types/api/queries.d.ts +51 -0
- package/dist-lib/types/i18n/resources.d.ts +24 -0
- package/dist-lib/types/inbox/MessageBubble.d.ts +5 -1
- package/dist-lib/types/inbox/MessageList.d.ts +5 -1
- package/dist-lib/types/inbox/ReactionBadges.d.ts +31 -0
- package/dist-lib/types/inbox/ReactionPicker.d.ts +26 -0
- package/dist-lib/types/inbox/useSwipeReply.d.ts +3 -1
- package/package.json +2 -2
|
@@ -198,6 +198,14 @@ export declare function useMessages(jid: string | null | undefined): import("@ta
|
|
|
198
198
|
error: string | null;
|
|
199
199
|
timestamp: number;
|
|
200
200
|
clientId: string | null;
|
|
201
|
+
reactions: {
|
|
202
|
+
emoji: string;
|
|
203
|
+
senderJid: string | null;
|
|
204
|
+
fromMe: boolean;
|
|
205
|
+
at: number;
|
|
206
|
+
sentByUserId: number | null;
|
|
207
|
+
senderName?: string | null | undefined;
|
|
208
|
+
}[];
|
|
201
209
|
voiceNote?: boolean | undefined;
|
|
202
210
|
viaAssistant?: boolean | undefined;
|
|
203
211
|
transcript?: string | null | undefined;
|
|
@@ -237,6 +245,14 @@ export declare function useSendText(jid: string): import("@tanstack/react-query"
|
|
|
237
245
|
error: string | null;
|
|
238
246
|
timestamp: number;
|
|
239
247
|
clientId: string | null;
|
|
248
|
+
reactions: {
|
|
249
|
+
emoji: string;
|
|
250
|
+
senderJid: string | null;
|
|
251
|
+
fromMe: boolean;
|
|
252
|
+
at: number;
|
|
253
|
+
sentByUserId: number | null;
|
|
254
|
+
senderName?: string | null | undefined;
|
|
255
|
+
}[];
|
|
240
256
|
voiceNote?: boolean | undefined;
|
|
241
257
|
viaAssistant?: boolean | undefined;
|
|
242
258
|
transcript?: string | null | undefined;
|
|
@@ -276,6 +292,14 @@ export declare function useSendMedia(jid: string): import("@tanstack/react-query
|
|
|
276
292
|
error: string | null;
|
|
277
293
|
timestamp: number;
|
|
278
294
|
clientId: string | null;
|
|
295
|
+
reactions: {
|
|
296
|
+
emoji: string;
|
|
297
|
+
senderJid: string | null;
|
|
298
|
+
fromMe: boolean;
|
|
299
|
+
at: number;
|
|
300
|
+
sentByUserId: number | null;
|
|
301
|
+
senderName?: string | null | undefined;
|
|
302
|
+
}[];
|
|
279
303
|
voiceNote?: boolean | undefined;
|
|
280
304
|
viaAssistant?: boolean | undefined;
|
|
281
305
|
transcript?: string | null | undefined;
|
|
@@ -304,6 +328,14 @@ export declare function useRetryMessage(): import("@tanstack/react-query").UseMu
|
|
|
304
328
|
error: string | null;
|
|
305
329
|
timestamp: number;
|
|
306
330
|
clientId: string | null;
|
|
331
|
+
reactions: {
|
|
332
|
+
emoji: string;
|
|
333
|
+
senderJid: string | null;
|
|
334
|
+
fromMe: boolean;
|
|
335
|
+
at: number;
|
|
336
|
+
sentByUserId: number | null;
|
|
337
|
+
senderName?: string | null | undefined;
|
|
338
|
+
}[];
|
|
307
339
|
voiceNote?: boolean | undefined;
|
|
308
340
|
viaAssistant?: boolean | undefined;
|
|
309
341
|
transcript?: string | null | undefined;
|
|
@@ -314,6 +346,25 @@ export declare function useRetryMessage(): import("@tanstack/react-query").UseMu
|
|
|
314
346
|
name: string;
|
|
315
347
|
} | null | undefined;
|
|
316
348
|
}, Error, string, unknown>;
|
|
349
|
+
/**
|
|
350
|
+
* The linked number reacts to a message (`emoji` '' removes the reaction). The answer carries the
|
|
351
|
+
* message's reactions; the `message:reactions` event brings the same list to every teammate.
|
|
352
|
+
*/
|
|
353
|
+
export declare function useSendReaction(): import("@tanstack/react-query").UseMutationResult<{
|
|
354
|
+
messageId: string;
|
|
355
|
+
reactions: {
|
|
356
|
+
emoji: string;
|
|
357
|
+
senderJid: string | null;
|
|
358
|
+
fromMe: boolean;
|
|
359
|
+
at: number;
|
|
360
|
+
sentByUserId: number | null;
|
|
361
|
+
senderName?: string | null | undefined;
|
|
362
|
+
}[];
|
|
363
|
+
}, Error, {
|
|
364
|
+
chatJid: string;
|
|
365
|
+
messageId: string;
|
|
366
|
+
emoji: string;
|
|
367
|
+
}, unknown>;
|
|
317
368
|
export declare function usePatchChat(jid: string): import("@tanstack/react-query").UseMutationResult<{
|
|
318
369
|
jid: string;
|
|
319
370
|
inboxId: number;
|
|
@@ -580,6 +580,24 @@ export declare const enResources: {
|
|
|
580
580
|
};
|
|
581
581
|
reply: string;
|
|
582
582
|
viaAssistant: string;
|
|
583
|
+
reactions: {
|
|
584
|
+
label: string;
|
|
585
|
+
title: string;
|
|
586
|
+
fromPhone: string;
|
|
587
|
+
add: string;
|
|
588
|
+
reactWith: string;
|
|
589
|
+
more: string;
|
|
590
|
+
back: string;
|
|
591
|
+
removeHint: string;
|
|
592
|
+
removeYours: string;
|
|
593
|
+
replacesTeammate: string;
|
|
594
|
+
notConnected: string;
|
|
595
|
+
notSent: string;
|
|
596
|
+
fromYou: string;
|
|
597
|
+
fromTeammate: string;
|
|
598
|
+
remove: string;
|
|
599
|
+
fromTeammateUnknown: string;
|
|
600
|
+
};
|
|
583
601
|
};
|
|
584
602
|
media: {
|
|
585
603
|
types: {
|
|
@@ -712,6 +730,7 @@ export declare const enResources: {
|
|
|
712
730
|
cancel: string;
|
|
713
731
|
saveFailed: string;
|
|
714
732
|
noName: string;
|
|
733
|
+
nameFromWhatsapp: string;
|
|
715
734
|
whatsappName: string;
|
|
716
735
|
updatedBy: string;
|
|
717
736
|
updated: string;
|
|
@@ -1826,6 +1845,11 @@ export declare const enResources: {
|
|
|
1826
1845
|
noFreeInbox: string;
|
|
1827
1846
|
addInbox: string;
|
|
1828
1847
|
createNext: string;
|
|
1848
|
+
typeTitle: string;
|
|
1849
|
+
typeHint: string;
|
|
1850
|
+
typeChange: string;
|
|
1851
|
+
typeEditRole: string;
|
|
1852
|
+
typeOwnTexts: string;
|
|
1829
1853
|
};
|
|
1830
1854
|
presets: {
|
|
1831
1855
|
sales: string;
|
|
@@ -13,6 +13,10 @@ export interface MessageBubbleProps {
|
|
|
13
13
|
retrying?: boolean;
|
|
14
14
|
/** Start a reply that quotes this message (hover button, swipe right or long-press on touch). */
|
|
15
15
|
onReply?(m: Message): void;
|
|
16
|
+
/** React as the linked number ('' removes): 🙂 button, or press and hold on touch. */
|
|
17
|
+
onReact?(m: Message, emoji: string): void;
|
|
18
|
+
/** Why reacting is not possible now (WhatsApp not connected): the bar shows it, disabled. */
|
|
19
|
+
reactDisabledReason?: string | null;
|
|
16
20
|
onMediaLoad?(): void;
|
|
17
21
|
/** Team directory, for "Updated by" in a group sender's profile popover. */
|
|
18
22
|
directory?: Directory;
|
|
@@ -28,4 +32,4 @@ export declare function quotedPreview(q: Message, t: TFunction<'inbox'>): string
|
|
|
28
32
|
export declare function StatusTicks({ status }: {
|
|
29
33
|
status: Message['status'];
|
|
30
34
|
}): React.JSX.Element;
|
|
31
|
-
export declare function MessageBubble({ message: m, showSender, outboundLabel, quoted, onRetry, retrying, onMediaLoad, directory, onReply, contactName, }: MessageBubbleProps): React.JSX.Element;
|
|
35
|
+
export declare function MessageBubble({ message: m, showSender, outboundLabel, quoted, onRetry, retrying, onMediaLoad, directory, onReply, onReact, reactDisabledReason, contactName, }: MessageBubbleProps): React.JSX.Element;
|
|
@@ -14,8 +14,12 @@ export interface MessageListProps {
|
|
|
14
14
|
onRetry(m: Message): void;
|
|
15
15
|
retryingId: string | null;
|
|
16
16
|
onReply?(m: Message): void;
|
|
17
|
+
/** React as the linked number ('' removes); offered wherever a reply is. */
|
|
18
|
+
onReact?(m: Message, emoji: string): void;
|
|
19
|
+
/** Why reacting is not possible now (WhatsApp not connected); null when it is. */
|
|
20
|
+
reactDisabledReason?: string | null;
|
|
17
21
|
/** Direct chats: the customer's display name, for quotes. */
|
|
18
22
|
contactName?: string;
|
|
19
23
|
footer?: React.ReactNode;
|
|
20
24
|
}
|
|
21
|
-
export declare function MessageList({ items, messagesById, isGroup, directory, loading, hasOlder, loadingOlder, onLoadOlder, onRetry, retryingId, onReply, contactName, footer, }: MessageListProps): React.JSX.Element;
|
|
25
|
+
export declare function MessageList({ items, messagesById, isGroup, directory, loading, hasOlder, loadingOlder, onLoadOlder, onRetry, retryingId, onReply, onReact, reactDisabledReason, contactName, footer, }: MessageListProps): React.JSX.Element;
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
import type { TFunction } from 'i18next';
|
|
2
|
+
import type { MessageReaction } from '@ezychat/shared';
|
|
3
|
+
/** Distinct emojis shown in the badge; the popover lists every reaction. */
|
|
4
|
+
export declare const BADGE_EMOJIS = 3;
|
|
5
|
+
export interface ReactionGroup {
|
|
6
|
+
emoji: string;
|
|
7
|
+
reactions: MessageReaction[];
|
|
8
|
+
}
|
|
9
|
+
/** One group per emoji: the most used first, then the one used first. */
|
|
10
|
+
export declare function groupReactions(reactions: MessageReaction[]): ReactionGroup[];
|
|
11
|
+
/**
|
|
12
|
+
* Who reacted, named like the rest of the conversation: the server's name (customer profile,
|
|
13
|
+
* contact, WhatsApp name), else the direct chat's name, else the phone number. Never inferred.
|
|
14
|
+
*/
|
|
15
|
+
export declare function reactorName(r: MessageReaction, t: TFunction<'inbox'>, contactName?: string, teamName?: string | null): string;
|
|
16
|
+
export interface ReactionBadgesProps {
|
|
17
|
+
reactions: MessageReaction[];
|
|
18
|
+
/** Outbound bubble: the badge sits under its right corner, else under the left one. */
|
|
19
|
+
out: boolean;
|
|
20
|
+
/** Direct chats: the customer's name as the header shows it. */
|
|
21
|
+
contactName?: string;
|
|
22
|
+
/** Who sent the linked number's reaction (see `reactorName`). */
|
|
23
|
+
teamName?: string | null;
|
|
24
|
+
/** Removes the linked number's reaction from the list. */
|
|
25
|
+
onRemoveMine?(): void;
|
|
26
|
+
}
|
|
27
|
+
/**
|
|
28
|
+
* Emoji reactions under a bubble's corner, as WhatsApp shows them: the emojis (most used first)
|
|
29
|
+
* and the total when more than one person reacted. Tap or click lists who reacted with what.
|
|
30
|
+
*/
|
|
31
|
+
export declare function ReactionBadges({ reactions, out, contactName, teamName, onRemoveMine, }: ReactionBadgesProps): import("react").JSX.Element | null;
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
/** The bar's emojis, as on WhatsApp. */
|
|
2
|
+
export declare const QUICK_REACTIONS: readonly ["👍", "❤️", "😂", "😮", "😢", "🙏"];
|
|
3
|
+
/** "+" opens these: common reactions in a business chat, no emoji library. */
|
|
4
|
+
export declare const MORE_REACTIONS: readonly ["👍", "❤️", "😂", "😮", "😢", "🙏", "👏", "🙌", "🔥", "🎉", "💯", "✅", "👌", "🤝", "💪", "😊", "😍", "🥰", "😁", "🤣", "😅", "😉", "🤔", "😎", "😴", "😭", "😡", "😱", "🥲", "🙈", "👀", "💐", "🎂", "☕", "🍜", "🚚", "📦", "💰", "⭐", "❌"];
|
|
5
|
+
export interface ReactionPickerProps {
|
|
6
|
+
/** Outbound bubble: the bar opens towards the left. */
|
|
7
|
+
out: boolean;
|
|
8
|
+
/** The linked number's current reaction to this message, '' when there is none. */
|
|
9
|
+
current: string;
|
|
10
|
+
/** The teammate who sent that reaction, when it was not the signed-in user or the phone. */
|
|
11
|
+
currentBy?: string | null;
|
|
12
|
+
open: boolean;
|
|
13
|
+
onOpenChange(open: boolean): void;
|
|
14
|
+
/** '' removes the linked number's reaction. */
|
|
15
|
+
onReact(emoji: string): void;
|
|
16
|
+
/** Why the team cannot react now (WhatsApp is not connected), else null. */
|
|
17
|
+
disabledReason: string | null;
|
|
18
|
+
/** Touch screens open the bar by press-and-hold, so it offers Reply as well. */
|
|
19
|
+
onReply?(): void;
|
|
20
|
+
}
|
|
21
|
+
/**
|
|
22
|
+
* The 🙂 button next to a message and its emoji bar. WhatsApp keeps one
|
|
23
|
+
* reaction per number, so the whole team shares the linked number's reaction: a new emoji replaces
|
|
24
|
+
* it, the same emoji again removes it.
|
|
25
|
+
*/
|
|
26
|
+
export declare function ReactionPicker({ out, current, currentBy, open, onOpenChange, onReact, disabledReason, onReply, }: ReactionPickerProps): import("react").JSX.Element;
|
|
@@ -4,8 +4,10 @@ export declare const SWIPE_TRIGGER_PX = 56;
|
|
|
4
4
|
/**
|
|
5
5
|
* Touch gestures that start a reply, like WhatsApp: swipe the message right, or press and hold.
|
|
6
6
|
* Mouse and pen are ignored (desktop uses the Reply button). Vertical movement keeps scrolling.
|
|
7
|
+
* With `onLongPress`, press-and-hold calls it instead (the reaction bar,
|
|
8
|
+
* which offers Reply too).
|
|
7
9
|
*/
|
|
8
|
-
export declare function useSwipeReply(onReply: (() => void) | undefined): {
|
|
10
|
+
export declare function useSwipeReply(onReply: (() => void) | undefined, onLongPress?: () => void): {
|
|
9
11
|
offset: number;
|
|
10
12
|
handlers: React.HTMLAttributes<HTMLElement>;
|
|
11
13
|
};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@ezychat/web",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.51",
|
|
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.51",
|
|
44
44
|
"@fontsource-variable/inter": "^5.3.0",
|
|
45
45
|
"@tanstack/react-query": "^5.104.4",
|
|
46
46
|
"@types/react": "^19.3.0",
|