@ezychat/web 0.1.61 → 0.1.62
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-DJH4L6VN.js → admin-C53MA04L.js} +1 -1
- package/dist-lib/chunks/{admin-i6F-0wNq.js → admin-CwbMAJHw.js} +1 -1
- package/dist-lib/chunks/{inbox-DI6Z9gdw.js → inbox-BSvakhw6.js} +21 -1
- package/dist-lib/chunks/{inbox-hT-ebVtf.js → inbox-C6YZJKZX.js} +21 -1
- package/dist-lib/ezychat-web.css +1 -1
- package/dist-lib/index.js +8710 -8338
- package/dist-lib/types/components/app/FileDropZone.d.ts +17 -0
- package/dist-lib/types/i18n/resources.d.ts +23 -0
- package/dist-lib/types/inbox/Composer.d.ts +12 -3
- package/dist-lib/types/inbox/MediaView.d.ts +4 -1
- package/dist-lib/types/inbox/ReactionPicker.d.ts +3 -1
- package/dist-lib/types/lib/clipboard.d.ts +11 -0
- package/dist-lib/types/lib/file-transfer.d.ts +42 -0
- package/package.json +2 -2
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import type React from 'react';
|
|
2
|
+
export interface FileDropZoneProps extends React.ComponentPropsWithoutRef<'section'> {
|
|
3
|
+
/** False: the drop is refused with a note (sending is blocked, or the reply window is closed). */
|
|
4
|
+
enabled: boolean;
|
|
5
|
+
onFiles(files: File[]): void;
|
|
6
|
+
/** The element to render (a conversation is a `section`). */
|
|
7
|
+
as?: 'section' | 'div';
|
|
8
|
+
/** Overlay texts; default to the conversation's ("Drop files to send them in this chat"). */
|
|
9
|
+
title?: string;
|
|
10
|
+
hint?: string;
|
|
11
|
+
blockedText?: string;
|
|
12
|
+
}
|
|
13
|
+
/**
|
|
14
|
+
* A drop target for files dragged from the desktop (the conversation, Business context): they show
|
|
15
|
+
* an overlay and, when dropped, go to `onFiles`. Text or links dragged inside the page are left alone.
|
|
16
|
+
*/
|
|
17
|
+
export declare function FileDropZone({ enabled, onFiles, as: Tag, title, hint, blockedText, className, children, ...rest }: Readonly<FileDropZoneProps>): React.JSX.Element;
|
|
@@ -482,6 +482,19 @@ export declare const enResources: {
|
|
|
482
482
|
completionStatus: string;
|
|
483
483
|
unavailable: string;
|
|
484
484
|
};
|
|
485
|
+
files: {
|
|
486
|
+
title_one: string;
|
|
487
|
+
title_other: string;
|
|
488
|
+
clear: string;
|
|
489
|
+
remove: string;
|
|
490
|
+
caption: string;
|
|
491
|
+
too_large: string;
|
|
492
|
+
empty: string;
|
|
493
|
+
too_many: string;
|
|
494
|
+
drop: string;
|
|
495
|
+
dropHint: string;
|
|
496
|
+
dropBlocked: string;
|
|
497
|
+
};
|
|
485
498
|
};
|
|
486
499
|
quickReplies: {
|
|
487
500
|
title: string;
|
|
@@ -653,6 +666,14 @@ export declare const enResources: {
|
|
|
653
666
|
fromTeammateUnknown: string;
|
|
654
667
|
};
|
|
655
668
|
template: string;
|
|
669
|
+
copy: {
|
|
670
|
+
text: string;
|
|
671
|
+
image: string;
|
|
672
|
+
done: string;
|
|
673
|
+
imageDone: string;
|
|
674
|
+
failed: string;
|
|
675
|
+
imageFailed: string;
|
|
676
|
+
};
|
|
656
677
|
};
|
|
657
678
|
media: {
|
|
658
679
|
types: {
|
|
@@ -1865,6 +1886,8 @@ export declare const enResources: {
|
|
|
1865
1886
|
markCustomerFor: string;
|
|
1866
1887
|
markedInternal: string;
|
|
1867
1888
|
markedCustomer: string;
|
|
1889
|
+
drop: string;
|
|
1890
|
+
dropHint: string;
|
|
1868
1891
|
};
|
|
1869
1892
|
defaults: {
|
|
1870
1893
|
sales: {
|
|
@@ -1,10 +1,18 @@
|
|
|
1
1
|
import type React from 'react';
|
|
2
2
|
import { type QuickReply, type ReplyPhraseListItem } from '@ezychat/shared';
|
|
3
|
+
/** Lets the conversation hand files dropped anywhere on it to the composer. */
|
|
4
|
+
export interface ComposerHandle {
|
|
5
|
+
addFiles(files: readonly File[]): void;
|
|
6
|
+
}
|
|
3
7
|
export interface ComposerProps {
|
|
4
8
|
quickReplies: QuickReply[];
|
|
5
9
|
onSend(text: string): void;
|
|
6
|
-
/**
|
|
7
|
-
|
|
10
|
+
/**
|
|
11
|
+
* One file to send, with the caption (the typed text goes with the first file). Files picked,
|
|
12
|
+
* pasted or dropped wait in the tray until Send; they are sent one after another, in order:
|
|
13
|
+
* resolve when this one is handed over. `index` is the file's place in that send (0 = first).
|
|
14
|
+
*/
|
|
15
|
+
onAttach(file: File, caption?: string, index?: number): void | Promise<void>;
|
|
8
16
|
/**
|
|
9
17
|
* Mic button (shown while the box is empty): a recorded Ogg/Opus voice note with the clientId it
|
|
10
18
|
* keeps across retries. Resolve once it is uploaded; reject to keep it in Review.
|
|
@@ -30,6 +38,7 @@ export interface ComposerProps {
|
|
|
30
38
|
* AI reply suggestions in this chat (direct chats only; null = off). `unavailable` shows the
|
|
31
39
|
* button disabled. The chips clear when `lastCustomerMessageId` changes (a new customer message).
|
|
32
40
|
*/
|
|
41
|
+
ref?: React.Ref<ComposerHandle>;
|
|
33
42
|
aiSuggest?: {
|
|
34
43
|
chatJid: string;
|
|
35
44
|
lastCustomerMessageId: string | null;
|
|
@@ -39,4 +48,4 @@ export interface ComposerProps {
|
|
|
39
48
|
phrases?: readonly ReplyPhraseListItem[];
|
|
40
49
|
} | null;
|
|
41
50
|
}
|
|
42
|
-
export declare function Composer({ quickReplies, onSend, onAttach, onVoiceNote, onTyping, confirmSend, disabled, placeholder, replyTo, onCancelReply, aiSuggest, }: ComposerProps): React.JSX.Element;
|
|
51
|
+
export declare function Composer({ quickReplies, onSend, onAttach, onVoiceNote, onTyping, confirmSend, disabled, placeholder, replyTo, onCancelReply, aiSuggest, ref, }: ComposerProps): React.JSX.Element;
|
|
@@ -1,8 +1,11 @@
|
|
|
1
|
+
import type React from 'react';
|
|
1
2
|
import type { Message } from '@ezychat/shared';
|
|
2
3
|
export interface MediaViewProps {
|
|
3
4
|
message: Message;
|
|
4
5
|
/** Fired when an image/video finishes loading (lets the list keep its scroll anchored). */
|
|
5
6
|
onLoad?(): void;
|
|
6
7
|
}
|
|
8
|
+
/** The file name a media file gets when dragged or saved out of the app. */
|
|
9
|
+
export declare function mediaFileName(m: Pick<Message, 'id' | 'type' | 'mediaName' | 'mediaMime'>): string;
|
|
7
10
|
/** Renders the media part of a message (image, sticker, video, audio, document). */
|
|
8
|
-
export declare function MediaView({ message: m, onLoad }: MediaViewProps):
|
|
11
|
+
export declare function MediaView({ message: m, onLoad }: MediaViewProps): React.JSX.Element;
|
|
@@ -17,10 +17,12 @@ 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 Copy text, for a message with text. */
|
|
21
|
+
onCopy?(): void;
|
|
20
22
|
}
|
|
21
23
|
/**
|
|
22
24
|
* The 🙂 button next to a message and its emoji bar. WhatsApp keeps one
|
|
23
25
|
* reaction per number, so the whole team shares the linked number's reaction: a new emoji replaces
|
|
24
26
|
* it, the same emoji again removes it.
|
|
25
27
|
*/
|
|
26
|
-
export declare function ReactionPicker({ out, current, currentBy, open, onOpenChange, onReact, disabledReason, onReply, }: ReactionPickerProps): import("react").JSX.Element;
|
|
28
|
+
export declare function ReactionPicker({ out, current, currentBy, open, onOpenChange, onReact, disabledReason, onReply, onCopy, }: ReactionPickerProps): import("react").JSX.Element;
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Copies text. The async Clipboard API needs a secure context (localhost, the tunnel's https); a
|
|
3
|
+
* LAN address over http falls back to the older selection copy, which still works there.
|
|
4
|
+
*/
|
|
5
|
+
export declare function copyText(text: string): Promise<void>;
|
|
6
|
+
/** Images go on the clipboard only through the async API (secure context, ClipboardItem). */
|
|
7
|
+
export declare function canCopyImage(): boolean;
|
|
8
|
+
/** Browsers accept only PNG images on the clipboard: other types are redrawn as PNG. */
|
|
9
|
+
export declare function toPngBlob(blob: Blob): Promise<Blob>;
|
|
10
|
+
/** Copies the image at `url` (a same-origin media link). */
|
|
11
|
+
export declare function copyImageFromUrl(url: string): Promise<void>;
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
/** Files one send takes at most, as WhatsApp's own picker. */
|
|
2
|
+
export declare const MAX_ATTACHMENTS = 10;
|
|
3
|
+
/** A drag that carries files from the OS (not text or a link from inside the page). */
|
|
4
|
+
export declare function hasFiles(dt: Pick<DataTransfer, 'types'> | null | undefined): boolean;
|
|
5
|
+
/**
|
|
6
|
+
* The files of a drop or paste. A screenshot pasted from the clipboard has no useful name
|
|
7
|
+
* ("image.png" or none), so it is named after the time it was pasted.
|
|
8
|
+
*/
|
|
9
|
+
export declare function filesFromTransfer(dt: Pick<DataTransfer, 'files'> | null | undefined, now?: () => Date): File[];
|
|
10
|
+
export type RejectedFile = {
|
|
11
|
+
file: File;
|
|
12
|
+
reason: 'too_large' | 'empty' | 'too_many';
|
|
13
|
+
};
|
|
14
|
+
/** 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): {
|
|
16
|
+
accepted: File[];
|
|
17
|
+
rejected: RejectedFile[];
|
|
18
|
+
};
|
|
19
|
+
/** "1.2 MB" style size for the attachment tray. */
|
|
20
|
+
export declare function formatBytes(n: number): string;
|
|
21
|
+
/** The sender chose the type: only a plain `type/subtype` goes into the drag, else a neutral one. */
|
|
22
|
+
export declare function safeMime(mime: string | null): string;
|
|
23
|
+
/**
|
|
24
|
+
* The sender chose the name: no control characters, nothing a desktop forbids in a file name
|
|
25
|
+
* (`<>:"/\|?*`; a colon would also end the drag's name field early) and no leading dots.
|
|
26
|
+
*/
|
|
27
|
+
export declare function safeFileName(name: string): string;
|
|
28
|
+
/**
|
|
29
|
+
* Lets a media file be dragged out of the app onto the desktop or a folder (Chromium browsers and
|
|
30
|
+
* the desktop app): the `DownloadURL` drag type is `mime:name:absolute-url`, saved like a download.
|
|
31
|
+
*/
|
|
32
|
+
export declare function setDownloadDrag(dt: DataTransfer, file: {
|
|
33
|
+
url: string;
|
|
34
|
+
name: string;
|
|
35
|
+
mime: string | null;
|
|
36
|
+
}): void;
|
|
37
|
+
/**
|
|
38
|
+
* A file dropped where nothing takes it would make the browser open it in place of the app (or,
|
|
39
|
+
* in the desktop window, try to navigate to it). Refuse such drops page-wide; drop zones call
|
|
40
|
+
* `preventDefault` first and keep working. Returns the uninstall function.
|
|
41
|
+
*/
|
|
42
|
+
export declare function installFileDropGuard(target?: Window): () => void;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@ezychat/web",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.62",
|
|
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.62",
|
|
44
44
|
"@fontsource-variable/inter": "^5.3.0",
|
|
45
45
|
"@tanstack/react-query": "^5.104.5",
|
|
46
46
|
"@types/react": "^19.3.0",
|