@droppii-org/chat-sdk 0.6.51 → 0.6.52
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/search-conversation/SearchAll.d.ts.map +1 -1
- package/dist/components/search-conversation/SearchAll.js +7 -9
- package/dist/components/search-conversation/SearchConversationAsGroups.d.ts.map +1 -1
- package/dist/components/search-conversation/SearchConversationAsGroups.js +3 -0
- package/dist/components/search-conversation/SearchConversationAsMessages.d.ts.map +1 -1
- package/dist/components/search-conversation/SearchConversationAsMessages.js +4 -1
- package/dist/components/search-conversation/SearchConversationAsUsers.d.ts.map +1 -1
- package/dist/components/search-conversation/SearchConversationAsUsers.js +4 -6
- package/dist/components/search-conversation/SearchScopeContext.d.ts +4 -0
- package/dist/components/search-conversation/SearchScopeContext.d.ts.map +1 -0
- package/dist/components/search-conversation/SearchScopeContext.js +5 -0
- package/dist/components/search-conversation/index.d.ts +5 -2
- package/dist/components/search-conversation/index.d.ts.map +1 -1
- package/dist/components/search-conversation/index.js +17 -12
- package/dist/components/search-conversation/item/SearchItemAsGroup.d.ts.map +1 -1
- package/dist/components/search-conversation/item/SearchItemAsGroup.js +9 -0
- package/dist/components/search-conversation/item/SearchItemAsMessage.d.ts +2 -0
- package/dist/components/search-conversation/item/SearchItemAsMessage.d.ts.map +1 -1
- package/dist/components/search-conversation/item/SearchItemAsMessage.js +28 -6
- package/dist/components/search-conversation/item/SearchItemAsUser.d.ts +2 -1
- package/dist/components/search-conversation/item/SearchItemAsUser.d.ts.map +1 -1
- package/dist/components/search-conversation/item/SearchItemAsUser.js +9 -2
- package/dist/hooks/message/useTypingStatus.d.ts.map +1 -1
- package/dist/hooks/message/useTypingStatus.js +1 -9
- package/dist/hooks/search/useOpenPdpSearchResult.d.ts +8 -0
- package/dist/hooks/search/useOpenPdpSearchResult.d.ts.map +1 -0
- package/dist/hooks/search/useOpenPdpSearchResult.js +31 -0
- package/dist/hooks/search/useSearchGroups.d.ts +3 -1
- package/dist/hooks/search/useSearchGroups.d.ts.map +1 -1
- package/dist/hooks/search/useSearchGroups.js +22 -11
- package/dist/hooks/search/useSearchMessage.d.ts +2 -0
- package/dist/hooks/search/useSearchMessage.d.ts.map +1 -1
- package/dist/hooks/search/useSearchMessage.js +10 -4
- package/dist/hooks/search/useSearchPdpTeamSessions.d.ts +17 -0
- package/dist/hooks/search/useSearchPdpTeamSessions.d.ts.map +1 -0
- package/dist/hooks/search/useSearchPdpTeamSessions.js +38 -0
- package/dist/hooks/search/useSearchUsers.d.ts +14 -0
- package/dist/hooks/search/useSearchUsers.d.ts.map +1 -0
- package/dist/hooks/search/useSearchUsers.js +23 -0
- package/dist/index.d.ts +3 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +3 -0
- package/dist/locales/vi/common.json +1 -0
- package/dist/services/query.d.ts +1 -0
- package/dist/services/query.d.ts.map +1 -1
- package/dist/services/query.js +1 -0
- package/dist/services/routes.d.ts +3 -0
- package/dist/services/routes.d.ts.map +1 -1
- package/dist/services/routes.js +3 -0
- package/dist/types/search.d.ts +2 -0
- package/dist/types/search.d.ts.map +1 -0
- package/dist/types/search.js +1 -0
- package/dist/utils/conversation.d.ts +2 -1
- package/dist/utils/conversation.d.ts.map +1 -1
- package/dist/utils/conversation.js +8 -1
- package/package.json +1 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"SearchAll.d.ts","sourceRoot":"","sources":["../../../src/components/search-conversation/SearchAll.tsx"],"names":[],"mappings":"AAWA,OAAO,EAAE,wBAAwB,EAAE,MAAM,GAAG,CAAC;
|
|
1
|
+
{"version":3,"file":"SearchAll.d.ts","sourceRoot":"","sources":["../../../src/components/search-conversation/SearchAll.tsx"],"names":[],"mappings":"AAWA,OAAO,EAAE,wBAAwB,EAAE,MAAM,GAAG,CAAC;AAI7C,UAAU,0BAA0B;IAClC,UAAU,EAAE,MAAM,CAAC;IACnB,YAAY,EAAE,CAAC,GAAG,EAAE,wBAAwB,KAAK,IAAI,CAAC;CACvD;AACD,QAAA,MAAM,qBAAqB,GAAI,+BAG5B,0BAA0B,4CAyJ5B,CAAC;AAEF,eAAe,qBAAqB,CAAC"}
|
|
@@ -6,30 +6,28 @@ import { useSearchMessage } from "../../hooks/search/useSearchMessage";
|
|
|
6
6
|
import { MessageType } from "@droppii-org/wasm-client-sdk";
|
|
7
7
|
import { Icon } from "../../components/icon";
|
|
8
8
|
import SearchItemAsMessage from "./item/SearchItemAsMessage";
|
|
9
|
-
import { useGetSession } from "../../hooks/session/useGetSession";
|
|
10
9
|
import SearchItemAsUser from "./item/SearchItemAsUser";
|
|
11
10
|
import SearchItemAsGroup from "./item/SearchItemAsGroup";
|
|
12
11
|
import { useSearchGroups } from "../../hooks/search/useSearchGroups";
|
|
12
|
+
import { useSearchUsers } from "../../hooks/search/useSearchUsers";
|
|
13
13
|
import { SearchConversationTabKey } from ".";
|
|
14
|
+
import { useSearchScope } from "./SearchScopeContext";
|
|
14
15
|
import { PAGE_SIZE } from "../../constants";
|
|
15
16
|
const SearchConversationAll = ({ searchTerm = "", setActiveKey, }) => {
|
|
16
17
|
const { t } = useTranslation();
|
|
18
|
+
const scope = useSearchScope();
|
|
17
19
|
const { dataFlatten: messages, isLoading: isLoadingMessage, hasNextPage: hasNextPageMessage, } = useSearchMessage({
|
|
18
20
|
payload: {
|
|
19
21
|
searchTerm: searchTerm.trim(),
|
|
20
22
|
contentType: MessageType.TextMessage,
|
|
21
23
|
},
|
|
22
|
-
options: { pageSize: PAGE_SIZE.xs },
|
|
23
|
-
});
|
|
24
|
-
const { dataFlatten: sessions, isLoading: isLoadingSession, hasNextPage: hasNextPageSession, } = useGetSession({
|
|
25
|
-
filter: {
|
|
26
|
-
searchTerm: searchTerm.trim(),
|
|
27
|
-
},
|
|
28
|
-
options: { pageSize: PAGE_SIZE.xs },
|
|
24
|
+
options: { pageSize: PAGE_SIZE.xs, scope },
|
|
29
25
|
});
|
|
26
|
+
const { dataFlatten: sessions, isLoading: isLoadingSession, hasNextPage: hasNextPageSession, } = useSearchUsers({ searchTerm, scope, pageSize: PAGE_SIZE.xs });
|
|
30
27
|
const { groups, isLoading: isLoadingGroup, hasNextPage: hasNextPageGroup, } = useSearchGroups({
|
|
31
28
|
searchTerm: searchTerm.trim(),
|
|
32
29
|
pageSize: PAGE_SIZE.xs,
|
|
30
|
+
scope,
|
|
33
31
|
});
|
|
34
32
|
if (searchTerm.trim() === "" ||
|
|
35
33
|
(messages.length === 0 && sessions.length === 0 && groups.length === 0)) {
|
|
@@ -38,6 +36,6 @@ const SearchConversationAll = ({ searchTerm = "", setActiveKey, }) => {
|
|
|
38
36
|
if (isLoadingMessage || isLoadingSession || isLoadingGroup) {
|
|
39
37
|
return (_jsx("div", { className: "h-full overflow-auto flex items-center justify-center", children: _jsx(Spin, {}) }));
|
|
40
38
|
}
|
|
41
|
-
return (_jsxs("div", { className: "h-full overflow-auto", "data-cp-name": "SearchConversationAll", children: [sessions.length > 0 && (_jsxs("div", { children: [_jsxs("div", { className: "flex items-center justify-between px-3 min-h-[32px]", children: [_jsx("span", { className: "text-xs font-medium uppercase flex-1 text-gray-600", children: t("users") }), _jsx(Button, { type: "link", icon: _jsx(Icon, { icon: "angle-right-o", size: 18, className: "!align-[-4px]" }), iconPosition: "end", className: clsx("p-0 gap-1", !hasNextPageSession && "invisible"), onClick: () => setActiveKey === null || setActiveKey === void 0 ? void 0 : setActiveKey(SearchConversationTabKey.Users), children: t("see_more") })] }), _jsx("div", { children: sessions.map((session) => (_jsx(SearchItemAsUser, { session: session, searchTerm: searchTerm }, session.conversationId))) })] })), messages.length > 0 && (_jsxs("div", { children: [_jsxs("div", { className: "flex items-center justify-between px-3 min-h-[32px]", children: [_jsx("span", { className: "text-xs font-medium uppercase flex-1 text-gray-600", children: t("messages") }), _jsx(Button, { type: "link", icon: _jsx(Icon, { icon: "angle-right-o", size: 18, className: "!align-[-4px]" }), iconPosition: "end", className: clsx("p-0 gap-1", !hasNextPageMessage && "invisible"), onClick: () => setActiveKey === null || setActiveKey === void 0 ? void 0 : setActiveKey(SearchConversationTabKey.Messages), children: t("see_more") })] }), _jsx("div", { children: messages.map((message) => (_jsx(SearchItemAsMessage, { message: message.chatLog, searchTerm: searchTerm, displayTag: message.displayTag }, message.chatLog.clientMsgID))) })] })), groups.length > 0 && (_jsxs("div", { children: [_jsxs("div", { className: "flex items-center justify-between px-3 min-h-[32px]", children: [_jsx("span", { className: "text-xs font-medium uppercase flex-1 text-gray-600", children: t("groups") }), _jsx(Button, { type: "link", icon: _jsx(Icon, { icon: "angle-right-o", size: 18, className: "!align-[-4px]" }), iconPosition: "end", className: clsx("p-0 gap-1", !hasNextPageGroup && "invisible"), onClick: () => setActiveKey === null || setActiveKey === void 0 ? void 0 : setActiveKey(SearchConversationTabKey.Groups), children: t("see_more") })] }), _jsx("div", { children: groups.map((group) => (_jsx(SearchItemAsGroup, { group: group, searchTerm: searchTerm }, group.conversationId))) })] }))] }));
|
|
39
|
+
return (_jsxs("div", { className: "h-full overflow-auto", "data-cp-name": "SearchConversationAll", children: [sessions.length > 0 && (_jsxs("div", { children: [_jsxs("div", { className: "flex items-center justify-between px-3 min-h-[32px]", children: [_jsx("span", { className: "text-xs font-medium uppercase flex-1 text-gray-600", children: t("users") }), _jsx(Button, { type: "link", icon: _jsx(Icon, { icon: "angle-right-o", size: 18, className: "!align-[-4px]" }), iconPosition: "end", className: clsx("p-0 gap-1", !hasNextPageSession && "invisible"), onClick: () => setActiveKey === null || setActiveKey === void 0 ? void 0 : setActiveKey(SearchConversationTabKey.Users), children: t("see_more") })] }), _jsx("div", { children: sessions.map((session) => (_jsx(SearchItemAsUser, { session: session, searchTerm: searchTerm }, session.conversationId))) })] })), messages.length > 0 && (_jsxs("div", { children: [_jsxs("div", { className: "flex items-center justify-between px-3 min-h-[32px]", children: [_jsx("span", { className: "text-xs font-medium uppercase flex-1 text-gray-600", children: t("messages") }), _jsx(Button, { type: "link", icon: _jsx(Icon, { icon: "angle-right-o", size: 18, className: "!align-[-4px]" }), iconPosition: "end", className: clsx("p-0 gap-1", !hasNextPageMessage && "invisible"), onClick: () => setActiveKey === null || setActiveKey === void 0 ? void 0 : setActiveKey(SearchConversationTabKey.Messages), children: t("see_more") })] }), _jsx("div", { children: messages.map((message) => (_jsx(SearchItemAsMessage, { message: message.chatLog, searchTerm: searchTerm, displayTag: message.displayTag, tag: message.tag }, message.chatLog.clientMsgID))) })] })), groups.length > 0 && (_jsxs("div", { children: [_jsxs("div", { className: "flex items-center justify-between px-3 min-h-[32px]", children: [_jsx("span", { className: "text-xs font-medium uppercase flex-1 text-gray-600", children: t("groups") }), _jsx(Button, { type: "link", icon: _jsx(Icon, { icon: "angle-right-o", size: 18, className: "!align-[-4px]" }), iconPosition: "end", className: clsx("p-0 gap-1", !hasNextPageGroup && "invisible"), onClick: () => setActiveKey === null || setActiveKey === void 0 ? void 0 : setActiveKey(SearchConversationTabKey.Groups), children: t("see_more") })] }), _jsx("div", { children: groups.map((group) => (_jsx(SearchItemAsGroup, { group: group, searchTerm: searchTerm }, group.conversationId))) })] }))] }));
|
|
42
40
|
};
|
|
43
41
|
export default SearchConversationAll;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"SearchConversationAsGroups.d.ts","sourceRoot":"","sources":["../../../src/components/search-conversation/SearchConversationAsGroups.tsx"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"SearchConversationAsGroups.d.ts","sourceRoot":"","sources":["../../../src/components/search-conversation/SearchConversationAsGroups.tsx"],"names":[],"mappings":"AASA,UAAU,+BAA+B;IACvC,UAAU,EAAE,MAAM,CAAC;CACpB;AACD,QAAA,MAAM,0BAA0B,GAAI,OAAO,+BAA+B,4CA4CzE,CAAC;AAEF,eAAe,0BAA0B,CAAC"}
|
|
@@ -5,11 +5,14 @@ import { useTranslation } from "react-i18next";
|
|
|
5
5
|
import InfiniteScroll from "react-infinite-scroll-component";
|
|
6
6
|
import SearchItemAsGroup from "./item/SearchItemAsGroup";
|
|
7
7
|
import { useSearchGroups } from "../../hooks/search/useSearchGroups";
|
|
8
|
+
import { useSearchScope } from "./SearchScopeContext";
|
|
8
9
|
const SearchConversationAsGroups = (props) => {
|
|
9
10
|
const { searchTerm = "" } = props;
|
|
10
11
|
const { t } = useTranslation();
|
|
12
|
+
const scope = useSearchScope();
|
|
11
13
|
const { groups, hasNextPage, fetchNextPage, isLoading } = useSearchGroups({
|
|
12
14
|
searchTerm,
|
|
15
|
+
scope,
|
|
13
16
|
});
|
|
14
17
|
if ((groups.length === 0 && !isLoading) || searchTerm.trim() === "")
|
|
15
18
|
return _jsx(Empty, { description: t("no_conversation") });
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"SearchConversationAsMessages.d.ts","sourceRoot":"","sources":["../../../src/components/search-conversation/SearchConversationAsMessages.tsx"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"SearchConversationAsMessages.d.ts","sourceRoot":"","sources":["../../../src/components/search-conversation/SearchConversationAsMessages.tsx"],"names":[],"mappings":"AAQA,UAAU,iCAAiC;IACzC,UAAU,EAAE,MAAM,CAAC;CACpB;AACD,QAAA,MAAM,4BAA4B,GAChC,OAAO,iCAAiC,4CAmDzC,CAAC;AAEF,eAAe,4BAA4B,CAAC"}
|
|
@@ -5,19 +5,22 @@ import { useSearchMessage } from "../../hooks/search/useSearchMessage";
|
|
|
5
5
|
import { MessageType } from "@droppii-org/wasm-client-sdk";
|
|
6
6
|
import InfiniteScroll from "react-infinite-scroll-component";
|
|
7
7
|
import SearchItemAsMessage from "./item/SearchItemAsMessage";
|
|
8
|
+
import { useSearchScope } from "./SearchScopeContext";
|
|
8
9
|
const SearchConversationAsMessages = (props) => {
|
|
9
10
|
const { searchTerm = "" } = props;
|
|
10
11
|
const { t } = useTranslation();
|
|
12
|
+
const scope = useSearchScope();
|
|
11
13
|
const { dataFlatten, hasNextPage, fetchNextPage, isLoading } = useSearchMessage({
|
|
12
14
|
payload: {
|
|
13
15
|
searchTerm: searchTerm.trim(),
|
|
14
16
|
contentType: MessageType.TextMessage,
|
|
15
17
|
},
|
|
18
|
+
options: { scope },
|
|
16
19
|
});
|
|
17
20
|
if ((dataFlatten.length === 0 && !isLoading) || searchTerm.trim() === "")
|
|
18
21
|
return _jsx(Empty, { description: t("no_conversation") });
|
|
19
22
|
if (isLoading)
|
|
20
23
|
return (_jsx("div", { className: "flex items-center justify-center", children: _jsx(Spin, {}) }));
|
|
21
|
-
return (_jsx("div", { id: "scrollableSearchMessagesTab", className: "h-full overflow-auto", "data-cp-name": "SearchConversationAsMessages", children: _jsx(InfiniteScroll, { dataLength: dataFlatten.length, next: fetchNextPage, hasMore: hasNextPage, loader: _jsx("div", { className: "flex items-center justify-center py-2", children: _jsx(Spin, {}) }), scrollableTarget: "scrollableSearchMessagesTab", children: dataFlatten.map((item) => (_jsx(SearchItemAsMessage, { message: item.chatLog, searchTerm: searchTerm, displayTag: item.displayTag }, item.chatLog.clientMsgID))) }) }));
|
|
24
|
+
return (_jsx("div", { id: "scrollableSearchMessagesTab", className: "h-full overflow-auto", "data-cp-name": "SearchConversationAsMessages", children: _jsx(InfiniteScroll, { dataLength: dataFlatten.length, next: fetchNextPage, hasMore: hasNextPage, loader: _jsx("div", { className: "flex items-center justify-center py-2", children: _jsx(Spin, {}) }), scrollableTarget: "scrollableSearchMessagesTab", children: dataFlatten.map((item) => (_jsx(SearchItemAsMessage, { message: item.chatLog, searchTerm: searchTerm, displayTag: item.displayTag, tag: item.tag }, item.chatLog.clientMsgID))) }) }));
|
|
22
25
|
};
|
|
23
26
|
export default SearchConversationAsMessages;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"SearchConversationAsUsers.d.ts","sourceRoot":"","sources":["../../../src/components/search-conversation/SearchConversationAsUsers.tsx"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"SearchConversationAsUsers.d.ts","sourceRoot":"","sources":["../../../src/components/search-conversation/SearchConversationAsUsers.tsx"],"names":[],"mappings":"AAOA,UAAU,8BAA8B;IACtC,UAAU,EAAE,MAAM,CAAC;CACpB;AACD,QAAA,MAAM,yBAAyB,GAAI,OAAO,8BAA8B,4CA0CvE,CAAC;AAEF,eAAe,yBAAyB,CAAC"}
|
|
@@ -3,15 +3,13 @@ import { Empty, Spin } from "antd";
|
|
|
3
3
|
import { useTranslation } from "react-i18next";
|
|
4
4
|
import InfiniteScroll from "react-infinite-scroll-component";
|
|
5
5
|
import SearchItemAsUser from "./item/SearchItemAsUser";
|
|
6
|
-
import {
|
|
6
|
+
import { useSearchUsers } from "../../hooks/search/useSearchUsers";
|
|
7
|
+
import { useSearchScope } from "./SearchScopeContext";
|
|
7
8
|
const SearchConversationAsUsers = (props) => {
|
|
8
9
|
const { searchTerm = "" } = props;
|
|
9
10
|
const { t } = useTranslation();
|
|
10
|
-
const
|
|
11
|
-
|
|
12
|
-
searchTerm: searchTerm.trim(),
|
|
13
|
-
},
|
|
14
|
-
});
|
|
11
|
+
const scope = useSearchScope();
|
|
12
|
+
const { dataFlatten, hasNextPage, fetchNextPage, isLoading } = useSearchUsers({ searchTerm, scope });
|
|
15
13
|
if ((dataFlatten.length === 0 && !isLoading) || searchTerm.trim() === "")
|
|
16
14
|
return _jsx(Empty, { description: t("no_conversation") });
|
|
17
15
|
if (isLoading)
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"SearchScopeContext.d.ts","sourceRoot":"","sources":["../../../src/components/search-conversation/SearchScopeContext.tsx"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,gBAAgB,CAAC;AAIlD,eAAO,MAAM,mBAAmB,uCAA8B,CAAC;AAE/D,eAAO,MAAM,cAAc,mBAAuC,CAAC"}
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import type { SearchScope } from "../../types/search";
|
|
1
2
|
export declare enum SearchConversationTabKey {
|
|
2
3
|
All = "all",
|
|
3
4
|
MyInbox = "myInbox",
|
|
@@ -5,9 +6,11 @@ export declare enum SearchConversationTabKey {
|
|
|
5
6
|
Messages = "messages",
|
|
6
7
|
Groups = "groups"
|
|
7
8
|
}
|
|
8
|
-
interface SearchConversationProps {
|
|
9
|
+
export interface SearchConversationProps {
|
|
9
10
|
searchTerm: string;
|
|
11
|
+
/** Data sources + result navigation. Defaults to the CRM desk behavior. */
|
|
12
|
+
scope?: SearchScope;
|
|
10
13
|
}
|
|
11
|
-
declare const SearchConversation: ({ searchTerm }: SearchConversationProps) => import("react/jsx-runtime").JSX.Element;
|
|
14
|
+
declare const SearchConversation: ({ searchTerm, scope, }: SearchConversationProps) => import("react/jsx-runtime").JSX.Element;
|
|
12
15
|
export default SearchConversation;
|
|
13
16
|
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/components/search-conversation/index.tsx"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/components/search-conversation/index.tsx"],"names":[],"mappings":"AAUA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,gBAAgB,CAAC;AAGlD,oBAAY,wBAAwB;IAClC,GAAG,QAAQ;IACX,OAAO,YAAY;IACnB,KAAK,UAAU;IACf,QAAQ,aAAa;IACrB,MAAM,WAAW;CAClB;AAED,MAAM,WAAW,uBAAuB;IACtC,UAAU,EAAE,MAAM,CAAC;IACnB,2EAA2E;IAC3E,KAAK,CAAC,EAAE,WAAW,CAAC;CACrB;AACD,QAAA,MAAM,kBAAkB,GAAI,wBAGzB,uBAAuB,4CAkFzB,CAAC;AAEF,eAAe,kBAAkB,CAAC"}
|
|
@@ -8,6 +8,7 @@ import SearchConversationMyInbox from "./SearchConversationMyInbox";
|
|
|
8
8
|
import SearchConversationAsUsers from "./SearchConversationAsUsers";
|
|
9
9
|
import SearchConversationAsMessages from "./SearchConversationAsMessages";
|
|
10
10
|
import SearchConversationAsGroups from "./SearchConversationAsGroups";
|
|
11
|
+
import { SearchScopeProvider } from "./SearchScopeContext";
|
|
11
12
|
export var SearchConversationTabKey;
|
|
12
13
|
(function (SearchConversationTabKey) {
|
|
13
14
|
SearchConversationTabKey["All"] = "all";
|
|
@@ -16,11 +17,11 @@ export var SearchConversationTabKey;
|
|
|
16
17
|
SearchConversationTabKey["Messages"] = "messages";
|
|
17
18
|
SearchConversationTabKey["Groups"] = "groups";
|
|
18
19
|
})(SearchConversationTabKey || (SearchConversationTabKey = {}));
|
|
19
|
-
const SearchConversation = ({ searchTerm }) => {
|
|
20
|
+
const SearchConversation = ({ searchTerm, scope = "crm", }) => {
|
|
20
21
|
const { t } = useTranslation();
|
|
21
22
|
const [activeKey, setActiveKey] = useState(SearchConversationTabKey.All);
|
|
22
23
|
const items = useMemo(() => {
|
|
23
|
-
|
|
24
|
+
const allItems = [
|
|
24
25
|
{
|
|
25
26
|
key: SearchConversationTabKey.All,
|
|
26
27
|
label: t("all"),
|
|
@@ -47,7 +48,11 @@ const SearchConversation = ({ searchTerm }) => {
|
|
|
47
48
|
children: _jsx(SearchConversationAsGroups, { searchTerm: searchTerm }),
|
|
48
49
|
},
|
|
49
50
|
];
|
|
50
|
-
|
|
51
|
+
// PDP spec: the source inbox is never a search category.
|
|
52
|
+
return scope === "pdp-portal"
|
|
53
|
+
? allItems.filter((item) => item.key !== SearchConversationTabKey.MyInbox)
|
|
54
|
+
: allItems;
|
|
55
|
+
}, [t, searchTerm, scope]);
|
|
51
56
|
// Clicking a result row while on "All" switches activeKey without any
|
|
52
57
|
// click/focus on the tab header itself — antd's own scroll-into-view for
|
|
53
58
|
// that path relies on measuring .ant-tabs-nav against its scroll parent,
|
|
@@ -58,14 +63,14 @@ const SearchConversation = ({ searchTerm }) => {
|
|
|
58
63
|
(_a = document
|
|
59
64
|
.querySelector('[data-cp-name="SearchConversation"] .ant-tabs-tab-active')) === null || _a === void 0 ? void 0 : _a.scrollIntoView({ inline: "nearest", block: "nearest" });
|
|
60
65
|
}, [activeKey]);
|
|
61
|
-
return (_jsx("div", { className: "h-full", "data-cp-name": "SearchConversation", children: _jsx(Tabs, { defaultActiveKey: SearchConversationTabKey.All, items: items, className: "h-full", activeKey: activeKey, onChange: (key) => setActiveKey(key), destroyOnHidden: true,
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
66
|
+
return (_jsx(SearchScopeProvider, { value: scope, children: _jsx("div", { className: "h-full", "data-cp-name": "SearchConversation", children: _jsx(Tabs, { defaultActiveKey: SearchConversationTabKey.All, items: items, className: "h-full", activeKey: activeKey, onChange: (key) => setActiveKey(key), destroyOnHidden: true,
|
|
67
|
+
// Ant's built-in tab-overflow ("...") dropdown never recovers from
|
|
68
|
+
// its initial off-screen measurement inside this Drawer (rendered
|
|
69
|
+
// with getContainer={false} for unrelated scroll-position reasons —
|
|
70
|
+
// see DeskConversationList) — the last tab (Nhóm) becomes
|
|
71
|
+
// permanently unreachable. A plain horizontally-scrollable strip
|
|
72
|
+
// sidesteps that positioning bug entirely: every tab stays a real,
|
|
73
|
+
// always-clickable element: no hidden dropdown involved.
|
|
74
|
+
renderTabBar: (tabBarProps, DefaultTabBar) => (_jsx("div", { className: "overflow-x-auto", children: _jsx(DefaultTabBar, Object.assign({}, tabBarProps, { className: "!w-max" })) })) }) }) }));
|
|
70
75
|
};
|
|
71
76
|
export default SearchConversation;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"SearchItemAsGroup.d.ts","sourceRoot":"","sources":["../../../../src/components/search-conversation/item/SearchItemAsGroup.tsx"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,4BAA4B,EAAE,MAAM,qCAAqC,CAAC;
|
|
1
|
+
{"version":3,"file":"SearchItemAsGroup.d.ts","sourceRoot":"","sources":["../../../../src/components/search-conversation/item/SearchItemAsGroup.tsx"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,4BAA4B,EAAE,MAAM,qCAAqC,CAAC;AASxF,UAAU,sBAAsB;IAC9B,KAAK,EAAE,4BAA4B,CAAC;IACpC,UAAU,EAAE,MAAM,CAAC;CACpB;AAED,QAAA,MAAM,iBAAiB,GAAI,OAAO,sBAAsB,4CAwEvD,CAAC;AAEF,eAAe,iBAAiB,CAAC"}
|
|
@@ -7,15 +7,24 @@ import { useChatNavigate } from "../../../hooks/conversation/useChatNavigate";
|
|
|
7
7
|
import { highlightSearch, sanitizeHtml } from "../../../utils/common";
|
|
8
8
|
import { Icon } from "../../../components/icon";
|
|
9
9
|
import GroupCompositeAvatar from "../../../components/group/GroupCompositeAvatar";
|
|
10
|
+
import { useOpenPdpSearchResult } from "../../../hooks/search/useOpenPdpSearchResult";
|
|
11
|
+
import { useSearchScope } from "../SearchScopeContext";
|
|
10
12
|
const SearchItemAsGroup = (props) => {
|
|
11
13
|
const { group, searchTerm = "" } = props;
|
|
12
14
|
const { t } = useTranslation();
|
|
13
15
|
const onNavigate = useChatNavigate();
|
|
16
|
+
const scope = useSearchScope();
|
|
17
|
+
const openPdpResult = useOpenPdpSearchResult();
|
|
14
18
|
const setConversationData = useConversationStore((state) => state.setConversationData);
|
|
15
19
|
const setSelectedConversationId = useConversationStore((state) => state.setSelectedConversationId);
|
|
16
20
|
const { conversation } = group;
|
|
17
21
|
const isPublic = group.visibility === GroupVisibility.Public;
|
|
18
22
|
const onPressItem = () => {
|
|
23
|
+
// PDP's inbox opens real groups by ?groupId, same as its group list.
|
|
24
|
+
if (scope === "pdp-portal") {
|
|
25
|
+
openPdpResult({ groupId: group.groupId });
|
|
26
|
+
return;
|
|
27
|
+
}
|
|
19
28
|
// Result can go stale before the click — force a fresh membership check.
|
|
20
29
|
setConversationData(conversation, undefined, { forceRevalidate: true });
|
|
21
30
|
setSelectedConversationId(conversation.conversationID);
|
|
@@ -5,6 +5,8 @@ interface SearchItemAsMessageProps {
|
|
|
5
5
|
};
|
|
6
6
|
searchTerm: string;
|
|
7
7
|
displayTag?: string;
|
|
8
|
+
/** BE source tag (MY_INBOX | CS_TEAM); only PDP Portal renders from it. */
|
|
9
|
+
tag?: string;
|
|
8
10
|
onClick?: () => void;
|
|
9
11
|
}
|
|
10
12
|
declare const SearchItemAsMessage: (props: SearchItemAsMessageProps) => import("react/jsx-runtime").JSX.Element;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"SearchItemAsMessage.d.ts","sourceRoot":"","sources":["../../../../src/components/search-conversation/item/SearchItemAsMessage.tsx"],"names":[],"mappings":"AACA,OAAO,EAAE,WAAW,EAA4B,MAAM,8BAA8B,CAAC;
|
|
1
|
+
{"version":3,"file":"SearchItemAsMessage.d.ts","sourceRoot":"","sources":["../../../../src/components/search-conversation/item/SearchItemAsMessage.tsx"],"names":[],"mappings":"AACA,OAAO,EAAE,WAAW,EAA4B,MAAM,8BAA8B,CAAC;AAwBrF,UAAU,wBAAwB;IAChC,OAAO,EAAE,WAAW,GAAG;QAAE,SAAS,CAAC,EAAE,OAAO,CAAA;KAAE,CAAC;IAC/C,UAAU,EAAE,MAAM,CAAC;IACnB,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,2EAA2E;IAC3E,GAAG,CAAC,EAAE,MAAM,CAAC;IACb,OAAO,CAAC,EAAE,MAAM,IAAI,CAAC;CACtB;AAED,QAAA,MAAM,mBAAmB,GAAI,OAAO,wBAAwB,4CAyH3D,CAAC;AAEF,eAAe,mBAAmB,CAAC"}
|
|
@@ -10,19 +10,41 @@ import { useTranslation } from "react-i18next";
|
|
|
10
10
|
import useConversationStore from "../../../store/conversation";
|
|
11
11
|
import { useMemo } from "react";
|
|
12
12
|
import useAuthStore from "../../../store/auth";
|
|
13
|
+
import { getConversationIdFromMessage } from "../../../utils/conversation";
|
|
14
|
+
import { useOpenPdpSearchResult } from "../../../hooks/search/useOpenPdpSearchResult";
|
|
15
|
+
import { useSearchScope } from "../SearchScopeContext";
|
|
16
|
+
// PDP labels the source by its inbox tab; BE's displayTag carries the CS team name.
|
|
17
|
+
const PDP_TAG_LABEL_KEYS = {
|
|
18
|
+
MY_INBOX: "my_messages",
|
|
19
|
+
CS_TEAM: "pdp_team_inbox_tag",
|
|
20
|
+
};
|
|
13
21
|
const SearchItemAsMessage = (props) => {
|
|
14
|
-
var _a;
|
|
22
|
+
var _a, _b;
|
|
15
23
|
const { t } = useTranslation();
|
|
16
|
-
const { message, searchTerm = "", displayTag, onClick } = props;
|
|
24
|
+
const { message, searchTerm = "", displayTag, tag, onClick } = props;
|
|
17
25
|
const { user } = useChatContext();
|
|
18
26
|
const isCrm = useAuthStore((state) => state.isCrm);
|
|
27
|
+
const scope = useSearchScope();
|
|
28
|
+
const isPdpPortal = scope === "pdp-portal";
|
|
29
|
+
const openPdpResult = useOpenPdpSearchResult();
|
|
19
30
|
const conversationData = useConversationStore((state) => state.conversationData);
|
|
20
31
|
const useConversationDisplay = useMemo(() => {
|
|
21
|
-
|
|
32
|
+
// PDP results span many threads, so show the sender like CRM does.
|
|
33
|
+
if (isCrm || isPdpPortal)
|
|
22
34
|
return true;
|
|
23
35
|
return (user === null || user === void 0 ? void 0 : user.userID) === (message === null || message === void 0 ? void 0 : message.sendID);
|
|
24
|
-
}, [conversationData === null || conversationData === void 0 ? void 0 : conversationData.ex, message === null || message === void 0 ? void 0 : message.sendID, isCrm]);
|
|
36
|
+
}, [conversationData === null || conversationData === void 0 ? void 0 : conversationData.ex, message === null || message === void 0 ? void 0 : message.sendID, isCrm, isPdpPortal]);
|
|
37
|
+
const tagLabel = isPdpPortal
|
|
38
|
+
? tag && PDP_TAG_LABEL_KEYS[tag] && t(PDP_TAG_LABEL_KEYS[tag])
|
|
39
|
+
: displayTag;
|
|
25
40
|
const onPressItem = async () => {
|
|
41
|
+
if (isPdpPortal) {
|
|
42
|
+
openPdpResult({
|
|
43
|
+
threadId: getConversationIdFromMessage(message),
|
|
44
|
+
messageId: message.clientMsgID,
|
|
45
|
+
});
|
|
46
|
+
return;
|
|
47
|
+
}
|
|
26
48
|
const { data } = await DChatSDK.getOneConversation({
|
|
27
49
|
sourceID: message.sessionType === SessionType.Group
|
|
28
50
|
? message.groupID
|
|
@@ -63,13 +85,13 @@ const SearchItemAsMessage = (props) => {
|
|
|
63
85
|
: conversationData === null || conversationData === void 0 ? void 0 : conversationData.faceURL, alt: useConversationDisplay
|
|
64
86
|
? message.senderNickname
|
|
65
87
|
: conversationData === null || conversationData === void 0 ? void 0 : conversationData.showName, children: useConversationDisplay
|
|
66
|
-
? message.senderNickname.charAt(0).toUpperCase()
|
|
88
|
+
? (_b = message.senderNickname) === null || _b === void 0 ? void 0 : _b.charAt(0).toUpperCase()
|
|
67
89
|
: conversationData === null || conversationData === void 0 ? void 0 : conversationData.showName.charAt(0).toUpperCase() }) }), _jsxs("div", { className: "flex flex-col flex-1 min-w-0 gap-1", children: [_jsxs("div", { className: "flex flex-1 items-center justify-between", children: [_jsx("span", { className: "text-sm flex-1 font-semibold truncate", children: useConversationDisplay
|
|
68
90
|
? message.senderNickname
|
|
69
91
|
: conversationData === null || conversationData === void 0 ? void 0 : conversationData.showName }), _jsx("span", { className: "text-xs text-gray-500", children: formatTimestamp(message.sendTime, {
|
|
70
92
|
hasTime: true,
|
|
71
93
|
}) })] }), _jsxs("div", { className: "flex flex-col flex-1 min-w-0 gap-1", children: [_jsx("span", { className: "text-xs flex-1 text-gray-500 truncate", dangerouslySetInnerHTML: {
|
|
72
94
|
__html: sanitizeHtml(highlightSearch(msgContent, searchTerm)),
|
|
73
|
-
} }),
|
|
95
|
+
} }), tagLabel && (_jsx("span", { className: "text-[10px] text-[var(--dc-color-primary)] bg-[var(--dc-color-primary-light)] px-1.5 py-0.5 rounded w-fit truncate", children: tagLabel }))] })] })] }, message.clientMsgID));
|
|
74
96
|
};
|
|
75
97
|
export default SearchItemAsMessage;
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { ISessionByStatus } from "../../../store/type";
|
|
2
|
+
import type { PdpTeamSessionItem } from "../../../hooks/search/useSearchPdpTeamSessions";
|
|
2
3
|
interface SearchItemAsUserProps {
|
|
3
|
-
session: ISessionByStatus
|
|
4
|
+
session: PdpTeamSessionItem & Partial<Pick<ISessionByStatus, "conversation">>;
|
|
4
5
|
searchTerm: string;
|
|
5
6
|
}
|
|
6
7
|
declare const SearchItemAsUser: (props: SearchItemAsUserProps) => import("react/jsx-runtime").JSX.Element;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"SearchItemAsUser.d.ts","sourceRoot":"","sources":["../../../../src/components/search-conversation/item/SearchItemAsUser.tsx"],"names":[],"mappings":"AAEA,OAAO,EAAE,gBAAgB,EAAE,MAAM,cAAc,CAAC;
|
|
1
|
+
{"version":3,"file":"SearchItemAsUser.d.ts","sourceRoot":"","sources":["../../../../src/components/search-conversation/item/SearchItemAsUser.tsx"],"names":[],"mappings":"AAEA,OAAO,EAAE,gBAAgB,EAAE,MAAM,cAAc,CAAC;AAIhD,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,yCAAyC,CAAC;AAIlF,UAAU,qBAAqB;IAE7B,OAAO,EAAE,kBAAkB,GAAG,OAAO,CAAC,IAAI,CAAC,gBAAgB,EAAE,cAAc,CAAC,CAAC,CAAC;IAC9E,UAAU,EAAE,MAAM,CAAC;CACpB;AAED,QAAA,MAAM,gBAAgB,GAAI,OAAO,qBAAqB,4CA+CrD,CAAC;AAEF,eAAe,gBAAgB,CAAC"}
|
|
@@ -4,12 +4,19 @@ import { Avatar, message } from "antd";
|
|
|
4
4
|
import { highlightSearch, sanitizeHtml } from "../../../utils/common";
|
|
5
5
|
import useConversationStore from "../../../store/conversation";
|
|
6
6
|
import { useTranslation } from "react-i18next";
|
|
7
|
+
import { useOpenPdpSearchResult } from "../../../hooks/search/useOpenPdpSearchResult";
|
|
8
|
+
import { useSearchScope } from "../SearchScopeContext";
|
|
7
9
|
const SearchItemAsUser = (props) => {
|
|
8
|
-
var _a, _b, _c, _d, _e, _f;
|
|
10
|
+
var _a, _b, _c, _d, _e, _f, _g;
|
|
9
11
|
const { session, searchTerm = "" } = props;
|
|
10
12
|
const { t } = useTranslation();
|
|
13
|
+
const scope = useSearchScope();
|
|
14
|
+
const openPdpResult = useOpenPdpSearchResult();
|
|
11
15
|
const ownerName = `${(_a = session.owner) === null || _a === void 0 ? void 0 : _a.fullName}${((_b = session.owner) === null || _b === void 0 ? void 0 : _b.username) ? ` (${(_c = session.owner) === null || _c === void 0 ? void 0 : _c.username})` : ""}`;
|
|
12
16
|
const onPressItem = async () => {
|
|
17
|
+
if (scope === "pdp-portal") {
|
|
18
|
+
return openPdpResult({ threadId: session.conversationId });
|
|
19
|
+
}
|
|
13
20
|
if (!(session === null || session === void 0 ? void 0 : session.conversation)) {
|
|
14
21
|
return message.error(t("err_get_conversation"));
|
|
15
22
|
}
|
|
@@ -18,7 +25,7 @@ const SearchItemAsUser = (props) => {
|
|
|
18
25
|
.getState()
|
|
19
26
|
.setSelectedConversationId(session.conversationId);
|
|
20
27
|
};
|
|
21
|
-
return (_jsxs("div", { className: "py-3 px-2 flex items-center gap-3 hover:bg-gray-100 hover:rounded-sm cursor-pointer border-b mx-1", onClick: onPressItem, "data-cp-name": "SearchItemAsUser", children: [_jsx(Avatar, { size: "large", src: (_d = session.owner) === null || _d === void 0 ? void 0 : _d.avatar, alt: (_e = session.owner) === null || _e === void 0 ? void 0 : _e.username, children: (_f = session.owner) === null || _f === void 0 ? void 0 : _f.fullName.charAt(0).toUpperCase() }), _jsx("div", { className: "flex flex-col flex-1 min-w-0", children: _jsx("p", { className: "text-sm font-semibold truncate", dangerouslySetInnerHTML: {
|
|
28
|
+
return (_jsxs("div", { className: "py-3 px-2 flex items-center gap-3 hover:bg-gray-100 hover:rounded-sm cursor-pointer border-b mx-1", onClick: onPressItem, "data-cp-name": "SearchItemAsUser", children: [_jsx(Avatar, { size: "large", src: (_d = session.owner) === null || _d === void 0 ? void 0 : _d.avatar, alt: (_e = session.owner) === null || _e === void 0 ? void 0 : _e.username, children: (_g = (_f = session.owner) === null || _f === void 0 ? void 0 : _f.fullName) === null || _g === void 0 ? void 0 : _g.charAt(0).toUpperCase() }), _jsx("div", { className: "flex flex-col flex-1 min-w-0", children: _jsx("p", { className: "text-sm font-semibold truncate", dangerouslySetInnerHTML: {
|
|
22
29
|
__html: sanitizeHtml(highlightSearch(ownerName, searchTerm)),
|
|
23
30
|
} }) })] }, session.id));
|
|
24
31
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"useTypingStatus.d.ts","sourceRoot":"","sources":["../../../src/hooks/message/useTypingStatus.ts"],"names":[],"mappings":"AAEA,OAAO,EACL,uBAAuB,EACvB,WAAW,
|
|
1
|
+
{"version":3,"file":"useTypingStatus.d.ts","sourceRoot":"","sources":["../../../src/hooks/message/useTypingStatus.ts"],"names":[],"mappings":"AAEA,OAAO,EACL,uBAAuB,EACvB,WAAW,EACZ,MAAM,8BAA8B,CAAC;AA0BtC,eAAO,MAAM,iBAAiB,GAAI,MAAM,MAAM,WAK7C,CAAC;AAqDF,eAAO,MAAM,wBAAwB,GACnC,SAAS,uBAAuB,GAAG,MAAM,SA0B1C,CAAC;AAEF,wEAAwE;AACxE,eAAO,MAAM,uBAAuB,GAAI,SAAS,WAAW,SAK3D,CAAC;AAEF,MAAM,WAAW,WAAW;IAC1B,mFAAmF;IACnF,KAAK,EAAE,MAAM,EAAE,CAAC;IAChB,KAAK,EAAE,MAAM,CAAC;CACf;AAED,eAAO,MAAM,cAAc,GAAI,iBAAiB,MAAM,KAAG,WAoBxD,CAAC"}
|
|
@@ -1,11 +1,10 @@
|
|
|
1
1
|
import { useTranslation } from "react-i18next";
|
|
2
2
|
import { useShallow } from "zustand/react/shallow";
|
|
3
|
-
import { SessionType, } from "@droppii-org/wasm-client-sdk";
|
|
4
3
|
import { DChatSDK } from "../../constants/sdk";
|
|
5
4
|
import useAuthStore from "../../store/auth";
|
|
6
5
|
import useConversationStore from "../../store/conversation";
|
|
7
6
|
import useTypingStore from "../../store/typing";
|
|
8
|
-
import { getGroupIdFromConversationId } from "../../utils/conversation";
|
|
7
|
+
import { getConversationIdFromMessage, getGroupIdFromConversationId, } from "../../utils/conversation";
|
|
9
8
|
// One typer is named; from two on the text drops names ("Nhiều người đang nhập").
|
|
10
9
|
const MAX_NAMED_TYPERS = 1;
|
|
11
10
|
// Longer names are cut to this many characters and end with "...".
|
|
@@ -97,13 +96,6 @@ export const handleInputStatusChanged = (payload) => {
|
|
|
97
96
|
useTypingStore.getState().removeTyper(conversationID, userID);
|
|
98
97
|
}
|
|
99
98
|
};
|
|
100
|
-
// Mirrors OpenIM's conversationID scheme: si_<sorted user ids> / sg_<groupID>.
|
|
101
|
-
const getConversationIdFromMessage = (message) => {
|
|
102
|
-
if (message.sessionType === SessionType.Single) {
|
|
103
|
-
return `si_${[message.sendID, message.recvID].sort().join("_")}`;
|
|
104
|
-
}
|
|
105
|
-
return message.groupID ? `sg_${message.groupID}` : "";
|
|
106
|
-
};
|
|
107
99
|
/** A typer's own message landing ends their typing state right away. */
|
|
108
100
|
export const removeTyperOnNewMessage = (message) => {
|
|
109
101
|
const conversationId = getConversationIdFromMessage(message);
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
export interface PdpSearchResultTarget {
|
|
2
|
+
threadId?: string;
|
|
3
|
+
groupId?: string;
|
|
4
|
+
messageId?: string;
|
|
5
|
+
}
|
|
6
|
+
export declare const buildPdpSearchResultUrl: (pathname: string, search: string, target: PdpSearchResultTarget) => string;
|
|
7
|
+
export declare const useOpenPdpSearchResult: () => (target: PdpSearchResultTarget) => void;
|
|
8
|
+
//# sourceMappingURL=useOpenPdpSearchResult.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"useOpenPdpSearchResult.d.ts","sourceRoot":"","sources":["../../../src/hooks/search/useOpenPdpSearchResult.ts"],"names":[],"mappings":"AAMA,MAAM,WAAW,qBAAqB;IACpC,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,SAAS,CAAC,EAAE,MAAM,CAAC;CACpB;AAID,eAAO,MAAM,uBAAuB,GAClC,UAAU,MAAM,EAChB,QAAQ,MAAM,EACd,QAAQ,qBAAqB,WAQ9B,CAAC;AAIF,eAAO,MAAM,sBAAsB,iBAItB,qBAAqB,SAuBjC,CAAC"}
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { useCallback } from "react";
|
|
3
|
+
import { useChatNavigate } from "../../hooks/conversation/useChatNavigate";
|
|
4
|
+
import useConversationStore from "../../store/conversation";
|
|
5
|
+
const TARGET_PARAMS = ["threadId", "groupId", "userId", "botId", "messageId"];
|
|
6
|
+
export const buildPdpSearchResultUrl = (pathname, search, target) => {
|
|
7
|
+
const params = new URLSearchParams(search);
|
|
8
|
+
TARGET_PARAMS.forEach((key) => params.delete(key));
|
|
9
|
+
Object.entries(target).forEach(([key, value]) => {
|
|
10
|
+
if (value)
|
|
11
|
+
params.set(key, value);
|
|
12
|
+
});
|
|
13
|
+
return `${pathname}?${params.toString()}`;
|
|
14
|
+
};
|
|
15
|
+
// PDP opens results through its URL: DChatConversationDetail re-resolves the target
|
|
16
|
+
// with forceRevalidate, which is the access check before showing any content.
|
|
17
|
+
export const useOpenPdpSearchResult = () => {
|
|
18
|
+
const onNavigate = useChatNavigate();
|
|
19
|
+
return useCallback((target) => {
|
|
20
|
+
onNavigate(buildPdpSearchResultUrl(window.location.pathname, window.location.search, target));
|
|
21
|
+
// The resolver skips an already-open thread, so hand it the jump target directly.
|
|
22
|
+
const { conversationData, setConversationData } = useConversationStore.getState();
|
|
23
|
+
if (target.messageId &&
|
|
24
|
+
conversationData &&
|
|
25
|
+
conversationData.conversationID === target.threadId) {
|
|
26
|
+
setConversationData(conversationData, target.messageId, {
|
|
27
|
+
forceRevalidate: true,
|
|
28
|
+
});
|
|
29
|
+
}
|
|
30
|
+
}, [onNavigate]);
|
|
31
|
+
};
|
|
@@ -1,11 +1,13 @@
|
|
|
1
1
|
import { BaseResponse, IConversationGroupItem } from "../../types/dto";
|
|
2
2
|
import { type ConversationGroupDisplayItem } from "../../hooks/group/useConversationGroups";
|
|
3
|
+
import type { SearchScope } from "../../types/search";
|
|
3
4
|
interface UseSearchGroupsParams {
|
|
4
5
|
searchTerm: string;
|
|
5
6
|
enabled?: boolean;
|
|
6
7
|
pageSize?: number;
|
|
8
|
+
scope?: SearchScope;
|
|
7
9
|
}
|
|
8
|
-
export declare const useSearchGroups: ({ searchTerm, enabled, pageSize, }: UseSearchGroupsParams) => {
|
|
10
|
+
export declare const useSearchGroups: ({ searchTerm, enabled, pageSize, scope, }: UseSearchGroupsParams) => {
|
|
9
11
|
groups: ConversationGroupDisplayItem[];
|
|
10
12
|
fetchNextPage: (options?: import("@tanstack/react-query").FetchNextPageOptions) => Promise<import("@tanstack/react-query").InfiniteQueryObserverResult<import("@tanstack/react-query").InfiniteData<BaseResponse<IConversationGroupItem[]>, unknown>, Error>>;
|
|
11
13
|
hasNextPage: boolean;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"useSearchGroups.d.ts","sourceRoot":"","sources":["../../../src/hooks/search/useSearchGroups.ts"],"names":[],"mappings":"AAQA,OAAO,EAAE,YAAY,EAAE,sBAAsB,EAAE,MAAM,aAAa,CAAC;AAGnE,OAAO,EAGL,KAAK,4BAA4B,EAClC,MAAM,qCAAqC,CAAC;
|
|
1
|
+
{"version":3,"file":"useSearchGroups.d.ts","sourceRoot":"","sources":["../../../src/hooks/search/useSearchGroups.ts"],"names":[],"mappings":"AAQA,OAAO,EAAE,YAAY,EAAE,sBAAsB,EAAE,MAAM,aAAa,CAAC;AAGnE,OAAO,EAGL,KAAK,4BAA4B,EAClC,MAAM,qCAAqC,CAAC;AAC7C,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,gBAAgB,CAAC;AAElD,UAAU,qBAAqB;IAC7B,UAAU,EAAE,MAAM,CAAC;IACnB,OAAO,CAAC,EAAE,OAAO,CAAC;IAClB,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,KAAK,CAAC,EAAE,WAAW,CAAC;CACrB;AA4BD,eAAO,MAAM,eAAe,GAAI,2CAK7B,qBAAqB;;;;;;CAkEvB,CAAC"}
|
|
@@ -8,23 +8,34 @@ import { PAGE_SIZE } from "../../constants";
|
|
|
8
8
|
import useAuthStore from "../../store/auth";
|
|
9
9
|
import useConversationStore from "../../store/conversation";
|
|
10
10
|
import { buildFallbackConversation, syncGroupConversationsToStore, } from "../../hooks/group/useConversationGroups";
|
|
11
|
-
|
|
11
|
+
const fetchGroupsPage = (scope, page, pageSize, searchTerm) => {
|
|
12
|
+
if (scope === "pdp-portal") {
|
|
13
|
+
// Joined groups only, already limited to the PDP account by BE.
|
|
14
|
+
return apiInstance.post(ENDPOINTS.chatService.searchPdpPortalGroups, { page, pageSize, searchTerm });
|
|
15
|
+
}
|
|
16
|
+
return apiInstance.get(ENDPOINTS.chatService.searchConversationGroups, {
|
|
17
|
+
params: {
|
|
18
|
+
page,
|
|
19
|
+
pageSize,
|
|
20
|
+
applicationType: useAuthStore.getState().applicationType,
|
|
21
|
+
searchTerm,
|
|
22
|
+
},
|
|
23
|
+
});
|
|
24
|
+
};
|
|
25
|
+
export const useSearchGroups = ({ searchTerm, enabled = true, pageSize = PAGE_SIZE.medium, scope = "crm", }) => {
|
|
12
26
|
const trimmedSearchTerm = searchTerm.trim();
|
|
13
27
|
const conversationList = useConversationStore((state) => state.conversationList);
|
|
14
28
|
const { data, fetchNextPage, hasNextPage, isFetchingNextPage, isLoading } = useInfiniteQuery({
|
|
15
29
|
initialPageParam: 1,
|
|
16
|
-
queryKey: [
|
|
30
|
+
queryKey: [
|
|
31
|
+
QUERY_KEYS.SEARCH_CONVERSATION_GROUPS,
|
|
32
|
+
scope,
|
|
33
|
+
trimmedSearchTerm,
|
|
34
|
+
pageSize,
|
|
35
|
+
],
|
|
17
36
|
queryFn: async ({ pageParam = 1 }) => {
|
|
18
37
|
var _a, _b;
|
|
19
|
-
const
|
|
20
|
-
const res = await apiInstance.get(ENDPOINTS.chatService.searchConversationGroups, {
|
|
21
|
-
params: {
|
|
22
|
-
page: pageParam,
|
|
23
|
-
pageSize,
|
|
24
|
-
applicationType,
|
|
25
|
-
searchTerm: trimmedSearchTerm,
|
|
26
|
-
},
|
|
27
|
-
});
|
|
38
|
+
const res = await fetchGroupsPage(scope, pageParam, pageSize, trimmedSearchTerm);
|
|
28
39
|
if ((_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.length) {
|
|
29
40
|
void syncGroupConversationsToStore(res.data.data).catch((error) => {
|
|
30
41
|
console.error("syncGroupConversationsToStore", error);
|
|
@@ -1,9 +1,11 @@
|
|
|
1
1
|
import { SearchMessageRequest } from "../../types/dto";
|
|
2
|
+
import type { SearchScope } from "../../types/search";
|
|
2
3
|
interface UseSearchMessagePayload {
|
|
3
4
|
payload: Pick<SearchMessageRequest, "contentType" | "pageSize" | "recvID" | "searchTerm" | "tag">;
|
|
4
5
|
options?: {
|
|
5
6
|
pageSize?: number;
|
|
6
7
|
untilEmptyPage?: boolean;
|
|
8
|
+
scope?: SearchScope;
|
|
7
9
|
};
|
|
8
10
|
}
|
|
9
11
|
export declare const useSearchMessage: ({ payload, options, }: UseSearchMessagePayload) => {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"useSearchMessage.d.ts","sourceRoot":"","sources":["../../../src/hooks/search/useSearchMessage.ts"],"names":[],"mappings":"AAIA,OAAO,EAEL,oBAAoB,EAErB,MAAM,aAAa,CAAC;
|
|
1
|
+
{"version":3,"file":"useSearchMessage.d.ts","sourceRoot":"","sources":["../../../src/hooks/search/useSearchMessage.ts"],"names":[],"mappings":"AAIA,OAAO,EAEL,oBAAoB,EAErB,MAAM,aAAa,CAAC;AAOrB,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,gBAAgB,CAAC;AAElD,UAAU,uBAAuB;IAC/B,OAAO,EAAE,IAAI,CACX,oBAAoB,EACpB,aAAa,GAAG,UAAU,GAAG,QAAQ,GAAG,YAAY,GAAG,KAAK,CAC7D,CAAC;IACF,OAAO,CAAC,EAAE;QAAE,QAAQ,CAAC,EAAE,MAAM,CAAC;QAAC,cAAc,CAAC,EAAE,OAAO,CAAC;QAAC,KAAK,CAAC,EAAE,WAAW,CAAA;KAAE,CAAC;CAChF;AAED,eAAO,MAAM,gBAAgB,GAAI,uBAG9B,uBAAuB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CA0FzB,CAAC"}
|
|
@@ -20,12 +20,15 @@ import useConversationStore from "../../store/conversation";
|
|
|
20
20
|
import { isGroupSession } from "../../utils/imCommon";
|
|
21
21
|
import { PAGE_SIZE } from "../../constants";
|
|
22
22
|
export const useSearchMessage = ({ payload, options, }) => {
|
|
23
|
+
const isPdpPortal = (options === null || options === void 0 ? void 0 : options.scope) === "pdp-portal";
|
|
23
24
|
const _a = useInfiniteQuery({
|
|
24
25
|
initialPageParam: 1,
|
|
25
26
|
queryKey: [QUERY_KEYS.SEARCH_MESSAGE, payload, options],
|
|
26
27
|
queryFn: async ({ pageParam = 1 }) => {
|
|
27
28
|
const params = Object.assign(Object.assign({ pageSize: (options === null || options === void 0 ? void 0 : options.pageSize) || PAGE_SIZE.small }, payload), { page: pageParam, applicationType: useAuthStore.getState().applicationType });
|
|
28
|
-
const res = await apiInstance.post(
|
|
29
|
+
const res = await apiInstance.post(isPdpPortal
|
|
30
|
+
? ENDPOINTS.chatService.searchPdpPortalMessages
|
|
31
|
+
: ENDPOINTS.chatService.searchMessage, params);
|
|
29
32
|
return res.data;
|
|
30
33
|
},
|
|
31
34
|
getNextPageParam: (lastPage) => {
|
|
@@ -54,8 +57,11 @@ export const useSearchMessage = ({ payload, options, }) => {
|
|
|
54
57
|
.getState()
|
|
55
58
|
.conversationList.filter((c) => isGroupSession(c.conversationType))
|
|
56
59
|
.map((c) => c.groupID));
|
|
57
|
-
|
|
58
|
-
|
|
60
|
+
// PDP's endpoint is scoped server-side and returns team threads the user hasn't joined.
|
|
61
|
+
const allItems = isPdpPortal
|
|
62
|
+
? rawItems
|
|
63
|
+
: rawItems.filter((item) => !isGroupSession(item.chatLog.sessionType) ||
|
|
64
|
+
joinedGroupIDs.has(item.chatLog.groupID));
|
|
59
65
|
const mGroupeddata = allItems.reduce((acc, item) => {
|
|
60
66
|
const dateKey = dayjs(item.chatLog.sendTime).format("YYYY-MM-DD");
|
|
61
67
|
if (!acc[dateKey])
|
|
@@ -67,7 +73,7 @@ export const useSearchMessage = ({ payload, options, }) => {
|
|
|
67
73
|
groupedData: mGroupeddata,
|
|
68
74
|
dataFlatten: allItems,
|
|
69
75
|
};
|
|
70
|
-
}, [data]);
|
|
76
|
+
}, [data, isPdpPortal]);
|
|
71
77
|
return Object.assign({ data,
|
|
72
78
|
fetchNextPage,
|
|
73
79
|
hasNextPage,
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import { BaseResponse } from "../../types/dto";
|
|
2
|
+
import { ISessionByStatus } from "../../store/type";
|
|
3
|
+
export type PdpTeamSessionItem = Omit<ISessionByStatus, "conversation">;
|
|
4
|
+
interface UseSearchPdpTeamSessionsParams {
|
|
5
|
+
searchTerm: string;
|
|
6
|
+
enabled?: boolean;
|
|
7
|
+
pageSize?: number;
|
|
8
|
+
}
|
|
9
|
+
export declare const useSearchPdpTeamSessions: ({ searchTerm, enabled, pageSize, }: UseSearchPdpTeamSessionsParams) => {
|
|
10
|
+
dataFlatten: PdpTeamSessionItem[];
|
|
11
|
+
fetchNextPage: (options?: import("@tanstack/react-query").FetchNextPageOptions) => Promise<import("@tanstack/react-query").InfiniteQueryObserverResult<import("@tanstack/react-query").InfiniteData<BaseResponse<PdpTeamSessionItem[]>, unknown>, Error>>;
|
|
12
|
+
hasNextPage: boolean;
|
|
13
|
+
isFetchingNextPage: boolean;
|
|
14
|
+
isLoading: boolean;
|
|
15
|
+
};
|
|
16
|
+
export {};
|
|
17
|
+
//# sourceMappingURL=useSearchPdpTeamSessions.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"useSearchPdpTeamSessions.d.ts","sourceRoot":"","sources":["../../../src/hooks/search/useSearchPdpTeamSessions.ts"],"names":[],"mappings":"AAQA,OAAO,EAAE,YAAY,EAAE,MAAM,aAAa,CAAC;AAC3C,OAAO,EAAE,gBAAgB,EAAE,MAAM,cAAc,CAAC;AAGhD,MAAM,MAAM,kBAAkB,GAAG,IAAI,CAAC,gBAAgB,EAAE,cAAc,CAAC,CAAC;AAExE,UAAU,8BAA8B;IACtC,UAAU,EAAE,MAAM,CAAC;IACnB,OAAO,CAAC,EAAE,OAAO,CAAC;IAClB,QAAQ,CAAC,EAAE,MAAM,CAAC;CACnB;AAGD,eAAO,MAAM,wBAAwB,GAAI,oCAItC,8BAA8B;;;;;;CAsChC,CAAC"}
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { useMemo } from "react";
|
|
3
|
+
import { useInfiniteQuery } from "@tanstack/react-query";
|
|
4
|
+
import { apiInstance } from "../../services/api";
|
|
5
|
+
import { ENDPOINTS } from "../../services/routes";
|
|
6
|
+
import { QUERY_KEYS } from "../../services/query";
|
|
7
|
+
import { PAGE_SIZE } from "../../constants";
|
|
8
|
+
// "Người dùng" for PDP Portal: sellers owning a thread of the account's team inbox.
|
|
9
|
+
export const useSearchPdpTeamSessions = ({ searchTerm, enabled = true, pageSize = PAGE_SIZE.medium, }) => {
|
|
10
|
+
const trimmedSearchTerm = searchTerm.trim();
|
|
11
|
+
const { data, fetchNextPage, hasNextPage, isFetchingNextPage, isLoading } = useInfiniteQuery({
|
|
12
|
+
initialPageParam: 1,
|
|
13
|
+
queryKey: [
|
|
14
|
+
QUERY_KEYS.SEARCH_PDP_PORTAL_TEAM_SESSIONS,
|
|
15
|
+
trimmedSearchTerm,
|
|
16
|
+
pageSize,
|
|
17
|
+
],
|
|
18
|
+
queryFn: async ({ pageParam = 1 }) => {
|
|
19
|
+
const res = await apiInstance.post(ENDPOINTS.chatService.searchPdpPortalTeamSessions, { page: pageParam, pageSize, searchTerm: trimmedSearchTerm });
|
|
20
|
+
return res.data;
|
|
21
|
+
},
|
|
22
|
+
getNextPageParam: (lastPage) => {
|
|
23
|
+
var _a, _b;
|
|
24
|
+
const dataLength = ((_a = lastPage === null || lastPage === void 0 ? void 0 : lastPage.data) === null || _a === void 0 ? void 0 : _a.length) || 0;
|
|
25
|
+
const currentPage = ((_b = lastPage === null || lastPage === void 0 ? void 0 : lastPage.pageable) === null || _b === void 0 ? void 0 : _b.pageNumber) || 1;
|
|
26
|
+
return dataLength < pageSize ? undefined : currentPage + 1;
|
|
27
|
+
},
|
|
28
|
+
enabled: enabled && trimmedSearchTerm !== "",
|
|
29
|
+
});
|
|
30
|
+
const dataFlatten = useMemo(() => { var _a; return (_a = data === null || data === void 0 ? void 0 : data.pages.flatMap((page) => { var _a; return (_a = page.data) !== null && _a !== void 0 ? _a : []; })) !== null && _a !== void 0 ? _a : []; }, [data]);
|
|
31
|
+
return {
|
|
32
|
+
dataFlatten,
|
|
33
|
+
fetchNextPage,
|
|
34
|
+
hasNextPage,
|
|
35
|
+
isFetchingNextPage,
|
|
36
|
+
isLoading,
|
|
37
|
+
};
|
|
38
|
+
};
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import type { SearchScope } from "../../types/search";
|
|
2
|
+
interface UseSearchUsersParams {
|
|
3
|
+
searchTerm: string;
|
|
4
|
+
scope: SearchScope;
|
|
5
|
+
pageSize?: number;
|
|
6
|
+
}
|
|
7
|
+
export declare const useSearchUsers: ({ searchTerm, scope, pageSize, }: UseSearchUsersParams) => {
|
|
8
|
+
dataFlatten: import("./useSearchPdpTeamSessions").PdpTeamSessionItem[];
|
|
9
|
+
hasNextPage: boolean;
|
|
10
|
+
fetchNextPage: (options?: import("@tanstack/react-query").FetchNextPageOptions) => Promise<import("@tanstack/react-query").InfiniteQueryObserverResult<import("@tanstack/react-query").InfiniteData<import("../../types/dto").BaseResponse<import("./useSearchPdpTeamSessions").PdpTeamSessionItem[]>, unknown>, Error>>;
|
|
11
|
+
isLoading: boolean;
|
|
12
|
+
};
|
|
13
|
+
export {};
|
|
14
|
+
//# sourceMappingURL=useSearchUsers.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"useSearchUsers.d.ts","sourceRoot":"","sources":["../../../src/hooks/search/useSearchUsers.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,gBAAgB,CAAC;AAGlD,UAAU,oBAAoB;IAC5B,UAAU,EAAE,MAAM,CAAC;IACnB,KAAK,EAAE,WAAW,CAAC;IACnB,QAAQ,CAAC,EAAE,MAAM,CAAC;CACnB;AAGD,eAAO,MAAM,cAAc,GAAI,kCAI5B,oBAAoB;;;;;CAmBtB,CAAC"}
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { useGetSession } from "../../hooks/session/useGetSession";
|
|
3
|
+
import { useSearchPdpTeamSessions } from "./useSearchPdpTeamSessions";
|
|
4
|
+
// Both hooks are always called (rules of hooks); only the scope's own one is enabled.
|
|
5
|
+
export const useSearchUsers = ({ searchTerm, scope, pageSize, }) => {
|
|
6
|
+
const isPdpPortal = scope === "pdp-portal";
|
|
7
|
+
const crm = useGetSession({
|
|
8
|
+
filter: { searchTerm: searchTerm.trim() },
|
|
9
|
+
options: { pageSize, isEnabled: !isPdpPortal },
|
|
10
|
+
});
|
|
11
|
+
const pdp = useSearchPdpTeamSessions({
|
|
12
|
+
searchTerm,
|
|
13
|
+
pageSize,
|
|
14
|
+
enabled: isPdpPortal,
|
|
15
|
+
});
|
|
16
|
+
const active = isPdpPortal ? pdp : crm;
|
|
17
|
+
return {
|
|
18
|
+
dataFlatten: active.dataFlatten,
|
|
19
|
+
hasNextPage: active.hasNextPage,
|
|
20
|
+
fetchNextPage: active.fetchNextPage,
|
|
21
|
+
isLoading: active.isLoading,
|
|
22
|
+
};
|
|
23
|
+
};
|
package/dist/index.d.ts
CHANGED
|
@@ -32,6 +32,9 @@ export { default as ComposeNewMessageModal } from "./components/compose/ComposeN
|
|
|
32
32
|
export type { ComposeNewMessageModalProps } from "./components/compose/ComposeNewMessageModal";
|
|
33
33
|
export { default as DChatConversationDetail } from "./screens/conversation-detail";
|
|
34
34
|
export type { DChatConversationDetailProps } from "./screens/conversation-detail";
|
|
35
|
+
export { default as DChatSearchConversation } from "./components/search-conversation";
|
|
36
|
+
export type { SearchConversationProps as DChatSearchConversationProps } from "./components/search-conversation";
|
|
37
|
+
export type { SearchScope as DChatSearchScope } from "./types/search";
|
|
35
38
|
export { ConversationDetailHeader, ConversationDetailInput, } from "./components/conversation-detail";
|
|
36
39
|
export type { ConversationDetailHeaderProps, ConversationDetailInputProps, } from "./components/conversation-detail";
|
|
37
40
|
export { MORE_OPTIONS, MoreOptionKey } from "./constants/moreOption";
|
package/dist/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,gBAAgB,CAAC;AAExB,OAAO,gBAAgB,MAAM,wBAAwB,CAAC;AACtD,OAAO,WAAW,MAAM,uBAAuB,CAAC;AAChD,OAAO,EAAE,QAAQ,EAAE,QAAQ,EAAE,WAAW,EAAE,MAAM,8BAA8B,CAAC;AAC/E,OAAO,EAAE,IAAI,EAAE,MAAM,mBAAmB,CAAC;AACzC,OAAO,YAAY,MAAM,cAAc,CAAC;AACxC,OAAO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AsB,EAAE,MAAM,gBAAgB,CAAC;AAC7D,OAAO,EAAE,mBAAmB,EAAE,MAAM,0CAA0C,CAAC;AAC/E,OAAO,EAAE,qBAAqB,EAAE,MAAM,4CAA4C,CAAC;AACnF,YAAY,EAAE,uBAAuB,EAAE,MAAM,4CAA4C,CAAC;AAC1F,OAAO,EACL,mBAAmB,EACnB,mBAAmB,GACpB,MAAM,qCAAqC,CAAC;AAC7C,OAAO,EAAE,iCAAiC,EAAE,MAAM,mDAAmD,CAAC;AAGtG,OAAO,EAAE,YAAY,EAAE,oBAAoB,EAAE,YAAY,EAAE,CAAC;AAC5D,OAAO,EAAE,OAAO,IAAI,oBAAoB,EAAE,MAAM,sBAAsB,CAAC;AAIvE,OAAO,EACL,QAAQ,IAAI,aAAa,EACzB,QAAQ,IAAI,aAAa,EACzB,WAAW,IAAI,gBAAgB,GAChC,CAAC;AAEF,YAAY,EAAE,uBAAuB,EAAE,CAAC;AAExC,OAAO,EAAE,WAAW,EAAE,MAAM,iBAAiB,CAAC;AAE9C,OAAO,EACL,cAAc,EACd,kBAAkB,EAClB,iBAAiB,EACjB,mBAAmB,GACpB,MAAM,8BAA8B,CAAC;AACtC,YAAY,EAAE,sBAAsB,EAAE,MAAM,gDAAgD,CAAC;AAC7F,OAAO,EAAE,mBAAmB,EAAE,MAAM,qCAAqC,CAAC;AAC1E,OAAO,EAAE,SAAS,EAAE,MAAM,aAAa,CAAC"}
|
package/dist/index.js
CHANGED
|
@@ -33,6 +33,9 @@ export { default as ConversationPeerAvatar } from "./components/conversation-inb
|
|
|
33
33
|
export { default as ConversationInboxTitle } from "./components/conversation-inbox/ConversationInboxTitle";
|
|
34
34
|
export { default as ComposeNewMessageModal } from "./components/compose/ComposeNewMessageModal";
|
|
35
35
|
export { default as DChatConversationDetail } from "./screens/conversation-detail";
|
|
36
|
+
// CRM's global search (Tất cả/Người dùng/Tin nhắn/Nhóm) for hosts with their own
|
|
37
|
+
// inbox layout; scope="pdp-portal" switches to the PDP-scoped endpoints.
|
|
38
|
+
export { default as DChatSearchConversation } from "./components/search-conversation";
|
|
36
39
|
export { ConversationDetailHeader, ConversationDetailInput, } from "./components/conversation-detail";
|
|
37
40
|
export { MORE_OPTIONS, MoreOptionKey } from "./constants/moreOption";
|
|
38
41
|
export { ChatCategory, ChatType, PeerType, } from "./types/conversation";
|
|
@@ -211,6 +211,7 @@
|
|
|
211
211
|
"my_messages": "Tin nhắn của tôi",
|
|
212
212
|
"my_inbox_tab": "My inbox",
|
|
213
213
|
"team_messages": "Tin nhắn nhóm",
|
|
214
|
+
"pdp_team_inbox_tag": "Tin nhắn chung",
|
|
214
215
|
"join_group_required": "Bạn cần tham gia nhóm để gửi tin nhắn",
|
|
215
216
|
"send_message_disabled": "Chỉ quản trị viên được phép gửi tin nhắn",
|
|
216
217
|
"send_message_disabled_group_mute": "Chỉ chủ nhóm và quản trị viên được phép gửi tin nhắn",
|
package/dist/services/query.d.ts
CHANGED
|
@@ -42,6 +42,7 @@ export declare const QUERY_KEYS: {
|
|
|
42
42
|
SEARCH_CONVERSATION_GROUPS: string;
|
|
43
43
|
SEARCH_CONTACTS: string;
|
|
44
44
|
SEARCH_PUBLIC_GROUPS: string;
|
|
45
|
+
SEARCH_PDP_PORTAL_TEAM_SESSIONS: string;
|
|
45
46
|
GET_BLACK_LIST: string;
|
|
46
47
|
DELETE_CONVERSATION: string;
|
|
47
48
|
GET_JOIN_LINK: string;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"query.d.ts","sourceRoot":"","sources":["../../src/services/query.ts"],"names":[],"mappings":"AAAA,eAAO,MAAM,UAAU
|
|
1
|
+
{"version":3,"file":"query.d.ts","sourceRoot":"","sources":["../../src/services/query.ts"],"names":[],"mappings":"AAAA,eAAO,MAAM,UAAU;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAoDtB,CAAC"}
|
package/dist/services/query.js
CHANGED
|
@@ -42,6 +42,7 @@ export const QUERY_KEYS = {
|
|
|
42
42
|
SEARCH_CONVERSATION_GROUPS: "SEARCH_CONVERSATION_GROUPS",
|
|
43
43
|
SEARCH_CONTACTS: "SEARCH_CONTACTS",
|
|
44
44
|
SEARCH_PUBLIC_GROUPS: "SEARCH_PUBLIC_GROUPS",
|
|
45
|
+
SEARCH_PDP_PORTAL_TEAM_SESSIONS: "SEARCH_PDP_PORTAL_TEAM_SESSIONS",
|
|
45
46
|
GET_BLACK_LIST: "GET_BLACK_LIST",
|
|
46
47
|
DELETE_CONVERSATION: "DELETE_CONVERSATION",
|
|
47
48
|
GET_JOIN_LINK: "GET_JOIN_LINK",
|
|
@@ -32,6 +32,9 @@ export declare const ENDPOINTS: {
|
|
|
32
32
|
getConversationsImDetail: string;
|
|
33
33
|
getConversationGroups: string;
|
|
34
34
|
searchConversationGroups: string;
|
|
35
|
+
searchPdpPortalMessages: string;
|
|
36
|
+
searchPdpPortalTeamSessions: string;
|
|
37
|
+
searchPdpPortalGroups: string;
|
|
35
38
|
createConversation: string;
|
|
36
39
|
getConversationDetail: (conversationId: string) => string;
|
|
37
40
|
runBotFlow: (conversationId: string) => string;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"routes.d.ts","sourceRoot":"","sources":["../../src/services/routes.ts"],"names":[],"mappings":"AAAA,eAAO,MAAM,SAAS;;;;;;mCAMS,MAAM;;0CAGC,MAAM,UAAU,MAAM;6BAEnC,MAAM;;oDAEiB,MAAM;uCAEnB,MAAM;kCAEX,MAAM;;oCAGJ,MAAM;mCAEP,MAAM;uCAEF,MAAM;;;;;;;;;iCAUZ,MAAM;4CAEK,MAAM;mCAEf,MAAM;yCAEA,MAAM;gCAEf,MAAM
|
|
1
|
+
{"version":3,"file":"routes.d.ts","sourceRoot":"","sources":["../../src/services/routes.ts"],"names":[],"mappings":"AAAA,eAAO,MAAM,SAAS;;;;;;mCAMS,MAAM;;0CAGC,MAAM,UAAU,MAAM;6BAEnC,MAAM;;oDAEiB,MAAM;uCAEnB,MAAM;kCAEX,MAAM;;oCAGJ,MAAM;mCAEP,MAAM;uCAEF,MAAM;;;;;;;;;iCAUZ,MAAM;4CAEK,MAAM;mCAEf,MAAM;yCAEA,MAAM;gCAEf,MAAM;;;;;;;;gDAYU,MAAM;qCAEjB,MAAM;uCAEJ,MAAM;0CAEH,MAAM;yCAEP,MAAM;8BAEjB,MAAM;wCACI,MAAM;;;;;4CAMF,MAAM;;;;;;;;;;;;CAa7C,CAAC"}
|
package/dist/services/routes.js
CHANGED
|
@@ -32,6 +32,9 @@ export const ENDPOINTS = {
|
|
|
32
32
|
getConversationsImDetail: "/chat-service/v1/crm/conversations/im-detail",
|
|
33
33
|
getConversationGroups: "/chat-service/v1/crm/conversations/groups",
|
|
34
34
|
searchConversationGroups: "/chat-service/v1/crm/conversations/groups/search",
|
|
35
|
+
searchPdpPortalMessages: "/chat-service/v1/pdp-portal/messages/search",
|
|
36
|
+
searchPdpPortalTeamSessions: "/chat-service/v1/pdp-portal/conversations/teams/query",
|
|
37
|
+
searchPdpPortalGroups: "/chat-service/v1/pdp-portal/conversations/groups/query",
|
|
35
38
|
createConversation: "/chat-service/v1/app/conversations",
|
|
36
39
|
getConversationDetail: (conversationId) => `/chat-service/v1/app/conversations/${conversationId}`,
|
|
37
40
|
runBotFlow: (conversationId) => `/chat-service/v1/app/conversations/${conversationId}/bot-flows/run`,
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"search.d.ts","sourceRoot":"","sources":["../../src/types/search.ts"],"names":[],"mappings":"AAEA,MAAM,MAAM,WAAW,GAAG,KAAK,GAAG,YAAY,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { ConversationItem } from "@droppii-org/wasm-client-sdk";
|
|
1
|
+
import { ConversationItem, MessageItem } from "@droppii-org/wasm-client-sdk";
|
|
2
2
|
import { ChatCategory, PeerType, type ConversationExtra } from "../types/conversation";
|
|
3
3
|
export declare const parseConversationExtra: (ex: string | undefined) => ConversationExtra;
|
|
4
4
|
export declare const resolveConversationChatCategory: (item: ConversationItem) => ChatCategory;
|
|
@@ -47,6 +47,7 @@ export declare const resolvePeerBadgeColor: (peerType: PeerType) => "" | "bg-[va
|
|
|
47
47
|
* "group unknown".
|
|
48
48
|
*/
|
|
49
49
|
export declare const getGroupIdFromConversationId: (conversationId?: string) => string;
|
|
50
|
+
export declare const getConversationIdFromMessage: (message: MessageItem) => string;
|
|
50
51
|
/**
|
|
51
52
|
* Pulls the OTHER participant out of a 1:1 conversation id
|
|
52
53
|
* ("si_<userA>_<userB>"), which is what getOneConversation wants as its
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"conversation.d.ts","sourceRoot":"","sources":["../../src/utils/conversation.ts"],"names":[],"mappings":"AAAA,OAAO,
|
|
1
|
+
{"version":3,"file":"conversation.d.ts","sourceRoot":"","sources":["../../src/utils/conversation.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,gBAAgB,EAChB,WAAW,EAEZ,MAAM,8BAA8B,CAAC;AACtC,OAAO,EACL,YAAY,EACZ,QAAQ,EACR,KAAK,iBAAiB,EACvB,MAAM,sBAAsB,CAAC;AAW9B,eAAO,MAAM,sBAAsB,GACjC,IAAI,MAAM,GAAG,SAAS,KACrB,iBAcF,CAAC;AAEF,eAAO,MAAM,+BAA+B,GAC1C,MAAM,gBAAgB,KACrB,YAA4D,CAAC;AAEhE,eAAO,MAAM,wBAAwB,GAAI,MAAM,gBAAgB,KAAG,MAOjE,CAAC;AAEF,KAAK,oBAAoB,GAAG;IAC1B,cAAc,CAAC,EAAE,MAAM,CAAC;IACxB,gBAAgB,CAAC,EAAE,MAAM,CAAC;IAC1B,EAAE,CAAC,EAAE,MAAM,CAAC;CACb,GAAG,IAAI,CAAC;AAIT,eAAO,MAAM,4BAA4B,GACvC,OAAO,oBAAoB,KAC1B,MAiBF,CAAC;AAEF;;;GAGG;AACH,eAAO,MAAM,y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AS,WAAW,WAKhE,CAAC;AAEF;;;;;;;;;GASG;AACH,eAAO,MAAM,+BAA+B,GAC1C,iBAAiB,MAAM,EACvB,aAAa,MAAM,KAClB,MAYF,CAAC"}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { SessionType } from "@droppii-org/wasm-client-sdk";
|
|
1
|
+
import { SessionType, } from "@droppii-org/wasm-client-sdk";
|
|
2
2
|
import { ChatCategory, PeerType, } from "../types/conversation";
|
|
3
3
|
import { DChatApplicationType, } from "../types/chat";
|
|
4
4
|
const DEFAULT_CONVERSATION_EXTRA = {
|
|
@@ -125,6 +125,13 @@ const SINGLE_CONVERSATION_ID_PREFIX = "si_";
|
|
|
125
125
|
export const getGroupIdFromConversationId = (conversationId) => (conversationId === null || conversationId === void 0 ? void 0 : conversationId.startsWith(GROUP_CONVERSATION_ID_PREFIX))
|
|
126
126
|
? conversationId.slice(GROUP_CONVERSATION_ID_PREFIX.length)
|
|
127
127
|
: "";
|
|
128
|
+
// Mirrors OpenIM's conversationID scheme: si_<sorted user ids> / sg_<groupID>.
|
|
129
|
+
export const getConversationIdFromMessage = (message) => {
|
|
130
|
+
if (message.sessionType === SessionType.Single) {
|
|
131
|
+
return `si_${[message.sendID, message.recvID].sort().join("_")}`;
|
|
132
|
+
}
|
|
133
|
+
return message.groupID ? `sg_${message.groupID}` : "";
|
|
134
|
+
};
|
|
128
135
|
/**
|
|
129
136
|
* Pulls the OTHER participant out of a 1:1 conversation id
|
|
130
137
|
* ("si_<userA>_<userB>"), which is what getOneConversation wants as its
|