@droppii-org/chat-mobile 0.2.0
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/LICENSE +20 -0
- package/README.md +101 -0
- package/lib/module/assets/images/icon_bot.png +0 -0
- package/lib/module/assets/images/index.js +9 -0
- package/lib/module/assets/images/index.js.map +1 -0
- package/lib/module/assets/images/tag_bot.png +0 -0
- package/lib/module/assets/images/tag_mall.png +0 -0
- package/lib/module/build-ignore.d.js +2 -0
- package/lib/module/build-ignore.d.js.map +1 -0
- package/lib/module/components/Avatar/Avatar.js +81 -0
- package/lib/module/components/Avatar/Avatar.js.map +1 -0
- package/lib/module/components/Avatar/Avatar.types.js +2 -0
- package/lib/module/components/Avatar/Avatar.types.js.map +1 -0
- package/lib/module/components/Avatar/Avatar.utils.js +44 -0
- package/lib/module/components/Avatar/Avatar.utils.js.map +1 -0
- package/lib/module/components/Avatar/AvatarBadge.js +28 -0
- package/lib/module/components/Avatar/AvatarBadge.js.map +1 -0
- package/lib/module/components/Avatar/DoubleAvatar.js +74 -0
- package/lib/module/components/Avatar/DoubleAvatar.js.map +1 -0
- package/lib/module/components/Avatar/SingleAvatar.js +53 -0
- package/lib/module/components/Avatar/SingleAvatar.js.map +1 -0
- package/lib/module/components/Avatar/index.js +7 -0
- package/lib/module/components/Avatar/index.js.map +1 -0
- package/lib/module/components/ThreadCard/AvatarSection.js +37 -0
- package/lib/module/components/ThreadCard/AvatarSection.js.map +1 -0
- package/lib/module/components/ThreadCard/NamePrefixIcon.js +36 -0
- package/lib/module/components/ThreadCard/NamePrefixIcon.js.map +1 -0
- package/lib/module/components/ThreadCard/ThreadCard.js +132 -0
- package/lib/module/components/ThreadCard/ThreadCard.js.map +1 -0
- package/lib/module/components/ThreadCard/UnreadBadge.js +35 -0
- package/lib/module/components/ThreadCard/UnreadBadge.js.map +1 -0
- package/lib/module/components/ThreadCard/index.js +7 -0
- package/lib/module/components/ThreadCard/index.js.map +1 -0
- package/lib/module/components/ThreadCard/thread-card.utils.js +51 -0
- package/lib/module/components/ThreadCard/thread-card.utils.js.map +1 -0
- package/lib/module/core/index.js +11 -0
- package/lib/module/core/index.js.map +1 -0
- package/lib/module/core/useChatListener.js +62 -0
- package/lib/module/core/useChatListener.js.map +1 -0
- package/lib/module/core/useUserListener.js +72 -0
- package/lib/module/core/useUserListener.js.map +1 -0
- package/lib/module/hooks/query-keys.js +10 -0
- package/lib/module/hooks/query-keys.js.map +1 -0
- package/lib/module/hooks/useChatMessages.js +163 -0
- package/lib/module/hooks/useChatMessages.js.map +1 -0
- package/lib/module/hooks/useConversationList.js +51 -0
- package/lib/module/hooks/useConversationList.js.map +1 -0
- package/lib/module/index.js +14 -0
- package/lib/module/index.js.map +1 -0
- package/lib/module/package.json +1 -0
- package/lib/module/screens/chat-detail/ChatAttachmentPanel.js +106 -0
- package/lib/module/screens/chat-detail/ChatAttachmentPanel.js.map +1 -0
- package/lib/module/screens/chat-detail/ChatComposer.js +288 -0
- package/lib/module/screens/chat-detail/ChatComposer.js.map +1 -0
- package/lib/module/screens/chat-detail/ChatDay.js +65 -0
- package/lib/module/screens/chat-detail/ChatDay.js.map +1 -0
- package/lib/module/screens/chat-detail/ChatDetail.js +104 -0
- package/lib/module/screens/chat-detail/ChatDetail.js.map +1 -0
- package/lib/module/screens/chat-detail/ChatDetailHeader.js +92 -0
- package/lib/module/screens/chat-detail/ChatDetailHeader.js.map +1 -0
- package/lib/module/screens/chat-detail/ChatList.js +145 -0
- package/lib/module/screens/chat-detail/ChatList.js.map +1 -0
- package/lib/module/screens/chat-detail/ChatLoadEarlier.js +23 -0
- package/lib/module/screens/chat-detail/ChatLoadEarlier.js.map +1 -0
- package/lib/module/screens/chat-detail/ChatQuickActions.js +85 -0
- package/lib/module/screens/chat-detail/ChatQuickActions.js.map +1 -0
- package/lib/module/screens/chat-detail/ChatScrollToBottom.js +12 -0
- package/lib/module/screens/chat-detail/ChatScrollToBottom.js.map +1 -0
- package/lib/module/screens/chat-detail/ChatTextBubble.js +62 -0
- package/lib/module/screens/chat-detail/ChatTextBubble.js.map +1 -0
- package/lib/module/screens/chat-detail/constants.js +59 -0
- package/lib/module/screens/chat-detail/constants.js.map +1 -0
- package/lib/module/screens/chat-detail/index.js +12 -0
- package/lib/module/screens/chat-detail/index.js.map +1 -0
- package/lib/module/screens/chat-detail/messages/ChatMessageBubble.js +24 -0
- package/lib/module/screens/chat-detail/messages/ChatMessageBubble.js.map +1 -0
- package/lib/module/screens/chat-detail/messages/types.js +4 -0
- package/lib/module/screens/chat-detail/messages/types.js.map +1 -0
- package/lib/module/screens/chat-detail/types.js +4 -0
- package/lib/module/screens/chat-detail/types.js.map +1 -0
- package/lib/module/screens/chat-detail/useChatActionPress.js +11 -0
- package/lib/module/screens/chat-detail/useChatActionPress.js.map +1 -0
- package/lib/module/screens/inbox/Inbox.js +134 -0
- package/lib/module/screens/inbox/Inbox.js.map +1 -0
- package/lib/module/screens/inbox/MessagesTab.js +58 -0
- package/lib/module/screens/inbox/MessagesTab.js.map +1 -0
- package/lib/module/screens/inbox/index.js +5 -0
- package/lib/module/screens/inbox/index.js.map +1 -0
- package/lib/module/services/apis.js +41 -0
- package/lib/module/services/apis.js.map +1 -0
- package/lib/module/services/index.js +5 -0
- package/lib/module/services/index.js.map +1 -0
- package/lib/module/services/message.js +38 -0
- package/lib/module/services/message.js.map +1 -0
- package/lib/module/store/conversation.js +89 -0
- package/lib/module/store/conversation.js.map +1 -0
- package/lib/module/store/index.js +6 -0
- package/lib/module/store/index.js.map +1 -0
- package/lib/module/store/storeConfig.js +19 -0
- package/lib/module/store/storeConfig.js.map +1 -0
- package/lib/module/store/user.js +25 -0
- package/lib/module/store/user.js.map +1 -0
- package/lib/module/translation/index.js +24 -0
- package/lib/module/translation/index.js.map +1 -0
- package/lib/module/translation/resources/i18n.js +10 -0
- package/lib/module/translation/resources/i18n.js.map +1 -0
- package/lib/module/types/auth.js +9 -0
- package/lib/module/types/auth.js.map +1 -0
- package/lib/module/types/chat.js +26 -0
- package/lib/module/types/chat.js.map +1 -0
- package/lib/module/types/message.js +16 -0
- package/lib/module/types/message.js.map +1 -0
- package/lib/module/utils/conversation.js +61 -0
- package/lib/module/utils/conversation.js.map +1 -0
- package/lib/module/utils/giftedChatMessage.js +90 -0
- package/lib/module/utils/giftedChatMessage.js.map +1 -0
- package/lib/module/utils/message.js +68 -0
- package/lib/module/utils/message.js.map +1 -0
- package/lib/module/utils/resolveMessageType.js +44 -0
- package/lib/module/utils/resolveMessageType.js.map +1 -0
- package/lib/typescript/package.json +1 -0
- package/lib/typescript/src/assets/images/index.d.ts +7 -0
- package/lib/typescript/src/assets/images/index.d.ts.map +1 -0
- package/lib/typescript/src/components/Avatar/Avatar.d.ts +4 -0
- package/lib/typescript/src/components/Avatar/Avatar.d.ts.map +1 -0
- package/lib/typescript/src/components/Avatar/Avatar.types.d.ts +18 -0
- package/lib/typescript/src/components/Avatar/Avatar.types.d.ts.map +1 -0
- package/lib/typescript/src/components/Avatar/Avatar.utils.d.ts +14 -0
- package/lib/typescript/src/components/Avatar/Avatar.utils.d.ts.map +1 -0
- package/lib/typescript/src/components/Avatar/AvatarBadge.d.ts +7 -0
- package/lib/typescript/src/components/Avatar/AvatarBadge.d.ts.map +1 -0
- package/lib/typescript/src/components/Avatar/DoubleAvatar.d.ts +13 -0
- package/lib/typescript/src/components/Avatar/DoubleAvatar.d.ts.map +1 -0
- package/lib/typescript/src/components/Avatar/SingleAvatar.d.ts +12 -0
- package/lib/typescript/src/components/Avatar/SingleAvatar.d.ts.map +1 -0
- package/lib/typescript/src/components/Avatar/index.d.ts +6 -0
- package/lib/typescript/src/components/Avatar/index.d.ts.map +1 -0
- package/lib/typescript/src/components/ThreadCard/AvatarSection.d.ts +8 -0
- package/lib/typescript/src/components/ThreadCard/AvatarSection.d.ts.map +1 -0
- package/lib/typescript/src/components/ThreadCard/NamePrefixIcon.d.ts +8 -0
- package/lib/typescript/src/components/ThreadCard/NamePrefixIcon.d.ts.map +1 -0
- package/lib/typescript/src/components/ThreadCard/ThreadCard.d.ts +11 -0
- package/lib/typescript/src/components/ThreadCard/ThreadCard.d.ts.map +1 -0
- package/lib/typescript/src/components/ThreadCard/UnreadBadge.d.ts +6 -0
- package/lib/typescript/src/components/ThreadCard/UnreadBadge.d.ts.map +1 -0
- package/lib/typescript/src/components/ThreadCard/index.d.ts +5 -0
- package/lib/typescript/src/components/ThreadCard/index.d.ts.map +1 -0
- package/lib/typescript/src/components/ThreadCard/thread-card.utils.d.ts +4 -0
- package/lib/typescript/src/components/ThreadCard/thread-card.utils.d.ts.map +1 -0
- package/lib/typescript/src/core/index.d.ts +3 -0
- package/lib/typescript/src/core/index.d.ts.map +1 -0
- package/lib/typescript/src/core/useChatListener.d.ts +2 -0
- package/lib/typescript/src/core/useChatListener.d.ts.map +1 -0
- package/lib/typescript/src/core/useUserListener.d.ts +2 -0
- package/lib/typescript/src/core/useUserListener.d.ts.map +1 -0
- package/lib/typescript/src/hooks/query-keys.d.ts +9 -0
- package/lib/typescript/src/hooks/query-keys.d.ts.map +1 -0
- package/lib/typescript/src/hooks/useChatMessages.d.ts +21 -0
- package/lib/typescript/src/hooks/useChatMessages.d.ts.map +1 -0
- package/lib/typescript/src/hooks/useConversationList.d.ts +8 -0
- package/lib/typescript/src/hooks/useConversationList.d.ts.map +1 -0
- package/lib/typescript/src/index.d.ts +14 -0
- package/lib/typescript/src/index.d.ts.map +1 -0
- package/lib/typescript/src/screens/chat-detail/ChatAttachmentPanel.d.ts +3 -0
- package/lib/typescript/src/screens/chat-detail/ChatAttachmentPanel.d.ts.map +1 -0
- package/lib/typescript/src/screens/chat-detail/ChatComposer.d.ts +3 -0
- package/lib/typescript/src/screens/chat-detail/ChatComposer.d.ts.map +1 -0
- package/lib/typescript/src/screens/chat-detail/ChatDay.d.ts +3 -0
- package/lib/typescript/src/screens/chat-detail/ChatDay.d.ts.map +1 -0
- package/lib/typescript/src/screens/chat-detail/ChatDetail.d.ts +4 -0
- package/lib/typescript/src/screens/chat-detail/ChatDetail.d.ts.map +1 -0
- package/lib/typescript/src/screens/chat-detail/ChatDetailHeader.d.ts +4 -0
- package/lib/typescript/src/screens/chat-detail/ChatDetailHeader.d.ts.map +1 -0
- package/lib/typescript/src/screens/chat-detail/ChatList.d.ts +3 -0
- package/lib/typescript/src/screens/chat-detail/ChatList.d.ts.map +1 -0
- package/lib/typescript/src/screens/chat-detail/ChatLoadEarlier.d.ts +3 -0
- package/lib/typescript/src/screens/chat-detail/ChatLoadEarlier.d.ts.map +1 -0
- package/lib/typescript/src/screens/chat-detail/ChatQuickActions.d.ts +3 -0
- package/lib/typescript/src/screens/chat-detail/ChatQuickActions.d.ts.map +1 -0
- package/lib/typescript/src/screens/chat-detail/ChatScrollToBottom.d.ts +2 -0
- package/lib/typescript/src/screens/chat-detail/ChatScrollToBottom.d.ts.map +1 -0
- package/lib/typescript/src/screens/chat-detail/ChatTextBubble.d.ts +3 -0
- package/lib/typescript/src/screens/chat-detail/ChatTextBubble.d.ts.map +1 -0
- package/lib/typescript/src/screens/chat-detail/constants.d.ts +17 -0
- package/lib/typescript/src/screens/chat-detail/constants.d.ts.map +1 -0
- package/lib/typescript/src/screens/chat-detail/index.d.ts +13 -0
- package/lib/typescript/src/screens/chat-detail/index.d.ts.map +1 -0
- package/lib/typescript/src/screens/chat-detail/messages/ChatMessageBubble.d.ts +3 -0
- package/lib/typescript/src/screens/chat-detail/messages/ChatMessageBubble.d.ts.map +1 -0
- package/lib/typescript/src/screens/chat-detail/messages/types.d.ts +13 -0
- package/lib/typescript/src/screens/chat-detail/messages/types.d.ts.map +1 -0
- package/lib/typescript/src/screens/chat-detail/types.d.ts +86 -0
- package/lib/typescript/src/screens/chat-detail/types.d.ts.map +1 -0
- package/lib/typescript/src/screens/chat-detail/useChatActionPress.d.ts +3 -0
- package/lib/typescript/src/screens/chat-detail/useChatActionPress.d.ts.map +1 -0
- package/lib/typescript/src/screens/inbox/Inbox.d.ts +10 -0
- package/lib/typescript/src/screens/inbox/Inbox.d.ts.map +1 -0
- package/lib/typescript/src/screens/inbox/MessagesTab.d.ts +7 -0
- package/lib/typescript/src/screens/inbox/MessagesTab.d.ts.map +1 -0
- package/lib/typescript/src/screens/inbox/index.d.ts +3 -0
- package/lib/typescript/src/screens/inbox/index.d.ts.map +1 -0
- package/lib/typescript/src/services/apis.d.ts +12 -0
- package/lib/typescript/src/services/apis.d.ts.map +1 -0
- package/lib/typescript/src/services/index.d.ts +3 -0
- package/lib/typescript/src/services/index.d.ts.map +1 -0
- package/lib/typescript/src/services/message.d.ts +21 -0
- package/lib/typescript/src/services/message.d.ts.map +1 -0
- package/lib/typescript/src/store/conversation.d.ts +24 -0
- package/lib/typescript/src/store/conversation.d.ts.map +1 -0
- package/lib/typescript/src/store/index.d.ts +4 -0
- package/lib/typescript/src/store/index.d.ts.map +1 -0
- package/lib/typescript/src/store/storeConfig.d.ts +4 -0
- package/lib/typescript/src/store/storeConfig.d.ts.map +1 -0
- package/lib/typescript/src/store/user.d.ts +12 -0
- package/lib/typescript/src/store/user.d.ts.map +1 -0
- package/lib/typescript/src/translation/index.d.ts +4 -0
- package/lib/typescript/src/translation/index.d.ts.map +1 -0
- package/lib/typescript/src/translation/resources/i18n.d.ts +5 -0
- package/lib/typescript/src/translation/resources/i18n.d.ts.map +1 -0
- package/lib/typescript/src/types/auth.d.ts +24 -0
- package/lib/typescript/src/types/auth.d.ts.map +1 -0
- package/lib/typescript/src/types/chat.d.ts +99 -0
- package/lib/typescript/src/types/chat.d.ts.map +1 -0
- package/lib/typescript/src/types/message.d.ts +15 -0
- package/lib/typescript/src/types/message.d.ts.map +1 -0
- package/lib/typescript/src/utils/conversation.d.ts +10 -0
- package/lib/typescript/src/utils/conversation.d.ts.map +1 -0
- package/lib/typescript/src/utils/giftedChatMessage.d.ts +10 -0
- package/lib/typescript/src/utils/giftedChatMessage.d.ts.map +1 -0
- package/lib/typescript/src/utils/message.d.ts +15 -0
- package/lib/typescript/src/utils/message.d.ts.map +1 -0
- package/lib/typescript/src/utils/resolveMessageType.d.ts +4 -0
- package/lib/typescript/src/utils/resolveMessageType.d.ts.map +1 -0
- package/package.json +209 -0
- package/src/assets/images/icon_bot.png +0 -0
- package/src/assets/images/index.ts +7 -0
- package/src/assets/images/tag_bot.png +0 -0
- package/src/assets/images/tag_mall.png +0 -0
- package/src/build-ignore.d.ts +24 -0
- package/src/components/Avatar/Avatar.tsx +105 -0
- package/src/components/Avatar/Avatar.types.ts +17 -0
- package/src/components/Avatar/Avatar.utils.ts +49 -0
- package/src/components/Avatar/AvatarBadge.tsx +29 -0
- package/src/components/Avatar/DoubleAvatar.tsx +89 -0
- package/src/components/Avatar/SingleAvatar.tsx +74 -0
- package/src/components/Avatar/index.ts +5 -0
- package/src/components/ThreadCard/AvatarSection.tsx +42 -0
- package/src/components/ThreadCard/NamePrefixIcon.tsx +45 -0
- package/src/components/ThreadCard/ThreadCard.tsx +145 -0
- package/src/components/ThreadCard/UnreadBadge.tsx +35 -0
- package/src/components/ThreadCard/index.ts +4 -0
- package/src/components/ThreadCard/thread-card.utils.ts +68 -0
- package/src/core/index.ts +10 -0
- package/src/core/useChatListener.ts +85 -0
- package/src/core/useUserListener.ts +86 -0
- package/src/hooks/query-keys.ts +11 -0
- package/src/hooks/useChatMessages.ts +243 -0
- package/src/hooks/useConversationList.ts +57 -0
- package/src/index.tsx +36 -0
- package/src/screens/chat-detail/ChatAttachmentPanel.tsx +142 -0
- package/src/screens/chat-detail/ChatComposer.tsx +412 -0
- package/src/screens/chat-detail/ChatDay.tsx +73 -0
- package/src/screens/chat-detail/ChatDetail.tsx +118 -0
- package/src/screens/chat-detail/ChatDetailHeader.tsx +114 -0
- package/src/screens/chat-detail/ChatList.tsx +187 -0
- package/src/screens/chat-detail/ChatLoadEarlier.tsx +20 -0
- package/src/screens/chat-detail/ChatQuickActions.tsx +108 -0
- package/src/screens/chat-detail/ChatScrollToBottom.tsx +8 -0
- package/src/screens/chat-detail/ChatTextBubble.tsx +73 -0
- package/src/screens/chat-detail/constants.ts +76 -0
- package/src/screens/chat-detail/index.ts +33 -0
- package/src/screens/chat-detail/messages/ChatMessageBubble.tsx +24 -0
- package/src/screens/chat-detail/messages/types.ts +14 -0
- package/src/screens/chat-detail/types.ts +97 -0
- package/src/screens/chat-detail/useChatActionPress.ts +17 -0
- package/src/screens/inbox/Inbox.tsx +164 -0
- package/src/screens/inbox/MessagesTab.tsx +62 -0
- package/src/screens/inbox/index.ts +2 -0
- package/src/services/apis.ts +60 -0
- package/src/services/index.ts +2 -0
- package/src/services/message.ts +61 -0
- package/src/store/conversation.ts +116 -0
- package/src/store/index.ts +3 -0
- package/src/store/storeConfig.ts +19 -0
- package/src/store/user.ts +26 -0
- package/src/translation/index.ts +30 -0
- package/src/translation/resources/i18n.ts +8 -0
- package/src/types/auth.ts +25 -0
- package/src/types/chat.ts +118 -0
- package/src/types/message.ts +17 -0
- package/src/utils/conversation.ts +106 -0
- package/src/utils/giftedChatMessage.ts +137 -0
- package/src/utils/message.ts +136 -0
- package/src/utils/resolveMessageType.ts +49 -0
|
@@ -0,0 +1,99 @@
|
|
|
1
|
+
import { type MessageItem, type SessionType, type MessageReceiveOptType, type GroupAtType } from '@droppii/openim-rn-client-sdk';
|
|
2
|
+
export interface ChatProviderProps {
|
|
3
|
+
children: React.ReactNode;
|
|
4
|
+
}
|
|
5
|
+
export declare enum DChatApplicationType {
|
|
6
|
+
BIZ = "BIZ",
|
|
7
|
+
MALL = "MALL"
|
|
8
|
+
}
|
|
9
|
+
export declare enum DChatCategory {
|
|
10
|
+
BIZ_BIZ = "BIZ_BIZ",
|
|
11
|
+
BIZ_MALL = "BIZ_MALL",
|
|
12
|
+
GROUP = "GROUP",
|
|
13
|
+
BIZ_BOT_PDP = "BIZ_BOT_PDP",
|
|
14
|
+
BIZ_BOT_CRM = "BIZ_BOT_CRM"
|
|
15
|
+
}
|
|
16
|
+
export declare enum DChatType {
|
|
17
|
+
SINGLE = "SINGLE",
|
|
18
|
+
GROUP = "GROUP"
|
|
19
|
+
}
|
|
20
|
+
export declare enum DMemberRole {
|
|
21
|
+
AGENT = "AGENT",
|
|
22
|
+
MEMBER = "MEMBER"
|
|
23
|
+
}
|
|
24
|
+
export interface DConversationPeerUser {
|
|
25
|
+
id: string;
|
|
26
|
+
username?: string;
|
|
27
|
+
fullName?: string;
|
|
28
|
+
avatar?: string;
|
|
29
|
+
type: string;
|
|
30
|
+
botName?: string;
|
|
31
|
+
}
|
|
32
|
+
export interface DConversationPeer {
|
|
33
|
+
type: 'USER' | 'GROUP';
|
|
34
|
+
user: DConversationPeerUser | null;
|
|
35
|
+
group: null;
|
|
36
|
+
}
|
|
37
|
+
export interface DConversationItem {
|
|
38
|
+
conversationId: string;
|
|
39
|
+
chatCategory: DChatCategory;
|
|
40
|
+
chatType: DChatType;
|
|
41
|
+
applicationType: string;
|
|
42
|
+
memberRole: DMemberRole;
|
|
43
|
+
pinnedAt: string | null;
|
|
44
|
+
isMuted: boolean;
|
|
45
|
+
peer: DConversationPeerUser;
|
|
46
|
+
lastMessage?: DMessageItem;
|
|
47
|
+
unreadCount?: number;
|
|
48
|
+
conversationType?: SessionType;
|
|
49
|
+
userID?: string;
|
|
50
|
+
groupID?: string;
|
|
51
|
+
showName?: string;
|
|
52
|
+
faceURL?: string;
|
|
53
|
+
recvMsgOpt?: MessageReceiveOptType;
|
|
54
|
+
groupAtType?: GroupAtType;
|
|
55
|
+
latestMsgSendTime?: number;
|
|
56
|
+
draftText?: string;
|
|
57
|
+
draftTextTime?: number;
|
|
58
|
+
isPinned?: boolean;
|
|
59
|
+
isNotInGroup?: boolean;
|
|
60
|
+
isPrivateChat?: boolean;
|
|
61
|
+
isMsgDestruct?: boolean;
|
|
62
|
+
attachedInfo?: string;
|
|
63
|
+
ex?: string;
|
|
64
|
+
}
|
|
65
|
+
export interface DConversationQueryParams {
|
|
66
|
+
applicationType: string;
|
|
67
|
+
page: number;
|
|
68
|
+
pageSize: number;
|
|
69
|
+
}
|
|
70
|
+
export interface DMessageItem extends MessageItem {
|
|
71
|
+
isInternal?: boolean;
|
|
72
|
+
atUserIDList?: unknown;
|
|
73
|
+
attachedInfo?: 'null';
|
|
74
|
+
options?: DMessageOption;
|
|
75
|
+
}
|
|
76
|
+
export interface DMessageOption {
|
|
77
|
+
conversationUpdate: boolean;
|
|
78
|
+
offlinePush: boolean;
|
|
79
|
+
senderConversationUpdate: boolean;
|
|
80
|
+
unreadCount: boolean;
|
|
81
|
+
}
|
|
82
|
+
export interface DMessagePushInfo {
|
|
83
|
+
title: string;
|
|
84
|
+
desc: string;
|
|
85
|
+
/**
|
|
86
|
+
* @instance DMessagePushInfoEx
|
|
87
|
+
*/
|
|
88
|
+
ex: string;
|
|
89
|
+
signalInfo: string;
|
|
90
|
+
iospushSound: 'default';
|
|
91
|
+
iosbadgeCount: boolean;
|
|
92
|
+
}
|
|
93
|
+
export interface DMessagePushInfoEx {
|
|
94
|
+
icon: string;
|
|
95
|
+
conversationId: string;
|
|
96
|
+
title: string;
|
|
97
|
+
desc: string;
|
|
98
|
+
}
|
|
99
|
+
//# sourceMappingURL=chat.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"chat.d.ts","sourceRoot":"","sources":["../../../../src/types/chat.ts"],"names":[],"mappings":"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"}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
export declare const DChatMessageType: {
|
|
2
|
+
readonly Text: "TEXT";
|
|
3
|
+
readonly Link: "LINK";
|
|
4
|
+
readonly Image: "IMAGE";
|
|
5
|
+
readonly Video: "VIDEO";
|
|
6
|
+
readonly File: "FILE";
|
|
7
|
+
readonly Order: "ORDER";
|
|
8
|
+
readonly Unsupported: "UNSUPPORTED";
|
|
9
|
+
};
|
|
10
|
+
export type DChatMessageType = (typeof DChatMessageType)[keyof typeof DChatMessageType];
|
|
11
|
+
export declare const CUSTOM_MESSAGE_DATA_TYPE: {
|
|
12
|
+
readonly LINK: "LINK";
|
|
13
|
+
readonly ORDER: "ORDER";
|
|
14
|
+
};
|
|
15
|
+
//# sourceMappingURL=message.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"message.d.ts","sourceRoot":"","sources":["../../../../src/types/message.ts"],"names":[],"mappings":"AAAA,eAAO,MAAM,gBAAgB;;;;;;;;CAQnB,CAAC;AAEX,MAAM,MAAM,gBAAgB,GAC1B,CAAC,OAAO,gBAAgB,CAAC,CAAC,MAAM,OAAO,gBAAgB,CAAC,CAAC;AAE3D,eAAO,MAAM,wBAAwB;;;CAG3B,CAAC"}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { SessionType, type ConversationItem } from '@droppii/openim-rn-client-sdk';
|
|
2
|
+
import { type DConversationItem, DChatCategory } from '../types/chat';
|
|
3
|
+
export declare const conversationCompare: (a: ConversationItem, b: ConversationItem) => number;
|
|
4
|
+
export declare const dConversationCompare: (a: DConversationItem, b: DConversationItem) => number;
|
|
5
|
+
export declare const mergeOpenIMIntoConversation: (droppii: DConversationItem, openim: ConversationItem) => DConversationItem;
|
|
6
|
+
export declare const getConversationID: (sessionType: SessionType, senderID?: string, receiverID?: string) => string;
|
|
7
|
+
export declare const isBotCrmChat: (chatCategory: DChatCategory) => chatCategory is DChatCategory.BIZ_BOT_PDP | DChatCategory.BIZ_BOT_CRM;
|
|
8
|
+
export declare const resolveDisplayName: (item: DConversationItem, t: (key: string) => string) => string;
|
|
9
|
+
export declare const resolveAvatarUrl: (item: DConversationItem) => string;
|
|
10
|
+
//# sourceMappingURL=conversation.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"conversation.d.ts","sourceRoot":"","sources":["../../../../src/utils/conversation.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,WAAW,EACX,KAAK,gBAAgB,EACtB,MAAM,+BAA+B,CAAC;AACvC,OAAO,EACL,KAAK,iBAAiB,EAEtB,aAAa,EACd,MAAM,eAAe,CAAC;AAEvB,eAAO,MAAM,mBAAmB,GAC9B,GAAG,gBAAgB,EACnB,GAAG,gBAAgB,WAcpB,CAAC;AAEF,eAAO,MAAM,oBAAoB,GAC/B,GAAG,iBAAiB,EACpB,GAAG,iBAAiB,WAWrB,CAAC;AAEF,eAAO,MAAM,2BAA2B,GACtC,SAAS,iBAAiB,EAC1B,QAAQ,gBAAgB,KACvB,iBAkBF,CAAC;AAEF,eAAO,MAAM,iBAAiB,GAC5B,aAAa,WAAW,EACxB,WAAW,MAAM,EACjB,aAAa,MAAM,WAUpB,CAAC;AAEF,eAAO,MAAM,YAAY,GAAI,cAAc,aAAa,0EAEZ,CAAC;AAE7C,eAAO,MAAM,kBAAkB,GAC7B,MAAM,iBAAiB,EACvB,GAAG,CAAC,GAAG,EAAE,MAAM,KAAK,MAAM,WAa3B,CAAC;AAEF,eAAO,MAAM,gBAAgB,GAAI,MAAM,iBAAiB,WAGvD,CAAC"}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import type { IMessage } from 'react-native-gifted-chat';
|
|
2
|
+
import type { DChatMessageType } from '../types/message';
|
|
3
|
+
import type { DMessageItem } from '../types/chat';
|
|
4
|
+
export type DGiftedChatMessage = IMessage & {
|
|
5
|
+
openIMMessage: DMessageItem;
|
|
6
|
+
messageType: DChatMessageType;
|
|
7
|
+
};
|
|
8
|
+
export declare const mapOpenIMMessageToGiftedChat: (message: DMessageItem) => DGiftedChatMessage;
|
|
9
|
+
export declare const mapOpenIMMessagesToGiftedChat: (messages: DMessageItem[]) => DGiftedChatMessage[];
|
|
10
|
+
//# sourceMappingURL=giftedChatMessage.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"giftedChatMessage.d.ts","sourceRoot":"","sources":["../../../../src/utils/giftedChatMessage.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,0BAA0B,CAAC;AACzD,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,kBAAkB,CAAC;AACzD,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,eAAe,CAAC;AAGlD,MAAM,MAAM,kBAAkB,GAAG,QAAQ,GAAG;IAC1C,aAAa,EAAE,YAAY,CAAC;IAC5B,WAAW,EAAE,gBAAgB,CAAC;CAC/B,CAAC;AAqEF,eAAO,MAAM,4BAA4B,GACvC,SAAS,YAAY,KACpB,kBA6CF,CAAC;AAEF,eAAO,MAAM,6BAA6B,GACxC,UAAU,YAAY,EAAE,KACvB,kBAAkB,EAOpB,CAAC"}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import { type MessageItem } from '@droppii/openim-rn-client-sdk';
|
|
2
|
+
import type { DMessageItem } from '../types/chat';
|
|
3
|
+
export declare const mergeMessages: (current: DMessageItem[], incoming: DMessageItem[]) => DMessageItem[];
|
|
4
|
+
export declare const normalizeCreatedMessage: (message: MessageItem | string) => MessageItem;
|
|
5
|
+
export type HistoryPaginationAnchor = {
|
|
6
|
+
clientMsgID: string;
|
|
7
|
+
lastMinSeq?: number;
|
|
8
|
+
};
|
|
9
|
+
export declare const resolveHistoryLastMinSeq: (history: {
|
|
10
|
+
lastMinSeq?: number;
|
|
11
|
+
}, fallbackMessage?: DMessageItem) => number;
|
|
12
|
+
export declare const getHistoryPaginationAnchor: (messages: DMessageItem[]) => HistoryPaginationAnchor | null;
|
|
13
|
+
export declare const hasNewHistoryMessages: (current: DMessageItem[], incoming: DMessageItem[]) => boolean;
|
|
14
|
+
export declare const belongsToConversation: (message: MessageItem, conversationId: string, groupID?: string) => boolean;
|
|
15
|
+
//# sourceMappingURL=message.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"message.d.ts","sourceRoot":"","sources":["../../../../src/utils/message.ts"],"names":[],"mappings":"AAAA,OAAO,EAAe,KAAK,WAAW,EAAE,MAAM,+BAA+B,CAAC;AAC9E,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,eAAe,CAAC;AASlD,eAAO,MAAM,aAAa,GACxB,SAAS,YAAY,EAAE,EACvB,UAAU,YAAY,EAAE,KACvB,YAAY,EAad,CAAC;AAEF,eAAO,MAAM,uBAAuB,GAClC,SAAS,WAAW,GAAG,MAAM,KAC5B,WAYF,CAAC;AAEF,MAAM,MAAM,uBAAuB,GAAG;IACpC,WAAW,EAAE,MAAM,CAAC;IACpB,UAAU,CAAC,EAAE,MAAM,CAAC;CACrB,CAAC;AAEF,eAAO,MAAM,wBAAwB,GACnC,SAAS;IAAE,UAAU,CAAC,EAAE,MAAM,CAAA;CAAE,EAChC,kBAAkB,YAAY,KAC7B,MAMF,CAAC;AAEF,eAAO,MAAM,0BAA0B,GACrC,UAAU,YAAY,EAAE,KACvB,uBAAuB,GAAG,IAkB5B,CAAC;AAEF,eAAO,MAAM,qBAAqB,GAChC,SAAS,YAAY,EAAE,EACvB,UAAU,YAAY,EAAE,KACvB,OASF,CAAC;AAEF,eAAO,MAAM,qBAAqB,GAChC,SAAS,WAAW,EACpB,gBAAgB,MAAM,EACtB,UAAU,MAAM,KACf,OAmCF,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"resolveMessageType.d.ts","sourceRoot":"","sources":["../../../../src/utils/resolveMessageType.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,eAAe,CAAC;AAClD,OAAO,EAA4B,gBAAgB,EAAE,MAAM,kBAAkB,CAAC;AAgB9E,eAAO,MAAM,sBAAsB,GACjC,SAAS,YAAY,KACpB,gBA4BF,CAAC"}
|
package/package.json
ADDED
|
@@ -0,0 +1,209 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@droppii-org/chat-mobile",
|
|
3
|
+
"version": "0.2.0",
|
|
4
|
+
"description": "Droppii chat mobile",
|
|
5
|
+
"keywords": [
|
|
6
|
+
"react-native",
|
|
7
|
+
"ios",
|
|
8
|
+
"android"
|
|
9
|
+
],
|
|
10
|
+
"homepage": "https://github.com/droppii/chat-mobile#readme",
|
|
11
|
+
"bugs": {
|
|
12
|
+
"url": "https://github.com/droppii/chat-mobile/issues"
|
|
13
|
+
},
|
|
14
|
+
"repository": {
|
|
15
|
+
"type": "git",
|
|
16
|
+
"url": "git+https://github.com/droppii/chat-mobile.gitt"
|
|
17
|
+
},
|
|
18
|
+
"license": "MIT",
|
|
19
|
+
"author": "droppii <hoang.phan@droppii.com> (https://github.com/hoangphandroppii)",
|
|
20
|
+
"type": "commonjs",
|
|
21
|
+
"exports": {
|
|
22
|
+
".": {
|
|
23
|
+
"source": "./src/index.tsx",
|
|
24
|
+
"types": "./lib/typescript/src/index.d.ts",
|
|
25
|
+
"default": "./lib/module/index.js"
|
|
26
|
+
},
|
|
27
|
+
"./package.json": "./package.json"
|
|
28
|
+
},
|
|
29
|
+
"main": "./lib/module/index.js",
|
|
30
|
+
"types": "./lib/typescript/src/index.d.ts",
|
|
31
|
+
"directories": {
|
|
32
|
+
"doc": "docs",
|
|
33
|
+
"example": "example",
|
|
34
|
+
"lib": "lib"
|
|
35
|
+
},
|
|
36
|
+
"files": [
|
|
37
|
+
"src",
|
|
38
|
+
"lib",
|
|
39
|
+
"android",
|
|
40
|
+
"ios",
|
|
41
|
+
"cpp",
|
|
42
|
+
"*.podspec",
|
|
43
|
+
"react-native.config.js",
|
|
44
|
+
"!ios/build",
|
|
45
|
+
"!android/build",
|
|
46
|
+
"!android/gradle",
|
|
47
|
+
"!android/gradlew",
|
|
48
|
+
"!android/gradlew.bat",
|
|
49
|
+
"!android/local.properties",
|
|
50
|
+
"!**/__tests__",
|
|
51
|
+
"!**/__fixtures__",
|
|
52
|
+
"!**/__mocks__",
|
|
53
|
+
"!**/.*"
|
|
54
|
+
],
|
|
55
|
+
"workspaces": [
|
|
56
|
+
"example"
|
|
57
|
+
],
|
|
58
|
+
"scripts": {
|
|
59
|
+
"example": "yarn workspace @droppii/chat-mobile-example",
|
|
60
|
+
"clean": "del-cli android/build example/android/build example/android/app/build example/ios/build lib",
|
|
61
|
+
"prepare": "bob build",
|
|
62
|
+
"typecheck": "tsc -p tsconfig.build.json 2>&1 | grep -E 'src/.*error' || echo 'Typecheck passed (external dependency warnings ignored)'",
|
|
63
|
+
"lint": "eslint \"**/*.{js,ts,tsx}\"",
|
|
64
|
+
"test": "jest",
|
|
65
|
+
"release": "release-it --no-git --ci --no-increment",
|
|
66
|
+
"web": "vite",
|
|
67
|
+
"build:web": "vite build"
|
|
68
|
+
},
|
|
69
|
+
"dependencies": {
|
|
70
|
+
"@droppii/openim-rn-client-sdk": "git+ssh://git@github.com/droppii/open-im-sdk-reactnative.git#v1.0.0-rc5",
|
|
71
|
+
"axios": "^1.16.1",
|
|
72
|
+
"lodash": "^4.18.1",
|
|
73
|
+
"react-native-fs": "^2.20.0",
|
|
74
|
+
"react-native-gifted-chat": "^3.3.3",
|
|
75
|
+
"react-native-tab-view": "^4.3.1"
|
|
76
|
+
},
|
|
77
|
+
"devDependencies": {
|
|
78
|
+
"@commitlint/config-conventional": "^20.5.0",
|
|
79
|
+
"@droppii/libs": "git+ssh://git@github.com:droppii/mobile-components.git#v1.1.13",
|
|
80
|
+
"@eslint/compat": "^2.0.3",
|
|
81
|
+
"@eslint/eslintrc": "^3.3.5",
|
|
82
|
+
"@eslint/js": "^10.0.1",
|
|
83
|
+
"@growthbook/growthbook-react": "*",
|
|
84
|
+
"@jest/globals": "^30.0.0",
|
|
85
|
+
"@react-native/babel-preset": "0.85.0",
|
|
86
|
+
"@react-native/eslint-config": "0.85.0",
|
|
87
|
+
"@react-native/jest-preset": "0.85.0",
|
|
88
|
+
"@react-navigation/native": "*",
|
|
89
|
+
"@release-it/conventional-changelog": "^10.0.6",
|
|
90
|
+
"@tanstack/react-query": "^5.101.0",
|
|
91
|
+
"@types/lodash": "^4",
|
|
92
|
+
"@types/react": "^19.2.0",
|
|
93
|
+
"@types/react-native": "^0.73.0",
|
|
94
|
+
"@types/react-query": "^1.2.9",
|
|
95
|
+
"commitlint": "^20.5.0",
|
|
96
|
+
"del-cli": "^7.0.0",
|
|
97
|
+
"eslint": "^9.39.4",
|
|
98
|
+
"eslint-config-prettier": "^10.1.8",
|
|
99
|
+
"eslint-plugin-ft-flow": "^3.0.11",
|
|
100
|
+
"eslint-plugin-prettier": "^5.5.5",
|
|
101
|
+
"jest": "^30.3.0",
|
|
102
|
+
"lefthook": "^2.1.4",
|
|
103
|
+
"prettier": "^3.8.1",
|
|
104
|
+
"react-native": "^0.86.0",
|
|
105
|
+
"react-native-builder-bob": "^0.41.0",
|
|
106
|
+
"react-native-device-info": "*",
|
|
107
|
+
"react-native-gesture-handler": "^3.0.0",
|
|
108
|
+
"react-native-keyboard-controller": "1.19.0",
|
|
109
|
+
"react-native-linear-gradient": "^2.8.3",
|
|
110
|
+
"react-native-mmkv": "4.0.0",
|
|
111
|
+
"react-native-reanimated": "3.19.1",
|
|
112
|
+
"react-native-safe-area-context": "^5.8.0",
|
|
113
|
+
"react-native-svg": "^15.15.5",
|
|
114
|
+
"react-native-vector-icons": "*",
|
|
115
|
+
"react-native-web": "~0.21.1",
|
|
116
|
+
"release-it": "^19.2.4",
|
|
117
|
+
"turbo": "^2.8.21",
|
|
118
|
+
"typescript": "^6.0.2",
|
|
119
|
+
"zustand": "^5.0.14"
|
|
120
|
+
},
|
|
121
|
+
"peerDependencies": {
|
|
122
|
+
"@droppii/libs": "*",
|
|
123
|
+
"@tanstack/react-query": "*",
|
|
124
|
+
"react": "*",
|
|
125
|
+
"react-native": "*",
|
|
126
|
+
"react-native-gesture-handler": "*",
|
|
127
|
+
"react-native-gifted-chat": "*",
|
|
128
|
+
"react-native-keyboard-controller": "*",
|
|
129
|
+
"react-native-linear-gradient": "*",
|
|
130
|
+
"react-native-mmkv": "*",
|
|
131
|
+
"react-native-reanimated": "*",
|
|
132
|
+
"react-native-safe-area-context": "*",
|
|
133
|
+
"react-native-svg": "*",
|
|
134
|
+
"zustand": "*"
|
|
135
|
+
},
|
|
136
|
+
"publishConfig": {
|
|
137
|
+
"registry": "https://registry.npmjs.org/",
|
|
138
|
+
"access": "public"
|
|
139
|
+
},
|
|
140
|
+
"packageManager": "yarn@4.17.0",
|
|
141
|
+
"react-native-builder-bob": {
|
|
142
|
+
"source": "src",
|
|
143
|
+
"output": "lib",
|
|
144
|
+
"targets": [
|
|
145
|
+
[
|
|
146
|
+
"module",
|
|
147
|
+
{
|
|
148
|
+
"esm": true
|
|
149
|
+
}
|
|
150
|
+
],
|
|
151
|
+
[
|
|
152
|
+
"typescript",
|
|
153
|
+
{
|
|
154
|
+
"project": "tsconfig.build.json"
|
|
155
|
+
}
|
|
156
|
+
]
|
|
157
|
+
]
|
|
158
|
+
},
|
|
159
|
+
"prettier": {
|
|
160
|
+
"quoteProps": "consistent",
|
|
161
|
+
"singleQuote": true,
|
|
162
|
+
"tabWidth": 2,
|
|
163
|
+
"trailingComma": "es5",
|
|
164
|
+
"useTabs": false
|
|
165
|
+
},
|
|
166
|
+
"jest": {
|
|
167
|
+
"preset": "@react-native/jest-preset",
|
|
168
|
+
"modulePathIgnorePatterns": [
|
|
169
|
+
"<rootDir>/example/node_modules",
|
|
170
|
+
"<rootDir>/lib/"
|
|
171
|
+
]
|
|
172
|
+
},
|
|
173
|
+
"commitlint": {
|
|
174
|
+
"extends": [
|
|
175
|
+
"@commitlint/config-conventional"
|
|
176
|
+
]
|
|
177
|
+
},
|
|
178
|
+
"release-it": {
|
|
179
|
+
"git": {
|
|
180
|
+
"commitMessage": "chore: release ${version}",
|
|
181
|
+
"tagName": "v${version}"
|
|
182
|
+
},
|
|
183
|
+
"npm": {
|
|
184
|
+
"publish": true
|
|
185
|
+
},
|
|
186
|
+
"github": {
|
|
187
|
+
"release": true
|
|
188
|
+
},
|
|
189
|
+
"plugins": {
|
|
190
|
+
"@release-it/conventional-changelog": {
|
|
191
|
+
"preset": {
|
|
192
|
+
"name": "angular"
|
|
193
|
+
}
|
|
194
|
+
}
|
|
195
|
+
}
|
|
196
|
+
},
|
|
197
|
+
"create-react-native-library": {
|
|
198
|
+
"type": "library",
|
|
199
|
+
"languages": "js",
|
|
200
|
+
"tools": [
|
|
201
|
+
"eslint",
|
|
202
|
+
"jest",
|
|
203
|
+
"lefthook",
|
|
204
|
+
"release-it",
|
|
205
|
+
"vite"
|
|
206
|
+
],
|
|
207
|
+
"version": "0.62.0"
|
|
208
|
+
}
|
|
209
|
+
}
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
declare module '@droppii/libs/*';
|
|
2
|
+
declare module '@droppii/libs' {
|
|
3
|
+
export type KBottomSheetProps = any;
|
|
4
|
+
export type KPopupProps = any;
|
|
5
|
+
export type KToastBarProps = any;
|
|
6
|
+
|
|
7
|
+
export const KColors: any;
|
|
8
|
+
export const KSpacingValue: any;
|
|
9
|
+
export const KContainer: any;
|
|
10
|
+
export const KLabel: any;
|
|
11
|
+
export const KImage: any;
|
|
12
|
+
export const KButton: any;
|
|
13
|
+
export const KInput: any;
|
|
14
|
+
export const KRadiusValue: any;
|
|
15
|
+
export const KDivider: any;
|
|
16
|
+
export const KListItem: any;
|
|
17
|
+
export const KDims: any;
|
|
18
|
+
export const KBars: any;
|
|
19
|
+
export const KRating: any;
|
|
20
|
+
export const KProduct: any;
|
|
21
|
+
export const KFonts: any;
|
|
22
|
+
export const KBadge: any;
|
|
23
|
+
export const KNavigation: any;
|
|
24
|
+
}
|
|
@@ -0,0 +1,105 @@
|
|
|
1
|
+
import { memo, useMemo } from 'react';
|
|
2
|
+
import { StyleSheet } from 'react-native';
|
|
3
|
+
import { KContainer, KColors } from '@droppii/libs';
|
|
4
|
+
import { SingleAvatar } from './SingleAvatar';
|
|
5
|
+
import { DoubleAvatar } from './DoubleAvatar';
|
|
6
|
+
import { AvatarBadge } from './AvatarBadge';
|
|
7
|
+
import { SIZE_MAP } from './Avatar.utils';
|
|
8
|
+
import type { AvatarProps } from './Avatar.types';
|
|
9
|
+
|
|
10
|
+
const Avatar = memo(
|
|
11
|
+
({
|
|
12
|
+
source,
|
|
13
|
+
size = 'md',
|
|
14
|
+
type = 'single',
|
|
15
|
+
secondarySource,
|
|
16
|
+
badge,
|
|
17
|
+
fullName,
|
|
18
|
+
borderColor = KColors.white,
|
|
19
|
+
borderWidth = 1,
|
|
20
|
+
placeholderColor = KColors.palette.gray.w400,
|
|
21
|
+
onPress,
|
|
22
|
+
}: AvatarProps) => {
|
|
23
|
+
const sizeValue = useMemo(() => SIZE_MAP[size], [size]);
|
|
24
|
+
|
|
25
|
+
const content = useMemo(() => {
|
|
26
|
+
if (type === 'double') {
|
|
27
|
+
return (
|
|
28
|
+
<DoubleAvatar
|
|
29
|
+
primarySource={source}
|
|
30
|
+
secondarySource={secondarySource}
|
|
31
|
+
size={sizeValue}
|
|
32
|
+
borderColor={borderColor}
|
|
33
|
+
borderWidth={borderWidth}
|
|
34
|
+
placeholderColor={placeholderColor}
|
|
35
|
+
/>
|
|
36
|
+
);
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
return (
|
|
40
|
+
<SingleAvatar
|
|
41
|
+
source={source}
|
|
42
|
+
size={sizeValue}
|
|
43
|
+
borderColor={borderColor}
|
|
44
|
+
borderWidth={borderWidth}
|
|
45
|
+
placeholderColor={placeholderColor}
|
|
46
|
+
backgroundColor={KColors.palette.gray.w300}
|
|
47
|
+
fullName={fullName}
|
|
48
|
+
/>
|
|
49
|
+
);
|
|
50
|
+
}, [
|
|
51
|
+
type,
|
|
52
|
+
source,
|
|
53
|
+
secondarySource,
|
|
54
|
+
sizeValue,
|
|
55
|
+
borderColor,
|
|
56
|
+
borderWidth,
|
|
57
|
+
placeholderColor,
|
|
58
|
+
fullName,
|
|
59
|
+
]);
|
|
60
|
+
|
|
61
|
+
const containerStyle = useMemo(
|
|
62
|
+
() => ({
|
|
63
|
+
width: sizeValue,
|
|
64
|
+
height: sizeValue,
|
|
65
|
+
}),
|
|
66
|
+
[sizeValue]
|
|
67
|
+
);
|
|
68
|
+
|
|
69
|
+
if (onPress) {
|
|
70
|
+
return (
|
|
71
|
+
<KContainer.Touchable
|
|
72
|
+
style={[styles.container, containerStyle]}
|
|
73
|
+
onPress={onPress}
|
|
74
|
+
activeOpacity={0.7}
|
|
75
|
+
>
|
|
76
|
+
{content}
|
|
77
|
+
{badge && <AvatarBadge variant={badge.variant} size={sizeValue} />}
|
|
78
|
+
</KContainer.Touchable>
|
|
79
|
+
);
|
|
80
|
+
}
|
|
81
|
+
|
|
82
|
+
return (
|
|
83
|
+
<KContainer.View style={[styles.container, containerStyle]}>
|
|
84
|
+
{content}
|
|
85
|
+
{badge && <AvatarBadge variant={badge.variant} size={sizeValue} />}
|
|
86
|
+
</KContainer.View>
|
|
87
|
+
);
|
|
88
|
+
}
|
|
89
|
+
);
|
|
90
|
+
|
|
91
|
+
Avatar.displayName = 'Avatar';
|
|
92
|
+
|
|
93
|
+
export default Avatar;
|
|
94
|
+
|
|
95
|
+
const styles = StyleSheet.create({
|
|
96
|
+
container: {
|
|
97
|
+
position: 'relative',
|
|
98
|
+
justifyContent: 'center',
|
|
99
|
+
alignItems: 'center',
|
|
100
|
+
},
|
|
101
|
+
badge: {
|
|
102
|
+
position: 'absolute',
|
|
103
|
+
overflow: 'hidden',
|
|
104
|
+
},
|
|
105
|
+
});
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
export interface AvatarProps {
|
|
2
|
+
userId?: string;
|
|
3
|
+
source?: string | null;
|
|
4
|
+
size?: 'sm' | 'md' | 'lg';
|
|
5
|
+
type?: 'single' | 'double';
|
|
6
|
+
secondarySource?: string | null;
|
|
7
|
+
badge?: {
|
|
8
|
+
label?: string;
|
|
9
|
+
variant?: 'bot' | 'support' | 'mall' | 'custom';
|
|
10
|
+
};
|
|
11
|
+
fullName?: string;
|
|
12
|
+
borderColor?: string;
|
|
13
|
+
borderWidth?: number;
|
|
14
|
+
placeholderColor?: string;
|
|
15
|
+
backgroundColor?: string;
|
|
16
|
+
onPress?: () => void;
|
|
17
|
+
}
|
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
const SIZE_MAP = {
|
|
2
|
+
sm: 24,
|
|
3
|
+
md: 48,
|
|
4
|
+
lg: 64,
|
|
5
|
+
} as const;
|
|
6
|
+
|
|
7
|
+
const TYPO_MAP = {
|
|
8
|
+
24: 'TextXsBold',
|
|
9
|
+
48: 'TextNmBold',
|
|
10
|
+
64: 'TextLgBold',
|
|
11
|
+
} as const;
|
|
12
|
+
|
|
13
|
+
export const getInitials = (fullName?: string): string => {
|
|
14
|
+
if (!fullName) return '?';
|
|
15
|
+
|
|
16
|
+
// Remove emoji, numbers, and special characters, keep only letters and spaces
|
|
17
|
+
const cleaned = fullName
|
|
18
|
+
.replace(/[^\p{L}\s]/gu, '') // Remove non-letter, non-space chars (Unicode-safe)
|
|
19
|
+
.trim();
|
|
20
|
+
|
|
21
|
+
if (!cleaned) return '?';
|
|
22
|
+
|
|
23
|
+
const parts = cleaned.split(/\s+/).filter(Boolean);
|
|
24
|
+
|
|
25
|
+
if (parts.length === 1) {
|
|
26
|
+
// Single name: use first character
|
|
27
|
+
return parts[0][0]?.toUpperCase() ?? '?';
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
// Multiple names: use first letter of first and last name
|
|
31
|
+
const firstInitial = parts[0][0]?.toUpperCase() ?? '';
|
|
32
|
+
const lastInitial = parts[parts.length - 1][0]?.toUpperCase() ?? '';
|
|
33
|
+
return firstInitial + lastInitial || '?';
|
|
34
|
+
};
|
|
35
|
+
|
|
36
|
+
export const getBadgeImage = (variant?: string) => {
|
|
37
|
+
const Images = require('../../assets/images').default;
|
|
38
|
+
switch (variant) {
|
|
39
|
+
case 'mall':
|
|
40
|
+
return Images.TAG_MALL;
|
|
41
|
+
case 'bot':
|
|
42
|
+
case 'support':
|
|
43
|
+
return Images.TAG_BOT;
|
|
44
|
+
default:
|
|
45
|
+
return Images.TAG_BOT;
|
|
46
|
+
}
|
|
47
|
+
};
|
|
48
|
+
|
|
49
|
+
export { SIZE_MAP, TYPO_MAP };
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
import { memo } from 'react';
|
|
2
|
+
import { Image as RNImage, StyleSheet } from 'react-native';
|
|
3
|
+
import { getBadgeImage } from './Avatar.utils';
|
|
4
|
+
|
|
5
|
+
interface AvatarBadgeProps {
|
|
6
|
+
variant?: 'bot' | 'support' | 'mall' | 'custom';
|
|
7
|
+
size: number;
|
|
8
|
+
}
|
|
9
|
+
|
|
10
|
+
export const AvatarBadge = memo(
|
|
11
|
+
({ variant, size: _size }: AvatarBadgeProps) => {
|
|
12
|
+
const badgeImage = getBadgeImage(variant);
|
|
13
|
+
|
|
14
|
+
return <RNImage source={badgeImage} style={styles.badgeImage} />;
|
|
15
|
+
}
|
|
16
|
+
);
|
|
17
|
+
|
|
18
|
+
AvatarBadge.displayName = 'AvatarBadge';
|
|
19
|
+
|
|
20
|
+
const styles = StyleSheet.create({
|
|
21
|
+
badgeImage: {
|
|
22
|
+
position: 'absolute',
|
|
23
|
+
bottom: 0,
|
|
24
|
+
right: 0,
|
|
25
|
+
width: 28,
|
|
26
|
+
height: 17,
|
|
27
|
+
resizeMode: 'contain',
|
|
28
|
+
},
|
|
29
|
+
});
|