@droppii-org/chat-sdk 0.1.89 → 0.1.91
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/components/conversation-detail/ConversationDetailHeader.d.ts +1 -1
- package/dist/components/conversation-detail/ConversationDetailHeader.d.ts.map +1 -1
- package/dist/components/conversation-detail/PinnedMessageBar.js +1 -1
- package/dist/components/conversation-detail/PinnedMessageItem.d.ts +1 -1
- package/dist/components/conversation-detail/PinnedMessageItem.d.ts.map +1 -1
- package/dist/components/conversation-detail/PinnedMessageItem.js +5 -8
- package/dist/components/conversation-detail/ThreadProfilePanel.d.ts +1 -1
- package/dist/components/conversation-detail/ThreadProfilePanel.d.ts.map +1 -1
- package/dist/components/media-collection/FileCollection.js +1 -1
- package/dist/components/media-collection/ImageCollection.js +1 -1
- package/dist/components/media-collection/LinkCollection.js +1 -1
- package/dist/components/media-collection/VideoCollection.js +1 -1
- package/dist/components/media-resources/constants.d.ts +1 -1
- package/dist/components/media-resources/constants.d.ts.map +1 -1
- package/dist/components/media-resources/constants.js +1 -1
- package/dist/components/message/GroupMembersDrawer.js +1 -1
- package/dist/components/message/MediaPreviewIcon.d.ts +1 -1
- package/dist/components/message/MediaPreviewIcon.d.ts.map +1 -1
- package/dist/components/message/MediaPreviewIcon.js +1 -1
- package/dist/components/message/item/CustomMessage.d.ts +1 -1
- package/dist/components/message/item/CustomMessage.d.ts.map +1 -1
- package/dist/components/message/item/FileMessage.d.ts +1 -1
- package/dist/components/message/item/FileMessage.d.ts.map +1 -1
- package/dist/components/message/item/FileMessage.js +1 -1
- package/dist/components/message/item/ImageMessage.d.ts +1 -1
- package/dist/components/message/item/ImageMessage.d.ts.map +1 -1
- package/dist/components/message/item/ImageMessage.js +1 -1
- package/dist/components/message/item/MergeImageMessage.d.ts +1 -1
- package/dist/components/message/item/MergeImageMessage.d.ts.map +1 -1
- package/dist/components/message/item/MergeImageMessage.js +1 -1
- package/dist/components/message/item/MessageStatusIndicator.d.ts +1 -1
- package/dist/components/message/item/MessageStatusIndicator.d.ts.map +1 -1
- package/dist/components/message/item/MessageStatusIndicator.js +1 -1
- package/dist/components/message/item/QuoteMessage.d.ts +1 -1
- package/dist/components/message/item/QuoteMessage.d.ts.map +1 -1
- package/dist/components/message/item/StickerMessage.d.ts +1 -1
- package/dist/components/message/item/StickerMessage.d.ts.map +1 -1
- package/dist/components/message/item/SystemLogMessage.d.ts +1 -1
- package/dist/components/message/item/SystemLogMessage.d.ts.map +1 -1
- package/dist/components/message/item/TextMessage.d.ts +1 -1
- package/dist/components/message/item/TextMessage.d.ts.map +1 -1
- package/dist/components/message/item/UrlTextMessage.d.ts +1 -1
- package/dist/components/message/item/UrlTextMessage.d.ts.map +1 -1
- package/dist/components/message/item/VideoMessage.d.ts +1 -1
- package/dist/components/message/item/VideoMessage.d.ts.map +1 -1
- package/dist/components/message/item/VideoMessage.js +1 -1
- package/dist/components/message/item/index.d.ts +1 -1
- package/dist/components/message/item/index.d.ts.map +1 -1
- package/dist/components/message/item/index.js +1 -1
- package/dist/components/message/item/renderMessageContent.d.ts +1 -1
- package/dist/components/message/item/renderMessageContent.d.ts.map +1 -1
- package/dist/components/message/item/renderMessageContent.js +1 -1
- package/dist/components/message/reply/ReplyPreviewMedia.d.ts +1 -1
- package/dist/components/message/reply/ReplyPreviewMedia.d.ts.map +1 -1
- package/dist/components/message/reply/ReplyPreviewMedia.js +1 -1
- package/dist/components/message/reply/ReplyQuoteContent.d.ts +1 -1
- package/dist/components/message/reply/ReplyQuoteContent.d.ts.map +1 -1
- package/dist/components/message/reply/ReplyQuoteContent.js +1 -1
- package/dist/components/message/toolbox/getCopyableMessageText.d.ts +1 -1
- package/dist/components/message/toolbox/getCopyableMessageText.d.ts.map +1 -1
- package/dist/components/message/toolbox/getCopyableMessageText.js +1 -1
- package/dist/components/message/toolbox/isPinnableMessageType.d.ts +1 -1
- package/dist/components/message/toolbox/isPinnableMessageType.d.ts.map +1 -1
- package/dist/components/message/toolbox/isPinnableMessageType.js +1 -1
- package/dist/components/message/toolbox/useMessageToolboxVisibility.d.ts +1 -1
- package/dist/components/message/toolbox/useMessageToolboxVisibility.d.ts.map +1 -1
- package/dist/components/message/toolbox/useMessageToolboxVisibility.js +1 -1
- package/dist/components/search-conversation/SearchAll.js +1 -1
- package/dist/components/search-conversation/SearchConversationAsMessages.js +1 -1
- package/dist/components/search-conversation/SearchConversationMyInbox.js +1 -1
- package/dist/components/search-conversation/SearchMessageOnCurrentConversation.js +1 -1
- package/dist/components/search-conversation/item/SearchItemAsMessage.d.ts +1 -1
- package/dist/components/search-conversation/item/SearchItemAsMessage.d.ts.map +1 -1
- package/dist/components/search-conversation/item/SearchItemAsMessage.js +1 -1
- package/dist/constants/im.d.ts +1 -1
- package/dist/constants/im.d.ts.map +1 -1
- package/dist/constants/im.js +1 -1
- package/dist/constants/sdk.d.ts +1 -1
- package/dist/constants/sdk.d.ts.map +1 -1
- package/dist/constants/sdk.js +1 -1
- package/dist/hooks/conversation/useBotFlow.d.ts.map +1 -1
- package/dist/hooks/conversation/useBotFlow.js +12 -2
- package/dist/hooks/conversation/useConversation.d.ts +1 -1
- package/dist/hooks/conversation/useConversation.d.ts.map +1 -1
- package/dist/hooks/conversation/useConversation.js +1 -1
- package/dist/hooks/conversation/useConversationAvatarUrl.d.ts +1 -1
- package/dist/hooks/conversation/useConversationAvatarUrl.d.ts.map +1 -1
- package/dist/hooks/conversation/useConversationList.js +1 -1
- package/dist/hooks/conversation/useResolveConversation.d.ts.map +1 -1
- package/dist/hooks/conversation/useResolveConversation.js +67 -44
- package/dist/hooks/global/useGlobalEvent.js +1 -1
- package/dist/hooks/group/useGroupMembers.d.ts +1 -1
- package/dist/hooks/group/useGroupMembers.d.ts.map +1 -1
- package/dist/hooks/group/useGroupMembers.js +1 -1
- package/dist/hooks/message/useMessage.d.ts +1 -1
- package/dist/hooks/message/useMessage.d.ts.map +1 -1
- package/dist/hooks/message/useMessage.js +1 -1
- package/dist/hooks/message/useMessageListScroll.d.ts +1 -1
- package/dist/hooks/message/useMessageListScroll.d.ts.map +1 -1
- package/dist/hooks/message/useMessageResources.d.ts +1 -1
- package/dist/hooks/message/useMessageResources.d.ts.map +1 -1
- package/dist/hooks/message/usePinnedMessages.d.ts +1 -1
- package/dist/hooks/message/useRevokeMessage.js +1 -1
- package/dist/hooks/message/useSendMessage.d.ts +1 -1
- package/dist/hooks/message/useSendMessage.d.ts.map +1 -1
- package/dist/hooks/message/useSendMessage.js +1 -1
- package/dist/hooks/session/useConversationSessionState.d.ts +1 -1
- package/dist/hooks/session/useConversationSessionState.d.ts.map +1 -1
- package/dist/hooks/session/useGetSession.d.ts.map +1 -1
- package/dist/hooks/session/useGetSession.js +2 -0
- package/dist/hooks/session/useSessionLatestPreview.js +1 -1
- package/dist/hooks/user/useAuth.d.ts +1 -1
- package/dist/hooks/user/useAuth.js +1 -1
- package/dist/hooks/user/useUpdateFcmToken.js +1 -1
- package/dist/hooks/user/useUsersInfo.d.ts +1 -1
- package/dist/hooks/user/useUsersInfo.d.ts.map +1 -1
- package/dist/hooks/user/useUsersInfo.js +1 -1
- package/dist/index.d.ts +1 -1
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +1 -1
- package/dist/store/auth.js +1 -1
- package/dist/store/conversation.js +1 -1
- package/dist/store/type.d.ts +1 -1
- package/dist/store/type.d.ts.map +1 -1
- package/dist/styles/global.css +1 -1
- package/dist/types/chat.d.ts +1 -1
- package/dist/types/chat.d.ts.map +1 -1
- package/dist/types/conversation.d.ts +1 -1
- package/dist/types/conversation.d.ts.map +1 -1
- package/dist/types/customMessage.d.ts +1 -1
- package/dist/types/customMessage.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/common.d.ts +1 -1
- package/dist/utils/common.d.ts.map +1 -1
- package/dist/utils/common.js +1 -1
- package/dist/utils/conversation.d.ts +1 -1
- package/dist/utils/conversation.d.ts.map +1 -1
- package/dist/utils/customMessage.d.ts +1 -1
- package/dist/utils/customMessage.d.ts.map +1 -1
- package/dist/utils/events.d.ts +1 -1
- package/dist/utils/events.d.ts.map +1 -1
- package/dist/utils/imCommon.d.ts +5 -3
- package/dist/utils/imCommon.d.ts.map +1 -1
- package/dist/utils/messageLog.d.ts +1 -1
- package/dist/utils/messageLog.d.ts.map +1 -1
- package/dist/utils/messageLog.js +1 -1
- package/package.json +2 -2
package/dist/constants/im.d.ts
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"im.d.ts","sourceRoot":"","sources":["../../src/constants/im.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAE,MAAM,
|
|
1
|
+
{"version":3,"file":"im.d.ts","sourceRoot":"","sources":["../../src/constants/im.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAE,MAAM,8BAA8B,CAAC;AAE3D,eAAO,MAAM,iBAAiB,eAAgD,CAAC"}
|
package/dist/constants/im.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { SessionType } from "@
|
|
1
|
+
import { SessionType } from "@droppii-org/wasm-client-sdk";
|
|
2
2
|
export const GroupSessionTypes = [SessionType.Group, SessionType.WorkingGroup];
|
package/dist/constants/sdk.d.ts
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"sdk.d.ts","sourceRoot":"","sources":["../../src/constants/sdk.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAAE,MAAM,
|
|
1
|
+
{"version":3,"file":"sdk.d.ts","sourceRoot":"","sources":["../../src/constants/sdk.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAAE,MAAM,8BAA8B,CAAC;AAEtD,eAAO,IAAI,QAAQ,EAAE,UAAU,CAAC,OAAO,MAAM,CAAC,CAAC;AAE/C,eAAO,MAAM,WAAW,QAAO,UAAU,CAAC,OAAO,MAAM,CAYtD,CAAC"}
|
package/dist/constants/sdk.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"useBotFlow.d.ts","sourceRoot":"","sources":["../../../src/hooks/conversation/useBotFlow.ts"],"names":[],"mappings":"AAMA,OAAO,EAKL,KAAK,oBAAoB,EACzB,KAAK,eAAe,EACrB,MAAM,sBAAsB,CAAC;AAgB9B,MAAM,MAAM,aAAa,GAAG,SAAS,GAAG,aAAa,CAAC;AAMtD,UAAU,gBAAgB;IACxB,cAAc,EAAE,MAAM,CAAC;IACvB,WAAW,EAAE,OAAO,CAAC;CACtB;AAsBD,eAAO,MAAM,UAAU,GAAI,kCAGxB,gBAAgB;;;;;;;;;;;;
|
|
1
|
+
{"version":3,"file":"useBotFlow.d.ts","sourceRoot":"","sources":["../../../src/hooks/conversation/useBotFlow.ts"],"names":[],"mappings":"AAMA,OAAO,EAKL,KAAK,oBAAoB,EACzB,KAAK,eAAe,EACrB,MAAM,sBAAsB,CAAC;AAgB9B,MAAM,MAAM,aAAa,GAAG,SAAS,GAAG,aAAa,CAAC;AAMtD,UAAU,gBAAgB;IACxB,cAAc,EAAE,MAAM,CAAC;IACvB,WAAW,EAAE,OAAO,CAAC;CACtB;AAsBD,eAAO,MAAM,UAAU,GAAI,kCAGxB,gBAAgB;;;;;;;;;;;;6BAmJqB,MAAM;;6BA0DN,eAAe;;;CAmDtD,CAAC"}
|
|
@@ -56,7 +56,13 @@ export const useBotFlow = ({ conversationId, isBotThread, }) => {
|
|
|
56
56
|
});
|
|
57
57
|
const [pendingCsAction, setPendingCsAction] = useState(null);
|
|
58
58
|
const menuQuery = useBotMainMenu(conversationId, isBotThread && botType === BOT_TYPE.FLOW);
|
|
59
|
-
const
|
|
59
|
+
const visibleMenuItems = filterVisibleBotButtons((_c = menuQuery.data) !== null && _c !== void 0 ? _c : []);
|
|
60
|
+
const menuItems = botType === BOT_TYPE.FLOW
|
|
61
|
+
? [
|
|
62
|
+
...visibleMenuItems,
|
|
63
|
+
{ id: BOT_DEFAULT_BUTTON_ID, label: t("thread_detail.bot.restart") },
|
|
64
|
+
]
|
|
65
|
+
: visibleMenuItems;
|
|
60
66
|
useEffect(() => {
|
|
61
67
|
if (!isBotThread) {
|
|
62
68
|
setBotFlowState(INITIAL_BOT_FLOW_STATE);
|
|
@@ -90,7 +96,11 @@ export const useBotFlow = ({ conversationId, isBotThread, }) => {
|
|
|
90
96
|
};
|
|
91
97
|
}, [authUserID]);
|
|
92
98
|
const activeStep = isActiveConversation ? flowCurrentStep : null;
|
|
93
|
-
const
|
|
99
|
+
const inputButtonsBlocks = (_d = activeStep === null || activeStep === void 0 ? void 0 : activeStep.data.children.filter((child) => child.type === BotBlockType.InputButtons)) !== null && _d !== void 0 ? _d : [];
|
|
100
|
+
const currentButtonsBlock = inputButtonsBlocks.length > 0
|
|
101
|
+
? Object.assign(Object.assign({}, inputButtonsBlocks[0]), { data: {
|
|
102
|
+
buttons: inputButtonsBlocks.flatMap((block) => block.data.buttons),
|
|
103
|
+
} }) : null;
|
|
94
104
|
const isInActiveCsSession = isInCsSession({ flowCurrentStep: activeStep });
|
|
95
105
|
const isProcessing = runMutation.isPending ||
|
|
96
106
|
resetMutation.isPending ||
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { ConversationItem, SessionType } from "@
|
|
1
|
+
import { ConversationItem, SessionType } from "@droppii-org/wasm-client-sdk";
|
|
2
2
|
export declare const markConversationMessageAsRead: (conversationId: string) => void;
|
|
3
3
|
export declare const useConversationDetail: ({ sourceID, sessionType, }: {
|
|
4
4
|
sourceID: string;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"useConversation.d.ts","sourceRoot":"","sources":["../../../src/hooks/conversation/useConversation.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,gBAAgB,EAAE,WAAW,EAAE,MAAM,
|
|
1
|
+
{"version":3,"file":"useConversation.d.ts","sourceRoot":"","sources":["../../../src/hooks/conversation/useConversation.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,gBAAgB,EAAE,WAAW,EAAE,MAAM,8BAA8B,CAAC;AAQ7E,eAAO,MAAM,6BAA6B,GAAI,gBAAgB,MAAM,SAOnE,CAAC;AAEF,eAAO,MAAM,qBAAqB,GAAI,4BAGnC;IACD,QAAQ,EAAE,MAAM,CAAC;IACjB,WAAW,EAAE,WAAW,CAAC;CAC1B;;CAuBA,CAAC;AAEF,eAAO,MAAM,0BAA0B,GACrC,cAAc,gBAAgB,GAAG,IAAI;;;CA4CtC,CAAC"}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { SessionType } from "@
|
|
1
|
+
import { SessionType } from "@droppii-org/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";
|
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
import type { ConversationItem } from "@
|
|
1
|
+
import type { ConversationItem } from "@droppii-org/wasm-client-sdk";
|
|
2
2
|
export declare const useConversationAvatarUrl: (conversation: ConversationItem) => string | null;
|
|
3
3
|
//# sourceMappingURL=useConversationAvatarUrl.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"useConversationAvatarUrl.d.ts","sourceRoot":"","sources":["../../../src/hooks/conversation/useConversationAvatarUrl.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,
|
|
1
|
+
{"version":3,"file":"useConversationAvatarUrl.d.ts","sourceRoot":"","sources":["../../../src/hooks/conversation/useConversationAvatarUrl.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,8BAA8B,CAAC;AAQrE,eAAO,MAAM,wBAAwB,GACnC,cAAc,gBAAgB,KAC7B,MAAM,GAAG,IASX,CAAC"}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use client";
|
|
2
2
|
import { useCallback, useEffect, useMemo, useState } from "react";
|
|
3
|
-
import { CbEvents } from "@
|
|
3
|
+
import { CbEvents } from "@droppii-org/wasm-client-sdk";
|
|
4
4
|
import { DChatSDK } from "../../constants/sdk";
|
|
5
5
|
import { useChatContext } from "../../context/ChatContext";
|
|
6
6
|
import { ConnectStatus, DChatApplicationType } from "../../types/chat";
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"useResolveConversation.d.ts","sourceRoot":"","sources":["../../../src/hooks/conversation/useResolveConversation.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"useResolveConversation.d.ts","sourceRoot":"","sources":["../../../src/hooks/conversation/useResolveConversation.ts"],"names":[],"mappings":"AAaA,MAAM,WAAW,4BAA4B;IAC3C,cAAc,CAAC,EAAE,MAAM,CAAC;IACxB,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,KAAK,CAAC,EAAE,MAAM,CAAC;CAChB;AAqED,eAAO,MAAM,sBAAsB,GAAI,6CAKpC,4BAA4B;;;CA0E9B,CAAC"}
|
|
@@ -1,63 +1,83 @@
|
|
|
1
1
|
"use client";
|
|
2
2
|
import { useEffect, useState } from "react";
|
|
3
|
-
import { SessionType } from "@
|
|
3
|
+
import { SessionType } from "@droppii-org/wasm-client-sdk";
|
|
4
4
|
import { DChatSDK } from "../../constants/sdk";
|
|
5
5
|
import { apiInstance } from "../../services/api";
|
|
6
6
|
import { ENDPOINTS } from "../../services/routes";
|
|
7
|
+
import { ConnectStatus, SyncStatus } from "../../types/chat";
|
|
8
|
+
import { useChatContext } from "../../context/ChatContext";
|
|
7
9
|
import useConversationStore from "../../store/conversation";
|
|
8
10
|
import { resolveConversationBotId } from "../../utils/conversation";
|
|
11
|
+
const MISSING_BOT_GROUP_ERROR = "Missing groupId from get-or-create bot conversation response";
|
|
12
|
+
const CONVERSATION_NOT_FOUND_ERROR = "Conversation not found";
|
|
13
|
+
const RESOLVE_FAILED_ERROR = "Failed to resolve conversation";
|
|
14
|
+
const fetchByConversationId = async (conversationId) => {
|
|
15
|
+
var _a;
|
|
16
|
+
const { data } = await DChatSDK.getMultipleConversation([conversationId]);
|
|
17
|
+
return (_a = data === null || data === void 0 ? void 0 : data[0]) !== null && _a !== void 0 ? _a : null;
|
|
18
|
+
};
|
|
19
|
+
const fetchBySource = async (sourceID, sessionType) => {
|
|
20
|
+
const { data } = await DChatSDK.getOneConversation({ sourceID, sessionType });
|
|
21
|
+
return data !== null && data !== void 0 ? data : null;
|
|
22
|
+
};
|
|
23
|
+
const fetchByBotId = async (botId) => {
|
|
24
|
+
var _a;
|
|
25
|
+
const { data: botConversationResponse } = await apiInstance.get(ENDPOINTS.chatService.getConversationByBotId(botId));
|
|
26
|
+
const resolvedGroupId = (_a = botConversationResponse.data) === null || _a === void 0 ? void 0 : _a.groupId;
|
|
27
|
+
if (!resolvedGroupId) {
|
|
28
|
+
throw new Error(MISSING_BOT_GROUP_ERROR);
|
|
29
|
+
}
|
|
30
|
+
return fetchBySource(resolvedGroupId, SessionType.Group);
|
|
31
|
+
};
|
|
32
|
+
const fetchConversationByTarget = ({ conversationId, userId, groupId, botId, }) => {
|
|
33
|
+
if (conversationId)
|
|
34
|
+
return fetchByConversationId(conversationId);
|
|
35
|
+
if (userId)
|
|
36
|
+
return fetchBySource(userId, SessionType.Single);
|
|
37
|
+
if (groupId)
|
|
38
|
+
return fetchBySource(groupId, SessionType.Group);
|
|
39
|
+
if (botId)
|
|
40
|
+
return fetchByBotId(botId);
|
|
41
|
+
return Promise.resolve(null);
|
|
42
|
+
};
|
|
43
|
+
const matchesTarget = (conversation, { conversationId, userId, groupId, botId }) => {
|
|
44
|
+
if (!conversation)
|
|
45
|
+
return false;
|
|
46
|
+
return ((!!conversationId && conversation.conversationID === conversationId) ||
|
|
47
|
+
(!!userId && conversation.userID === userId) ||
|
|
48
|
+
(!!groupId && conversation.groupID === groupId) ||
|
|
49
|
+
(!!botId && resolveConversationBotId(conversation) === botId));
|
|
50
|
+
};
|
|
9
51
|
export const useResolveConversation = ({ conversationId, userId, groupId, botId, }) => {
|
|
10
|
-
const [
|
|
52
|
+
const [isFetching, setIsFetching] = useState(false);
|
|
11
53
|
const [error, setError] = useState(null);
|
|
54
|
+
const { connectStatus, syncStatus } = useChatContext();
|
|
55
|
+
const isSdkReady = connectStatus === ConnectStatus.Connected &&
|
|
56
|
+
syncStatus !== SyncStatus.Loading;
|
|
12
57
|
const conversationData = useConversationStore((state) => state.conversationData);
|
|
13
58
|
const setConversationData = useConversationStore((state) => state.setConversationData);
|
|
14
59
|
const setSelectedConversationId = useConversationStore((state) => state.setSelectedConversationId);
|
|
60
|
+
const target = { conversationId, userId, groupId, botId };
|
|
15
61
|
const hasTarget = !!(conversationId || userId || groupId || botId);
|
|
16
|
-
const
|
|
17
|
-
const matchesUserId = !!userId && (conversationData === null || conversationData === void 0 ? void 0 : conversationData.userID) === userId;
|
|
18
|
-
const matchesGroupId = !!groupId && (conversationData === null || conversationData === void 0 ? void 0 : conversationData.groupID) === groupId;
|
|
19
|
-
const matchesBotId = !!botId &&
|
|
20
|
-
!!conversationData &&
|
|
21
|
-
resolveConversationBotId(conversationData) === botId;
|
|
22
|
-
const isAlreadyResolved = matchesConversationId || matchesUserId || matchesGroupId || matchesBotId;
|
|
62
|
+
const shouldResolve = hasTarget && !matchesTarget(conversationData, target);
|
|
23
63
|
useEffect(() => {
|
|
24
|
-
if (!
|
|
64
|
+
if (!shouldResolve || !isSdkReady)
|
|
25
65
|
return;
|
|
26
66
|
let cancelled = false;
|
|
27
|
-
|
|
67
|
+
setIsFetching(true);
|
|
28
68
|
setError(null);
|
|
29
69
|
const resolve = async () => {
|
|
30
|
-
var _a, _b;
|
|
31
70
|
try {
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
const { data } = await DChatSDK.getOneConversation({
|
|
39
|
-
sourceID: (userId || groupId),
|
|
40
|
-
sessionType: userId ? SessionType.Single : SessionType.Group,
|
|
41
|
-
});
|
|
42
|
-
resolved = data;
|
|
43
|
-
}
|
|
44
|
-
else if (botId) {
|
|
45
|
-
const { data: botConversationResponse } = await apiInstance.get(ENDPOINTS.chatService.getConversationByBotId(botId));
|
|
46
|
-
const resolvedGroupId = (_b = botConversationResponse.data) === null || _b === void 0 ? void 0 : _b.groupId;
|
|
47
|
-
if (!resolvedGroupId) {
|
|
48
|
-
throw new Error("Missing groupId from get-or-create bot conversation response");
|
|
49
|
-
}
|
|
50
|
-
const { data: conversation } = await DChatSDK.getOneConversation({
|
|
51
|
-
sourceID: resolvedGroupId,
|
|
52
|
-
sessionType: SessionType.Group,
|
|
53
|
-
});
|
|
54
|
-
resolved = conversation;
|
|
55
|
-
}
|
|
71
|
+
const resolved = await fetchConversationByTarget({
|
|
72
|
+
conversationId,
|
|
73
|
+
userId,
|
|
74
|
+
groupId,
|
|
75
|
+
botId,
|
|
76
|
+
});
|
|
56
77
|
if (cancelled)
|
|
57
78
|
return;
|
|
58
|
-
if (!resolved)
|
|
59
|
-
throw new Error(
|
|
60
|
-
}
|
|
79
|
+
if (!resolved)
|
|
80
|
+
throw new Error(CONVERSATION_NOT_FOUND_ERROR);
|
|
61
81
|
setConversationData(resolved);
|
|
62
82
|
setSelectedConversationId(resolved.conversationID);
|
|
63
83
|
}
|
|
@@ -65,11 +85,11 @@ export const useResolveConversation = ({ conversationId, userId, groupId, botId,
|
|
|
65
85
|
if (cancelled)
|
|
66
86
|
return;
|
|
67
87
|
console.error("useResolveConversation", err);
|
|
68
|
-
setError(err instanceof Error ? err : new Error(
|
|
88
|
+
setError(err instanceof Error ? err : new Error(RESOLVE_FAILED_ERROR));
|
|
69
89
|
}
|
|
70
90
|
finally {
|
|
71
91
|
if (!cancelled)
|
|
72
|
-
|
|
92
|
+
setIsFetching(false);
|
|
73
93
|
}
|
|
74
94
|
};
|
|
75
95
|
void resolve();
|
|
@@ -81,10 +101,13 @@ export const useResolveConversation = ({ conversationId, userId, groupId, botId,
|
|
|
81
101
|
userId,
|
|
82
102
|
groupId,
|
|
83
103
|
botId,
|
|
84
|
-
|
|
85
|
-
|
|
104
|
+
shouldResolve,
|
|
105
|
+
isSdkReady,
|
|
86
106
|
setConversationData,
|
|
87
107
|
setSelectedConversationId,
|
|
88
108
|
]);
|
|
89
|
-
return {
|
|
109
|
+
return {
|
|
110
|
+
isResolving: shouldResolve && (isFetching || !isSdkReady),
|
|
111
|
+
error: shouldResolve ? error : null,
|
|
112
|
+
};
|
|
90
113
|
};
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { useEffect } from "react";
|
|
2
2
|
import { useLatest } from "ahooks";
|
|
3
3
|
import { DChatSDK } from "../../constants/sdk";
|
|
4
|
-
import { CbEvents, MessageType, SessionType, } from "@
|
|
4
|
+
import { CbEvents, MessageType, SessionType, } from "@droppii-org/wasm-client-sdk";
|
|
5
5
|
import { BusinessNotificationType, ConnectStatus, CustomType, SyncStatus, } from "../../types/chat";
|
|
6
6
|
import { pushNewMessage, updateOneMessage } from "../../hooks/message/useMessage";
|
|
7
7
|
import { fetchPinnedMessages } from "../../hooks/message/usePinnedMessages";
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"useGroupMembers.d.ts","sourceRoot":"","sources":["../../../src/hooks/group/useGroupMembers.ts"],"names":[],"mappings":"AACA,OAAO,EAAY,eAAe,EAAW,MAAM,
|
|
1
|
+
{"version":3,"file":"useGroupMembers.d.ts","sourceRoot":"","sources":["../../../src/hooks/group/useGroupMembers.ts"],"names":[],"mappings":"AACA,OAAO,EAAY,eAAe,EAAW,MAAM,8BAA8B,CAAC;AAMlF,UAAU,qBAAqB;IAC7B,OAAO,EAAE,eAAe,EAAE,CAAC;IAC3B,SAAS,EAAE,OAAO,CAAC;IACnB,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,OAAO,EAAE,MAAM,OAAO,CAAC,IAAI,CAAC,CAAC;CAC9B;AAED,eAAO,MAAM,eAAe,GAC1B,UAAU,MAAM,KACf,qBA+DF,CAAC"}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { useCallback, useEffect, useState } from "react";
|
|
2
|
-
import { CbEvents } from "@
|
|
2
|
+
import { CbEvents } from "@droppii-org/wasm-client-sdk";
|
|
3
3
|
import { DChatSDK } from "../../constants/sdk";
|
|
4
4
|
const GROUP_MEMBER_LIST_OFFSET = 0;
|
|
5
5
|
const GROUP_MEMBER_LIST_COUNT = 999;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { MessageItem, MessageType } from "@
|
|
1
|
+
import { MessageItem, MessageType } from "@droppii-org/wasm-client-sdk";
|
|
2
2
|
export declare const visibleTypeMessage: MessageType[];
|
|
3
3
|
export declare const isMessageHiddenForViewer: (message: MessageItem, isCrm: boolean) => boolean;
|
|
4
4
|
export declare const useMessage: (conversationId?: string, searchClientMsgID?: string, enabled?: boolean, useAppHistory?: boolean) => {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"useMessage.d.ts","sourceRoot":"","sources":["../../../src/hooks/message/useMessage.ts"],"names":[],"mappings":"AACA,OAAO,EAEL,WAAW,EACX,WAAW,EAEZ,MAAM,
|
|
1
|
+
{"version":3,"file":"useMessage.d.ts","sourceRoot":"","sources":["../../../src/hooks/message/useMessage.ts"],"names":[],"mappings":"AACA,OAAO,EAEL,WAAW,EACX,WAAW,EAEZ,MAAM,8BAA8B,CAAC;AAYtC,eAAO,MAAM,kBAAkB,eAiB9B,CAAC;AAEF,eAAO,MAAM,wBAAwB,GACnC,SAAS,WAAW,EACpB,OAAO,OAAO,KACb,OAWF,CAAC;AAEF,eAAO,MAAM,UAAU,GACrB,iBAAiB,MAAM,EACvB,oBAAoB,MAAM,EAC1B,iBAAc,EACd,uBAAqB;;;;;qBAeA,WAAW,EAAE;;;;;;qBAAb,WAAW,EAAE;;;;;;CAsSnC,CAAC;AAEF,eAAO,MAAM,cAAc,GAAI,SAAS,WAAW,SACpB,CAAC;AAChC,eAAO,MAAM,gBAAgB,GAAI,SAAS,WAAW,SACpB,CAAC;AAClC,eAAO,MAAM,gBAAgB,GAAI,aAAa,MAAM,SACf,CAAC;AAEtC,eAAO,MAAM,kBAAkB,GAC7B,aAAa,WAAW,EAAE,EAC1B,SAAS,WAAW,EACpB,WAAW,MAAM,GAAG,MAAM,KACzB,WAAW,GAAG,SAkBhB,CAAC"}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { useEffect, useState } from "react";
|
|
2
|
-
import { ViewType, MessageType, } from "@
|
|
2
|
+
import { ViewType, MessageType, } from "@droppii-org/wasm-client-sdk";
|
|
3
3
|
import { DChatSDK } from "../../constants/sdk";
|
|
4
4
|
import { PAGE_SIZE } from "../../constants";
|
|
5
5
|
import { useLatest, useRequest } from "ahooks";
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { RefObject } from "react";
|
|
2
|
-
import { MessageItem } from "@
|
|
2
|
+
import { MessageItem } from "@droppii-org/wasm-client-sdk";
|
|
3
3
|
export declare const MESSAGE_LIST_BOTTOM_THRESHOLD = -5;
|
|
4
4
|
export interface MessageListLoadState {
|
|
5
5
|
initLoading: boolean;
|
|
@@ -1 +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,
|
|
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,8BAA8B,CAAC;AAM3D,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;;;;8BA6DrB,KAAK,CAAC,OAAO,CAAC,cAAc,CAAC;;;mCA0Ce,MAAM;CA6CzD,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"useMessageResources.d.ts","sourceRoot":"","sources":["../../../src/hooks/message/useMessageResources.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,WAAW,EAAE,MAAM,
|
|
1
|
+
{"version":3,"file":"useMessageResources.d.ts","sourceRoot":"","sources":["../../../src/hooks/message/useMessageResources.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,WAAW,EAAE,MAAM,8BAA8B,CAAC;AAe3D,UAAU,0BAA0B;IAClC,MAAM,EAAE,MAAM,CAAC;IACf,WAAW,EAAE,WAAW,CAAC;IACzB,QAAQ,CAAC,EAAE,MAAM,CAAC;CACnB;AAED,eAAO,MAAM,mBAAmB,GAAI,oCAIjC,0BAA0B;;;;;;;;CA8D5B,CAAC"}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
export declare const fetchPinnedMessages: (conversationID: string) => Promise<void>;
|
|
2
2
|
export declare const usePinnedMessages: (conversationID: string) => {
|
|
3
|
-
pinnedMessageList: import("@
|
|
3
|
+
pinnedMessageList: import("@droppii-org/wasm-client-sdk").MessageItem[];
|
|
4
4
|
pinnedTotalCount: number;
|
|
5
5
|
pinnedRemainingCount: number;
|
|
6
6
|
};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { MessageType } from "@
|
|
1
|
+
import { MessageType } from "@droppii-org/wasm-client-sdk";
|
|
2
2
|
import { DChatSDK } from "../../constants/sdk";
|
|
3
3
|
import { useRequest } from "ahooks";
|
|
4
4
|
import { updateOneMessage } from "../../hooks/message/useMessage";
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { CustomMsgParams, MergerMsgParams, MessageItem } from "@
|
|
1
|
+
import { CustomMsgParams, MergerMsgParams, MessageItem } from "@droppii-org/wasm-client-sdk";
|
|
2
2
|
import { type CustomMessagePayload } from "../../types/customMessage";
|
|
3
3
|
import { BotFlowMeta, ExtendMessageInfo, FileMsgParamsByFile, ImageMsgParamsByFile, UrlMetadataInfo, VideoMsgParamsByFile } from "../../types/chat";
|
|
4
4
|
import { UploadFile } from "antd";
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"useSendMessage.d.ts","sourceRoot":"","sources":["../../../src/hooks/message/useSendMessage.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,eAAe,EACf,eAAe,EACf,WAAW,EAGZ,MAAM,
|
|
1
|
+
{"version":3,"file":"useSendMessage.d.ts","sourceRoot":"","sources":["../../../src/hooks/message/useSendMessage.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,eAAe,EACf,eAAe,EACf,WAAW,EAGZ,MAAM,8BAA8B,CAAC;AACtC,OAAO,EAEL,KAAK,oBAAoB,EAC1B,MAAM,uBAAuB,CAAC;AAE/B,OAAO,EACL,WAAW,EACX,iBAAiB,EACjB,mBAAmB,EACnB,oBAAoB,EACpB,eAAe,EACf,oBAAoB,EACrB,MAAM,cAAc,CAAC;AAWtB,OAAO,EAAE,UAAU,EAAE,MAAM,MAAM,CAAC;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K,CAAC,EAAE,UAAU,EAAE,CAAC;QACrB,cAAc,CAAC,EAAE,gBAAgB,CAAC;QAClC,UAAU,EAAE,OAAO,CAAC;QACpB,WAAW,CAAC,EAAE,eAAe,CAAC;QAC9B,IAAI,CAAC,EAAE,WAAW,CAAC;QACnB,aAAa,CAAC,EAAE,oBAAoB,CAAC;KACtC,KAAG,OAAO,CAAC,OAAO,CAAC;iCA3CT,oBAAoB,gBACf;QAAE,cAAc,CAAC,EAAE,gBAAgB,CAAA;KAAE,KAClD,OAAO,CAAC,OAAO,CAAC;mCAnHG,WAAW;CAyVpC,CAAC;AAEF,eAAO,MAAM,yBAAyB,GAAI,kDAKvC;IACD,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,WAAW,CAAC,EAAE,eAAe,CAAC;IAC9B,cAAc,CAAC,EAAE,gBAAgB,CAAC;IAClC,IAAI,CAAC,EAAE,WAAW,CAAC;CACpB,sBA8BA,CAAC"}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { MessageStatus, MessageType, } from "@
|
|
1
|
+
import { MessageStatus, MessageType, } from "@droppii-org/wasm-client-sdk";
|
|
2
2
|
import { CustomMessageType, } from "../../types/customMessage";
|
|
3
3
|
import { DChatSDK } from "../../constants/sdk";
|
|
4
4
|
import { v4 as uuidv4 } from "uuid";
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"useConversationSessionState.d.ts","sourceRoot":"","sources":["../../../src/hooks/session/useConversationSessionState.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,WAAW,EAAE,MAAM,
|
|
1
|
+
{"version":3,"file":"useConversationSessionState.d.ts","sourceRoot":"","sources":["../../../src/hooks/session/useConversationSessionState.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,WAAW,EAAE,MAAM,8BAA8B,CAAC;AAI3D,UAAU,iCAAiC;IACzC,cAAc,EAAE,MAAM,CAAC;IACvB,gBAAgB,CAAC,EAAE,WAAW,CAAC;IAC/B,OAAO,CAAC,EAAE,MAAM,CAAC;CAClB;AAED,eAAO,MAAM,2BAA2B,GAAI,gDAIzC,iCAAiC;;;;;CAmBnC,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,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;
|
|
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;AA6JD,eAAO,MAAM,aAAa,GAAI,sBAG3B,kBAAkB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAyEpB,CAAC"}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
"use client";
|
|
2
|
-
import { ViewType } from "@
|
|
2
|
+
import { ViewType } from "@droppii-org/wasm-client-sdk";
|
|
3
3
|
import { useQueries, useQueryClient } from "@tanstack/react-query";
|
|
4
4
|
import { useEffect, useMemo } from "react";
|
|
5
5
|
import { QUERY_KEYS } from "../../services/query";
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { useMutation } from "@tanstack/react-query";
|
|
2
2
|
import { apiInstance } from "../../services/api";
|
|
3
3
|
import { ENDPOINTS } from "../../services/routes";
|
|
4
|
-
import { Platform as DChatPlatform } from "@
|
|
4
|
+
import { Platform as DChatPlatform } from "@droppii-org/wasm-client-sdk";
|
|
5
5
|
import useAuthStore from "../../store/auth";
|
|
6
6
|
import { DChatApplicationType } from "../../types/chat";
|
|
7
7
|
import dayjs from "dayjs";
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { ConversationItem } from "@
|
|
1
|
+
import { ConversationItem } from "@droppii-org/wasm-client-sdk";
|
|
2
2
|
export declare const extractUserIdsFromConversations: (conversations: ConversationItem[]) => string[];
|
|
3
3
|
export declare const useSyncUsersInfo: () => void;
|
|
4
4
|
//# sourceMappingURL=useUsersInfo.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"useUsersInfo.d.ts","sourceRoot":"","sources":["../../../src/hooks/user/useUsersInfo.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,gBAAgB,EAAe,MAAM,
|
|
1
|
+
{"version":3,"file":"useUsersInfo.d.ts","sourceRoot":"","sources":["../../../src/hooks/user/useUsersInfo.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,gBAAgB,EAAe,MAAM,8BAA8B,CAAC;AAS7E,eAAO,MAAM,+BAA+B,GAC1C,eAAe,gBAAgB,EAAE,aAwBlC,CAAC;AAEF,eAAO,MAAM,gBAAgB,YA4B5B,CAAC"}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { useCallback, useEffect } from "react";
|
|
2
2
|
import useConversationStore from "../../store/conversation";
|
|
3
|
-
import { SessionType } from "@
|
|
3
|
+
import { SessionType } from "@droppii-org/wasm-client-sdk";
|
|
4
4
|
import useUsersInfoStore from "../../store/usersInfo";
|
|
5
5
|
import useAuthStore from "../../store/auth";
|
|
6
6
|
import { DChatSDK } from "../../constants/sdk";
|
package/dist/index.d.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import "./locales/i18n";
|
|
2
2
|
import DChatDeskMessage from "./screens/desk-message";
|
|
3
3
|
import DChatBubble from "./screens/chat-bubble";
|
|
4
|
-
import { Platform, LogLevel, SessionType } from "@
|
|
4
|
+
import { Platform, LogLevel, SessionType } from "@droppii-org/wasm-client-sdk";
|
|
5
5
|
import { Icon } from "./components/icon";
|
|
6
6
|
import useUserStore from "./store/user";
|
|
7
7
|
import { DChatInitAndLoginConfig, DChatApplicationType } from "./types/chat";
|
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,
|
|
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,EAAE,uBAAuB,EAAE,oBAAoB,EAAE,MAAM,cAAc,CAAC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,EAAE,mBAAmB,EAAE,MAAM,qCAAqC,CAAC;AAC1E,OAAO,EAAE,SAAS,EAAE,MAAM,aAAa,CAAC"}
|
package/dist/index.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import "./locales/i18n";
|
|
2
2
|
import DChatDeskMessage from "./screens/desk-message";
|
|
3
3
|
import DChatBubble from "./screens/chat-bubble";
|
|
4
|
-
import { Platform, LogLevel, SessionType } from "@
|
|
4
|
+
import { Platform, LogLevel, SessionType } from "@droppii-org/wasm-client-sdk";
|
|
5
5
|
import { Icon } from "./components/icon";
|
|
6
6
|
import useUserStore from "./store/user";
|
|
7
7
|
import { DChatApplicationType } from "./types/chat";
|
package/dist/store/auth.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { create } from "zustand";
|
|
2
|
-
import { Platform } from "@
|
|
2
|
+
import { Platform } from "@droppii-org/wasm-client-sdk";
|
|
3
3
|
import { DChatApplicationType } from "../types/chat";
|
|
4
4
|
import { jwtDecode } from "jwt-decode";
|
|
5
5
|
const useAuthStore = create((set, get) => ({
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { SessionType, } from "@
|
|
1
|
+
import { SessionType, } from "@droppii-org/wasm-client-sdk";
|
|
2
2
|
import { create } from "zustand";
|
|
3
3
|
import { DChatSDK } from "../constants/sdk";
|
|
4
4
|
import { conversationSort, isGroupSession } from "../utils/imCommon";
|
package/dist/store/type.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { GroupItem, GroupMemberItem, ConversationItem, PublicUserItem, MessageItem } from "@
|
|
1
|
+
import { GroupItem, GroupMemberItem, ConversationItem, PublicUserItem, MessageItem } from "@droppii-org/wasm-client-sdk";
|
|
2
2
|
import { DChatApplicationType, DChatPlatform, SessionStatus, SessionTag } from "../types/chat";
|
|
3
3
|
import { ChatCategory } from "../types/conversation";
|
|
4
4
|
export interface ConversationListAppParams {
|
package/dist/store/type.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"type.d.ts","sourceRoot":"","sources":["../../src/store/type.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,SAAS,EACT,eAAe,EACf,gBAAgB,EAChB,cAAc,EACd,WAAW,EACZ,MAAM,
|
|
1
|
+
{"version":3,"file":"type.d.ts","sourceRoot":"","sources":["../../src/store/type.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,SAAS,EACT,eAAe,EACf,gBAAgB,EAChB,cAAc,EACd,WAAW,EACZ,MAAM,8BAA8B,CAAC;AACtC,OAAO,EACL,oBAAoB,EACpB,aAAa,EACb,aAAa,EACb,UAAU,EACX,MAAM,cAAc,CAAC;AACtB,OAAO,EAAE,YAAY,EAAE,MAAM,sBAAsB,CAAC;AAEpD,MAAM,WAAW,yBAAyB;IACxC,eAAe,EAAE,oBAAoB,CAAC;IACtC,YAAY,CAAC,EAAE,YAAY,CAAC;CAC7B;AAED,MAAM,MAAM,0BAA0B,GAAG,MAAM,GAAG,QAAQ,CAAC;AAE3D,MAAM,WAAW,iBAAiB;IAChC,IAAI,EAAE,aAAa,CAAC;IACpB,KAAK,EAAE,MAAM,CAAC;CACf;AAED,MAAM,WAAW,OAAO;IACtB,IAAI,EAAE,UAAU,CAAC;IACjB,KAAK,EAAE,MAAM,CAAC;CACf;AAED,MAAM,WAAW,eAAe;IAC9B,kBAAkB,EAAE,MAAM,CAAC;IAC3B,qBAAqB,EAAE,MAAM,CAAC;IAC9B,eAAe,EAAE,iBAAiB,EAAE,CAAC;IACrC,SAAS,EAAE,OAAO,EAAE,CAAC;CACtB;AAED,MAAM,WAAW,gBAAgB;IAC/B,EAAE,EAAE,MAAM,CAAC;IACX,KAAK,EAAE,MAAM,CAAC;IACd,OAAO,EAAE,MAAM,CAAC;IAChB,cAAc,EAAE,MAAM,CAAC;IACvB,MAAM,EAAE,aAAa,CAAC;IACtB,GAAG,EAAE,UAAU,CAAC;IAChB,eAAe,EAAE,oBAAoB,CAAC;IACtC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