gotrip-fx-transaction-form 1.0.292-dev → 1.0.293-dev
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/index.js +7 -7
- package/package.json +1 -1
- package/types/components/Chat/ChatComposer.d.ts +9 -0
- package/types/components/Chat/ChatImageGallery.d.ts +9 -0
- package/types/components/Chat/ImageLightbox.d.ts +11 -0
- package/types/hooks/useChat.d.ts +1 -0
- package/types/types/chat.d.ts +9 -1
- package/types/util/chat.d.ts +16 -0
package/index.js
CHANGED
|
@@ -46609,18 +46609,18 @@ const F4e = () => {
|
|
|
46609
46609
|
const r = eR(e.senderInfo);
|
|
46610
46610
|
return r || (e.senderType === Z0.ADMIN ? "Nhân viên hỗ trợ" : "Khách hàng");
|
|
46611
46611
|
}, V4e = (e) => {
|
|
46612
|
-
var t;
|
|
46612
|
+
var t, r;
|
|
46613
46613
|
try {
|
|
46614
46614
|
if (typeof window > "u" || !("Notification" in window) || Notification.permission !== "granted") return;
|
|
46615
|
-
const
|
|
46616
|
-
body:
|
|
46615
|
+
const n = B4e(e), a = !!((t = e.media) != null && t.some((c) => c.type === "image")), i = (r = e.content) == null ? void 0 : r.trim(), o = i ? i.slice(0, 120) : a ? "Đã gửi ảnh" : "Bạn có tin nhắn mới", s = new Notification(n, {
|
|
46616
|
+
body: o,
|
|
46617
46617
|
tag: `chat_${e.sessionId}`
|
|
46618
46618
|
});
|
|
46619
|
-
|
|
46620
|
-
window.focus(),
|
|
46619
|
+
s.onclick = () => {
|
|
46620
|
+
window.focus(), s.close();
|
|
46621
46621
|
};
|
|
46622
|
-
} catch (
|
|
46623
|
-
console.warn("[Socket] Failed to show browser notification:",
|
|
46622
|
+
} catch (n) {
|
|
46623
|
+
console.warn("[Socket] Failed to show browser notification:", n);
|
|
46624
46624
|
}
|
|
46625
46625
|
};
|
|
46626
46626
|
typeof window < "u" && (document.addEventListener("visibilitychange", () => {
|
package/package.json
CHANGED
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
interface Props {
|
|
2
|
+
onSendText: (text: string) => void | Promise<void>;
|
|
3
|
+
onSendImages: (files: File[], caption: string) => Promise<void>;
|
|
4
|
+
onTypingChange?: (isTyping: boolean) => void;
|
|
5
|
+
disabled?: boolean;
|
|
6
|
+
placeholder?: string;
|
|
7
|
+
}
|
|
8
|
+
export declare const ChatComposer: ({ onSendText, onSendImages, onTypingChange, disabled, placeholder, }: Props) => import("react/jsx-runtime").JSX.Element;
|
|
9
|
+
export {};
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
interface Props {
|
|
2
|
+
images: string[];
|
|
3
|
+
}
|
|
4
|
+
/**
|
|
5
|
+
* Renders image message content: a single image, or a grid gallery for
|
|
6
|
+
* multiple. Images that fail to load show an "Ảnh không khả dụng" placeholder.
|
|
7
|
+
*/
|
|
8
|
+
export declare const ChatImageGallery: ({ images }: Props) => import("react/jsx-runtime").JSX.Element | null;
|
|
9
|
+
export {};
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
interface Props {
|
|
2
|
+
images: string[];
|
|
3
|
+
startIndex?: number;
|
|
4
|
+
onClose: () => void;
|
|
5
|
+
}
|
|
6
|
+
/**
|
|
7
|
+
* Fullscreen image viewer rendered in a portal. Supports keyboard (Esc to
|
|
8
|
+
* close, ←/→ to navigate) and on-screen arrows when there are multiple images.
|
|
9
|
+
*/
|
|
10
|
+
export declare const ImageLightbox: ({ images, startIndex, onClose }: Props) => import("react/jsx-runtime").JSX.Element | null;
|
|
11
|
+
export {};
|
package/types/hooks/useChat.d.ts
CHANGED
|
@@ -17,6 +17,7 @@ export declare const useChat: () => {
|
|
|
17
17
|
transferSession: (sessionId: number, targetAdminId: number) => Promise<void>;
|
|
18
18
|
getOnlineAdmins: () => Promise<any>;
|
|
19
19
|
sendOfflineMessage: (sessionId: number, content: string) => Promise<void>;
|
|
20
|
+
uploadImages: (sessionId: number, files: File[], caption?: string) => Promise<void>;
|
|
20
21
|
getAdminProfile: () => Promise<any>;
|
|
21
22
|
getSessionByPublicId: (publicId: string) => Promise<IChatSession | null>;
|
|
22
23
|
getSessionById: (sessionId: number) => Promise<IChatSession | null>;
|
package/types/types/chat.d.ts
CHANGED
|
@@ -59,6 +59,13 @@ export interface SenderInfo {
|
|
|
59
59
|
lastName?: string;
|
|
60
60
|
email?: string;
|
|
61
61
|
}
|
|
62
|
+
export interface IChatMedia {
|
|
63
|
+
type: 'image' | 'file';
|
|
64
|
+
url: string;
|
|
65
|
+
name?: string;
|
|
66
|
+
size?: number;
|
|
67
|
+
mime?: string;
|
|
68
|
+
}
|
|
62
69
|
export interface IChatMessage {
|
|
63
70
|
id: number;
|
|
64
71
|
sessionId: number;
|
|
@@ -66,7 +73,8 @@ export interface IChatMessage {
|
|
|
66
73
|
senderType: EChatSenderType;
|
|
67
74
|
senderInfo?: SenderInfo;
|
|
68
75
|
content: string;
|
|
69
|
-
|
|
76
|
+
media?: IChatMedia[] | null;
|
|
77
|
+
messageType: 'text' | 'image' | 'system_event';
|
|
70
78
|
createdAt: string;
|
|
71
79
|
}
|
|
72
80
|
export interface IAdminSupportProfile {
|
package/types/util/chat.d.ts
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { ETenantType } from '../types/enum';
|
|
2
|
+
import { IChatMessage } from '../types/chat';
|
|
2
3
|
export declare const getAvatarColor: (userId: number) => string;
|
|
3
4
|
export declare const getAvatarInitials: (firstName?: string, lastName?: string) => string;
|
|
4
5
|
/** Join first + last name, falling back to `fallback` when both are empty. */
|
|
@@ -12,3 +13,18 @@ export declare const isAdminUser: (user?: {
|
|
|
12
13
|
type?: ETenantType;
|
|
13
14
|
} | null;
|
|
14
15
|
} | null) => boolean;
|
|
16
|
+
/**
|
|
17
|
+
* Legacy image messages stored their URLs as a JSON array string in `content`.
|
|
18
|
+
* Parse defensively, falling back to treating the raw content as a single URL.
|
|
19
|
+
*/
|
|
20
|
+
export declare const parseImageUrls: (content: string) => string[];
|
|
21
|
+
/**
|
|
22
|
+
* Image URLs for a message. Prefers the structured `media` column; falls back
|
|
23
|
+
* to the legacy `messageType === 'image'` content-as-JSON encoding.
|
|
24
|
+
*/
|
|
25
|
+
export declare const getMessageImages: (message: IChatMessage) => string[];
|
|
26
|
+
/**
|
|
27
|
+
* Text of a message to display as a bubble/caption. The legacy image encoding
|
|
28
|
+
* stored a JSON URL array in `content`, which must not be shown as text.
|
|
29
|
+
*/
|
|
30
|
+
export declare const getMessageText: (message: IChatMessage) => string;
|