@droppii-org/chat-mobile 0.2.18 → 0.2.20
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/lib/module/components/ThreadCard/AvatarSection.js.map +1 -1
- package/lib/module/components/ThreadCard/ThreadCard.js +17 -9
- package/lib/module/components/ThreadCard/ThreadCard.js.map +1 -1
- package/lib/module/components/flows/inputButtons/index.js +7 -3
- package/lib/module/components/flows/inputButtons/index.js.map +1 -1
- package/lib/module/context/ChatContext.js +27 -4
- package/lib/module/context/ChatContext.js.map +1 -1
- package/lib/module/context/ChatDetailContext.js.map +1 -1
- package/lib/module/core/useChatListener.js +2 -4
- package/lib/module/core/useChatListener.js.map +1 -1
- package/lib/module/core/useUserListener.js +4 -7
- package/lib/module/core/useUserListener.js.map +1 -1
- package/lib/module/hooks/flows/useFlow.js +14 -3
- package/lib/module/hooks/flows/useFlow.js.map +1 -1
- package/lib/module/hooks/message/useSendMessage.js +1 -1
- package/lib/module/hooks/message/useSendMessage.js.map +1 -1
- package/lib/module/hooks/useConversationList.js +3 -27
- package/lib/module/hooks/useConversationList.js.map +1 -1
- package/lib/module/hooks/useLinkPreview/useLinkPreview.js +1 -1
- package/lib/module/hooks/useLinkPreview/useLinkPreview.js.map +1 -1
- package/lib/module/screens/chat-detail/ChatDetail.js +1 -6
- package/lib/module/screens/chat-detail/ChatDetail.js.map +1 -1
- package/lib/module/screens/chat-detail/ChatDetailHeader.js +6 -6
- package/lib/module/screens/chat-detail/ChatDetailHeader.js.map +1 -1
- package/lib/module/screens/chat-detail/ChatLinkPreview.js +3 -1
- package/lib/module/screens/chat-detail/ChatLinkPreview.js.map +1 -1
- package/lib/module/screens/chat-detail/ChatListLegend.js +2 -2
- package/lib/module/screens/chat-detail/ChatListLegend.js.map +1 -1
- package/lib/module/screens/chat-detail/conversationHeader.utils.js +9 -0
- package/lib/module/screens/chat-detail/conversationHeader.utils.js.map +1 -1
- package/lib/module/screens/inbox/Inbox.js +5 -1
- package/lib/module/screens/inbox/Inbox.js.map +1 -1
- package/lib/module/services/apis.js +0 -20
- package/lib/module/services/apis.js.map +1 -1
- package/lib/module/store/conversation.js +1 -38
- package/lib/module/store/conversation.js.map +1 -1
- package/lib/module/types/auth.js.map +1 -1
- package/lib/module/types/chat.js.map +1 -1
- package/lib/module/utils/conversation.js +1 -28
- package/lib/module/utils/conversation.js.map +1 -1
- package/lib/module/utils/message.js.map +1 -1
- package/lib/module/utils/messageUtils.js +5 -3
- package/lib/module/utils/messageUtils.js.map +1 -1
- package/lib/typescript/src/components/ThreadCard/AvatarSection.d.ts +2 -2
- package/lib/typescript/src/components/ThreadCard/AvatarSection.d.ts.map +1 -1
- package/lib/typescript/src/components/ThreadCard/ThreadCard.d.ts.map +1 -1
- package/lib/typescript/src/context/ChatContext.d.ts.map +1 -1
- package/lib/typescript/src/core/useChatListener.d.ts.map +1 -1
- package/lib/typescript/src/core/useUserListener.d.ts.map +1 -1
- package/lib/typescript/src/hooks/flows/useFlow.d.ts.map +1 -1
- package/lib/typescript/src/hooks/useConversationList.d.ts +2 -2
- package/lib/typescript/src/hooks/useConversationList.d.ts.map +1 -1
- package/lib/typescript/src/hooks/useLinkPreview/useLinkPreview.d.ts.map +1 -1
- package/lib/typescript/src/screens/chat-detail/ChatDetail.d.ts +1 -1
- package/lib/typescript/src/screens/chat-detail/ChatDetail.d.ts.map +1 -1
- package/lib/typescript/src/screens/chat-detail/ChatDetailHeader.d.ts +1 -1
- package/lib/typescript/src/screens/chat-detail/ChatDetailHeader.d.ts.map +1 -1
- package/lib/typescript/src/screens/chat-detail/ChatLinkPreview.d.ts.map +1 -1
- package/lib/typescript/src/screens/chat-detail/ChatListLegend.d.ts.map +1 -1
- package/lib/typescript/src/screens/chat-detail/conversationHeader.utils.d.ts +7 -5
- package/lib/typescript/src/screens/chat-detail/conversationHeader.utils.d.ts.map +1 -1
- package/lib/typescript/src/screens/chat-detail/types.d.ts +6 -9
- package/lib/typescript/src/screens/chat-detail/types.d.ts.map +1 -1
- package/lib/typescript/src/screens/inbox/Inbox.d.ts.map +1 -1
- package/lib/typescript/src/services/apis.d.ts +0 -4
- package/lib/typescript/src/services/apis.d.ts.map +1 -1
- package/lib/typescript/src/store/conversation.d.ts +5 -8
- package/lib/typescript/src/store/conversation.d.ts.map +1 -1
- package/lib/typescript/src/types/auth.d.ts +1 -0
- package/lib/typescript/src/types/auth.d.ts.map +1 -1
- package/lib/typescript/src/types/chat.d.ts +15 -13
- package/lib/typescript/src/types/chat.d.ts.map +1 -1
- package/lib/typescript/src/utils/conversation.d.ts +2 -5
- package/lib/typescript/src/utils/conversation.d.ts.map +1 -1
- package/lib/typescript/src/utils/message.d.ts +3 -3
- package/lib/typescript/src/utils/message.d.ts.map +1 -1
- package/lib/typescript/src/utils/messageUtils.d.ts +2 -1
- package/lib/typescript/src/utils/messageUtils.d.ts.map +1 -1
- package/package.json +2 -2
- package/src/components/ThreadCard/AvatarSection.tsx +2 -3
- package/src/components/ThreadCard/ThreadCard.tsx +22 -15
- package/src/components/flows/inputButtons/index.tsx +4 -1
- package/src/context/ChatContext.tsx +35 -3
- package/src/context/ChatDetailContext.tsx +1 -1
- package/src/core/useChatListener.ts +2 -4
- package/src/core/useUserListener.ts +4 -8
- package/src/hooks/flows/useFlow.ts +12 -3
- package/src/hooks/message/useSendMessage.ts +1 -1
- package/src/hooks/useConversationList.ts +6 -40
- package/src/hooks/useLinkPreview/useLinkPreview.ts +6 -1
- package/src/screens/chat-detail/ChatDetail.tsx +1 -7
- package/src/screens/chat-detail/ChatDetailHeader.tsx +6 -7
- package/src/screens/chat-detail/ChatLinkPreview.tsx +16 -12
- package/src/screens/chat-detail/ChatListLegend.tsx +2 -6
- package/src/screens/chat-detail/conversationHeader.utils.ts +16 -6
- package/src/screens/chat-detail/types.ts +6 -13
- package/src/screens/inbox/Inbox.tsx +5 -1
- package/src/services/apis.ts +0 -38
- package/src/store/conversation.ts +6 -55
- package/src/types/auth.ts +1 -0
- package/src/types/chat.ts +16 -20
- package/src/utils/conversation.ts +2 -40
- package/src/utils/message.ts +3 -2
- package/src/utils/messageUtils.ts +11 -3
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ChatContext.d.ts","sourceRoot":"","sources":["../../../../src/context/ChatContext.tsx"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"ChatContext.d.ts","sourceRoot":"","sources":["../../../../src/context/ChatContext.tsx"],"names":[],"mappings":"AAOA,OAAO,KAAK,EAAE,eAAe,EAAE,iBAAiB,EAAE,MAAM,eAAe,CAAC;AAIxE,eAAO,MAAM,WAAW,0CAEvB,CAAC;AAEF,eAAO,MAAM,cAAc,QAAO,eAMjC,CAAC;AAuCF,eAAO,MAAM,YAAY,GAAI,cAAc,iBAAiB,gCAE3D,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"useChatListener.d.ts","sourceRoot":"","sources":["../../../../src/core/useChatListener.ts"],"names":[],"mappings":"AAQA,eAAO,MAAM,eAAe,
|
|
1
|
+
{"version":3,"file":"useChatListener.d.ts","sourceRoot":"","sources":["../../../../src/core/useChatListener.ts"],"names":[],"mappings":"AAQA,eAAO,MAAM,eAAe,YA0C3B,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"useUserListener.d.ts","sourceRoot":"","sources":["../../../../src/core/useUserListener.ts"],"names":[],"mappings":"AASA,eAAO,MAAM,eAAe,
|
|
1
|
+
{"version":3,"file":"useUserListener.d.ts","sourceRoot":"","sources":["../../../../src/core/useUserListener.ts"],"names":[],"mappings":"AASA,eAAO,MAAM,eAAe,YAwE3B,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"useFlow.d.ts","sourceRoot":"","sources":["../../../../../src/hooks/flows/useFlow.ts"],"names":[],"mappings":"AAMA,OAAO,KAAK,EACV,iBAAiB,EACjB,2BAA2B,EAC3B,4BAA4B,EAC7B,MAAM,mBAAmB,CAAC;
|
|
1
|
+
{"version":3,"file":"useFlow.d.ts","sourceRoot":"","sources":["../../../../../src/hooks/flows/useFlow.ts"],"names":[],"mappings":"AAMA,OAAO,KAAK,EACV,iBAAiB,EACjB,2BAA2B,EAC3B,4BAA4B,EAC7B,MAAM,mBAAmB,CAAC;AAK3B,eAAO,MAAM,YAAY,kGAiCxB,CAAC;AAEF,eAAO,MAAM,UAAU,oIAqBtB,CAAC"}
|
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
import type { DChatApplicationType
|
|
1
|
+
import type { DChatApplicationType } from '../types/chat';
|
|
2
2
|
type Params = {
|
|
3
3
|
applicationType: DChatApplicationType;
|
|
4
4
|
page: number;
|
|
5
5
|
enabled?: boolean;
|
|
6
6
|
};
|
|
7
|
-
export declare function useConversationList({ applicationType, page, enabled, }: Params): import("@tanstack/react-query").UseQueryResult<NoInfer<
|
|
7
|
+
export declare function useConversationList({ applicationType, page, enabled, }: Params): import("@tanstack/react-query").UseQueryResult<NoInfer<import("@droppii/openim-rn-client-sdk").ConversationItem[]>, Error>;
|
|
8
8
|
export {};
|
|
9
9
|
//# sourceMappingURL=useConversationList.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"useConversationList.d.ts","sourceRoot":"","sources":["../../../../src/hooks/useConversationList.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"useConversationList.d.ts","sourceRoot":"","sources":["../../../../src/hooks/useConversationList.ts"],"names":[],"mappings":"AAKA,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,eAAe,CAAC;AAE1D,KAAK,MAAM,GAAG;IACZ,eAAe,EAAE,oBAAoB,CAAC;IACtC,IAAI,EAAE,MAAM,CAAC;IACb,OAAO,CAAC,EAAE,OAAO,CAAC;CACnB,CAAC;AAEF,wBAAgB,mBAAmB,CAAC,EAClC,eAAe,EACf,IAAQ,EACR,OAAc,GACf,EAAE,MAAM,8HA+BR"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"useLinkPreview.d.ts","sourceRoot":"","sources":["../../../../../src/hooks/useLinkPreview/useLinkPreview.ts"],"names":[],"mappings":"AAIA,wBAAgB,cAAc,CAAC,KAAK,EAAE,MAAM,GAAG,SAAS;;;;;;;;;;
|
|
1
|
+
{"version":3,"file":"useLinkPreview.d.ts","sourceRoot":"","sources":["../../../../../src/hooks/useLinkPreview/useLinkPreview.ts"],"names":[],"mappings":"AAIA,wBAAgB,cAAc,CAAC,KAAK,EAAE,MAAM,GAAG,SAAS;;;;;;;;;;EA+BvD"}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
import type { ChatDetailProps } from './types';
|
|
2
|
-
declare const ChatDetail: import("react").MemoExoticComponent<({ conversationId, enabled, title, subtitle, avatarUri, avatarFullName,
|
|
2
|
+
declare const ChatDetail: import("react").MemoExoticComponent<({ conversationId, enabled, title, subtitle, avatarUri, avatarFullName, showAddMember, getSubtitle, onBack, onPressSearch, onPressAddMember, onPressMenu, onPressAvatar, renderChat, showQuickActions, quickActions, inputPlaceholder, onChangeInput, onPressAttach, onPressEmoji, attachmentActions, onQuickActionPress, onAttachmentAction, renderQuickAction, renderQuickActions, renderAttachmentAction, attachmentColumns, onPressUrl, }: ChatDetailProps) => import("react").JSX.Element>;
|
|
3
3
|
export default ChatDetail;
|
|
4
4
|
//# sourceMappingURL=ChatDetail.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ChatDetail.d.ts","sourceRoot":"","sources":["../../../../../src/screens/chat-detail/ChatDetail.tsx"],"names":[],"mappings":"AA0BA,OAAO,KAAK,EACV,eAAe,EAGhB,MAAM,SAAS,CAAC;AAOjB,QAAA,MAAM,UAAU,
|
|
1
|
+
{"version":3,"file":"ChatDetail.d.ts","sourceRoot":"","sources":["../../../../../src/screens/chat-detail/ChatDetail.tsx"],"names":[],"mappings":"AA0BA,OAAO,KAAK,EACV,eAAe,EAGhB,MAAM,SAAS,CAAC;AAOjB,QAAA,MAAM,UAAU,qdA8BX,eAAe,iCAqPnB,CAAC;AAUF,eAAe,UAAU,CAAC"}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
import type { ChatDetailHeaderProps } from './types';
|
|
2
|
-
declare const ChatDetailHeader: import("react").MemoExoticComponent<({ title, subtitle, avatarUri, avatarFullName,
|
|
2
|
+
declare const ChatDetailHeader: import("react").MemoExoticComponent<({ title, subtitle, avatarUri, avatarFullName, showAddMember, conversationId, onBack, onPressSearch, onPressAddMember, onPressMenu, onPressAvatar, }: ChatDetailHeaderProps) => import("react").JSX.Element>;
|
|
3
3
|
export default ChatDetailHeader;
|
|
4
4
|
//# sourceMappingURL=ChatDetailHeader.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ChatDetailHeader.d.ts","sourceRoot":"","sources":["../../../../../src/screens/chat-detail/ChatDetailHeader.tsx"],"names":[],"mappings":"AAUA,OAAO,KAAK,EAAE,qBAAqB,EAAE,MAAM,SAAS,CAAC;
|
|
1
|
+
{"version":3,"file":"ChatDetailHeader.d.ts","sourceRoot":"","sources":["../../../../../src/screens/chat-detail/ChatDetailHeader.tsx"],"names":[],"mappings":"AAUA,OAAO,KAAK,EAAE,qBAAqB,EAAE,MAAM,SAAS,CAAC;AAGrD,QAAA,MAAM,gBAAgB,4LAajB,qBAAqB,iCA4GzB,CAAC;AAIF,eAAe,gBAAgB,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ChatLinkPreview.d.ts","sourceRoot":"","sources":["../../../../../src/screens/chat-detail/ChatLinkPreview.tsx"],"names":[],"mappings":"AAUA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,oBAAoB,CAAC;AAEvD,UAAU,oBAAoB;IAC5B,QAAQ,CAAC,EAAE,YAAY,CAAC;IACxB,SAAS,CAAC,EAAE,OAAO,CAAC;IACpB,SAAS,CAAC,EAAE,MAAM,IAAI,CAAC;CACxB;AAID,eAAO,MAAM,eAAe,2EACW,oBAAoB,
|
|
1
|
+
{"version":3,"file":"ChatLinkPreview.d.ts","sourceRoot":"","sources":["../../../../../src/screens/chat-detail/ChatLinkPreview.tsx"],"names":[],"mappings":"AAUA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,oBAAoB,CAAC;AAEvD,UAAU,oBAAoB;IAC5B,QAAQ,CAAC,EAAE,YAAY,CAAC;IACxB,SAAS,CAAC,EAAE,OAAO,CAAC;IACpB,SAAS,CAAC,EAAE,MAAM,IAAI,CAAC;CACxB;AAID,eAAO,MAAM,eAAe,2EACW,oBAAoB,iCAqC1D,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ChatListLegend.d.ts","sourceRoot":"","sources":["../../../../../src/screens/chat-detail/ChatListLegend.tsx"],"names":[],"mappings":"AAUA,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,SAAS,CAAC;AAW7C,eAAO,MAAM,cAAc,kNActB,aAAa,
|
|
1
|
+
{"version":3,"file":"ChatListLegend.d.ts","sourceRoot":"","sources":["../../../../../src/screens/chat-detail/ChatListLegend.tsx"],"names":[],"mappings":"AAUA,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,SAAS,CAAC;AAW7C,eAAO,MAAM,cAAc,kNActB,aAAa,iCAsWjB,CAAC"}
|
|
@@ -1,6 +1,8 @@
|
|
|
1
|
-
import { type
|
|
2
|
-
|
|
3
|
-
export declare const
|
|
4
|
-
export declare const
|
|
5
|
-
export declare const
|
|
1
|
+
import { type ConversationItem } from '@droppii/openim-rn-client-sdk';
|
|
2
|
+
import type { IConversationItemEx } from '../../types/chat';
|
|
3
|
+
export declare const getConversationTitle: (conversation?: ConversationItem) => string;
|
|
4
|
+
export declare const getConversationAvatarUri: (conversation?: ConversationItem) => string | null;
|
|
5
|
+
export declare const getConversationSubtitle: (conversation?: ConversationItem) => string | undefined;
|
|
6
|
+
export declare const shouldShowAddMember: (conversation?: ConversationItem) => boolean;
|
|
7
|
+
export declare const getConversationEx: (ex?: string) => IConversationItemEx | {};
|
|
6
8
|
//# sourceMappingURL=conversationHeader.utils.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"conversationHeader.utils.d.ts","sourceRoot":"","sources":["../../../../../src/screens/chat-detail/conversationHeader.utils.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"conversationHeader.utils.d.ts","sourceRoot":"","sources":["../../../../../src/screens/chat-detail/conversationHeader.utils.ts"],"names":[],"mappings":"AAAA,OAAO,EAAY,KAAK,gBAAgB,EAAE,MAAM,+BAA+B,CAAC;AAChF,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,kBAAkB,CAAC;AAE5D,eAAO,MAAM,oBAAoB,GAC/B,eAAe,gBAAgB,KAC9B,MAMF,CAAC;AAEF,eAAO,MAAM,wBAAwB,GACnC,eAAe,gBAAgB,KAC9B,MAAM,GAAG,IAEX,CAAC;AAEF,eAAO,MAAM,uBAAuB,GAClC,eAAe,gBAAgB,KAC9B,MAAM,GAAG,SAkBX,CAAC;AAEF,eAAO,MAAM,mBAAmB,GAC9B,eAAe,gBAAgB,KAC9B,OAEF,CAAC;AAEF,eAAO,MAAM,iBAAiB,GAAI,KAAK,MAAM,KAAG,mBAAmB,GAAG,EAQrE,CAAC"}
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import type { ReactNode } from 'react';
|
|
2
2
|
import type { MediaItem } from '../../hooks/useMediaViewer';
|
|
3
|
-
import type {
|
|
3
|
+
import type { DMessageItem } from '../../types/chat';
|
|
4
4
|
import type { IUrlMetadata } from '../../types/common';
|
|
5
|
-
import type {
|
|
5
|
+
import type { ConversationItem } from '@droppii/openim-rn-client-sdk';
|
|
6
6
|
export type DChatActionIconProvider = 'MaterialCommunityIcons' | 'DroppiiNew';
|
|
7
7
|
export interface DChatActionItem {
|
|
8
8
|
id: string;
|
|
@@ -20,14 +20,13 @@ export interface ChatDetailHeaderProps {
|
|
|
20
20
|
subtitle?: string;
|
|
21
21
|
avatarUri?: string | null;
|
|
22
22
|
avatarFullName?: string;
|
|
23
|
-
peerType?: PeerType;
|
|
24
|
-
applicationType?: DConversationItem['applicationType'];
|
|
25
23
|
showAddMember?: boolean;
|
|
26
24
|
onBack?: () => void;
|
|
27
25
|
onPressSearch?: () => void;
|
|
28
26
|
onPressAddMember?: () => void;
|
|
29
27
|
onPressMenu?: () => void;
|
|
30
28
|
onPressAvatar?: () => void;
|
|
29
|
+
conversationId: string;
|
|
31
30
|
}
|
|
32
31
|
export interface ChatQuickActionsRenderParams {
|
|
33
32
|
actions: DChatQuickAction[];
|
|
@@ -79,22 +78,20 @@ export interface ChatListProps {
|
|
|
79
78
|
onMediaPress?: (items: MediaItem[], index?: number) => void;
|
|
80
79
|
onPressUrl?: (url: string) => void;
|
|
81
80
|
}
|
|
82
|
-
export interface ChatDetailProps extends Omit<ChatDetailHeaderProps, 'title' | 'subtitle' | 'avatarUri' | 'avatarFullName' | '
|
|
81
|
+
export interface ChatDetailProps extends Omit<ChatDetailHeaderProps, 'title' | 'subtitle' | 'avatarUri' | 'avatarFullName' | 'applicationType' | 'showAddMember' | 'conversationId'> {
|
|
83
82
|
conversationId: string;
|
|
84
83
|
enabled?: boolean;
|
|
85
84
|
title?: string;
|
|
86
85
|
subtitle?: string;
|
|
87
86
|
avatarUri?: string | null;
|
|
88
87
|
avatarFullName?: string;
|
|
89
|
-
peerType?: PeerType;
|
|
90
|
-
applicationType?: DChatApplicationType;
|
|
91
88
|
showAddMember?: boolean;
|
|
92
|
-
getSubtitle?: (conversation:
|
|
89
|
+
getSubtitle?: (conversation: ConversationItem) => string | undefined;
|
|
93
90
|
renderChat?: (item: DMessageItem) => ReactNode;
|
|
94
91
|
showQuickActions?: boolean;
|
|
95
92
|
showAttachmentActions?: boolean;
|
|
96
93
|
quickActions?: DChatQuickAction[];
|
|
97
|
-
getQuickActions?: (conversation:
|
|
94
|
+
getQuickActions?: (conversation: ConversationItem) => DChatQuickAction[] | undefined;
|
|
98
95
|
attachmentActions?: DChatAttachmentAction[];
|
|
99
96
|
inputPlaceholder?: string;
|
|
100
97
|
onChangeInput?: (text: string) => void;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../../../src/screens/chat-detail/types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,OAAO,CAAC;AAEvC,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,4BAA4B,CAAC;AAC5D,OAAO,KAAK,
|
|
1
|
+
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../../../src/screens/chat-detail/types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,OAAO,CAAC;AAEvC,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,4BAA4B,CAAC;AAC5D,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,kBAAkB,CAAC;AACrD,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,oBAAoB,CAAC;AACvD,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,+BAA+B,CAAC;AAEtE,MAAM,MAAM,uBAAuB,GAAG,wBAAwB,GAAG,YAAY,CAAC;AAE9E,MAAM,WAAW,eAAe;IAC9B,EAAE,EAAE,MAAM,CAAC;IACX,KAAK,EAAE,MAAM,CAAC;IACd,QAAQ,EAAE,MAAM,CAAC;IACjB,YAAY,CAAC,EAAE,uBAAuB,CAAC;IACvC,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB,OAAO,CAAC,EAAE,MAAM,IAAI,CAAC;IACrB,IAAI,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;CAChC;AAED,MAAM,MAAM,gBAAgB,GAAG,eAAe,CAAC;AAC/C,MAAM,MAAM,qBAAqB,GAAG,eAAe,CAAC;AAEpD,MAAM,WAAW,qBAAqB;IACpC,KAAK,EAAE,MAAM,CAAC;IACd,QAAQ,CAAC,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AAI,CAAC;IAC3B,YAAY,CAAC,EAAE,MAAM,IAAI,CAAC;IAC1B,kBAAkB,CAAC,EAAE,CAAC,MAAM,EAAE,gBAAgB,KAAK,IAAI,CAAC;IACxD,kBAAkB,CAAC,EAAE,CAAC,MAAM,EAAE,qBAAqB,KAAK,IAAI,CAAC;IAC7D,iBAAiB,CAAC,EAAE,qBAAqB,CAAC,cAAc,CAAC,CAAC;IAC1D,kBAAkB,CAAC,EAAE,qBAAqB,CAAC,oBAAoB,CAAC,CAAC;IACjE,sBAAsB,CAAC,EAAE,wBAAwB,CAAC,cAAc,CAAC,CAAC;IAClE,iBAAiB,CAAC,EAAE,MAAM,CAAC;IAC3B,UAAU,CAAC,EAAE,CAAC,GAAG,EAAE,MAAM,KAAK,IAAI,CAAC;CACpC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Inbox.d.ts","sourceRoot":"","sources":["../../../../../src/screens/inbox/Inbox.tsx"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"Inbox.d.ts","sourceRoot":"","sources":["../../../../../src/screens/inbox/Inbox.tsx"],"names":[],"mappings":"AAQA,UAAU,UAAU;IAClB,aAAa,CAAC,EAAE,CAAC,IAAI,EAAE,MAAM,KAAK,IAAI,CAAC;IACvC,aAAa,CAAC,EAAE,MAAM,IAAI,CAAC;IAC3B,WAAW,CAAC,EAAE,MAAM,IAAI,CAAC;IACzB,YAAY,CAAC,EAAE,MAAM,IAAI,CAAC;CAC3B;AAID,QAAA,MAAM,KAAK,oGACqD,UAAU,iCA4GzE,CAAC;AAIF,eAAe,KAAK,CAAC"}
|
|
@@ -1,13 +1,9 @@
|
|
|
1
1
|
import { type AxiosInstance } from 'axios';
|
|
2
|
-
import type { DConversationItem, DConversationQueryParams } from '../types/chat';
|
|
3
|
-
import type { BaseResponse } from '../types/auth';
|
|
4
2
|
export declare let apiInstance: AxiosInstance | null;
|
|
5
3
|
export declare namespace ChatAPI {
|
|
6
4
|
function initApiInstance(api: AxiosInstance): void;
|
|
7
5
|
const getLoginStatus: (operationID?: string) => Promise<boolean>;
|
|
8
|
-
const login: (instance: AxiosInstance, operationID?: string) => Promise<unknown>;
|
|
9
6
|
const logout: (operationID?: string) => Promise<unknown>;
|
|
10
7
|
const getUser: (operationID?: string | undefined) => Promise<import("@droppii/openim-rn-client-sdk").SelfUserInfo>;
|
|
11
|
-
function queryConversations(params: DConversationQueryParams): Promise<BaseResponse<DConversationItem[]>>;
|
|
12
8
|
}
|
|
13
9
|
//# sourceMappingURL=apis.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"apis.d.ts","sourceRoot":"","sources":["../../../../src/services/apis.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,aAAa,EAAE,MAAM,OAAO,CAAC;
|
|
1
|
+
{"version":3,"file":"apis.d.ts","sourceRoot":"","sources":["../../../../src/services/apis.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,aAAa,EAAE,MAAM,OAAO,CAAC;AAI3C,eAAO,IAAI,WAAW,EAAE,aAAa,GAAG,IAAW,CAAC;AAEpD,yBAAiB,OAAO,CAAC;IACvB,SAAgB,eAAe,CAAC,GAAG,EAAE,aAAa,GAAG,IAAI,CAExD;IAEM,MAAM,cAAc,GAAU,cAAc,MAAM,qBAExD,CAAC;IAEK,MAAM,MAAM,GAAU,cAAc,MAAM,qBAGhD,CAAC;IAEK,MAAM,OAAO,GAAU,cAAc,MAAM,GAAG,SAAS,kEAE7D,CAAC;CACH"}
|
|
@@ -1,25 +1,22 @@
|
|
|
1
|
-
import type {
|
|
2
|
-
import type { ConversationItem, MessageItem } from '@droppii/openim-rn-client-sdk';
|
|
1
|
+
import type { ConversationItem } from '@droppii/openim-rn-client-sdk';
|
|
3
2
|
type ConversationID = string;
|
|
4
3
|
export interface ConversationStore {
|
|
5
4
|
currentConversationId?: ConversationID;
|
|
6
5
|
setCurrentConversation(id: ConversationID): void;
|
|
7
|
-
getCurrentConversation():
|
|
6
|
+
getCurrentConversation(): ConversationItem | undefined;
|
|
8
7
|
list: ConversationID[];
|
|
9
|
-
map: Record<ConversationID,
|
|
8
|
+
map: Record<ConversationID, ConversationItem>;
|
|
10
9
|
/** Signal incremented when a truly new conversation arrives and a full refetch is needed. */
|
|
11
10
|
newConversationSignal: number;
|
|
12
|
-
updateConversations(conversations:
|
|
11
|
+
updateConversations(conversations: ConversationItem[]): void;
|
|
13
12
|
/**
|
|
14
13
|
* Patches existing conversations with real-time data from OpenIM events.
|
|
15
14
|
* Returns true if any conversation was not found in the store (triggers refetch).
|
|
16
15
|
*/
|
|
17
|
-
mergeOpenIMConversations(conversations: ConversationItem[]): boolean;
|
|
18
16
|
removeConversation(id: ConversationID): void;
|
|
19
|
-
updateLastMessage(id: ConversationID, message: MessageItem): void;
|
|
20
17
|
reset(): void;
|
|
21
18
|
}
|
|
22
19
|
export declare const useConversationStore: import("zustand").UseBoundStore<import("zustand").StoreApi<ConversationStore>>;
|
|
23
|
-
export declare const useConversation: (id: string) =>
|
|
20
|
+
export declare const useConversation: (id: string) => ConversationItem | undefined;
|
|
24
21
|
export {};
|
|
25
22
|
//# sourceMappingURL=conversation.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"conversation.d.ts","sourceRoot":"","sources":["../../../../src/store/conversation.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"conversation.d.ts","sourceRoot":"","sources":["../../../../src/store/conversation.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,+BAA+B,CAAC;AAEtE,KAAK,cAAc,GAAG,MAAM,CAAC;AAE7B,MAAM,WAAW,iBAAiB;IAChC,qBAAqB,CAAC,EAAE,cAAc,CAAC;IACvC,sBAAsB,CAAC,EAAE,EAAE,cAAc,GAAG,IAAI,CAAC;IACjD,sBAAsB,IAAI,gBAAgB,GAAG,SAAS,CAAC;IACvD,IAAI,EAAE,cAAc,EAAE,CAAC;IACvB,GAAG,EAAE,MAAM,CAAC,cAAc,EAAE,gBAAgB,CAAC,CAAC;IAC9C,6FAA6F;IAC7F,qBAAqB,EAAE,MAAM,CAAC;IAC9B,mBAAmB,CAAC,aAAa,EAAE,gBAAgB,EAAE,GAAG,IAAI,CAAC;IAC7D;;;OAGG;IACH,kBAAkB,CAAC,EAAE,EAAE,cAAc,GAAG,IAAI,CAAC;IAC7C,KAAK,IAAI,IAAI,CAAC;CACf;AAED,eAAO,MAAM,oBAAoB,gFA2C9B,CAAC;AAEJ,eAAO,MAAM,eAAe,GAAI,IAAI,MAAM,KAAG,gBAAgB,GAAG,SAE/D,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"auth.d.ts","sourceRoot":"","sources":["../../../../src/types/auth.ts"],"names":[],"mappings":"AAAA,MAAM,MAAM,YAAY,CAAC,CAAC,GAAG,OAAO,IAAI;IACtC,UAAU,EAAE,MAAM,CAAC;IACnB,OAAO,EAAE,MAAM,GAAG,IAAI,CAAC;IACvB,QAAQ,EAAE,OAAO,CAAC;IAClB,QAAQ,EAAE,QAAQ,CAAC;IACnB,IAAI,EAAE,CAAC,CAAC;CACT,CAAC;AAEF,KAAK,QAAQ,GAAG;IACd,UAAU,EAAE,MAAM,CAAC;IACnB,QAAQ,EAAE,MAAM,CAAC;IACjB,UAAU,EAAE,MAAM,CAAC;IACnB,aAAa,EAAE,MAAM,CAAC;CACvB,CAAC;AAEF,MAAM,MAAM,sBAAsB,GAAG;IACnC,EAAE,EAAE,MAAM,CAAC;IACX,KAAK,EAAE,MAAM,CAAC;
|
|
1
|
+
{"version":3,"file":"auth.d.ts","sourceRoot":"","sources":["../../../../src/types/auth.ts"],"names":[],"mappings":"AAAA,MAAM,MAAM,YAAY,CAAC,CAAC,GAAG,OAAO,IAAI;IACtC,UAAU,EAAE,MAAM,CAAC;IACnB,OAAO,EAAE,MAAM,GAAG,IAAI,CAAC;IACvB,QAAQ,EAAE,OAAO,CAAC;IAClB,QAAQ,EAAE,QAAQ,CAAC;IACnB,IAAI,EAAE,CAAC,CAAC;CACT,CAAC;AAEF,KAAK,QAAQ,GAAG;IACd,UAAU,EAAE,MAAM,CAAC;IACnB,QAAQ,EAAE,MAAM,CAAC;IACjB,UAAU,EAAE,MAAM,CAAC;IACnB,aAAa,EAAE,MAAM,CAAC;CACvB,CAAC;AAEF,MAAM,MAAM,sBAAsB,GAAG;IACnC,EAAE,EAAE,MAAM,CAAC;IACX,KAAK,EAAE,MAAM,CAAC;IACd,SAAS,EAAE,MAAM,CAAC;CACnB,CAAC;AAEF,oBAAY,UAAU;IACpB,OAAO,IAAI;IACX,OAAO,IAAI;IACX,MAAM,IAAI;CACX"}
|
|
@@ -1,7 +1,8 @@
|
|
|
1
|
-
import { type MessageItem
|
|
1
|
+
import { type MessageItem } from '@droppii/openim-rn-client-sdk';
|
|
2
2
|
import type { PropsWithChildren } from 'react';
|
|
3
3
|
import type { IUrlMetadata } from './common';
|
|
4
4
|
import type { IConversationFlow, IConversationFlowStep, IRunConversationFlowPayload } from './flows';
|
|
5
|
+
import type { GetOpenIMTokenResponse } from './auth';
|
|
5
6
|
export declare const EventProvider: {
|
|
6
7
|
readonly ga: "ga";
|
|
7
8
|
readonly appsflyer: "appsflyer";
|
|
@@ -15,6 +16,7 @@ export interface ChatContextType {
|
|
|
15
16
|
export type ChatProviderProps = PropsWithChildren<{
|
|
16
17
|
logGA?: LogGA;
|
|
17
18
|
applicationType: DChatApplicationType;
|
|
19
|
+
getChatToken: () => Promise<GetOpenIMTokenResponse | null>;
|
|
18
20
|
}>;
|
|
19
21
|
export declare enum DChatApplicationType {
|
|
20
22
|
DROPPII = "DROPPII",
|
|
@@ -44,17 +46,6 @@ export interface DConversationPeer {
|
|
|
44
46
|
user: DConversationPeerUser | null;
|
|
45
47
|
group: null;
|
|
46
48
|
}
|
|
47
|
-
export interface DConversationItem extends ConversationItem {
|
|
48
|
-
conversationId: string;
|
|
49
|
-
chatCategory: DChatCategory;
|
|
50
|
-
chatType: PeerType;
|
|
51
|
-
applicationType: DChatApplicationType;
|
|
52
|
-
memberRole: DMemberRole;
|
|
53
|
-
pinnedAt: string | null;
|
|
54
|
-
isMuted: boolean;
|
|
55
|
-
peer: DConversationPeerUser;
|
|
56
|
-
lastMessage?: DMessageItem;
|
|
57
|
-
}
|
|
58
49
|
export interface DConversationQueryParams {
|
|
59
50
|
applicationType: string;
|
|
60
51
|
page: number;
|
|
@@ -114,9 +105,20 @@ export interface ChatDetailContextType {
|
|
|
114
105
|
conversationFlow?: IConversationFlow;
|
|
115
106
|
refetchConversationFlow: () => void;
|
|
116
107
|
isBotConversation: boolean;
|
|
117
|
-
setConverationFlowStep: (step
|
|
108
|
+
setConverationFlowStep: (step?: IConversationFlowStep) => void;
|
|
118
109
|
}
|
|
119
110
|
export interface ChatDetailProviderProps extends PropsWithChildren {
|
|
120
111
|
}
|
|
112
|
+
export interface IConversationItemEx {
|
|
113
|
+
applicationType: DChatApplicationType;
|
|
114
|
+
sessionInfo?: {
|
|
115
|
+
type: 'SESSION_INFO';
|
|
116
|
+
data: {
|
|
117
|
+
ownerId: string;
|
|
118
|
+
botId: string;
|
|
119
|
+
};
|
|
120
|
+
};
|
|
121
|
+
chatCategory: DChatCategory;
|
|
122
|
+
}
|
|
121
123
|
export {};
|
|
122
124
|
//# sourceMappingURL=chat.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"chat.d.ts","sourceRoot":"","sources":["../../../../src/types/chat.ts"],"names":[],"mappings":"AAAA,OAAO,
|
|
1
|
+
{"version":3,"file":"chat.d.ts","sourceRoot":"","sources":["../../../../src/types/chat.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,WAAW,EAAE,MAAM,+BAA+B,CAAC;AACjE,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,OAAO,CAAC;AAC/C,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,UAAU,CAAC;AAC7C,OAAO,KAAK,EACV,i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IACxB,YAAY,EAAE,OAAO,CAAC;IACtB,WAAW,EAAE,CAAC,QAAQ,EAAE,YAAY,EAAE,EAAE,OAAO,EAAE,OAAO,KAAK,IAAI,CAAC;IAClE,cAAc,EAAE,CAAC,OAAO,EAAE,WAAW,KAAK,IAAI,CAAC;IAC/C,gBAAgB,EAAE,CAAC,OAAO,EAAE,WAAW,KAAK,IAAI,CAAC;IACjD,gBAAgB,EAAE,CAAC,WAAW,EAAE,MAAM,KAAK,IAAI,CAAC;IAChD,KAAK,EAAE,MAAM,IAAI,CAAC;CACnB;AAED,MAAM,WAAW,qBAAqB;IACpC,gBAAgB,CAAC,EAAE,iBAAiB,CAAC;IACrC,uBAAuB,EAAE,MAAM,IAAI,CAAC;IACpC,iBAAiB,EAAE,OAAO,CAAC;IAC3B,sBAAsB,EAAE,CAAC,IAAI,CAAC,EAAE,qBAAqB,KAAK,IAAI,CAAC;CAChE;AAED,MAAM,WAAW,uBAAwB,SAAQ,iBAAiB;CAAG;AAErE,MAAM,WAAW,mBAAmB;IAClC,eAAe,EAAE,oBAAoB,CAAC;IACtC,WAAW,CAAC,EAAE;QACZ,IAAI,EAAE,cAAc,CAAC;QACrB,IAAI,EAAE;YACJ,OAAO,EAAE,MAAM,CAAC;YAChB,KAAK,EAAE,MAAM,CAAC;SACf,CAAC;KACH,CAAC;IACF,YAAY,EAAE,aAAa,CAAC;CAC7B"}
|
|
@@ -1,11 +1,8 @@
|
|
|
1
1
|
import { MessageType, SessionType, type ConversationItem } from '@droppii/openim-rn-client-sdk';
|
|
2
|
-
import { type DConversationItem } from '../types/chat';
|
|
3
2
|
export declare const conversationCompare: (a: ConversationItem, b: ConversationItem) => number;
|
|
4
|
-
export declare const dConversationCompare: (a: DConversationItem, b: DConversationItem) => number;
|
|
5
|
-
export declare const mergeOpenIMIntoConversation: (existing: DConversationItem, openim: ConversationItem) => DConversationItem;
|
|
6
3
|
export declare const getConversationID: (sessionType: SessionType, senderID?: string, receiverID?: string) => string;
|
|
7
|
-
export declare const sortConversation: (map: Record<string,
|
|
8
|
-
map: Record<string,
|
|
4
|
+
export declare const sortConversation: (map: Record<string, ConversationItem>) => {
|
|
5
|
+
map: Record<string, ConversationItem>;
|
|
9
6
|
list: string[];
|
|
10
7
|
};
|
|
11
8
|
export declare const generateContentBasedOnMessageType: (contentType: MessageType, plainText?: string) => string;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"conversation.d.ts","sourceRoot":"","sources":["../../../../src/utils/conversation.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,WAAW,EACX,WAAW,EACX,KAAK,gBAAgB,EACtB,MAAM,+BAA+B,CAAC;
|
|
1
|
+
{"version":3,"file":"conversation.d.ts","sourceRoot":"","sources":["../../../../src/utils/conversation.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,WAAW,EACX,WAAW,EACX,KAAK,gBAAgB,EACtB,MAAM,+BAA+B,CAAC;AAGvC,eAAO,MAAM,mBAAmB,GAC9B,GAAG,gBAAgB,EACnB,GAAG,gBAAgB,WAcpB,CAAC;AAEF,eAAO,MAAM,iBAAiB,GAC5B,aAAa,WAAW,EACxB,WAAW,MAAM,EACjB,aAAa,MAAM,WAUpB,CAAC;AAEF,eAAO,MAAM,gBAAgB,GAAI,KAAK,MAAM,CAAC,MAAM,EAAE,gBAAgB,CAAC;;;CAKrE,CAAC;AAEF,eAAO,MAAM,iCAAiC,GAC5C,aAAa,WAAW,EACxB,YAAY,MAAM,WAsBnB,CAAC"}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { type MessageItem } from '@droppii/openim-rn-client-sdk';
|
|
2
|
-
import { type
|
|
1
|
+
import { type ConversationItem, type MessageItem } from '@droppii/openim-rn-client-sdk';
|
|
2
|
+
import { type DMessageItem } from '../types/chat';
|
|
3
3
|
export declare const mergeMessages: (current: DMessageItem[], incoming: DMessageItem[]) => DMessageItem[];
|
|
4
4
|
export declare const normalizeCreatedMessage: (message: MessageItem | string) => MessageItem;
|
|
5
5
|
export type HistoryPaginationAnchor = {
|
|
@@ -12,7 +12,7 @@ export declare const resolveHistoryLastMinSeq: (history: {
|
|
|
12
12
|
export declare const getHistoryPaginationAnchor: (messages: DMessageItem[]) => HistoryPaginationAnchor | null;
|
|
13
13
|
export declare const hasNewHistoryMessages: (current: DMessageItem[], incoming: DMessageItem[]) => boolean;
|
|
14
14
|
export declare const belongsToConversation: (message: MessageItem, conversationId: string) => boolean;
|
|
15
|
-
export declare const getReceiverId: (conversation?:
|
|
15
|
+
export declare const getReceiverId: (conversation?: ConversationItem) => {
|
|
16
16
|
groupID: string;
|
|
17
17
|
recvID: string;
|
|
18
18
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"message.d.ts","sourceRoot":"","sources":["../../../../src/utils/message.ts"],"names":[],"mappings":"AAAA,OAAO,EAGL,KAAK,WAAW,EACjB,MAAM,+BAA+B,CAAC;AACvC,OAAO,EAAE,KAAK,
|
|
1
|
+
{"version":3,"file":"message.d.ts","sourceRoot":"","sources":["../../../../src/utils/message.ts"],"names":[],"mappings":"AAAA,OAAO,EAGL,KAAK,gBAAgB,EACrB,KAAK,WAAW,EACjB,MAAM,+BAA+B,CAAC;AACvC,OAAO,EAAE,KAAK,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,KACrB,OAuBF,CAAC;AAEF,eAAO,MAAM,aAAa,GAAI,eAAe,gBAAgB;;;CAW5D,CAAC"}
|
|
@@ -1,8 +1,9 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* Message formatting and preview utilities
|
|
3
3
|
*/
|
|
4
|
+
import { type ConversationItem } from '@droppii/openim-rn-client-sdk';
|
|
4
5
|
import type { DMessageItem } from '../types/chat';
|
|
5
6
|
export declare const extractTextContent: (message: DMessageItem) => string;
|
|
6
7
|
export declare const getMessagePreview: (message: DMessageItem) => string;
|
|
7
|
-
export declare const getLastMessageText: (message: DMessageItem | undefined, currentUserId?: string) => string;
|
|
8
|
+
export declare const getLastMessageText: (message: DMessageItem | undefined, currentUserId?: string, conversation?: ConversationItem) => string;
|
|
8
9
|
//# sourceMappingURL=messageUtils.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"messageUtils.d.ts","sourceRoot":"","sources":["../../../../src/utils/messageUtils.ts"],"names":[],"mappings":"AAAA;;GAEG;
|
|
1
|
+
{"version":3,"file":"messageUtils.d.ts","sourceRoot":"","sources":["../../../../src/utils/messageUtils.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH,OAAO,EAGL,KAAK,gBAAgB,EACtB,MAAM,+BAA+B,CAAC;AACvC,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,eAAe,CAAC;AAIlD,eAAO,MAAM,kBAAkB,GAAI,SAAS,YAAY,KAAG,MAQ1D,CAAC;AAEF,eAAO,MAAM,iBAAiB,GAAI,SAAS,YAAY,KAAG,MA8EzD,CAAC;AAEF,eAAO,MAAM,kBAAkB,GAC7B,SAAS,YAAY,GAAG,SAAS,EACjC,gBAAgB,MAAM,EACtB,eAAe,gBAAgB,KAC9B,MAqBF,CAAC"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@droppii-org/chat-mobile",
|
|
3
|
-
"version": "0.2.
|
|
3
|
+
"version": "0.2.20",
|
|
4
4
|
"description": "Droppii chat mobile",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"react-native",
|
|
@@ -69,7 +69,7 @@
|
|
|
69
69
|
"example-legacy": "yarn workspace @droppii-org/chat-mobile-example-legacy"
|
|
70
70
|
},
|
|
71
71
|
"dependencies": {
|
|
72
|
-
"@droppii/openim-rn-client-sdk": "git+ssh://git@github.com/droppii/open-im-sdk-reactnative.git#v1.0.0-
|
|
72
|
+
"@droppii/openim-rn-client-sdk": "git+ssh://git@github.com/droppii/open-im-sdk-reactnative.git#v1.0.0-rc11",
|
|
73
73
|
"@legendapp/list": "^3.0.6",
|
|
74
74
|
"axios": "^1.16.1",
|
|
75
75
|
"lodash": "^4.18.1",
|
|
@@ -1,10 +1,9 @@
|
|
|
1
1
|
import { memo } from 'react';
|
|
2
2
|
import { Avatar } from '../Avatar';
|
|
3
|
-
import type
|
|
4
|
-
import { PeerType } from '@droppii/openim-rn-client-sdk';
|
|
3
|
+
import { PeerType, type ConversationItem } from '@droppii/openim-rn-client-sdk';
|
|
5
4
|
|
|
6
5
|
interface AvatarSectionProps extends Partial<
|
|
7
|
-
Pick<
|
|
6
|
+
Pick<ConversationItem, 'peerType'>
|
|
8
7
|
> {
|
|
9
8
|
avatar: string | null;
|
|
10
9
|
fullName: string;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { memo, useCallback } from 'react';
|
|
1
|
+
import { memo, useCallback, useMemo } from 'react';
|
|
2
2
|
import { type GestureResponderEvent } from 'react-native';
|
|
3
3
|
import { KContainer, KImage, KLabel, KColors } from '@droppii/libs';
|
|
4
4
|
import { AvatarSection } from './AvatarSection';
|
|
@@ -7,6 +7,7 @@ import { UnreadBadge } from './UnreadBadge';
|
|
|
7
7
|
import { formatTimestamp } from '../../utils/dateTimeUtils';
|
|
8
8
|
import { getLastMessageText } from '../../utils/messageUtils';
|
|
9
9
|
import { useConversation, useUserStore } from '../../store';
|
|
10
|
+
import type { MessageItem } from '@droppii/openim-rn-client-sdk';
|
|
10
11
|
|
|
11
12
|
interface ThreadCardProps {
|
|
12
13
|
item: string;
|
|
@@ -14,26 +15,41 @@ interface ThreadCardProps {
|
|
|
14
15
|
}
|
|
15
16
|
|
|
16
17
|
const ThreadCard = memo(({ item, onPress }: ThreadCardProps) => {
|
|
18
|
+
const consversation = useConversation(item);
|
|
19
|
+
|
|
17
20
|
const {
|
|
18
21
|
peerType,
|
|
19
22
|
showName,
|
|
20
23
|
faceURL,
|
|
21
|
-
lastMessage,
|
|
22
24
|
unreadCount = 0,
|
|
23
25
|
recvMsgOpt,
|
|
24
26
|
isPinned,
|
|
25
|
-
applicationType,
|
|
26
27
|
latestMsgSendTime,
|
|
27
|
-
|
|
28
|
+
latestMsg,
|
|
29
|
+
} = consversation || {};
|
|
30
|
+
|
|
31
|
+
const latestMsgData: MessageItem = useMemo(() => {
|
|
32
|
+
let result = null;
|
|
33
|
+
try {
|
|
34
|
+
result = JSON.parse(latestMsg || '{}');
|
|
35
|
+
} catch (error) {
|
|
36
|
+
console.error('Failed to parse ex conversation', error);
|
|
37
|
+
}
|
|
38
|
+
return result;
|
|
39
|
+
}, [latestMsg]);
|
|
28
40
|
|
|
29
41
|
const fullName = showName ?? '';
|
|
30
42
|
const hasUnread = unreadCount > 0;
|
|
31
43
|
const isMuted = (recvMsgOpt ?? 0) !== 0;
|
|
32
44
|
const timestamp = formatTimestamp(
|
|
33
|
-
latestMsgSendTime ??
|
|
45
|
+
latestMsgSendTime ?? latestMsgData?.sendTime ?? null
|
|
34
46
|
);
|
|
35
47
|
const currentUserId = useUserStore((s) => s.user?.userID);
|
|
36
|
-
const lastMessageText = getLastMessageText(
|
|
48
|
+
const lastMessageText = getLastMessageText(
|
|
49
|
+
latestMsgData,
|
|
50
|
+
currentUserId,
|
|
51
|
+
consversation
|
|
52
|
+
);
|
|
37
53
|
|
|
38
54
|
const handlePress = useCallback(
|
|
39
55
|
(event: GestureResponderEvent) => {
|
|
@@ -55,7 +71,6 @@ const ThreadCard = memo(({ item, onPress }: ThreadCardProps) => {
|
|
|
55
71
|
avatar={faceURL ?? null}
|
|
56
72
|
fullName={fullName}
|
|
57
73
|
peerType={peerType}
|
|
58
|
-
applicationType={applicationType}
|
|
59
74
|
/>
|
|
60
75
|
|
|
61
76
|
{/* Chat-Content */}
|
|
@@ -63,14 +78,6 @@ const ThreadCard = memo(({ item, onPress }: ThreadCardProps) => {
|
|
|
63
78
|
{/* Row-Title */}
|
|
64
79
|
<KContainer.View row alignItems="center">
|
|
65
80
|
<NamePrefixIcon peerType={peerType} />
|
|
66
|
-
{/* For verified PDP (configuration details to be defined later) */}
|
|
67
|
-
{/* <KContainer.VisibleView visible={peerType === DChatPeerType.BOT}>
|
|
68
|
-
<KImage.Base
|
|
69
|
-
uri={Images.ICON_BOT}
|
|
70
|
-
size={14}
|
|
71
|
-
style={styles.botIcon}
|
|
72
|
-
/>
|
|
73
|
-
</KContainer.VisibleView> */}
|
|
74
81
|
<KLabel.Text
|
|
75
82
|
typo={hasUnread ? 'TextMdBold' : 'TextMdNormal'}
|
|
76
83
|
numberOfLines={1}
|
|
@@ -50,7 +50,7 @@ export const InputButtonFlow = memo((props: IInputButtonFlow) => {
|
|
|
50
50
|
style={styles.buttonItem}
|
|
51
51
|
onPress={() => onPressItem(item)}
|
|
52
52
|
>
|
|
53
|
-
<KLabel.Text typo="TextMdMedium">
|
|
53
|
+
<KLabel.Text typo="TextMdMedium" flex>
|
|
54
54
|
{item?.id === DEFAULT_BUTTON_ID
|
|
55
55
|
? trans('restart')
|
|
56
56
|
: item?.label || ''}
|
|
@@ -87,11 +87,13 @@ const styles = StyleSheet.create({
|
|
|
87
87
|
borderRadius: KSpacingValue['1.25rem'],
|
|
88
88
|
...messageStyles.bubbleReceived,
|
|
89
89
|
marginVertical: KSpacingValue['0.5rem'],
|
|
90
|
+
width: '100%',
|
|
90
91
|
},
|
|
91
92
|
buttonsContainer: {
|
|
92
93
|
backgroundColor: KColors.white,
|
|
93
94
|
borderRadius: KRadiusValue['3x'],
|
|
94
95
|
paddingHorizontal: KSpacingValue['0.75rem'],
|
|
96
|
+
width: '100%',
|
|
95
97
|
},
|
|
96
98
|
buttonItem: {
|
|
97
99
|
flexDirection: 'row',
|
|
@@ -101,5 +103,6 @@ const styles = StyleSheet.create({
|
|
|
101
103
|
borderBottomWidth: 1,
|
|
102
104
|
borderBottomColor: KColors.border.light,
|
|
103
105
|
paddingVertical: KSpacingValue['0.5rem'],
|
|
106
|
+
width: '100%',
|
|
104
107
|
},
|
|
105
108
|
});
|
|
@@ -1,5 +1,13 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import {
|
|
2
|
+
createContext,
|
|
3
|
+
useCallback,
|
|
4
|
+
useContext,
|
|
5
|
+
useEffect,
|
|
6
|
+
useMemo,
|
|
7
|
+
} from 'react';
|
|
2
8
|
import type { ChatContextType, ChatProviderProps } from '../types/chat';
|
|
9
|
+
import OpenIMSDK, { LoginStatus } from '@droppii/openim-rn-client-sdk';
|
|
10
|
+
import { useUserStore } from '../store';
|
|
3
11
|
|
|
4
12
|
export const ChatContext = createContext<ChatContextType | undefined>(
|
|
5
13
|
undefined
|
|
@@ -17,12 +25,36 @@ const ChatProviderInner = ({
|
|
|
17
25
|
logGA,
|
|
18
26
|
children,
|
|
19
27
|
applicationType,
|
|
28
|
+
getChatToken,
|
|
20
29
|
}: ChatProviderProps) => {
|
|
30
|
+
const connectStatus = useUserStore((state) => state.connectStatus);
|
|
21
31
|
const value = useMemo(
|
|
22
|
-
() => ({ logGA, applicationType }),
|
|
23
|
-
[logGA, applicationType]
|
|
32
|
+
() => ({ logGA, applicationType, getChatToken }),
|
|
33
|
+
[logGA, applicationType, getChatToken]
|
|
24
34
|
);
|
|
25
35
|
|
|
36
|
+
const handleSdkLogin = useCallback(async () => {
|
|
37
|
+
if (!!getChatToken && connectStatus === LoginStatus.Logout) {
|
|
38
|
+
const res = await getChatToken();
|
|
39
|
+
if (!!res?.id && !!res?.token) {
|
|
40
|
+
OpenIMSDK.login({
|
|
41
|
+
token: res.token,
|
|
42
|
+
userID: res.id,
|
|
43
|
+
})
|
|
44
|
+
.then(() => {
|
|
45
|
+
useUserStore.getState().updateConnectStatus(LoginStatus.Logged);
|
|
46
|
+
})
|
|
47
|
+
.catch((error) => {
|
|
48
|
+
console.error('Failed to login', error);
|
|
49
|
+
});
|
|
50
|
+
}
|
|
51
|
+
}
|
|
52
|
+
}, [getChatToken, connectStatus]);
|
|
53
|
+
|
|
54
|
+
useEffect(() => {
|
|
55
|
+
handleSdkLogin();
|
|
56
|
+
}, [handleSdkLogin]);
|
|
57
|
+
|
|
26
58
|
return <ChatContext.Provider value={value}>{children}</ChatContext.Provider>;
|
|
27
59
|
};
|
|
28
60
|
|