@droppii-org/chat-sdk 0.0.44 → 0.0.46
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/assets/openIM.wasm +0 -0
- package/dist/components/ChatBubble.d.ts +10 -0
- package/dist/components/ChatBubble.d.ts.map +1 -0
- package/dist/components/ChatBubble.js +28 -0
- package/dist/components/message/MessageHeader.js +1 -1
- package/dist/components/message/MessageItem.d.ts +7 -0
- package/dist/components/message/MessageItem.d.ts.map +1 -0
- package/dist/components/message/MessageItem.js +21 -0
- package/dist/components/message/footer/BottomSection.d.ts +3 -0
- package/dist/components/message/footer/BottomSection.d.ts.map +1 -0
- package/dist/components/message/footer/BottomSection.js +6 -0
- package/dist/components/message/item/index.d.ts.map +1 -1
- package/dist/components/message/item/index.js +3 -4
- package/dist/components/searchConversation/item/SearchItemAsUser.d.ts.map +1 -1
- package/dist/components/searchConversation/item/SearchItemAsUser.js +1 -0
- package/dist/hooks/conversation/useConversationStore.d.ts +2 -3
- package/dist/hooks/conversation/useConversationStore.d.ts.map +1 -1
- package/dist/hooks/message/useSendMessage.d.ts.map +1 -1
- package/dist/hooks/message/useSendMessage.js +9 -1
- package/dist/hooks/user/useUpdateFcmToken.d.ts +3 -0
- package/dist/hooks/user/useUpdateFcmToken.d.ts.map +1 -0
- package/dist/hooks/user/useUpdateFcmToken.js +21 -0
- package/dist/index.d.ts +1 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +1 -0
- package/dist/screens/desk-message/index.d.ts +3 -0
- package/dist/screens/desk-message/index.d.ts.map +1 -0
- package/dist/screens/desk-message/index.js +15 -0
- package/dist/services/routes.d.ts +1 -0
- package/dist/services/routes.d.ts.map +1 -1
- package/dist/services/routes.js +1 -0
- package/dist/styles/global.css +1 -1
- package/dist/tsconfig.tsbuildinfo +1 -0
- package/dist/types/dto.d.ts +7 -0
- package/dist/types/dto.d.ts.map +1 -1
- package/dist/types/index.d.ts +1 -0
- package/dist/types/index.d.ts.map +1 -0
- package/dist/types/index.js +1 -0
- package/dist/types/sdk.d.ts +1 -0
- package/dist/types/sdk.d.ts.map +1 -0
- package/dist/types/sdk.js +1 -0
- package/package.json +1 -1
- package/dist/assets/conversationBg.png +0 -0
- package/dist/hooks/collection/useMediaCollection.d.ts +0 -229
- package/dist/hooks/collection/useMediaCollection.d.ts.map +0 -1
- package/dist/hooks/collection/useMediaCollection.js +0 -66
- package/dist/hooks/search/useSearchConversation.d.ts +0 -2
- package/dist/hooks/search/useSearchConversation.d.ts.map +0 -1
- package/dist/hooks/search/useSearchConversation.js +0 -1
- package/dist/hooks/session/useGetSessionByTagOrStatus.d.ts +0 -220
- package/dist/hooks/session/useGetSessionByTagOrStatus.d.ts.map +0 -1
- package/dist/hooks/session/useGetSessionByTagOrStatus.js +0 -72
|
@@ -1,72 +0,0 @@
|
|
|
1
|
-
"use client";
|
|
2
|
-
var __rest = (this && this.__rest) || function (s, e) {
|
|
3
|
-
var t = {};
|
|
4
|
-
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
|
|
5
|
-
t[p] = s[p];
|
|
6
|
-
if (s != null && typeof Object.getOwnPropertySymbols === "function")
|
|
7
|
-
for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
|
|
8
|
-
if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
|
|
9
|
-
t[p[i]] = s[p[i]];
|
|
10
|
-
}
|
|
11
|
-
return t;
|
|
12
|
-
};
|
|
13
|
-
import { useInfiniteQuery } from "@tanstack/react-query";
|
|
14
|
-
import { apiInstance } from "../../services/api";
|
|
15
|
-
import { ENDPOINTS } from "../../services/routes";
|
|
16
|
-
import { QUERY_KEYS } from "../../services/query";
|
|
17
|
-
import { useMemo } from "react";
|
|
18
|
-
import useConversationStore from "../../store/conversation";
|
|
19
|
-
import { DChatSDK } from "../../constants/sdk";
|
|
20
|
-
export const useGetSessionByTagOrStatus = (filter) => {
|
|
21
|
-
const _a = useInfiniteQuery({
|
|
22
|
-
initialPageParam: 1,
|
|
23
|
-
queryKey: [QUERY_KEYS.GET_SESSION_BY_TAG_OR_STATUS, filter],
|
|
24
|
-
queryFn: async ({ pageParam = 1 }) => {
|
|
25
|
-
var _a, _b;
|
|
26
|
-
const params = {
|
|
27
|
-
applicationType: "OBEFE",
|
|
28
|
-
tag: filter.tag,
|
|
29
|
-
status: filter.status,
|
|
30
|
-
page: pageParam,
|
|
31
|
-
pageSize: 100,
|
|
32
|
-
};
|
|
33
|
-
const res = await apiInstance.post(ENDPOINTS.chatService.getSessionsByTagOrStatus, params);
|
|
34
|
-
//FIND NEW CONVERSATIONS
|
|
35
|
-
const conversationList = useConversationStore.getState().conversationList;
|
|
36
|
-
const newConversations = (_b = (_a = res === null || res === void 0 ? void 0 : res.data) === null || _a === void 0 ? void 0 : _a.data) === null || _b === void 0 ? void 0 : _b.filter((session) => {
|
|
37
|
-
return !conversationList.some((conversation) => conversation.conversationID === session.conversationId);
|
|
38
|
-
});
|
|
39
|
-
if (newConversations === null || newConversations === void 0 ? void 0 : newConversations.length) {
|
|
40
|
-
DChatSDK.getMultipleConversation(newConversations.map((session) => session.conversationId)).then((res) => {
|
|
41
|
-
useConversationStore
|
|
42
|
-
.getState()
|
|
43
|
-
.updateConversationList(res.data, "filter");
|
|
44
|
-
});
|
|
45
|
-
}
|
|
46
|
-
return res.data;
|
|
47
|
-
},
|
|
48
|
-
getNextPageParam: (lastPage) => {
|
|
49
|
-
var _a, _b;
|
|
50
|
-
const currentPage = ((_a = lastPage === null || lastPage === void 0 ? void 0 : lastPage.pageable) === null || _a === void 0 ? void 0 : _a.pageNumber) || 1;
|
|
51
|
-
const totalPages = ((_b = lastPage === null || lastPage === void 0 ? void 0 : lastPage.pageable) === null || _b === void 0 ? void 0 : _b.totalPages) || 1;
|
|
52
|
-
return currentPage + 1 < totalPages ? currentPage + 1 : undefined;
|
|
53
|
-
},
|
|
54
|
-
enabled: !!filter.tag || !!filter.status,
|
|
55
|
-
}), { data, fetchNextPage, hasNextPage, isFetchingNextPage, isLoading } = _a, rest = __rest(_a, ["data", "fetchNextPage", "hasNextPage", "isFetchingNextPage", "isLoading"]);
|
|
56
|
-
const { dataFlatten } = useMemo(() => {
|
|
57
|
-
if (!data)
|
|
58
|
-
return {
|
|
59
|
-
dataFlatten: [],
|
|
60
|
-
};
|
|
61
|
-
const allItems = data.pages.flatMap((page) => page.data);
|
|
62
|
-
return {
|
|
63
|
-
dataFlatten: allItems,
|
|
64
|
-
};
|
|
65
|
-
}, [data]);
|
|
66
|
-
return Object.assign({ data,
|
|
67
|
-
fetchNextPage,
|
|
68
|
-
hasNextPage,
|
|
69
|
-
isFetchingNextPage,
|
|
70
|
-
isLoading,
|
|
71
|
-
dataFlatten }, rest);
|
|
72
|
-
};
|