@droppii-org/chat-sdk 0.0.49 → 0.0.51
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/conversation/DeskConversationList.js +1 -1
- package/dist/components/mediaCollection/LinkCollection.d.ts +3 -1
- package/dist/components/mediaCollection/LinkCollection.d.ts.map +1 -1
- package/dist/components/mediaCollection/LinkCollection.js +35 -4
- package/dist/components/mediaCollection/index.js +1 -1
- package/dist/components/message/MessageHeader.d.ts.map +1 -1
- package/dist/components/message/MessageHeader.js +25 -25
- package/dist/components/message/SelectSession.d.ts +3 -2
- package/dist/components/message/SelectSession.d.ts.map +1 -1
- package/dist/components/message/SelectSession.js +14 -13
- package/dist/constants/index.d.ts +1 -1
- package/dist/constants/index.d.ts.map +1 -1
- package/dist/constants/index.js +1 -1
- package/dist/styles/global.css +1 -1
- package/package.json +1 -1
- package/dist/assets/conversationBg.png +0 -0
- package/dist/assets/sql-wasm.wasm +0 -0
- package/dist/assets/version +0 -1
- package/dist/assets/wasm_exec.js +0 -575
- package/dist/components/conversation/ConversationItemList.d.ts +0 -7
- package/dist/components/conversation/ConversationItemList.d.ts.map +0 -1
- package/dist/components/conversation/ConversationItemList.js +0 -20
- package/dist/components/session/AssignedSessionFilter.d.ts +0 -7
- package/dist/components/session/AssignedSessionFilter.d.ts.map +0 -1
- package/dist/components/session/AssignedSessionFilter.js +0 -152
- 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/conversation/useConversationStore.d.ts +0 -12
- package/dist/hooks/conversation/useConversationStore.d.ts.map +0 -1
- package/dist/hooks/conversation/useConversationStore.js +0 -10
- 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
- package/dist/tsconfig.tsbuildinfo +0 -1
|
@@ -1,152 +0,0 @@
|
|
|
1
|
-
"use client";
|
|
2
|
-
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
3
|
-
import { useMemo, useState } from "react";
|
|
4
|
-
import { Icon } from "../icon";
|
|
5
|
-
import useConversationStore from "../../store/conversation";
|
|
6
|
-
import { SESSION_STATUS_ENUM, TAG_ENUM } from "../../constants";
|
|
7
|
-
const AssignedSessionFilter = ({ onFilterChange, className = "", }) => {
|
|
8
|
-
const [expandedCategories, setExpandedCategories] = useState(new Set([0]));
|
|
9
|
-
const [selectedFilter, setSelectedFilter] = useState(SESSION_STATUS_ENUM.UNASSIGNED);
|
|
10
|
-
const summary = useConversationStore((state) => state.summary);
|
|
11
|
-
const setFilterSummary = useConversationStore((state) => state.setFilterSummary);
|
|
12
|
-
const messageCategories = useMemo(() => {
|
|
13
|
-
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p;
|
|
14
|
-
return [
|
|
15
|
-
{
|
|
16
|
-
icon: "chat-square-b",
|
|
17
|
-
label: "Đang mở",
|
|
18
|
-
key: "ALL",
|
|
19
|
-
count: (summary === null || summary === void 0 ? void 0 : summary.activeSessionCount) || 0,
|
|
20
|
-
color: "text-gray-600",
|
|
21
|
-
query: {
|
|
22
|
-
status: undefined,
|
|
23
|
-
tag: undefined,
|
|
24
|
-
},
|
|
25
|
-
subCategories: [
|
|
26
|
-
{
|
|
27
|
-
icon: "user-del-o",
|
|
28
|
-
label: "Chưa phân công",
|
|
29
|
-
key: SESSION_STATUS_ENUM.UNASSIGNED,
|
|
30
|
-
count: ((_b = (_a = summary === null || summary === void 0 ? void 0 : summary.sessionStatuses) === null || _a === void 0 ? void 0 : _a.find((status) => status.type === SESSION_STATUS_ENUM.UNASSIGNED)) === null || _b === void 0 ? void 0 : _b.count) || 0,
|
|
31
|
-
color: "text-orange-500",
|
|
32
|
-
query: {
|
|
33
|
-
status: SESSION_STATUS_ENUM.UNASSIGNED,
|
|
34
|
-
tag: undefined,
|
|
35
|
-
},
|
|
36
|
-
},
|
|
37
|
-
{
|
|
38
|
-
icon: "warning-square-o",
|
|
39
|
-
label: "Chậm xử lý",
|
|
40
|
-
key: TAG_ENUM.SLOW_PROCESSING,
|
|
41
|
-
count: ((_d = (_c = summary === null || summary === void 0 ? void 0 : summary.tagCounts) === null || _c === void 0 ? void 0 : _c.find((status) => status.type === TAG_ENUM.SLOW_PROCESSING)) === null || _d === void 0 ? void 0 : _d.count) || 0,
|
|
42
|
-
color: "text-red-500",
|
|
43
|
-
query: {
|
|
44
|
-
status: undefined,
|
|
45
|
-
tag: TAG_ENUM.SLOW_PROCESSING,
|
|
46
|
-
},
|
|
47
|
-
},
|
|
48
|
-
{
|
|
49
|
-
icon: "time-circle-o",
|
|
50
|
-
label: "Chờ xử lý",
|
|
51
|
-
key: SESSION_STATUS_ENUM.WAITING_PROCESS,
|
|
52
|
-
count: ((_f = (_e = summary === null || summary === void 0 ? void 0 : summary.sessionStatuses) === null || _e === void 0 ? void 0 : _e.find((status) => status.type === SESSION_STATUS_ENUM.WAITING_PROCESS)) === null || _f === void 0 ? void 0 : _f.count) || 0,
|
|
53
|
-
color: "text-orange-400",
|
|
54
|
-
query: {
|
|
55
|
-
status: SESSION_STATUS_ENUM.WAITING_PROCESS,
|
|
56
|
-
tag: undefined,
|
|
57
|
-
},
|
|
58
|
-
},
|
|
59
|
-
{
|
|
60
|
-
icon: "arrow-reply-o",
|
|
61
|
-
label: "Chưa trả lời",
|
|
62
|
-
key: TAG_ENUM.AWAITING_REPLY,
|
|
63
|
-
count: ((_h = (_g = summary === null || summary === void 0 ? void 0 : summary.tagCounts) === null || _g === void 0 ? void 0 : _g.find((status) => status.type === TAG_ENUM.AWAITING_REPLY)) === null || _h === void 0 ? void 0 : _h.count) || 0,
|
|
64
|
-
color: "text-purple-500",
|
|
65
|
-
query: {
|
|
66
|
-
status: undefined,
|
|
67
|
-
tag: TAG_ENUM.AWAITING_REPLY,
|
|
68
|
-
},
|
|
69
|
-
},
|
|
70
|
-
{
|
|
71
|
-
icon: "play-b",
|
|
72
|
-
label: "Đang xử lý",
|
|
73
|
-
key: SESSION_STATUS_ENUM.IN_PROCESS,
|
|
74
|
-
count: ((_k = (_j = summary === null || summary === void 0 ? void 0 : summary.sessionStatuses) === null || _j === void 0 ? void 0 : _j.find((status) => status.type === SESSION_STATUS_ENUM.IN_PROCESS)) === null || _k === void 0 ? void 0 : _k.count) || 0,
|
|
75
|
-
color: "text-gray-600",
|
|
76
|
-
query: {
|
|
77
|
-
status: SESSION_STATUS_ENUM.IN_PROCESS,
|
|
78
|
-
tag: undefined,
|
|
79
|
-
},
|
|
80
|
-
},
|
|
81
|
-
{
|
|
82
|
-
icon: "pause-b",
|
|
83
|
-
label: "Tạm chờ",
|
|
84
|
-
key: TAG_ENUM.TEMPORARILY_PAUSED,
|
|
85
|
-
count: ((_m = (_l = summary === null || summary === void 0 ? void 0 : summary.sessionStatuses) === null || _l === void 0 ? void 0 : _l.find((status) => status.type === TAG_ENUM.TEMPORARILY_PAUSED)) === null || _m === void 0 ? void 0 : _m.count) || 0,
|
|
86
|
-
color: "text-gray-600",
|
|
87
|
-
query: {
|
|
88
|
-
status: undefined,
|
|
89
|
-
tag: TAG_ENUM.TEMPORARILY_PAUSED,
|
|
90
|
-
},
|
|
91
|
-
},
|
|
92
|
-
],
|
|
93
|
-
},
|
|
94
|
-
{
|
|
95
|
-
icon: "check-b",
|
|
96
|
-
label: "Đã đóng",
|
|
97
|
-
key: SESSION_STATUS_ENUM.COMPLETED,
|
|
98
|
-
count: ((_p = (_o = summary === null || summary === void 0 ? void 0 : summary.sessionStatuses) === null || _o === void 0 ? void 0 : _o.find((status) => status.type === SESSION_STATUS_ENUM.COMPLETED)) === null || _p === void 0 ? void 0 : _p.count) || 0,
|
|
99
|
-
color: "text-green-600",
|
|
100
|
-
query: {
|
|
101
|
-
status: SESSION_STATUS_ENUM.COMPLETED,
|
|
102
|
-
tag: undefined,
|
|
103
|
-
},
|
|
104
|
-
},
|
|
105
|
-
];
|
|
106
|
-
}, []);
|
|
107
|
-
const toggleCategory = (index) => {
|
|
108
|
-
const newExpanded = new Set(expandedCategories);
|
|
109
|
-
if (newExpanded.has(index)) {
|
|
110
|
-
newExpanded.delete(index);
|
|
111
|
-
}
|
|
112
|
-
else {
|
|
113
|
-
newExpanded.add(index);
|
|
114
|
-
}
|
|
115
|
-
setExpandedCategories(newExpanded);
|
|
116
|
-
};
|
|
117
|
-
const handleFilterSelect = (categoryKey, subCategoryKey) => {
|
|
118
|
-
const filterKey = subCategoryKey || categoryKey;
|
|
119
|
-
setSelectedFilter(filterKey);
|
|
120
|
-
// Find the selected category and subcategory by key
|
|
121
|
-
const category = messageCategories.find((cat) => cat.key === categoryKey);
|
|
122
|
-
let query;
|
|
123
|
-
if (category) {
|
|
124
|
-
if (subCategoryKey && category.subCategories) {
|
|
125
|
-
const subCategory = category.subCategories.find((sub) => sub.key === subCategoryKey);
|
|
126
|
-
query = subCategory === null || subCategory === void 0 ? void 0 : subCategory.query;
|
|
127
|
-
}
|
|
128
|
-
else {
|
|
129
|
-
query = category.query;
|
|
130
|
-
}
|
|
131
|
-
}
|
|
132
|
-
if (query) {
|
|
133
|
-
setFilterSummary(query);
|
|
134
|
-
}
|
|
135
|
-
onFilterChange === null || onFilterChange === void 0 ? void 0 : onFilterChange(categoryKey, subCategoryKey);
|
|
136
|
-
};
|
|
137
|
-
return (_jsxs("div", { className: `w-64 bg-white border-r border-gray-200 flex flex-col ${className}`, children: [_jsx("div", { className: "p-4 border-b border-gray-200", children: _jsx("h2", { className: "text-lg font-semibold text-gray-800", children: "TIN NH\u1EAEN C\u1EE6A T\u00D4I" }) }), _jsx("div", { className: "flex-1 overflow-y-auto", children: _jsx("ul", { className: "py-2", children: messageCategories.map((category, index) => (_jsxs("li", { children: [_jsxs("button", { onClick: () => {
|
|
138
|
-
if (category.subCategories) {
|
|
139
|
-
toggleCategory(index);
|
|
140
|
-
}
|
|
141
|
-
else {
|
|
142
|
-
handleFilterSelect(category.key);
|
|
143
|
-
}
|
|
144
|
-
}, className: `w-full flex items-center justify-between px-4 py-3 hover:bg-gray-50 transition-colors group ${selectedFilter === category.key && !category.subCategories
|
|
145
|
-
? "bg-blue-50 border-r-2 border-blue-500"
|
|
146
|
-
: ""}`, children: [_jsxs("div", { className: "flex items-center gap-3", children: [_jsxs("div", { className: "flex items-center gap-2", children: [category.subCategories && (_jsx(Icon, { icon: expandedCategories.has(index)
|
|
147
|
-
? "chevron-down-b"
|
|
148
|
-
: "chevron-right-b", size: 14, className: "text-gray-400" })), _jsx(Icon, { icon: category.icon, size: 20, className: category.color })] }), _jsx("span", { className: "font-medium text-gray-800 text-left", children: category.label })] }), _jsx("span", { className: "text-sm font-medium text-gray-500 min-w-0", children: category.count })] }), category.subCategories && expandedCategories.has(index) && (_jsx("ul", { className: "ml-4 border-l border-gray-200", children: category.subCategories.map((subCategory, subIndex) => (_jsx("li", { children: _jsxs("button", { onClick: () => handleFilterSelect(category.key, subCategory.key), className: `w-full flex items-center justify-between px-4 py-2 hover:bg-gray-50 transition-colors group ${selectedFilter === subCategory.key
|
|
149
|
-
? "bg-blue-50 border-r-2 border-blue-500"
|
|
150
|
-
: ""}`, children: [_jsxs("div", { className: "flex items-center gap-3", children: [_jsx("div", { className: "flex-shrink-0 ml-4", children: _jsx(Icon, { icon: subCategory.icon, size: 18, className: subCategory.color }) }), _jsx("span", { className: "text-sm font-medium text-gray-700 text-left", children: subCategory.label })] }), _jsx("span", { className: "text-xs font-medium text-gray-500 min-w-0", children: subCategory.count })] }) }, subIndex))) }))] }, index))) }) })] }));
|
|
151
|
-
};
|
|
152
|
-
export default AssignedSessionFilter;
|
|
@@ -1,229 +0,0 @@
|
|
|
1
|
-
import { MessageType } from "@openim/wasm-client-sdk";
|
|
2
|
-
import { MediaCollectionItem, MediaCollectionResponse } from "../../types/dto";
|
|
3
|
-
export declare const useMediaCollection: ({ recvID, contentType, }: {
|
|
4
|
-
recvID: string;
|
|
5
|
-
contentType: MessageType;
|
|
6
|
-
}) => {
|
|
7
|
-
error: Error;
|
|
8
|
-
isError: true;
|
|
9
|
-
isPending: false;
|
|
10
|
-
isLoadingError: false;
|
|
11
|
-
isRefetchError: true;
|
|
12
|
-
isSuccess: false;
|
|
13
|
-
isPlaceholderData: false;
|
|
14
|
-
status: "error";
|
|
15
|
-
fetchPreviousPage: (options?: import("@tanstack/react-query").FetchPreviousPageOptions) => Promise<import("@tanstack/react-query").InfiniteQueryObserverResult<import("@tanstack/react-query").InfiniteData<MediaCollectionResponse, unknown>, Error>>;
|
|
16
|
-
hasPreviousPage: boolean;
|
|
17
|
-
isFetchNextPageError: boolean;
|
|
18
|
-
isFetchPreviousPageError: boolean;
|
|
19
|
-
isFetchingPreviousPage: boolean;
|
|
20
|
-
dataUpdatedAt: number;
|
|
21
|
-
errorUpdatedAt: number;
|
|
22
|
-
failureCount: number;
|
|
23
|
-
failureReason: Error | null;
|
|
24
|
-
errorUpdateCount: number;
|
|
25
|
-
isFetched: boolean;
|
|
26
|
-
isFetchedAfterMount: boolean;
|
|
27
|
-
isFetching: boolean;
|
|
28
|
-
isInitialLoading: boolean;
|
|
29
|
-
isPaused: boolean;
|
|
30
|
-
isRefetching: boolean;
|
|
31
|
-
isStale: boolean;
|
|
32
|
-
isEnabled: boolean;
|
|
33
|
-
refetch: (options?: import("@tanstack/react-query").RefetchOptions) => Promise<import("@tanstack/react-query").QueryObserverResult<import("@tanstack/react-query").InfiniteData<MediaCollectionResponse, unknown>, Error>>;
|
|
34
|
-
fetchStatus: import("@tanstack/react-query").FetchStatus;
|
|
35
|
-
promise: Promise<import("@tanstack/react-query").InfiniteData<MediaCollectionResponse, unknown>>;
|
|
36
|
-
data: import("@tanstack/react-query").InfiniteData<MediaCollectionResponse, unknown> | undefined;
|
|
37
|
-
fetchNextPage: (options?: import("@tanstack/react-query").FetchNextPageOptions) => Promise<import("@tanstack/react-query").InfiniteQueryObserverResult<import("@tanstack/react-query").InfiniteData<MediaCollectionResponse, unknown>, Error>>;
|
|
38
|
-
hasNextPage: boolean;
|
|
39
|
-
isFetchingNextPage: boolean;
|
|
40
|
-
isLoading: boolean;
|
|
41
|
-
groupedData: Record<string, MediaCollectionItem[]>;
|
|
42
|
-
dataFlatten: MediaCollectionItem[];
|
|
43
|
-
} | {
|
|
44
|
-
error: null;
|
|
45
|
-
isError: false;
|
|
46
|
-
isPending: false;
|
|
47
|
-
isLoadingError: false;
|
|
48
|
-
isRefetchError: false;
|
|
49
|
-
isFetchNextPageError: false;
|
|
50
|
-
isFetchPreviousPageError: false;
|
|
51
|
-
isSuccess: true;
|
|
52
|
-
isPlaceholderData: false;
|
|
53
|
-
status: "success";
|
|
54
|
-
fetchPreviousPage: (options?: import("@tanstack/react-query").FetchPreviousPageOptions) => Promise<import("@tanstack/react-query").InfiniteQueryObserverResult<import("@tanstack/react-query").InfiniteData<MediaCollectionResponse, unknown>, Error>>;
|
|
55
|
-
hasPreviousPage: boolean;
|
|
56
|
-
isFetchingPreviousPage: boolean;
|
|
57
|
-
dataUpdatedAt: number;
|
|
58
|
-
errorUpdatedAt: number;
|
|
59
|
-
failureCount: number;
|
|
60
|
-
failureReason: Error | null;
|
|
61
|
-
errorUpdateCount: number;
|
|
62
|
-
isFetched: boolean;
|
|
63
|
-
isFetchedAfterMount: boolean;
|
|
64
|
-
isFetching: boolean;
|
|
65
|
-
isInitialLoading: boolean;
|
|
66
|
-
isPaused: boolean;
|
|
67
|
-
isRefetching: boolean;
|
|
68
|
-
isStale: boolean;
|
|
69
|
-
isEnabled: boolean;
|
|
70
|
-
refetch: (options?: import("@tanstack/react-query").RefetchOptions) => Promise<import("@tanstack/react-query").QueryObserverResult<import("@tanstack/react-query").InfiniteData<MediaCollectionResponse, unknown>, Error>>;
|
|
71
|
-
fetchStatus: import("@tanstack/react-query").FetchStatus;
|
|
72
|
-
promise: Promise<import("@tanstack/react-query").InfiniteData<MediaCollectionResponse, unknown>>;
|
|
73
|
-
data: import("@tanstack/react-query").InfiniteData<MediaCollectionResponse, unknown> | undefined;
|
|
74
|
-
fetchNextPage: (options?: import("@tanstack/react-query").FetchNextPageOptions) => Promise<import("@tanstack/react-query").InfiniteQueryObserverResult<import("@tanstack/react-query").InfiniteData<MediaCollectionResponse, unknown>, Error>>;
|
|
75
|
-
hasNextPage: boolean;
|
|
76
|
-
isFetchingNextPage: boolean;
|
|
77
|
-
isLoading: boolean;
|
|
78
|
-
groupedData: Record<string, MediaCollectionItem[]>;
|
|
79
|
-
dataFlatten: MediaCollectionItem[];
|
|
80
|
-
} | {
|
|
81
|
-
error: Error;
|
|
82
|
-
isError: true;
|
|
83
|
-
isPending: false;
|
|
84
|
-
isLoadingError: true;
|
|
85
|
-
isRefetchError: false;
|
|
86
|
-
isFetchNextPageError: false;
|
|
87
|
-
isFetchPreviousPageError: false;
|
|
88
|
-
isSuccess: false;
|
|
89
|
-
isPlaceholderData: false;
|
|
90
|
-
status: "error";
|
|
91
|
-
fetchPreviousPage: (options?: import("@tanstack/react-query").FetchPreviousPageOptions) => Promise<import("@tanstack/react-query").InfiniteQueryObserverResult<import("@tanstack/react-query").InfiniteData<MediaCollectionResponse, unknown>, Error>>;
|
|
92
|
-
hasPreviousPage: boolean;
|
|
93
|
-
isFetchingPreviousPage: boolean;
|
|
94
|
-
dataUpdatedAt: number;
|
|
95
|
-
errorUpdatedAt: number;
|
|
96
|
-
failureCount: number;
|
|
97
|
-
failureReason: Error | null;
|
|
98
|
-
errorUpdateCount: number;
|
|
99
|
-
isFetched: boolean;
|
|
100
|
-
isFetchedAfterMount: boolean;
|
|
101
|
-
isFetching: boolean;
|
|
102
|
-
isInitialLoading: boolean;
|
|
103
|
-
isPaused: boolean;
|
|
104
|
-
isRefetching: boolean;
|
|
105
|
-
isStale: boolean;
|
|
106
|
-
isEnabled: boolean;
|
|
107
|
-
refetch: (options?: import("@tanstack/react-query").RefetchOptions) => Promise<import("@tanstack/react-query").QueryObserverResult<import("@tanstack/react-query").InfiniteData<MediaCollectionResponse, unknown>, Error>>;
|
|
108
|
-
fetchStatus: import("@tanstack/react-query").FetchStatus;
|
|
109
|
-
promise: Promise<import("@tanstack/react-query").InfiniteData<MediaCollectionResponse, unknown>>;
|
|
110
|
-
data: import("@tanstack/react-query").InfiniteData<MediaCollectionResponse, unknown> | undefined;
|
|
111
|
-
fetchNextPage: (options?: import("@tanstack/react-query").FetchNextPageOptions) => Promise<import("@tanstack/react-query").InfiniteQueryObserverResult<import("@tanstack/react-query").InfiniteData<MediaCollectionResponse, unknown>, Error>>;
|
|
112
|
-
hasNextPage: boolean;
|
|
113
|
-
isFetchingNextPage: boolean;
|
|
114
|
-
isLoading: boolean;
|
|
115
|
-
groupedData: Record<string, MediaCollectionItem[]>;
|
|
116
|
-
dataFlatten: MediaCollectionItem[];
|
|
117
|
-
} | {
|
|
118
|
-
error: null;
|
|
119
|
-
isError: false;
|
|
120
|
-
isPending: true;
|
|
121
|
-
isLoadingError: false;
|
|
122
|
-
isRefetchError: false;
|
|
123
|
-
isFetchNextPageError: false;
|
|
124
|
-
isFetchPreviousPageError: false;
|
|
125
|
-
isSuccess: false;
|
|
126
|
-
isPlaceholderData: false;
|
|
127
|
-
status: "pending";
|
|
128
|
-
fetchPreviousPage: (options?: import("@tanstack/react-query").FetchPreviousPageOptions) => Promise<import("@tanstack/react-query").InfiniteQueryObserverResult<import("@tanstack/react-query").InfiniteData<MediaCollectionResponse, unknown>, Error>>;
|
|
129
|
-
hasPreviousPage: boolean;
|
|
130
|
-
isFetchingPreviousPage: boolean;
|
|
131
|
-
dataUpdatedAt: number;
|
|
132
|
-
errorUpdatedAt: number;
|
|
133
|
-
failureCount: number;
|
|
134
|
-
failureReason: Error | null;
|
|
135
|
-
errorUpdateCount: number;
|
|
136
|
-
isFetched: boolean;
|
|
137
|
-
isFetchedAfterMount: boolean;
|
|
138
|
-
isFetching: boolean;
|
|
139
|
-
isInitialLoading: boolean;
|
|
140
|
-
isPaused: boolean;
|
|
141
|
-
isRefetching: boolean;
|
|
142
|
-
isStale: boolean;
|
|
143
|
-
isEnabled: boolean;
|
|
144
|
-
refetch: (options?: import("@tanstack/react-query").RefetchOptions) => Promise<import("@tanstack/react-query").QueryObserverResult<import("@tanstack/react-query").InfiniteData<MediaCollectionResponse, unknown>, Error>>;
|
|
145
|
-
fetchStatus: import("@tanstack/react-query").FetchStatus;
|
|
146
|
-
promise: Promise<import("@tanstack/react-query").InfiniteData<MediaCollectionResponse, unknown>>;
|
|
147
|
-
data: import("@tanstack/react-query").InfiniteData<MediaCollectionResponse, unknown> | undefined;
|
|
148
|
-
fetchNextPage: (options?: import("@tanstack/react-query").FetchNextPageOptions) => Promise<import("@tanstack/react-query").InfiniteQueryObserverResult<import("@tanstack/react-query").InfiniteData<MediaCollectionResponse, unknown>, Error>>;
|
|
149
|
-
hasNextPage: boolean;
|
|
150
|
-
isFetchingNextPage: boolean;
|
|
151
|
-
isLoading: boolean;
|
|
152
|
-
groupedData: Record<string, MediaCollectionItem[]>;
|
|
153
|
-
dataFlatten: MediaCollectionItem[];
|
|
154
|
-
} | {
|
|
155
|
-
error: null;
|
|
156
|
-
isError: false;
|
|
157
|
-
isPending: true;
|
|
158
|
-
isLoadingError: false;
|
|
159
|
-
isRefetchError: false;
|
|
160
|
-
isFetchNextPageError: false;
|
|
161
|
-
isFetchPreviousPageError: false;
|
|
162
|
-
isSuccess: false;
|
|
163
|
-
isPlaceholderData: false;
|
|
164
|
-
status: "pending";
|
|
165
|
-
fetchPreviousPage: (options?: import("@tanstack/react-query").FetchPreviousPageOptions) => Promise<import("@tanstack/react-query").InfiniteQueryObserverResult<import("@tanstack/react-query").InfiniteData<MediaCollectionResponse, unknown>, Error>>;
|
|
166
|
-
hasPreviousPage: boolean;
|
|
167
|
-
isFetchingPreviousPage: boolean;
|
|
168
|
-
dataUpdatedAt: number;
|
|
169
|
-
errorUpdatedAt: number;
|
|
170
|
-
failureCount: number;
|
|
171
|
-
failureReason: Error | null;
|
|
172
|
-
errorUpdateCount: number;
|
|
173
|
-
isFetched: boolean;
|
|
174
|
-
isFetchedAfterMount: boolean;
|
|
175
|
-
isFetching: boolean;
|
|
176
|
-
isInitialLoading: boolean;
|
|
177
|
-
isPaused: boolean;
|
|
178
|
-
isRefetching: boolean;
|
|
179
|
-
isStale: boolean;
|
|
180
|
-
isEnabled: boolean;
|
|
181
|
-
refetch: (options?: import("@tanstack/react-query").RefetchOptions) => Promise<import("@tanstack/react-query").QueryObserverResult<import("@tanstack/react-query").InfiniteData<MediaCollectionResponse, unknown>, Error>>;
|
|
182
|
-
fetchStatus: import("@tanstack/react-query").FetchStatus;
|
|
183
|
-
promise: Promise<import("@tanstack/react-query").InfiniteData<MediaCollectionResponse, unknown>>;
|
|
184
|
-
data: import("@tanstack/react-query").InfiniteData<MediaCollectionResponse, unknown> | undefined;
|
|
185
|
-
fetchNextPage: (options?: import("@tanstack/react-query").FetchNextPageOptions) => Promise<import("@tanstack/react-query").InfiniteQueryObserverResult<import("@tanstack/react-query").InfiniteData<MediaCollectionResponse, unknown>, Error>>;
|
|
186
|
-
hasNextPage: boolean;
|
|
187
|
-
isFetchingNextPage: boolean;
|
|
188
|
-
isLoading: boolean;
|
|
189
|
-
groupedData: Record<string, MediaCollectionItem[]>;
|
|
190
|
-
dataFlatten: MediaCollectionItem[];
|
|
191
|
-
} | {
|
|
192
|
-
isError: false;
|
|
193
|
-
error: null;
|
|
194
|
-
isPending: false;
|
|
195
|
-
isLoadingError: false;
|
|
196
|
-
isRefetchError: false;
|
|
197
|
-
isSuccess: true;
|
|
198
|
-
isPlaceholderData: true;
|
|
199
|
-
isFetchNextPageError: false;
|
|
200
|
-
isFetchPreviousPageError: false;
|
|
201
|
-
status: "success";
|
|
202
|
-
fetchPreviousPage: (options?: import("@tanstack/react-query").FetchPreviousPageOptions) => Promise<import("@tanstack/react-query").InfiniteQueryObserverResult<import("@tanstack/react-query").InfiniteData<MediaCollectionResponse, unknown>, Error>>;
|
|
203
|
-
hasPreviousPage: boolean;
|
|
204
|
-
isFetchingPreviousPage: boolean;
|
|
205
|
-
dataUpdatedAt: number;
|
|
206
|
-
errorUpdatedAt: number;
|
|
207
|
-
failureCount: number;
|
|
208
|
-
failureReason: Error | null;
|
|
209
|
-
errorUpdateCount: number;
|
|
210
|
-
isFetched: boolean;
|
|
211
|
-
isFetchedAfterMount: boolean;
|
|
212
|
-
isFetching: boolean;
|
|
213
|
-
isInitialLoading: boolean;
|
|
214
|
-
isPaused: boolean;
|
|
215
|
-
isRefetching: boolean;
|
|
216
|
-
isStale: boolean;
|
|
217
|
-
isEnabled: boolean;
|
|
218
|
-
refetch: (options?: import("@tanstack/react-query").RefetchOptions) => Promise<import("@tanstack/react-query").QueryObserverResult<import("@tanstack/react-query").InfiniteData<MediaCollectionResponse, unknown>, Error>>;
|
|
219
|
-
fetchStatus: import("@tanstack/react-query").FetchStatus;
|
|
220
|
-
promise: Promise<import("@tanstack/react-query").InfiniteData<MediaCollectionResponse, unknown>>;
|
|
221
|
-
data: import("@tanstack/react-query").InfiniteData<MediaCollectionResponse, unknown> | undefined;
|
|
222
|
-
fetchNextPage: (options?: import("@tanstack/react-query").FetchNextPageOptions) => Promise<import("@tanstack/react-query").InfiniteQueryObserverResult<import("@tanstack/react-query").InfiniteData<MediaCollectionResponse, unknown>, Error>>;
|
|
223
|
-
hasNextPage: boolean;
|
|
224
|
-
isFetchingNextPage: boolean;
|
|
225
|
-
isLoading: boolean;
|
|
226
|
-
groupedData: Record<string, MediaCollectionItem[]>;
|
|
227
|
-
dataFlatten: MediaCollectionItem[];
|
|
228
|
-
};
|
|
229
|
-
//# sourceMappingURL=useMediaCollection.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"useMediaCollection.d.ts","sourceRoot":"","sources":["../../../src/hooks/collection/useMediaCollection.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,WAAW,EAAE,MAAM,yBAAyB,CAAC;AAGtD,OAAO,EACL,mBAAmB,EAEnB,uBAAuB,EACxB,MAAM,iBAAiB,CAAC;AAIzB,eAAO,MAAM,kBAAkB,GAAI,0BAGhC;IACD,MAAM,EAAE,MAAM,CAAC;IACf,WAAW,EAAE,WAAW,CAAC;CAC1B;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAkEA,CAAC"}
|
|
@@ -1,66 +0,0 @@
|
|
|
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 { useInfiniteQuery } from "@tanstack/react-query";
|
|
13
|
-
import { QUERY_KEYS } from "../../services/query";
|
|
14
|
-
import { apiInstance } from "../../services/api";
|
|
15
|
-
import { ENDPOINTS } from "../../services/routes";
|
|
16
|
-
import { useMemo } from "react";
|
|
17
|
-
import dayjs from "dayjs";
|
|
18
|
-
export const useMediaCollection = ({ recvID, contentType, }) => {
|
|
19
|
-
const _a = useInfiniteQuery({
|
|
20
|
-
initialPageParam: 1,
|
|
21
|
-
queryKey: [QUERY_KEYS.GET_IMAGE_COLLECTION, recvID, contentType],
|
|
22
|
-
queryFn: async ({ pageParam = 1 }) => {
|
|
23
|
-
const params = {
|
|
24
|
-
contentType,
|
|
25
|
-
recvID,
|
|
26
|
-
page: pageParam,
|
|
27
|
-
pageSize: 50,
|
|
28
|
-
};
|
|
29
|
-
const res = await apiInstance.post(ENDPOINTS.chatService.getMediaCollection, params);
|
|
30
|
-
return res.data;
|
|
31
|
-
},
|
|
32
|
-
getNextPageParam: (lastPage) => {
|
|
33
|
-
var _a, _b;
|
|
34
|
-
const currentPage = (_a = lastPage === null || lastPage === void 0 ? void 0 : lastPage.pageable) === null || _a === void 0 ? void 0 : _a.pageNumber;
|
|
35
|
-
const totalPages = (_b = lastPage === null || lastPage === void 0 ? void 0 : lastPage.pageable) === null || _b === void 0 ? void 0 : _b.totalPages;
|
|
36
|
-
return currentPage + 1 < totalPages ? currentPage + 1 : undefined;
|
|
37
|
-
},
|
|
38
|
-
enabled: !!recvID,
|
|
39
|
-
}), { data, fetchNextPage, hasNextPage, isFetchingNextPage, isLoading } = _a, rest = __rest(_a, ["data", "fetchNextPage", "hasNextPage", "isFetchingNextPage", "isLoading"]);
|
|
40
|
-
const { groupedData, dataFlatten } = useMemo(() => {
|
|
41
|
-
if (!data)
|
|
42
|
-
return {
|
|
43
|
-
groupedData: {},
|
|
44
|
-
dataFlatten: [],
|
|
45
|
-
};
|
|
46
|
-
const allItems = data.pages.flatMap((page) => page.data);
|
|
47
|
-
const mGroupeddata = allItems.reduce((acc, item) => {
|
|
48
|
-
const dateKey = dayjs(item.chatLog.sendTime).format("YYYY-MM-DD");
|
|
49
|
-
if (!acc[dateKey])
|
|
50
|
-
acc[dateKey] = [];
|
|
51
|
-
acc[dateKey].push(item);
|
|
52
|
-
return acc;
|
|
53
|
-
}, {});
|
|
54
|
-
return {
|
|
55
|
-
groupedData: mGroupeddata,
|
|
56
|
-
dataFlatten: allItems,
|
|
57
|
-
};
|
|
58
|
-
}, [data]);
|
|
59
|
-
return Object.assign({ data,
|
|
60
|
-
fetchNextPage,
|
|
61
|
-
hasNextPage,
|
|
62
|
-
isFetchingNextPage,
|
|
63
|
-
isLoading,
|
|
64
|
-
groupedData,
|
|
65
|
-
dataFlatten }, rest);
|
|
66
|
-
};
|
|
@@ -1,12 +0,0 @@
|
|
|
1
|
-
import { ConversationItem } from "@openim/wasm-client-sdk";
|
|
2
|
-
interface ConversationStore {
|
|
3
|
-
conversationData: ConversationItem | null;
|
|
4
|
-
setConversationData: (data: ConversationItem) => void;
|
|
5
|
-
selectedThreadId: string;
|
|
6
|
-
selectedSourceId: string;
|
|
7
|
-
setSelectedThreadId: (threadId: string) => void;
|
|
8
|
-
setSelectedSourceId: (sourceId: string) => void;
|
|
9
|
-
}
|
|
10
|
-
declare const useConversationStore: import("zustand").UseBoundStore<import("zustand").StoreApi<ConversationStore>>;
|
|
11
|
-
export default useConversationStore;
|
|
12
|
-
//# sourceMappingURL=useConversationStore.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"useConversationStore.d.ts","sourceRoot":"","sources":["../../../src/hooks/conversation/useConversationStore.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,gBAAgB,EAAE,MAAM,yBAAyB,CAAC;AAG3D,UAAU,iBAAiB;IACzB,gBAAgB,EAAE,gBAAgB,GAAG,IAAI,CAAC;IAC1C,mBAAmB,EAAE,CAAC,IAAI,EAAE,gBAAgB,KAAK,IAAI,CAAC;IACtD,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,oBAAoB,gFAOvB,CAAC;AAEJ,eAAe,oBAAoB,CAAC"}
|
|
@@ -1,10 +0,0 @@
|
|
|
1
|
-
import { create } from "zustand";
|
|
2
|
-
const useConversationStore = create((set) => ({
|
|
3
|
-
conversationData: null,
|
|
4
|
-
setConversationData: (data) => set({ conversationData: data }),
|
|
5
|
-
selectedThreadId: "",
|
|
6
|
-
setSelectedThreadId: (threadId) => set({ selectedThreadId: threadId }),
|
|
7
|
-
selectedSourceId: "",
|
|
8
|
-
setSelectedSourceId: (sourceId) => set({ selectedSourceId: sourceId }),
|
|
9
|
-
}));
|
|
10
|
-
export default useConversationStore;
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"useSearchConversation.d.ts","sourceRoot":"","sources":["../../../src/hooks/search/useSearchConversation.ts"],"names":[],"mappings":"AAAA,eAAO,MAAM,4BAA4B,YAAW,CAAC"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export const useSearchConversationAsUsers = () => { };
|