@droppii-org/chat-sdk 0.0.27 → 0.0.28
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/components/chatBubble/ChatBubble.d.ts.map +1 -1
- package/dist/components/chatBubble/ChatBubble.js +4 -5
- package/dist/components/conversation/DeskConversationList.d.ts.map +1 -1
- package/dist/components/conversation/DeskConversationList.js +14 -27
- package/dist/components/message/MessageHeader.d.ts +1 -3
- package/dist/components/message/MessageHeader.d.ts.map +1 -1
- package/dist/components/message/MessageHeader.js +7 -3
- package/dist/components/message/MessageList.d.ts +0 -2
- package/dist/components/message/MessageList.d.ts.map +1 -1
- package/dist/components/message/MessageList.js +5 -5
- package/dist/components/session/AssignedSessionFilter.d.ts.map +1 -1
- package/dist/components/session/AssignedSessionFilter.js +105 -51
- package/dist/constants/im.d.ts +3 -0
- package/dist/constants/im.d.ts.map +1 -0
- package/dist/constants/im.js +2 -0
- package/dist/constants/index.d.ts +12 -0
- package/dist/constants/index.d.ts.map +1 -1
- package/dist/constants/index.js +12 -0
- package/dist/context/ChatContext.d.ts.map +1 -1
- package/dist/context/ChatContext.js +29 -39
- package/dist/hooks/conversation/useConversation.d.ts +5 -5
- package/dist/hooks/conversation/useConversation.d.ts.map +1 -1
- package/dist/hooks/conversation/useConversation.js +47 -52
- package/dist/hooks/global/useGlobalEvent.d.ts.map +1 -1
- package/dist/hooks/global/useGlobalEvent.js +66 -3
- package/dist/hooks/message/useSendMessage.d.ts.map +1 -1
- package/dist/hooks/message/useSendMessage.js +1 -1
- package/dist/hooks/user/useUsersInfo.d.ts +4 -0
- package/dist/hooks/user/useUsersInfo.d.ts.map +1 -0
- package/dist/hooks/user/useUsersInfo.js +44 -0
- package/dist/index.d.ts +3 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +4 -0
- package/dist/layout/index.d.ts.map +1 -1
- package/dist/layout/index.js +8 -1
- package/dist/screens/chatBubble/index.d.ts.map +1 -1
- package/dist/screens/chatBubble/index.js +4 -11
- package/dist/screens/deskMessage/index.d.ts.map +1 -1
- package/dist/screens/deskMessage/index.js +3 -4
- package/dist/store/conversation.d.ts +4 -0
- package/dist/store/conversation.d.ts.map +1 -0
- package/dist/store/conversation.js +119 -0
- package/dist/store/index.d.ts +3 -0
- package/dist/store/index.d.ts.map +1 -0
- package/dist/store/index.js +2 -0
- package/dist/store/user.d.ts +4 -0
- package/dist/store/user.d.ts.map +1 -0
- package/dist/store/user.js +8 -0
- package/dist/store/usersInfo.d.ts +4 -0
- package/dist/store/usersInfo.d.ts.map +1 -0
- package/dist/store/usersInfo.js +12 -0
- package/dist/types/chat.d.ts +27 -0
- package/dist/types/chat.d.ts.map +1 -1
- package/dist/types/chat.js +6 -0
- package/dist/utils/imCommon.d.ts +26 -0
- package/dist/utils/imCommon.d.ts.map +1 -0
- package/dist/utils/imCommon.js +58 -0
- package/package.json +1 -1
- package/dist/hooks/zustand/useMessageStore.d.ts +0 -9
- package/dist/hooks/zustand/useMessageStore.d.ts.map +0 -1
- package/dist/hooks/zustand/useMessageStore.js +0 -8
- package/dist/tsconfig.tsbuildinfo +0 -1
- package/dist/types/index.d.ts +0 -1
- package/dist/types/index.d.ts.map +0 -1
- package/dist/types/index.js +0 -1
- package/dist/types/sdk.d.ts +0 -1
- package/dist/types/sdk.d.ts.map +0 -1
- package/dist/types/sdk.js +0 -1
package/dist/types/chat.d.ts
CHANGED
|
@@ -5,6 +5,11 @@ export declare enum ConnectStatus {
|
|
|
5
5
|
Connected = 1,
|
|
6
6
|
Connecting = 2
|
|
7
7
|
}
|
|
8
|
+
export declare enum SyncStatus {
|
|
9
|
+
Loading = 0,
|
|
10
|
+
Success = 1,
|
|
11
|
+
Failed = 2
|
|
12
|
+
}
|
|
8
13
|
export declare enum CustomType {
|
|
9
14
|
CallingInvite = 200,
|
|
10
15
|
CallingAccept = 201,
|
|
@@ -15,6 +20,10 @@ export declare enum CustomType {
|
|
|
15
20
|
export interface ChatContextType {
|
|
16
21
|
user: SelfUserInfo | null;
|
|
17
22
|
connectStatus: ConnectStatus;
|
|
23
|
+
syncStatus: SyncStatus;
|
|
24
|
+
userTokenHandler: () => void;
|
|
25
|
+
updateConnectStatus: (status: ConnectStatus) => void;
|
|
26
|
+
updateSyncStatus: (status: SyncStatus) => void;
|
|
18
27
|
}
|
|
19
28
|
export interface ChatProviderProps {
|
|
20
29
|
children: React.ReactNode;
|
|
@@ -62,4 +71,22 @@ export interface VideoMsgParamsByFile extends VideoMsgParamsByURL {
|
|
|
62
71
|
export interface FileMsgParamsByFile extends FileMsgParamsByURL {
|
|
63
72
|
file: File;
|
|
64
73
|
}
|
|
74
|
+
export interface ExtendConversationInfo {
|
|
75
|
+
applicationType?: "OBEFE";
|
|
76
|
+
sessionInfo?: {
|
|
77
|
+
type: "SESSION_INFO";
|
|
78
|
+
data: {
|
|
79
|
+
ownerId: string;
|
|
80
|
+
botId: string;
|
|
81
|
+
};
|
|
82
|
+
};
|
|
83
|
+
}
|
|
84
|
+
export interface ExtendPublicUserInfo {
|
|
85
|
+
userInfo?: {
|
|
86
|
+
type: "USER_INFO";
|
|
87
|
+
data: {
|
|
88
|
+
username?: string;
|
|
89
|
+
};
|
|
90
|
+
};
|
|
91
|
+
}
|
|
65
92
|
//# sourceMappingURL=chat.d.ts.map
|
package/dist/types/chat.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"chat.d.ts","sourceRoot":"","sources":["../../src/types/chat.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,kBAAkB,EAClB,mBAAmB,EACnB,kBAAkB,EAClB,WAAW,EACX,YAAY,EACZ,mBAAmB,EACpB,MAAM,yBAAyB,CAAC;AACjC,OAAO,EAAE,UAAU,EAAE,MAAM,MAAM,CAAC;AAElC,oBAAY,aAAa;IACvB,YAAY,IAAI;IAChB,SAAS,IAAI;IACb,UAAU,IAAI;CACf;AAED,oBAAY,UAAU;IACpB,aAAa,MAAM;IACnB,aAAa,MAA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C;YAChB,KAAK,EAAE,MAAM,CAAC;SACf,CAAC;KACH,CAAC;CACH;AAED,MAAM,WAAW,oBAAoB;IACnC,QAAQ,CAAC,EAAE;QACT,IAAI,EAAE,WAAW,CAAC;QAClB,IAAI,EAAE;YACJ,QAAQ,CAAC,EAAE,MAAM,CAAC;SACnB,CAAC;KACH,CAAC;CACH"}
|
package/dist/types/chat.js
CHANGED
|
@@ -4,6 +4,12 @@ export var ConnectStatus;
|
|
|
4
4
|
ConnectStatus[ConnectStatus["Connected"] = 1] = "Connected";
|
|
5
5
|
ConnectStatus[ConnectStatus["Connecting"] = 2] = "Connecting";
|
|
6
6
|
})(ConnectStatus || (ConnectStatus = {}));
|
|
7
|
+
export var SyncStatus;
|
|
8
|
+
(function (SyncStatus) {
|
|
9
|
+
SyncStatus[SyncStatus["Loading"] = 0] = "Loading";
|
|
10
|
+
SyncStatus[SyncStatus["Success"] = 1] = "Success";
|
|
11
|
+
SyncStatus[SyncStatus["Failed"] = 2] = "Failed";
|
|
12
|
+
})(SyncStatus || (SyncStatus = {}));
|
|
7
13
|
export var CustomType;
|
|
8
14
|
(function (CustomType) {
|
|
9
15
|
CustomType[CustomType["CallingInvite"] = 200] = "CallingInvite";
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import { ConversationItem, SessionType } from "@openim/wasm-client-sdk";
|
|
2
|
+
export declare const isGroupSession: (sessionType?: SessionType) => boolean;
|
|
3
|
+
export declare const conversationSort: (conversationList: ConversationItem[], originalList?: ConversationItem[]) => {
|
|
4
|
+
conversationID: string;
|
|
5
|
+
conversationType: SessionType;
|
|
6
|
+
userID: string;
|
|
7
|
+
groupID: string;
|
|
8
|
+
showName: string;
|
|
9
|
+
faceURL: string;
|
|
10
|
+
recvMsgOpt: import("@openim/wasm-client-sdk").MessageReceiveOptType;
|
|
11
|
+
unreadCount: number;
|
|
12
|
+
groupAtType: import("@openim/wasm-client-sdk").GroupAtType;
|
|
13
|
+
latestMsg: string;
|
|
14
|
+
latestMsgSendTime: number;
|
|
15
|
+
draftText: string;
|
|
16
|
+
draftTextTime: number;
|
|
17
|
+
burnDuration: number;
|
|
18
|
+
msgDestructTime: number;
|
|
19
|
+
isPinned: boolean;
|
|
20
|
+
isNotInGroup: boolean;
|
|
21
|
+
isPrivateChat: boolean;
|
|
22
|
+
isMsgDestruct: boolean;
|
|
23
|
+
attachedInfo: string;
|
|
24
|
+
ex?: string;
|
|
25
|
+
}[];
|
|
26
|
+
//# sourceMappingURL=imCommon.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"imCommon.d.ts","sourceRoot":"","sources":["../../src/utils/imCommon.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,gBAAgB,EAAE,WAAW,EAAE,MAAM,yBAAyB,CAAC;AAGxE,eAAO,MAAM,cAAc,GAAI,cAAc,WAAW,YACO,CAAC;AAEhE,eAAO,MAAM,gBAAgB,GAC3B,kBAAkB,gBAAgB,EAAE,EACpC,eAAe,gBAAgB,EAAE;;;;;;;;;;;;;;;;;;;;;;GA8ClC,CAAC"}
|
|
@@ -0,0 +1,58 @@
|
|
|
1
|
+
var __rest = (this && this.__rest) || function (s, e) {
|
|
2
|
+
var t = {};
|
|
3
|
+
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
|
|
4
|
+
t[p] = s[p];
|
|
5
|
+
if (s != null && typeof Object.getOwnPropertySymbols === "function")
|
|
6
|
+
for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
|
|
7
|
+
if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
|
|
8
|
+
t[p[i]] = s[p[i]];
|
|
9
|
+
}
|
|
10
|
+
return t;
|
|
11
|
+
};
|
|
12
|
+
import { GroupSessionTypes } from "../constants/im";
|
|
13
|
+
export const isGroupSession = (sessionType) => sessionType ? GroupSessionTypes.includes(sessionType) : false;
|
|
14
|
+
export const conversationSort = (conversationList, originalList) => {
|
|
15
|
+
const listWithIndex = conversationList.map((item, index) => {
|
|
16
|
+
var _a;
|
|
17
|
+
return (Object.assign(Object.assign({}, item), { originalIndex: (_a = originalList === null || originalList === void 0 ? void 0 : originalList.findIndex((c) => c.conversationID === item.conversationID)) !== null && _a !== void 0 ? _a : index }));
|
|
18
|
+
});
|
|
19
|
+
const arr = [];
|
|
20
|
+
const filterArr = listWithIndex.filter((c) => {
|
|
21
|
+
if (!arr.includes(c.conversationID)) {
|
|
22
|
+
arr.push(c.conversationID);
|
|
23
|
+
return true;
|
|
24
|
+
}
|
|
25
|
+
return false;
|
|
26
|
+
});
|
|
27
|
+
filterArr.sort((a, b) => {
|
|
28
|
+
if (a.isPinned === b.isPinned) {
|
|
29
|
+
const aCompare = a.draftTextTime > a.latestMsgSendTime
|
|
30
|
+
? a.draftTextTime
|
|
31
|
+
: a.latestMsgSendTime;
|
|
32
|
+
const bCompare = b.draftTextTime > b.latestMsgSendTime
|
|
33
|
+
? b.draftTextTime
|
|
34
|
+
: b.latestMsgSendTime;
|
|
35
|
+
if (aCompare > bCompare) {
|
|
36
|
+
return -1;
|
|
37
|
+
}
|
|
38
|
+
else if (aCompare < bCompare) {
|
|
39
|
+
return 1;
|
|
40
|
+
}
|
|
41
|
+
else {
|
|
42
|
+
if (!originalList)
|
|
43
|
+
return 0;
|
|
44
|
+
return a.originalIndex - b.originalIndex;
|
|
45
|
+
}
|
|
46
|
+
}
|
|
47
|
+
else if (a.isPinned && !b.isPinned) {
|
|
48
|
+
return -1;
|
|
49
|
+
}
|
|
50
|
+
else {
|
|
51
|
+
return 1;
|
|
52
|
+
}
|
|
53
|
+
});
|
|
54
|
+
return filterArr.map((_a) => {
|
|
55
|
+
var { originalIndex } = _a, rest = __rest(_a, ["originalIndex"]);
|
|
56
|
+
return rest;
|
|
57
|
+
});
|
|
58
|
+
};
|
package/package.json
CHANGED
|
@@ -1,9 +0,0 @@
|
|
|
1
|
-
interface MessageStore {
|
|
2
|
-
selectedThreadId: string;
|
|
3
|
-
selectedSourceId: string;
|
|
4
|
-
setSelectedThreadId: (threadId: string) => void;
|
|
5
|
-
setSelectedSourceId: (sourceId: string) => void;
|
|
6
|
-
}
|
|
7
|
-
declare const useMessageStore: import("zustand").UseBoundStore<import("zustand").StoreApi<MessageStore>>;
|
|
8
|
-
export default useMessageStore;
|
|
9
|
-
//# sourceMappingURL=useMessageStore.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"useMessageStore.d.ts","sourceRoot":"","sources":["../../../src/hooks/zustand/useMessageStore.ts"],"names":[],"mappings":"AAEA,UAAU,YAAY;IACpB,gBAAgB,EAAE,MAAM,CAAC;IACzB,gBAAgB,EAAE,MAAM,CAAC;IACzB,mBAAmB,EAAE,CAAC,QAAQ,EAAE,MAAM,KAAK,IAAI,CAAC;IAChD,mBAAmB,EAAE,CAAC,QAAQ,EAAE,MAAM,KAAK,IAAI,CAAC;CACjD;AAED,QAAA,MAAM,eAAe,2EAKlB,CAAC;AAEJ,eAAe,eAAe,CAAC"}
|
|
@@ -1,8 +0,0 @@
|
|
|
1
|
-
import { create } from "zustand";
|
|
2
|
-
const useMessageStore = create((set) => ({
|
|
3
|
-
selectedThreadId: "",
|
|
4
|
-
setSelectedThreadId: (threadId) => set({ selectedThreadId: threadId }),
|
|
5
|
-
selectedSourceId: "",
|
|
6
|
-
setSelectedSourceId: (sourceId) => set({ selectedSourceId: sourceId }),
|
|
7
|
-
}));
|
|
8
|
-
export default useMessageStore;
|