gotrip-fx-transaction-form 1.0.292-dev → 1.0.294-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 +26449 -25278
- package/package.json +1 -1
- package/types/components/Apps/EmbededIndividualApp.d.ts +2 -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/embeded-main.d.ts +1 -0
- package/types/hooks/useChat.d.ts +1 -0
- package/types/store/useChatStore.d.ts +3 -1
- package/types/types/chat.d.ts +10 -1
- package/types/types/sdk.d.ts +2 -1
- package/types/util/chat.d.ts +16 -0
- package/types/util/chatBrowserKey.d.ts +12 -0
- package/types/util/socket.d.ts +1 -1
package/package.json
CHANGED
|
@@ -8,5 +8,6 @@ export type EmbededIndividualAppProps = {
|
|
|
8
8
|
type?: ESdkFormType;
|
|
9
9
|
scrollable?: boolean;
|
|
10
10
|
recommendBoxHeight?: string;
|
|
11
|
+
chatTopics?: string[];
|
|
11
12
|
};
|
|
12
|
-
export declare const EmbededIndividualApp: ({ apiKey, externalCssUrl, hide, defaultBank, displayDefaultBankLogo, type, scrollable, recommendBoxHeight, }: EmbededIndividualAppProps) => import("react/jsx-runtime").JSX.Element;
|
|
13
|
+
export declare const EmbededIndividualApp: ({ apiKey, externalCssUrl, hide, defaultBank, displayDefaultBankLogo, type, scrollable, recommendBoxHeight, chatTopics, }: EmbededIndividualAppProps) => import("react/jsx-runtime").JSX.Element;
|
|
@@ -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/embeded-main.d.ts
CHANGED
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>;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { IChatMessage, IChatSession } from '../types/chat';
|
|
1
|
+
import { EChatTopic, IChatMessage, IChatSession } from '../types/chat';
|
|
2
2
|
interface ChatStore {
|
|
3
3
|
session: IChatSession | null;
|
|
4
4
|
messages: IChatMessage[];
|
|
@@ -8,6 +8,7 @@ interface ChatStore {
|
|
|
8
8
|
sessionUnreadCounts: Record<number, number>;
|
|
9
9
|
adminIsOnline: boolean | null;
|
|
10
10
|
agencyIsOnline: boolean | null;
|
|
11
|
+
allowedTopics: EChatTopic[] | null;
|
|
11
12
|
setSession: (session: IChatSession | null) => void;
|
|
12
13
|
setMessages: (messages: IChatMessage[]) => void;
|
|
13
14
|
addMessage: (message: IChatMessage) => void;
|
|
@@ -26,6 +27,7 @@ interface ChatStore {
|
|
|
26
27
|
getSessionUnread: (sessionId: number) => number;
|
|
27
28
|
setAdminIsOnline: (isOnline: boolean | null) => void;
|
|
28
29
|
setAgencyIsOnline: (isOnline: boolean | null) => void;
|
|
30
|
+
setAllowedTopics: (topics: EChatTopic[] | null) => void;
|
|
29
31
|
}
|
|
30
32
|
export declare const useChatStore: import('zustand').UseBoundStore<import('zustand').StoreApi<ChatStore>>;
|
|
31
33
|
export {};
|
package/types/types/chat.d.ts
CHANGED
|
@@ -38,6 +38,7 @@ export interface IChatSession {
|
|
|
38
38
|
id: number;
|
|
39
39
|
publicId: string;
|
|
40
40
|
agencyUserId: number;
|
|
41
|
+
browserKey?: string | null;
|
|
41
42
|
agencyInfo?: AgencyInfo;
|
|
42
43
|
assignedAdminId: number | null;
|
|
43
44
|
adminInfo?: AdminInfo;
|
|
@@ -59,6 +60,13 @@ export interface SenderInfo {
|
|
|
59
60
|
lastName?: string;
|
|
60
61
|
email?: string;
|
|
61
62
|
}
|
|
63
|
+
export interface IChatMedia {
|
|
64
|
+
type: 'image' | 'file';
|
|
65
|
+
url: string;
|
|
66
|
+
name?: string;
|
|
67
|
+
size?: number;
|
|
68
|
+
mime?: string;
|
|
69
|
+
}
|
|
62
70
|
export interface IChatMessage {
|
|
63
71
|
id: number;
|
|
64
72
|
sessionId: number;
|
|
@@ -66,7 +74,8 @@ export interface IChatMessage {
|
|
|
66
74
|
senderType: EChatSenderType;
|
|
67
75
|
senderInfo?: SenderInfo;
|
|
68
76
|
content: string;
|
|
69
|
-
|
|
77
|
+
media?: IChatMedia[] | null;
|
|
78
|
+
messageType: 'text' | 'image' | 'system_event';
|
|
70
79
|
createdAt: string;
|
|
71
80
|
}
|
|
72
81
|
export interface IAdminSupportProfile {
|
package/types/types/sdk.d.ts
CHANGED
|
@@ -7,5 +7,6 @@ export declare enum ESdkFormType {
|
|
|
7
7
|
EXCHANGE_RATE_TABLE = "exchange_rate_table",
|
|
8
8
|
INSURANCE_APPROVAL = "insurance_approval",
|
|
9
9
|
MOTOR_INSURANCE_CAR_APPROVAL = "motor_insurance_car_approval",
|
|
10
|
-
MOTOR_INSURANCE_BIKE_APPROVAL = "motor_insurance_bike_approval"
|
|
10
|
+
MOTOR_INSURANCE_BIKE_APPROVAL = "motor_insurance_bike_approval",
|
|
11
|
+
CHAT_SUPPORT = "chat_support"
|
|
11
12
|
}
|
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;
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Stable per-browser chat identity. Read-or-create a UUID in localStorage.
|
|
3
|
+
*
|
|
4
|
+
* The same agency identity (e.g. all visitors of a tenant behind one api-key)
|
|
5
|
+
* is split into one chat session per browser using this key. It is sent to the
|
|
6
|
+
* backend on every chat request (REST header `x-chat-browser-key`) and on the
|
|
7
|
+
* socket handshake (`auth.browserKey`).
|
|
8
|
+
*
|
|
9
|
+
* Idempotent: the first call on a browser writes the key; later calls reuse it.
|
|
10
|
+
* Call it once at app bootstrap so the key exists before any chat call fires.
|
|
11
|
+
*/
|
|
12
|
+
export declare const getChatBrowserKey: () => string;
|
package/types/util/socket.d.ts
CHANGED
|
@@ -7,7 +7,7 @@ export declare const requestNotificationPermission: () => void;
|
|
|
7
7
|
/**
|
|
8
8
|
* Initialize Socket.IO connection with authentication token
|
|
9
9
|
*/
|
|
10
|
-
export declare const initializeSocket: (token
|
|
10
|
+
export declare const initializeSocket: (token?: string) => Socket;
|
|
11
11
|
/**
|
|
12
12
|
* Get the current socket instance
|
|
13
13
|
*/
|