@droppii-org/chat-sdk 0.1.23 → 0.1.25
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/biz-inbox/BizInboxHeader.d.ts +3 -0
- package/dist/components/biz-inbox/BizInboxHeader.d.ts.map +1 -0
- package/dist/components/biz-inbox/BizInboxHeader.js +8 -0
- package/dist/components/biz-inbox/BizThreadAvatar.d.ts +10 -0
- package/dist/components/biz-inbox/BizThreadAvatar.d.ts.map +1 -0
- package/dist/components/biz-inbox/BizThreadAvatar.js +8 -0
- package/dist/components/biz-inbox/BizThreadCard.d.ts +8 -0
- package/dist/components/biz-inbox/BizThreadCard.d.ts.map +1 -0
- package/dist/components/biz-inbox/BizThreadCard.js +25 -0
- package/dist/components/biz-inbox/BizThreadList.d.ts +11 -0
- package/dist/components/biz-inbox/BizThreadList.d.ts.map +1 -0
- package/dist/components/biz-inbox/BizThreadList.js +35 -0
- package/dist/components/biz-inbox/BizThreadTitle.d.ts +8 -0
- package/dist/components/biz-inbox/BizThreadTitle.d.ts.map +1 -0
- package/dist/components/biz-inbox/BizThreadTitle.js +6 -0
- package/dist/components/biz-inbox/index.d.ts +10 -0
- package/dist/components/biz-inbox/index.d.ts.map +1 -0
- package/dist/components/biz-inbox/index.js +5 -0
- package/dist/components/bizInbox/BizThreadAvatar.d.ts +10 -0
- package/dist/components/bizInbox/BizThreadAvatar.d.ts.map +1 -0
- package/dist/components/bizInbox/BizThreadAvatar.js +8 -0
- package/dist/components/bizInbox/BizThreadCard.d.ts.map +1 -1
- package/dist/components/bizInbox/BizThreadCard.js +12 -40
- package/dist/components/bizInbox/BizThreadList.d.ts +1 -1
- package/dist/components/bizInbox/BizThreadList.d.ts.map +1 -1
- package/dist/components/bizInbox/BizThreadList.js +22 -4
- package/dist/components/bizInbox/BizThreadTitle.d.ts +8 -0
- package/dist/components/bizInbox/BizThreadTitle.d.ts.map +1 -0
- package/dist/components/bizInbox/BizThreadTitle.js +6 -0
- package/dist/components/bizInbox/index.d.ts +4 -0
- package/dist/components/bizInbox/index.d.ts.map +1 -1
- package/dist/components/bizInbox/index.js +2 -0
- package/dist/components/bizThreadDetail/BizMessageBubble.d.ts +10 -0
- package/dist/components/bizThreadDetail/BizMessageBubble.d.ts.map +1 -0
- package/dist/components/bizThreadDetail/BizMessageBubble.js +11 -0
- package/dist/components/bizThreadDetail/BizMessageList.d.ts +3 -0
- package/dist/components/bizThreadDetail/BizMessageList.d.ts.map +1 -0
- package/dist/components/bizThreadDetail/BizMessageList.js +28 -0
- package/dist/components/bizThreadDetail/BizThreadDetailHeader.d.ts +8 -0
- package/dist/components/bizThreadDetail/BizThreadDetailHeader.d.ts.map +1 -0
- package/dist/components/bizThreadDetail/BizThreadDetailHeader.js +18 -0
- package/dist/components/bizThreadDetail/BizThreadDetailInput.d.ts +8 -0
- package/dist/components/bizThreadDetail/BizThreadDetailInput.d.ts.map +1 -0
- package/dist/components/bizThreadDetail/BizThreadDetailInput.js +147 -0
- package/dist/components/bizThreadDetail/index.d.ts +8 -0
- package/dist/components/bizThreadDetail/index.d.ts.map +1 -0
- package/dist/components/bizThreadDetail/index.js +4 -0
- package/dist/components/bizThreadDetail/item/BizMessageItem.d.ts +8 -0
- package/dist/components/bizThreadDetail/item/BizMessageItem.d.ts.map +1 -0
- package/dist/components/bizThreadDetail/item/BizMessageItem.js +20 -0
- package/dist/components/cannedResponse/CannedResponseBody.js +2 -2
- package/dist/components/cannedResponse/CannedResponseFooter.js +1 -1
- package/dist/components/cannedResponse/CannedResponseHeader.js +1 -1
- package/dist/components/cannedResponse/team/TeamItem.d.ts.map +1 -1
- package/dist/components/cannedResponse/team/TeamItem.js +1 -1
- package/dist/components/chatBubble/ChatBubble.js +1 -1
- package/dist/components/conversation/ConversationBySessionItem.d.ts.map +1 -1
- package/dist/components/conversation/DeskConversationList.js +3 -3
- package/dist/components/mediaCollection/FileCollection.js +1 -1
- package/dist/components/mediaCollection/LinkCollection.js +1 -1
- package/dist/components/mediaCollection/VideoCollection.js +1 -1
- package/dist/components/mediaCollection/index.js +1 -1
- package/dist/components/message/GroupMembersDrawer.d.ts.map +1 -1
- package/dist/components/message/GroupMembersDrawer.js +1 -1
- package/dist/components/message/MessageHeader.d.ts.map +1 -1
- package/dist/components/message/MessageHeader.js +3 -3
- package/dist/components/message/MessageInfiniteScroll.d.ts +15 -0
- package/dist/components/message/MessageInfiniteScroll.d.ts.map +1 -0
- package/dist/components/message/MessageInfiniteScroll.js +20 -0
- package/dist/components/message/MessageList.d.ts.map +1 -1
- package/dist/components/message/MessageList.js +8 -76
- package/dist/components/message/SelectSession.js +1 -1
- package/dist/components/message/UnassignedSessionFooter.js +2 -2
- package/dist/components/message/footer/ActionBar.js +1 -1
- package/dist/components/message/footer/FilePreview.js +1 -1
- package/dist/components/message/footer/MediaActions.js +1 -1
- package/dist/components/message/footer/QuotedMessage.js +1 -1
- package/dist/components/message/footer/index.d.ts.map +1 -1
- package/dist/components/message/footer/index.js +1 -1
- package/dist/components/message/item/FileMessage.js +1 -1
- package/dist/components/message/item/QuoteMessage.js +2 -2
- package/dist/components/message/item/TextMessage.js +1 -1
- package/dist/components/message/item/index.js +1 -1
- package/dist/components/richTextEditor/RichTextEditor.js +4 -4
- package/dist/components/searchConversation/SearchAll.js +1 -1
- package/dist/components/searchConversation/SearchDrawer.js +1 -1
- package/dist/components/searchConversation/item/SearchItemAsUser.d.ts.map +1 -1
- package/dist/components/session/DeskAssignedSession.js +1 -1
- package/dist/components/session/DeskTeamInbox.js +1 -1
- package/dist/components/session/SessionFilterMenu.d.ts.map +1 -1
- package/dist/components/session/sessionMenuItems.d.ts.map +1 -1
- package/dist/components/session/sessionMenuItems.js +1 -1
- package/dist/components/thread/AssignConfirmModal.d.ts.map +1 -1
- package/dist/components/thread/ManualAssignPopover.js +1 -1
- package/dist/components/thread/SessionSection.d.ts.map +1 -1
- package/dist/components/thread/SessionSection.js +1 -1
- package/dist/components/thread/UserSection.js +1 -1
- package/dist/context/ChatContext.d.ts.map +1 -1
- package/dist/hooks/biz/index.d.ts +1 -0
- package/dist/hooks/biz/index.d.ts.map +1 -1
- package/dist/hooks/biz/index.js +1 -0
- package/dist/hooks/biz/useBizConversationList.d.ts.map +1 -1
- package/dist/hooks/biz/useBizSendMessage.d.ts +4 -0
- package/dist/hooks/biz/useBizSendMessage.d.ts.map +1 -0
- package/dist/hooks/biz/useBizSendMessage.js +61 -0
- package/dist/hooks/biz/useCreateBizConversation.d.ts.map +1 -1
- package/dist/hooks/cannedResponse/useFetchCannedCategories.d.ts.map +1 -1
- package/dist/hooks/cannedResponse/useFetchCannedResponse.d.ts.map +1 -1
- package/dist/hooks/conversation/useConversation.js +1 -1
- package/dist/hooks/global/useGlobalEvent.js +2 -2
- package/dist/hooks/message/useMessageListScroll.d.ts +29 -0
- package/dist/hooks/message/useMessageListScroll.d.ts.map +1 -0
- package/dist/hooks/message/useMessageListScroll.js +88 -0
- package/dist/hooks/message/usePullSessionMessages.d.ts.map +1 -1
- package/dist/hooks/message/useSendMessage.d.ts.map +1 -1
- package/dist/hooks/message/useSendMessage.js +1 -1
- package/dist/hooks/search/useSearchMessage.d.ts.map +1 -1
- package/dist/hooks/session/useAssignSession.d.ts.map +1 -1
- package/dist/hooks/session/useCloseSession.d.ts.map +1 -1
- package/dist/hooks/session/useCreateNote.d.ts.map +1 -1
- package/dist/hooks/session/useGetLabelSession.d.ts.map +1 -1
- package/dist/hooks/session/useGetListSessionByConversation.d.ts.map +1 -1
- package/dist/hooks/session/useGetSession.d.ts.map +1 -1
- package/dist/hooks/session/useGetSessionSummary.d.ts.map +1 -1
- package/dist/hooks/session/useGetTeamSessionSummary.d.ts.map +1 -1
- package/dist/hooks/session/useGetTeamSessionSummary.js +14 -8
- package/dist/hooks/session/useGetTeamSupporters.d.ts.map +1 -1
- package/dist/hooks/session/useGetUserSideInfo.d.ts.map +1 -1
- package/dist/hooks/session/useJoinSession.d.ts.map +1 -1
- package/dist/hooks/session/useLeaveConversation.d.ts.map +1 -1
- package/dist/hooks/session/useReopenOrCreateSession.d.ts.map +1 -1
- package/dist/hooks/session/useSessionLatestPreview.d.ts.map +1 -1
- package/dist/hooks/session/useSessionLatestPreview.js +1 -1
- package/dist/hooks/session/useSortedSessions.d.ts.map +1 -1
- package/dist/hooks/session/useUpdateNote.d.ts.map +1 -1
- package/dist/hooks/session/useUpdateSession.d.ts.map +1 -1
- package/dist/hooks/session/useUpdateSessionInfo.d.ts.map +1 -1
- package/dist/hooks/team/useFetchMyTeam.d.ts.map +1 -1
- package/dist/hooks/user/useCurrentUserAccountType.d.ts.map +1 -1
- package/dist/hooks/user/useUpdateFcmToken.d.ts.map +1 -1
- package/dist/hooks/user/useUpdateFcmToken.js +1 -1
- package/dist/index.d.ts +8 -2
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +5 -1
- package/dist/locales/i18n.js +3 -3
- package/dist/locales/i18n.ts +3 -3
- package/dist/locales/vi/biz-inbox.json +20 -0
- package/dist/locales/vi/bizInbox.json +7 -0
- package/dist/screens/bizMessage/index.d.ts.map +1 -1
- package/dist/screens/bizMessage/index.js +37 -12
- package/dist/screens/bizThreadDetail/index.d.ts +9 -0
- package/dist/screens/bizThreadDetail/index.d.ts.map +1 -0
- package/dist/screens/bizThreadDetail/index.js +36 -0
- package/dist/store/bizConversation.d.ts +12 -0
- package/dist/store/bizConversation.d.ts.map +1 -0
- package/dist/store/bizConversation.js +22 -0
- package/dist/store/bizMessageDraft.d.ts +8 -0
- package/dist/store/bizMessageDraft.d.ts.map +1 -0
- package/dist/store/bizMessageDraft.js +23 -0
- package/dist/store/type.d.ts +111 -0
- package/dist/store/type.d.ts.map +1 -0
- package/dist/store/type.js +1 -0
- package/dist/styles/global.css +1 -1
- package/dist/tsconfig.tsbuildinfo +1 -1
- package/dist/types/biz.d.ts +20 -17
- package/dist/types/biz.d.ts.map +1 -1
- package/dist/types/biz.js +17 -1
- package/dist/types/chat.d.ts +1 -0
- package/dist/types/chat.d.ts.map +1 -1
- package/dist/types/dto.d.ts +1 -1
- package/dist/types/dto.d.ts.map +1 -1
- package/dist/utils/bizConversation.d.ts +11 -0
- package/dist/utils/bizConversation.d.ts.map +1 -0
- package/dist/utils/bizConversation.js +65 -0
- package/dist/utils/bizMessage.d.ts +15 -0
- package/dist/utils/bizMessage.d.ts.map +1 -0
- package/dist/utils/bizMessage.js +23 -0
- package/dist/utils/events.d.ts +1 -0
- package/dist/utils/events.d.ts.map +1 -1
- package/dist/utils/messageTransform.d.ts.map +1 -1
- package/package.json +3 -2
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
3
3
|
import { useCallback, useEffect, useMemo, useState } from "react";
|
|
4
4
|
import { Button } from "antd";
|
|
5
|
-
import { Icon } from "
|
|
5
|
+
import { Icon } from "../../../components/icon";
|
|
6
6
|
import { useLexicalComposerContext } from "@lexical/react/LexicalComposerContext";
|
|
7
7
|
import { $createParagraphNode, $getRoot, $getSelection, $isRangeSelection, } from "lexical";
|
|
8
8
|
import { $generateHtmlFromNodes } from "@lexical/html";
|
|
@@ -3,7 +3,7 @@ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
|
3
3
|
import { useCallback } from "react";
|
|
4
4
|
import { useMessageFooterContext } from ".";
|
|
5
5
|
import { Button } from "antd";
|
|
6
|
-
import { Icon } from "
|
|
6
|
+
import { Icon } from "../../../components/icon";
|
|
7
7
|
import { documentIcon } from "../../../assets/svg";
|
|
8
8
|
const documentTypes = [
|
|
9
9
|
"application/pdf",
|
|
@@ -7,7 +7,7 @@ import { Button, Upload, message as antdMessage } from "antd";
|
|
|
7
7
|
import clsx from "clsx";
|
|
8
8
|
import { useTranslation } from "react-i18next";
|
|
9
9
|
import EmojiPicker from "./EmojiPicker";
|
|
10
|
-
import { Icon } from "
|
|
10
|
+
import { Icon } from "../../../components/icon";
|
|
11
11
|
import { validateFile, validateVideoLimit, } from "../../../utils/fileValidation";
|
|
12
12
|
import { DOCUMENT_TYPES } from "./editorConfig";
|
|
13
13
|
import CannedResponseIcon from "../../../assets/svg/cannedResponse";
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
2
|
import { useTranslation } from "react-i18next";
|
|
3
3
|
import useConversationStore from "../../../store/conversation";
|
|
4
|
-
import { Icon } from "
|
|
4
|
+
import { Icon } from "../../../components/icon";
|
|
5
5
|
import { useCallback } from "react";
|
|
6
6
|
import { Button } from "antd";
|
|
7
7
|
import { useChatContext } from "../../../context/ChatContext";
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/components/message/footer/index.tsx"],"names":[],"mappings":"AAgBA,OAAO,EAAe,wBAAwB,EAAE,MAAM,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/components/message/footer/index.tsx"],"names":[],"mappings":"AAgBA,OAAO,EAAe,wBAAwB,EAAE,MAAM,cAAc,CAAC;AAKrE,OAAO,EAAE,gBAAgB,EAAE,MAAM,aAAa,CAAC;AAkB/C,UAAU,kBAAkB;IAC1B,cAAc,CAAC,EAAE,gBAAgB,CAAC;IAClC,qBAAqB,CAAC,EAAE,MAAM,IAAI,CAAC;CACpC;AASD,eAAO,MAAM,oBAAoB,mDAY/B,CAAC;AAEH,eAAO,MAAM,uBAAuB,gCAAyC,CAAC;AAE9E,QAAA,MAAM,qBAAqB,GAAI,4CAG5B,kBAAkB,4CA8QpB,CAAC;AAEF,eAAe,qBAAqB,CAAC"}
|
|
@@ -15,7 +15,7 @@ import FilePreview from "./FilePreview";
|
|
|
15
15
|
import { useTranslation } from "react-i18next";
|
|
16
16
|
import PasteAndDropPlugin from "./PasteAndDropPlugin";
|
|
17
17
|
import { QuotedMessageFooter } from "./QuotedMessage";
|
|
18
|
-
import CannedResponse from "
|
|
18
|
+
import CannedResponse from "../../../components/cannedResponse";
|
|
19
19
|
import { CannedResponseTriggerPlugin } from "./CannedResponsePlugin";
|
|
20
20
|
import { useBoolean } from "ahooks";
|
|
21
21
|
import useAuthStore from "../../../store/auth";
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
-
import { shortenFileName } from "
|
|
2
|
+
import { shortenFileName } from "../../../components/message/footer/FilePreview";
|
|
3
3
|
import { documentIcon } from "../../../assets/svg";
|
|
4
4
|
const FileMessageItem = (props) => {
|
|
5
5
|
var _a;
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
2
|
import { generateContentBasedOnMessageType } from "../../../utils/common";
|
|
3
|
-
import { Icon } from "
|
|
3
|
+
import { Icon } from "../../../components/icon";
|
|
4
4
|
import { useTranslation } from "react-i18next";
|
|
5
5
|
import clsx from "clsx";
|
|
6
|
-
import MediaPreviewIcon from "
|
|
6
|
+
import MediaPreviewIcon from "../../../components/message/MediaPreviewIcon";
|
|
7
7
|
import useAuthStore from "../../../store/auth";
|
|
8
8
|
import { useCallback, useMemo } from "react";
|
|
9
9
|
import useConversationStore from "../../../store/conversation";
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
"use client";
|
|
2
2
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
3
3
|
import { MessageType } from "@openim/wasm-client-sdk";
|
|
4
|
-
import
|
|
4
|
+
import useAuthStore from "../../../store/auth";
|
|
5
5
|
import { sanitizeHtml } from "../../../utils/common";
|
|
6
6
|
const TextMessageItem = (props) => {
|
|
7
7
|
var _a, _b, _c;
|
|
@@ -18,7 +18,7 @@ import { Trans, useTranslation } from "react-i18next";
|
|
|
18
18
|
import UrlTextMessageItem from "./UrlTextMessage";
|
|
19
19
|
import MessageStatusIndicator from "./MessageStatusIndicator";
|
|
20
20
|
import { useSendMessage, isMediaResendable, } from "../../../hooks/message/useSendMessage";
|
|
21
|
-
import { Icon } from "
|
|
21
|
+
import { Icon } from "../../../components/icon";
|
|
22
22
|
import RevokeMessageItem from "./RevokeMessage";
|
|
23
23
|
import QuoteMessageItem from "./QuoteMessage";
|
|
24
24
|
import SystemLogMessageItem from "./SystemLogMessage";
|
|
@@ -12,10 +12,10 @@ import { $generateHtmlFromNodes, $generateNodesFromDOM } from "@lexical/html";
|
|
|
12
12
|
import { $getRoot } from "lexical";
|
|
13
13
|
import { useLexicalComposerContext } from "@lexical/react/LexicalComposerContext";
|
|
14
14
|
import { useEffect } from "react";
|
|
15
|
-
import { ToolbarPlugin } from "
|
|
16
|
-
import MediaActions from "
|
|
17
|
-
import { FilePreviewList } from "
|
|
18
|
-
import { editorTheme, editorNodes, editorOnError, } from "
|
|
15
|
+
import { ToolbarPlugin } from "../../components/message/footer/ToolbarPlugin";
|
|
16
|
+
import MediaActions from "../../components/message/footer/MediaActions";
|
|
17
|
+
import { FilePreviewList } from "../../components/message/footer/FilePreview";
|
|
18
|
+
import { editorTheme, editorNodes, editorOnError, } from "../../components/message/footer/editorConfig";
|
|
19
19
|
const EDITOR_CONFIG = {
|
|
20
20
|
namespace: "CannedResponseEditor",
|
|
21
21
|
theme: editorTheme,
|
|
@@ -4,7 +4,7 @@ import clsx from "clsx";
|
|
|
4
4
|
import { useTranslation } from "react-i18next";
|
|
5
5
|
import { useSearchMessage } from "../../hooks/search/useSearchMessage";
|
|
6
6
|
import { MessageType } from "@openim/wasm-client-sdk";
|
|
7
|
-
import { Icon } from "
|
|
7
|
+
import { Icon } from "../../components/icon";
|
|
8
8
|
import SearchItemAsMessage from "./item/SearchItemAsMessage";
|
|
9
9
|
import { useGetSession } from "../../hooks/session/useGetSession";
|
|
10
10
|
import SearchItemAsUser from "./item/SearchItemAsUser";
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
2
|
import { Button, Drawer, Input } from "antd";
|
|
3
|
-
import { Icon } from "
|
|
3
|
+
import { Icon } from "../../components/icon";
|
|
4
4
|
import { useIsMobile } from "../../hooks/common/useIsMobile";
|
|
5
5
|
import useBoolean from "ahooks/lib/useBoolean";
|
|
6
6
|
import { useTranslation } from "react-i18next";
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"SearchItemAsUser.d.ts","sourceRoot":"","sources":["../../../../src/components/searchConversation/item/SearchItemAsUser.tsx"],"names":[],"mappings":"AAEA,OAAO,EAAE,gBAAgB,EAAE,MAAM,
|
|
1
|
+
{"version":3,"file":"SearchItemAsUser.d.ts","sourceRoot":"","sources":["../../../../src/components/searchConversation/item/SearchItemAsUser.tsx"],"names":[],"mappings":"AAEA,OAAO,EAAE,gBAAgB,EAAE,MAAM,cAAc,CAAC;AAKhD,UAAU,qBAAqB;IAC7B,OAAO,EAAE,gBAAgB,CAAC;IAC1B,UAAU,EAAE,MAAM,CAAC;CACpB;AAED,QAAA,MAAM,gBAAgB,GAAI,OAAO,qBAAqB,4CAyCrD,CAAC;AAEF,eAAe,gBAAgB,CAAC"}
|
|
@@ -4,7 +4,7 @@ import { useBoolean } from "ahooks";
|
|
|
4
4
|
import { Button, Layout } from "antd";
|
|
5
5
|
import { useCallback, useEffect } from "react";
|
|
6
6
|
import { useTranslation } from "react-i18next";
|
|
7
|
-
import { Icon } from "
|
|
7
|
+
import { Icon } from "../../components/icon";
|
|
8
8
|
import { useGetSessionSummary } from "../../hooks/session/useGetSessionSummary";
|
|
9
9
|
import useSessionStore from "../../store/session";
|
|
10
10
|
import emitter from "../../utils/events";
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
3
3
|
import { memo, useCallback, useEffect, useMemo, useRef, useState } from "react";
|
|
4
4
|
import { useTranslation } from "react-i18next";
|
|
5
|
-
import { Icon } from "
|
|
5
|
+
import { Icon } from "../../components/icon";
|
|
6
6
|
import { useGetTeamSessionSummary } from "../../hooks/session/useGetTeamSessionSummary";
|
|
7
7
|
import useSessionStore from "../../store/session";
|
|
8
8
|
import emitter from "../../utils/events";
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"SessionFilterMenu.d.ts","sourceRoot":"","sources":["../../../src/components/session/SessionFilterMenu.tsx"],"names":[],"mappings":"AAKA,OAAO,EAAE,cAAc,EAAE,MAAM,
|
|
1
|
+
{"version":3,"file":"SessionFilterMenu.d.ts","sourceRoot":"","sources":["../../../src/components/session/SessionFilterMenu.tsx"],"names":[],"mappings":"AAKA,OAAO,EAAE,cAAc,EAAE,MAAM,cAAc,CAAC;AAC9C,OAAO,EAAE,uBAAuB,EAAE,MAAM,aAAa,CAAC;AAGtD,UAAU,sBAAsB;IAC9B,OAAO,EAAE,uBAAuB,CAAC;IACjC,QAAQ,EAAE,OAAO,CAAC;IAClB,aAAa,EAAE,cAAc,CAAC;IAC9B,cAAc,EAAE,CAAC,MAAM,EAAE,cAAc,KAAK,IAAI,CAAC;IACjD,iBAAiB,CAAC,EAAE,OAAO,CAAC;IAC5B,WAAW,CAAC,EAAE,MAAM,CAAC;CACtB;AAaD,QAAA,MAAM,iBAAiB,GAAI,uFAOxB,sBAAsB,4CAiCxB,CAAC;AAEF,eAAe,iBAAiB,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"sessionMenuItems.d.ts","sourceRoot":"","sources":["../../../src/components/session/sessionMenuItems.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,MAAM,CAAC;AACjC,OAAO,EAAE,SAAS,EAAE,MAAM,SAAS,CAAC;AAGpC,OAAO,EAAE,cAAc,EAAE,MAAM,
|
|
1
|
+
{"version":3,"file":"sessionMenuItems.d.ts","sourceRoot":"","sources":["../../../src/components/session/sessionMenuItems.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,MAAM,CAAC;AACjC,OAAO,EAAE,SAAS,EAAE,MAAM,SAAS,CAAC;AAGpC,OAAO,EAAE,cAAc,EAAE,MAAM,cAAc,CAAC;AAC9C,OAAO,EAAE,uBAAuB,EAAE,MAAM,aAAa,CAAC;AAEtD,KAAK,QAAQ,GAAG,QAAQ,CAAC,SAAS,CAAC,CAAC,OAAO,CAAC,CAAC,MAAM,CAAC,CAAC;AAErD,UAAU,mBAAmB;IAC3B,GAAG,EAAE,MAAM,CAAC;IACZ,QAAQ,EAAE,MAAM,CAAC;IACjB,QAAQ,EAAE,MAAM,CAAC;IACjB,aAAa,CAAC,EAAE,MAAM,CAAC;IACvB,MAAM,EAAE,cAAc,CAAC;IACvB,WAAW,EAAE,QAAQ,GAAG,KAAK,CAAC;IAC9B,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB,WAAW,CAAC,EAAE,OAAO,CAAC;CACvB;AAED,eAAO,MAAM,sBAAsB,EAAE,mBAAmB,EA0DvD,CAAC;AAEF,eAAO,MAAM,eAAe,GAAI,KAAK,MAAM,oCACQ,CAAC;AAEpD,UAAU,4BAA4B;IACpC,OAAO,EAAE,uBAAuB,CAAC;IACjC,CAAC,EAAE,SAAS,CAAC;IACb,cAAc,EAAE,CAAC,MAAM,EAAE,cAAc,KAAK,IAAI,CAAC;IACjD,iBAAiB,CAAC,EAAE,OAAO,CAAC;CAC7B;AA0BD,eAAO,MAAM,qBAAqB,GAAI,oDAKnC,4BAA4B,KAAG,QAAQ,EA4CzC,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"AssignConfirmModal.d.ts","sourceRoot":"","sources":["../../../src/components/thread/AssignConfirmModal.tsx"],"names":[],"mappings":"AACA,OAAO,EAAE,kBAAkB,EAAE,MAAM,
|
|
1
|
+
{"version":3,"file":"AssignConfirmModal.d.ts","sourceRoot":"","sources":["../../../src/components/thread/AssignConfirmModal.tsx"],"names":[],"mappings":"AACA,OAAO,EAAE,kBAAkB,EAAE,MAAM,aAAa,CAAC;AAGjD,UAAU,uBAAuB;IAC/B,IAAI,EAAE,OAAO,CAAC;IACd,KAAK,EAAE,kBAAkB,GAAG,IAAI,CAAC;IACjC,OAAO,EAAE,OAAO,CAAC;IACjB,QAAQ,EAAE,MAAM,IAAI,CAAC;IACrB,SAAS,EAAE,MAAM,IAAI,CAAC;IACtB,UAAU,CAAC,EAAE,MAAM,IAAI,CAAC;CACzB;AAED,QAAA,MAAM,kBAAkB,GAAI,4DAOzB,uBAAuB,4CAwDzB,CAAC;AAEF,eAAe,kBAAkB,CAAC"}
|
|
@@ -3,7 +3,7 @@ import { useState } from "react";
|
|
|
3
3
|
import { Popover, Input, Avatar, Spin, Badge, Divider } from "antd";
|
|
4
4
|
import { useTranslation } from "react-i18next";
|
|
5
5
|
import clsx from "clsx";
|
|
6
|
-
import { Icon } from "
|
|
6
|
+
import { Icon } from "../../components/icon";
|
|
7
7
|
import { useGetTeamSupporters } from "../../hooks/session/useGetTeamSupporters";
|
|
8
8
|
import { useAssignSession, useAutoAssignSession, } from "../../hooks/session/useAssignSession";
|
|
9
9
|
import { message as antdMessage } from "antd";
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"SessionSection.d.ts","sourceRoot":"","sources":["../../../src/components/thread/SessionSection.tsx"],"names":[],"mappings":"AAUA,OAAO,EAAkB,gBAAgB,EAAE,MAAM,
|
|
1
|
+
{"version":3,"file":"SessionSection.d.ts","sourceRoot":"","sources":["../../../src/components/thread/SessionSection.tsx"],"names":[],"mappings":"AAUA,OAAO,EAAkB,gBAAgB,EAAE,MAAM,aAAa,CAAC;AAqB/D,eAAO,MAAM,iBAAiB,GAAI,wBAG/B;IACD,OAAO,EAAE,gBAAgB,CAAC;IAC1B,QAAQ,EAAE,OAAO,CAAC;CACnB,4CAkNA,CAAC;AAiDF,UAAU,mBAAmB;IAC3B,QAAQ,EAAE,gBAAgB,EAAE,CAAC;IAC7B,SAAS,EAAE,OAAO,CAAC;CACpB;AAED,QAAA,MAAM,cAAc,GAAI,yBAAyB,mBAAmB,4CAmDnE,CAAC;AAEF,eAAe,cAAc,CAAC"}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
2
|
import { useBoolean, useDebounce } from "ahooks";
|
|
3
|
-
import { Icon } from "
|
|
3
|
+
import { Icon } from "../../components/icon";
|
|
4
4
|
import { Button, Select, Spin, Tag, Input, message, Avatar } from "antd";
|
|
5
5
|
import ManualAssignPopover from "./ManualAssignPopover";
|
|
6
6
|
import { useGetLabelSession } from "../../hooks/session/useGetLabelSession";
|
|
@@ -2,7 +2,7 @@ import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-run
|
|
|
2
2
|
import { Avatar, Input, message } from "antd";
|
|
3
3
|
import { useGetUserSideInfo } from "../../hooks/session/useGetUserSideInfo";
|
|
4
4
|
import useConversationStore from "../../store/conversation";
|
|
5
|
-
import { Icon } from "
|
|
5
|
+
import { Icon } from "../../components/icon";
|
|
6
6
|
import { useCreateNote } from "../../hooks/session/useCreateNote";
|
|
7
7
|
import { useUpdateNote } from "../../hooks/session/useUpdateNote";
|
|
8
8
|
import { useEffect, useRef, useState } from "react";
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ChatContext.d.ts","sourceRoot":"","sources":["../../src/context/ChatContext.tsx"],"names":[],"mappings":"AAEA,OAAO,sBAAsB,CAAC;AAG9B,OAAO,EACL,eAAe,EACf,iBAAiB,EAGlB,MAAM,
|
|
1
|
+
{"version":3,"file":"ChatContext.d.ts","sourceRoot":"","sources":["../../src/context/ChatContext.tsx"],"names":[],"mappings":"AAEA,OAAO,sBAAsB,CAAC;AAG9B,OAAO,EACL,eAAe,EACf,iBAAiB,EAGlB,MAAM,cAAc,CAAC;AAStB,eAAO,MAAM,WAAW,0CAOtB,CAAC;AAEH,eAAO,MAAM,cAAc,uBAAgC,CAAC;AAE5D,eAAO,MAAM,YAAY,GAAI,sBAAsB,iBAAiB,4CA0DnE,CAAC"}
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
export { useBizConversationList } from "./useBizConversationList";
|
|
2
2
|
export { useCreateBizConversation } from "./useCreateBizConversation";
|
|
3
|
+
export { useBizSendMessage } from "./useBizSendMessage";
|
|
3
4
|
export type { CreateBizConversationInput } from "./useCreateBizConversation";
|
|
4
5
|
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/hooks/biz/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,sBAAsB,EAAE,MAAM,0BAA0B,CAAC;AAClE,OAAO,EAAE,wBAAwB,EAAE,MAAM,4BAA4B,CAAC;AACtE,YAAY,EAAE,0BAA0B,EAAE,MAAM,4BAA4B,CAAC"}
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/hooks/biz/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,sBAAsB,EAAE,MAAM,0BAA0B,CAAC;AAClE,OAAO,EAAE,wBAAwB,EAAE,MAAM,4BAA4B,CAAC;AACtE,OAAO,EAAE,iBAAiB,EAAE,MAAM,qBAAqB,CAAC;AACxD,YAAY,EAAE,0BAA0B,EAAE,MAAM,4BAA4B,CAAC"}
|
package/dist/hooks/biz/index.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"useBizConversationList.d.ts","sourceRoot":"","sources":["../../../src/hooks/biz/useBizConversationList.ts"],"names":[],"mappings":"AAOA,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,
|
|
1
|
+
{"version":3,"file":"useBizConversationList.d.ts","sourceRoot":"","sources":["../../../src/hooks/biz/useBizConversationList.ts"],"names":[],"mappings":"AAOA,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,aAAa,CAAC;AAGvD,UAAU,4BAA4B;IACpC,OAAO,EAAE,OAAO,CAAC;IACjB,QAAQ,CAAC,EAAE,MAAM,CAAC;CACnB;AAED,UAAU,4BAA4B;IACpC,KAAK,EAAE,mBAAmB,EAAE,CAAC;IAC7B,kBAAkB,EAAE,OAAO,CAAC;IAC5B,WAAW,EAAE,OAAO,CAAC;IACrB,aAAa,EAAE,MAAM,IAAI,CAAC;CAC3B;AAED,eAAO,MAAM,sBAAsB,GACjC,QAAQ,4BAA4B,KACnC,4BA6CF,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"useBizSendMessage.d.ts","sourceRoot":"","sources":["../../../src/hooks/biz/useBizSendMessage.ts"],"names":[],"mappings":"AAiBA,eAAO,MAAM,iBAAiB;iCAOR,MAAM;CA6D3B,CAAC"}
|
|
@@ -0,0 +1,61 @@
|
|
|
1
|
+
import { useCallback } from "react";
|
|
2
|
+
import { MessageStatus } from "@openim/wasm-client-sdk";
|
|
3
|
+
import { useTranslation } from "react-i18next";
|
|
4
|
+
import { DChatSDK } from "../../constants/sdk";
|
|
5
|
+
import { createTextMessage, } from "../../hooks/message/useSendMessage";
|
|
6
|
+
import { pushNewMessage, updateOneMessage } from "../../hooks/message/useMessage";
|
|
7
|
+
import useBizConversationStore from "../../store/bizConversation";
|
|
8
|
+
import { isBizGroupChat, resolveBizAvatarUrl, resolveBizDisplayName, } from "../../utils/bizConversation";
|
|
9
|
+
import { generateContentBasedOnMessageType } from "../../utils/common";
|
|
10
|
+
import { emit } from "../../utils/events";
|
|
11
|
+
export const useBizSendMessage = () => {
|
|
12
|
+
const { t } = useTranslation("common");
|
|
13
|
+
const conversation = useBizConversationStore((state) => state.conversationData);
|
|
14
|
+
const sendTextMessage = useCallback(async (plainText) => {
|
|
15
|
+
var _a, _b;
|
|
16
|
+
const text = plainText.trim();
|
|
17
|
+
if (!text || !conversation)
|
|
18
|
+
return false;
|
|
19
|
+
const isGroup = isBizGroupChat(conversation);
|
|
20
|
+
const peerId = (_a = conversation.peer.id) !== null && _a !== void 0 ? _a : "";
|
|
21
|
+
const recvID = isGroup ? "" : peerId;
|
|
22
|
+
const groupID = isGroup ? peerId : "";
|
|
23
|
+
const message = await createTextMessage(text);
|
|
24
|
+
if (!message)
|
|
25
|
+
return false;
|
|
26
|
+
const messageItem = Object.assign(Object.assign({}, message), { ex: "{}", isInternal: false });
|
|
27
|
+
pushNewMessage(messageItem);
|
|
28
|
+
emit("BIZ_CHAT_SCROLL_TO_BOTTOM_IF_AT_BOTTOM");
|
|
29
|
+
try {
|
|
30
|
+
const desc = generateContentBasedOnMessageType(message.contentType, text) ||
|
|
31
|
+
t("new_message");
|
|
32
|
+
const showName = resolveBizDisplayName(conversation, "Droppii Chat");
|
|
33
|
+
const faceURL = (_b = resolveBizAvatarUrl(conversation)) !== null && _b !== void 0 ? _b : "";
|
|
34
|
+
const { data: successMessage } = await DChatSDK.sendMessage({
|
|
35
|
+
recvID,
|
|
36
|
+
groupID,
|
|
37
|
+
message: messageItem,
|
|
38
|
+
offlinePushInfo: {
|
|
39
|
+
title: showName,
|
|
40
|
+
desc,
|
|
41
|
+
ex: JSON.stringify({
|
|
42
|
+
icon: faceURL,
|
|
43
|
+
conversationId: conversation.conversationId,
|
|
44
|
+
title: showName,
|
|
45
|
+
desc,
|
|
46
|
+
}),
|
|
47
|
+
iOSPushSound: "default",
|
|
48
|
+
iOSBadgeCount: true,
|
|
49
|
+
},
|
|
50
|
+
});
|
|
51
|
+
updateOneMessage(Object.assign(Object.assign({}, successMessage), { ex: successMessage.ex || "{}" }));
|
|
52
|
+
return true;
|
|
53
|
+
}
|
|
54
|
+
catch (error) {
|
|
55
|
+
console.error("sendBizTextMessage", error);
|
|
56
|
+
updateOneMessage(Object.assign(Object.assign({}, messageItem), { status: MessageStatus.Failed }));
|
|
57
|
+
return false;
|
|
58
|
+
}
|
|
59
|
+
}, [conversation, t]);
|
|
60
|
+
return { sendTextMessage };
|
|
61
|
+
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"useCreateBizConversation.d.ts","sourceRoot":"","sources":["../../../src/hooks/biz/useCreateBizConversation.ts"],"names":[],"mappings":"AAQA,OAAO,KAAK,EACV,eAAe,EACf,WAAW,EACX,yBAAyB,EAC1B,MAAM,
|
|
1
|
+
{"version":3,"file":"useCreateBizConversation.d.ts","sourceRoot":"","sources":["../../../src/hooks/biz/useCreateBizConversation.ts"],"names":[],"mappings":"AAQA,OAAO,KAAK,EACV,eAAe,EACf,WAAW,EACX,yBAAyB,EAC1B,MAAM,aAAa,CAAC;AAErB,MAAM,WAAW,0BAA0B;IACzC,UAAU,EAAE,MAAM,CAAC;IACnB,YAAY,EAAE,eAAe,CAAC;IAC9B,QAAQ,EAAE,WAAW,CAAC;CACvB;AAED,eAAO,MAAM,wBAAwB,gIAepC,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"useFetchCannedCategories.d.ts","sourceRoot":"","sources":["../../../src/hooks/cannedResponse/useFetchCannedCategories.ts"],"names":[],"mappings":"AAIA,OAAO,EAAgB,uBAAuB,EAAE,MAAM,
|
|
1
|
+
{"version":3,"file":"useFetchCannedCategories.d.ts","sourceRoot":"","sources":["../../../src/hooks/cannedResponse/useFetchCannedCategories.ts"],"names":[],"mappings":"AAIA,OAAO,EAAgB,uBAAuB,EAAE,MAAM,aAAa,CAAC;AAEpE,eAAO,MAAM,wBAAwB,GAAI,SAAS,MAAM,EAAE,UAAU,OAAO,qFAUvE,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"useFetchCannedResponse.d.ts","sourceRoot":"","sources":["../../../src/hooks/cannedResponse/useFetchCannedResponse.tsx"],"names":[],"mappings":"AAEA,OAAO,EACL,YAAY,EACZ,mBAAmB,EACnB,2BAA2B,EAC5B,MAAM,
|
|
1
|
+
{"version":3,"file":"useFetchCannedResponse.d.ts","sourceRoot":"","sources":["../../../src/hooks/cannedResponse/useFetchCannedResponse.tsx"],"names":[],"mappings":"AAEA,OAAO,EACL,YAAY,EACZ,mBAAmB,EACnB,2BAA2B,EAC5B,MAAM,aAAa,CAAC;AAMrB,eAAO,MAAM,sBAAsB,GACjC,SAAS,2BAA2B;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAyDrC,CAAC"}
|
|
@@ -2,7 +2,7 @@ import { SessionType } from "@openim/wasm-client-sdk";
|
|
|
2
2
|
import { useCallback, useEffect, useMemo, useState } from "react";
|
|
3
3
|
import { DChatSDK } from "../../constants/sdk";
|
|
4
4
|
import useUsersInfoStore from "../../store/usersInfo";
|
|
5
|
-
import { extractUserIdsFromConversations } from "
|
|
5
|
+
import { extractUserIdsFromConversations } from "../../hooks/user/useUsersInfo";
|
|
6
6
|
import { useChatContext } from "../../context/ChatContext";
|
|
7
7
|
export const markConversationMessageAsRead = (conversationId) => {
|
|
8
8
|
if (!conversationId)
|
|
@@ -2,12 +2,12 @@ import { useEffect } from "react";
|
|
|
2
2
|
import { DChatSDK } from "../../constants/sdk";
|
|
3
3
|
import { CbEvents, MessageType, SessionType, } from "@openim/wasm-client-sdk";
|
|
4
4
|
import { BusinessNotificationType, ConnectStatus, CustomType, SyncStatus, } from "../../types/chat";
|
|
5
|
-
import { pushNewMessage, updateOneMessage } from "
|
|
5
|
+
import { pushNewMessage, updateOneMessage } from "../../hooks/message/useMessage";
|
|
6
6
|
import { useChatContext } from "../../context/ChatContext";
|
|
7
7
|
import useConversationStore from "../../store/conversation";
|
|
8
8
|
import useAuthStore from "../../store/auth";
|
|
9
9
|
import { useRefetchChatToken } from "../../hooks/init/useChatToken";
|
|
10
|
-
import { updateSession } from "
|
|
10
|
+
import { updateSession } from "../../hooks/session/useUpdateSession";
|
|
11
11
|
import { QUERY_KEYS } from "../../services/query";
|
|
12
12
|
import { useQueryClient } from "@tanstack/react-query";
|
|
13
13
|
import { isGroupSession } from "../../utils/imCommon";
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
import { RefObject } from "react";
|
|
2
|
+
import { MessageItem } from "@openim/wasm-client-sdk";
|
|
3
|
+
export declare const MESSAGE_LIST_BOTTOM_THRESHOLD = -5;
|
|
4
|
+
export interface MessageListLoadState {
|
|
5
|
+
initLoading: boolean;
|
|
6
|
+
hasMoreOld: boolean;
|
|
7
|
+
hasMoreNew: boolean;
|
|
8
|
+
messageList: MessageItem[];
|
|
9
|
+
}
|
|
10
|
+
interface UseMessageListScrollParams {
|
|
11
|
+
conversationId?: string;
|
|
12
|
+
userId?: string;
|
|
13
|
+
loadState: MessageListLoadState;
|
|
14
|
+
latestLoadState: RefObject<MessageListLoadState | null>;
|
|
15
|
+
moreOldLoading: boolean;
|
|
16
|
+
moreNewLoading: boolean;
|
|
17
|
+
getMoreOldMessages: () => void | Promise<unknown>;
|
|
18
|
+
getMoreNewMessages: () => void | Promise<unknown>;
|
|
19
|
+
}
|
|
20
|
+
export declare const useMessageListScroll: ({ conversationId, userId, loadState, latestLoadState, moreOldLoading, moreNewLoading, getMoreOldMessages, getMoreNewMessages, }: UseMessageListScrollParams) => {
|
|
21
|
+
scrollRef: RefObject<HTMLDivElement>;
|
|
22
|
+
handleMarkConversationMessageAsRead: () => void;
|
|
23
|
+
loadMoreOldMessage: () => void;
|
|
24
|
+
handleInfiniteScroll: (e: React.UIEvent<HTMLDivElement>) => void;
|
|
25
|
+
scrollToBottom: () => void;
|
|
26
|
+
scrollToBottomIfAtBottom: () => void;
|
|
27
|
+
};
|
|
28
|
+
export {};
|
|
29
|
+
//# sourceMappingURL=useMessageListScroll.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"useMessageListScroll.d.ts","sourceRoot":"","sources":["../../../src/hooks/message/useMessageListScroll.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,SAAS,EAAkC,MAAM,OAAO,CAAC;AAClE,OAAO,EAAE,WAAW,EAAE,MAAM,yBAAyB,CAAC;AAKtD,eAAO,MAAM,6BAA6B,KAAK,CAAC;AAEhD,MAAM,WAAW,oBAAoB;IACnC,WAAW,EAAE,OAAO,CAAC;IACrB,UAAU,EAAE,OAAO,CAAC;IACpB,UAAU,EAAE,OAAO,CAAC;IACpB,WAAW,EAAE,WAAW,EAAE,CAAC;CAC5B;AAED,UAAU,0BAA0B;IAClC,cAAc,CAAC,EAAE,MAAM,CAAC;IACxB,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,SAAS,EAAE,oBAAoB,CAAC;IAChC,eAAe,EAAE,SAAS,CAAC,oBAAoB,GAAG,IAAI,CAAC,CAAC;IACxD,cAAc,EAAE,OAAO,CAAC;IACxB,cAAc,EAAE,OAAO,CAAC;IACxB,kBAAkB,EAAE,MAAM,IAAI,GAAG,OAAO,CAAC,OAAO,CAAC,CAAC;IAClD,kBAAkB,EAAE,MAAM,IAAI,GAAG,OAAO,CAAC,OAAO,CAAC,CAAC;CACnD;AAED,eAAO,MAAM,oBAAoB,GAAI,iIASlC,0BAA0B;;;;8BAiDrB,KAAK,CAAC,OAAO,CAAC,cAAc,CAAC;;;CAkDpC,CAAC"}
|
|
@@ -0,0 +1,88 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { useCallback, useEffect, useRef } from "react";
|
|
3
|
+
import { useDebounceFn } from "ahooks";
|
|
4
|
+
import { isNumber } from "lodash";
|
|
5
|
+
import { markConversationMessageAsRead } from "../../hooks/conversation/useConversation";
|
|
6
|
+
export const MESSAGE_LIST_BOTTOM_THRESHOLD = -5;
|
|
7
|
+
export const useMessageListScroll = ({ conversationId, userId, loadState, latestLoadState, moreOldLoading, moreNewLoading, getMoreOldMessages, getMoreNewMessages, }) => {
|
|
8
|
+
const scrollRef = useRef(null);
|
|
9
|
+
const handleMarkConversationMessageAsRead = useCallback(() => {
|
|
10
|
+
var _a, _b, _c, _d;
|
|
11
|
+
const lastMessage = (_b = (_a = latestLoadState.current) === null || _a === void 0 ? void 0 : _a.messageList) === null || _b === void 0 ? void 0 : _b[0];
|
|
12
|
+
if (!conversationId ||
|
|
13
|
+
((_c = latestLoadState.current) === null || _c === void 0 ? void 0 : _c.hasMoreNew) ||
|
|
14
|
+
moreNewLoading ||
|
|
15
|
+
(lastMessage === null || lastMessage === void 0 ? void 0 : lastMessage.isRead) !== false ||
|
|
16
|
+
(lastMessage === null || lastMessage === void 0 ? void 0 : lastMessage.sendID) === userId ||
|
|
17
|
+
!isNumber((_d = scrollRef.current) === null || _d === void 0 ? void 0 : _d.scrollTop) ||
|
|
18
|
+
scrollRef.current.scrollTop < MESSAGE_LIST_BOTTOM_THRESHOLD) {
|
|
19
|
+
return;
|
|
20
|
+
}
|
|
21
|
+
markConversationMessageAsRead(conversationId);
|
|
22
|
+
}, [conversationId, latestLoadState, moreNewLoading, userId]);
|
|
23
|
+
useEffect(() => {
|
|
24
|
+
if (!loadState.hasMoreNew &&
|
|
25
|
+
!loadState.initLoading &&
|
|
26
|
+
loadState.messageList.length > 0) {
|
|
27
|
+
handleMarkConversationMessageAsRead();
|
|
28
|
+
}
|
|
29
|
+
}, [
|
|
30
|
+
loadState.messageList.length,
|
|
31
|
+
loadState.hasMoreNew,
|
|
32
|
+
loadState.initLoading,
|
|
33
|
+
handleMarkConversationMessageAsRead,
|
|
34
|
+
]);
|
|
35
|
+
const loadMoreOldMessage = useCallback(() => {
|
|
36
|
+
if (!loadState.hasMoreOld || moreOldLoading)
|
|
37
|
+
return;
|
|
38
|
+
getMoreOldMessages();
|
|
39
|
+
}, [loadState.hasMoreOld, moreOldLoading, getMoreOldMessages]);
|
|
40
|
+
const { run: loadMoreNewMessage } = useDebounceFn(() => {
|
|
41
|
+
if (!loadState.hasMoreNew || moreNewLoading)
|
|
42
|
+
return;
|
|
43
|
+
getMoreNewMessages();
|
|
44
|
+
}, { wait: 200 });
|
|
45
|
+
const handleInfiniteScroll = useCallback((e) => {
|
|
46
|
+
const target = e.target;
|
|
47
|
+
if (target.scrollTop > MESSAGE_LIST_BOTTOM_THRESHOLD) {
|
|
48
|
+
handleMarkConversationMessageAsRead();
|
|
49
|
+
loadMoreNewMessage();
|
|
50
|
+
}
|
|
51
|
+
}, [handleMarkConversationMessageAsRead, loadMoreNewMessage]);
|
|
52
|
+
const scrollToBottom = useCallback(() => {
|
|
53
|
+
handleMarkConversationMessageAsRead();
|
|
54
|
+
setTimeout(() => {
|
|
55
|
+
var _a, _b, _c;
|
|
56
|
+
if (isNumber((_a = scrollRef.current) === null || _a === void 0 ? void 0 : _a.scrollTop) &&
|
|
57
|
+
scrollRef.current.scrollTop >= MESSAGE_LIST_BOTTOM_THRESHOLD) {
|
|
58
|
+
return;
|
|
59
|
+
}
|
|
60
|
+
(_b = scrollRef.current) === null || _b === void 0 ? void 0 : _b.scrollTo({
|
|
61
|
+
top: (_c = scrollRef.current) === null || _c === void 0 ? void 0 : _c.scrollHeight,
|
|
62
|
+
behavior: "smooth",
|
|
63
|
+
});
|
|
64
|
+
});
|
|
65
|
+
}, [handleMarkConversationMessageAsRead]);
|
|
66
|
+
const scrollToBottomIfAtBottom = useCallback(() => {
|
|
67
|
+
setTimeout(() => {
|
|
68
|
+
var _a;
|
|
69
|
+
if (!isNumber((_a = scrollRef.current) === null || _a === void 0 ? void 0 : _a.scrollTop) ||
|
|
70
|
+
scrollRef.current.scrollTop < MESSAGE_LIST_BOTTOM_THRESHOLD) {
|
|
71
|
+
return;
|
|
72
|
+
}
|
|
73
|
+
scrollRef.current.scrollTo({
|
|
74
|
+
top: scrollRef.current.scrollHeight,
|
|
75
|
+
behavior: "smooth",
|
|
76
|
+
});
|
|
77
|
+
handleMarkConversationMessageAsRead();
|
|
78
|
+
});
|
|
79
|
+
}, [handleMarkConversationMessageAsRead]);
|
|
80
|
+
return {
|
|
81
|
+
scrollRef,
|
|
82
|
+
handleMarkConversationMessageAsRead,
|
|
83
|
+
loadMoreOldMessage,
|
|
84
|
+
handleInfiniteScroll,
|
|
85
|
+
scrollToBottom,
|
|
86
|
+
scrollToBottomIfAtBottom,
|
|
87
|
+
};
|
|
88
|
+
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"usePullSessionMessages.d.ts","sourceRoot":"","sources":["../../../src/hooks/message/usePullSessionMessages.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,WAAW,EAAE,MAAM,yBAAyB,CAAC;AAItD,OAAO,EAEL,2BAA2B,EAE5B,MAAM,
|
|
1
|
+
{"version":3,"file":"usePullSessionMessages.d.ts","sourceRoot":"","sources":["../../../src/hooks/message/usePullSessionMessages.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,WAAW,EAAE,MAAM,yBAAyB,CAAC;AAItD,OAAO,EAEL,2BAA2B,EAE5B,MAAM,aAAa,CAAC;AAOrB,UAAU,4BAA4B;IACpC,cAAc,CAAC,EAAE,MAAM,CAAC;IACxB,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,OAAO,CAAC,EAAE,OAAO,CAAC;CACnB;AAED,eAAO,MAAM,wBAAwB,GAAU,8CAI5C,2BAA2B,KAAG,OAAO,CAAC,WAAW,EAAE,CAerD,CAAC;AAEF,eAAO,MAAM,sBAAsB,GAAI,sCAIpC,4BAA4B,yEAa9B,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"useSendMessage.d.ts","sourceRoot":"","sources":["../../../src/hooks/message/useSendMessage.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,eAAe,EACf,WAAW,EAGZ,MAAM,yBAAyB,CAAC;AAEjC,OAAO,EACL,iBAAiB,EACjB,mBAAmB,EACnB,oBAAoB,EACpB,oBAAoB,EACrB,MAAM,
|
|
1
|
+
{"version":3,"file":"useSendMessage.d.ts","sourceRoot":"","sources":["../../../src/hooks/message/useSendMessage.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,eAAe,EACf,WAAW,EAGZ,MAAM,yBAAyB,CAAC;AAEjC,OAAO,EACL,iBAAiB,EACjB,mBAAmB,EACnB,oBAAoB,EACpB,oBAAoB,EACrB,MAAM,cAAc,CAAC;AAYtB,OAAO,EAAE,UAAU,EAAE,MAAM,MAAM,CAAC;AAUlC,OAAO,EAAgB,gBAAgB,EAAyB,MAAM,aAAa,CAAC;AAkBpF,eAAO,MAAM,iBAAiB,GAAI,SAAS;IACzC,WAAW,EAAE,MAAM,CAAC;IACpB,WAAW,EAAE,MAAM,CAAC;CACrB,YAE0C,CAAC;AAE5C,eAAO,MAAM,iBAAiB,GAAU,MAAM,MAAM,gCAanD,CAAC;AAEF,eAAO,MAAM,wBAAwB,GAAU,MAAM,oBAAoB,gCAaxE,CAAC;AAEF,eAAO,MAAM,mBAAmB,GAAU,iBAAiB,eAAe,gCAazE,CAAC;AAEF,eAAO,MAAM,wBAAwB,GAAU,MAAM,oBAAoB,gCAaxE,CAAC;AAEF,eAAO,MAAM,uBAAuB,GAAU,MAAM,mBAAmB,gCAatE,CAAC;AAEF,eAAO,MAAM,oBAAoB,GAAU,MAAM,MAAM,EAAE,MAAM,MAAM,EAAE,gCActE,CAAC;AAEF,eAAO,MAAM,kBAAkB,GAC7B,MAAM,MAAM,EACZ,eAAe,WAAW,gCAc3B,CAAC;AAEF,eAAO,MAAM,cAAc;4EA0NpB;QACD,SAAS,EAAE,MAAM,CAAC;QAClB,QAAQ,EAAE,MAAM,CAAC;QACjB,cAAc,CAAC,EAAE,gBAAgB,CAAC;QAClC,UAAU,EAAE,OAAO,CAAC;KACrB;oFAoCE;QACD,QAAQ,EAAE,MAAM,CAAC;QACjB,SAAS,EAAE,MAAM,CAAC;QAClB,KAAK,EAAE,UAAU,EAAE,CAAC;QACpB,cAAc,CAAC,EAAE,gBAAgB,CAAC;QAClC,UAAU,EAAE,OAAO,CAAC;KACrB;mCA5JqB,WAAW;CA6RpC,CAAC;AAEF,eAAO,MAAM,yBAAyB,GAAI,+BAGvC;IACD,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,cAAc,CAAC,EAAE,gBAAgB,CAAC;CACnC,KAWM,iBACN,CAAC"}
|
|
@@ -13,7 +13,7 @@ import { apiInstance } from "../../services/api";
|
|
|
13
13
|
import { ENDPOINTS } from "../../services/routes";
|
|
14
14
|
import { extractLinks, generateContentBasedOnMessageType, } from "../../utils/common";
|
|
15
15
|
import { SessionStatus, SessionTag } from "../../types/chat";
|
|
16
|
-
import { updateSession } from "
|
|
16
|
+
import { updateSession } from "../../hooks/session/useUpdateSession";
|
|
17
17
|
import { invalidateSessionQueries } from "../../utils/queryHelpers";
|
|
18
18
|
const messageFileStore = new Map();
|
|
19
19
|
const MEDIA_CONTENT_TYPES = new Set([
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"useSearchMessage.d.ts","sourceRoot":"","sources":["../../../src/hooks/search/useSearchMessage.ts"],"names":[],"mappings":"AAIA,OAAO,EACL,iBAAiB,EACjB,oBAAoB,EACpB,qBAAqB,EACtB,MAAM,
|
|
1
|
+
{"version":3,"file":"useSearchMessage.d.ts","sourceRoot":"","sources":["../../../src/hooks/search/useSearchMessage.ts"],"names":[],"mappings":"AAIA,OAAO,EACL,iBAAiB,EACjB,oBAAoB,EACpB,qBAAqB,EACtB,MAAM,aAAa,CAAC;AAMrB,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,CAAA;KAAE,CAAC;CAC3D;AAED,eAAO,MAAM,gBAAgB,GAAI,uBAG9B,uBAAuB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAsEzB,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"useAssignSession.d.ts","sourceRoot":"","sources":["../../../src/hooks/session/useAssignSession.ts"],"names":[],"mappings":"AAIA,OAAO,EAAE,YAAY,EAAE,MAAM,
|
|
1
|
+
{"version":3,"file":"useAssignSession.d.ts","sourceRoot":"","sources":["../../../src/hooks/session/useAssignSession.ts"],"names":[],"mappings":"AAIA,OAAO,EAAE,YAAY,EAAE,MAAM,aAAa,CAAC;AAM3C,UAAU,mBAAmB;IAC3B,SAAS,EAAE,MAAM,CAAC;IAClB,WAAW,EAAE,MAAM,CAAC;CACrB;AAED,eAAO,MAAM,gBAAgB,qHA0B5B,CAAC;AAEF,UAAU,uBAAuB;IAC/B,SAAS,EAAE,MAAM,CAAC;CACnB;AAED,eAAO,MAAM,oBAAoB,yHAqBhC,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"useCloseSession.d.ts","sourceRoot":"","sources":["../../../src/hooks/session/useCloseSession.ts"],"names":[],"mappings":"AAIA,OAAO,EAAE,YAAY,EAAE,MAAM,
|
|
1
|
+
{"version":3,"file":"useCloseSession.d.ts","sourceRoot":"","sources":["../../../src/hooks/session/useCloseSession.ts"],"names":[],"mappings":"AAIA,OAAO,EAAE,YAAY,EAAE,MAAM,aAAa,CAAC;AAI3C,eAAO,MAAM,eAAe,wGAqB3B,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"useCreateNote.d.ts","sourceRoot":"","sources":["../../../src/hooks/session/useCreateNote.ts"],"names":[],"mappings":"AAIA,OAAO,EAAE,YAAY,EAAE,MAAM,
|
|
1
|
+
{"version":3,"file":"useCreateNote.d.ts","sourceRoot":"","sources":["../../../src/hooks/session/useCreateNote.ts"],"names":[],"mappings":"AAIA,OAAO,EAAE,YAAY,EAAE,MAAM,aAAa,CAAC;AAG3C,eAAO,MAAM,aAAa;oBAQJ,MAAM;aACb,MAAM;cACL,MAAM;WAkBlB,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"useGetLabelSession.d.ts","sourceRoot":"","sources":["../../../src/hooks/session/useGetLabelSession.ts"],"names":[],"mappings":"AAIA,OAAO,EAAgB,cAAc,EAAE,MAAM,
|
|
1
|
+
{"version":3,"file":"useGetLabelSession.d.ts","sourceRoot":"","sources":["../../../src/hooks/session/useGetLabelSession.ts"],"names":[],"mappings":"AAIA,OAAO,EAAgB,cAAc,EAAE,MAAM,aAAa,CAAC;AAG3D,eAAO,MAAM,kBAAkB,+EAiB9B,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"useGetListSessionByConversation.d.ts","sourceRoot":"","sources":["../../../src/hooks/session/useGetListSessionByConversation.ts"],"names":[],"mappings":"AAIA,OAAO,EAAgB,gBAAgB,EAAE,MAAM,
|
|
1
|
+
{"version":3,"file":"useGetListSessionByConversation.d.ts","sourceRoot":"","sources":["../../../src/hooks/session/useGetListSessionByConversation.ts"],"names":[],"mappings":"AAIA,OAAO,EAAgB,gBAAgB,EAAE,MAAM,aAAa,CAAC;AAI7D,UAAU,oBAAoB;IAC5B,cAAc,EAAE,MAAM,CAAC;IACvB,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,QAAQ,CAAC,EAAE,MAAM,CAAC;CACnB;AAED,eAAO,MAAM,+BAA+B,GAAI,qCAI7C,oBAAoB,8EAyBtB,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"useGetSession.d.ts","sourceRoot":"","sources":["../../../src/hooks/session/useGetSession.ts"],"names":[],"mappings":"AAaA,OAAO,EACL,YAAY,EAIb,MAAM,
|
|
1
|
+
{"version":3,"file":"useGetSession.d.ts","sourceRoot":"","sources":["../../../src/hooks/session/useGetSession.ts"],"names":[],"mappings":"AAaA,OAAO,EACL,YAAY,EAIb,MAAM,aAAa,CAAC;AACrB,OAAO,EAAE,cAAc,EAAE,gBAAgB,EAAE,MAAM,cAAc,CAAC;AAMhE,UAAU,kBAAkB;IAC1B,MAAM,EAAE,cAAc,CAAC;IACvB,OAAO,CAAC,EAAE;QACR,QAAQ,CAAC,EAAE,MAAM,CAAC;QAClB,SAAS,CAAC,EAAE,OAAO,CAAC;KACrB,CAAC;CACH;AA2JD,eAAO,MAAM,aAAa,GAAI,sBAG3B,kBAAkB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAyEpB,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"useGetSessionSummary.d.ts","sourceRoot":"","sources":["../../../src/hooks/session/useGetSessionSummary.ts"],"names":[],"mappings":"AAIA,OAAO,EAAgB,uBAAuB,EAAE,MAAM,
|
|
1
|
+
{"version":3,"file":"useGetSessionSummary.d.ts","sourceRoot":"","sources":["../../../src/hooks/session/useGetSessionSummary.ts"],"names":[],"mappings":"AAIA,OAAO,EAAgB,uBAAuB,EAAE,MAAM,aAAa,CAAC;AAGpE,eAAO,MAAM,oBAAoB,sFAY7B,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"useGetTeamSessionSummary.d.ts","sourceRoot":"","sources":["../../../src/hooks/session/useGetTeamSessionSummary.ts"],"names":[],"mappings":"AAIA,OAAO,EAAgB,uBAAuB,EAAE,MAAM,
|
|
1
|
+
{"version":3,"file":"useGetTeamSessionSummary.d.ts","sourceRoot":"","sources":["../../../src/hooks/session/useGetTeamSessionSummary.ts"],"names":[],"mappings":"AAIA,OAAO,EAAgB,uBAAuB,EAAE,MAAM,aAAa,CAAC;AAGpE,eAAO,MAAM,wBAAwB,wFAcpC,CAAC"}
|