@droppii-org/chat-mobile 0.2.92 → 0.2.93
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/lib/module/hooks/conversation/useGetConversationDetail.js +7 -7
- package/lib/module/hooks/conversation/useGetConversationDetail.js.map +1 -1
- package/lib/module/hooks/flows/useCurrentConversationFlow.js +2 -2
- package/lib/module/hooks/flows/useCurrentConversationFlow.js.map +1 -1
- package/lib/module/hooks/flows/useFlow.js +4 -4
- package/lib/module/hooks/flows/useFlow.js.map +1 -1
- package/lib/module/hooks/flows/useGetConversationFlowMainMenu.js +2 -2
- package/lib/module/hooks/flows/useGetConversationFlowMainMenu.js.map +1 -1
- package/lib/module/hooks/stickers/useFetchStickerByCategory.js +2 -2
- package/lib/module/hooks/stickers/useFetchStickerByCategory.js.map +1 -1
- package/lib/module/hooks/stickers/useStickerCategories.js +2 -2
- package/lib/module/hooks/stickers/useStickerCategories.js.map +1 -1
- package/lib/module/hooks/stickers/useStickerHistory.js +2 -2
- package/lib/module/hooks/stickers/useStickerHistory.js.map +1 -1
- package/lib/module/hooks/useLinkPreview/useFetchUrlMetadata.js +4 -3
- package/lib/module/hooks/useLinkPreview/useFetchUrlMetadata.js.map +1 -1
- package/lib/module/index.js +1 -1
- package/lib/module/index.js.map +1 -1
- package/lib/module/screens/chat-detail/PinnedMessagesSheet.js +1 -0
- package/lib/module/screens/chat-detail/PinnedMessagesSheet.js.map +1 -1
- package/lib/module/screens/chat-detail/legend/LegendChatMessage.js +9 -4
- package/lib/module/screens/chat-detail/legend/LegendChatMessage.js.map +1 -1
- package/lib/module/services/apis.js +14 -1
- package/lib/module/services/apis.js.map +1 -1
- package/lib/module/services/resourceCenter.js +5 -4
- package/lib/module/services/resourceCenter.js.map +1 -1
- package/lib/typescript/src/hooks/useLinkPreview/useFetchUrlMetadata.d.ts.map +1 -1
- package/lib/typescript/src/index.d.ts +1 -1
- package/lib/typescript/src/index.d.ts.map +1 -1
- package/lib/typescript/src/screens/chat-detail/PinnedMessagesSheet.d.ts.map +1 -1
- package/lib/typescript/src/screens/chat-detail/legend/LegendChatMessage.d.ts +11 -1
- package/lib/typescript/src/screens/chat-detail/legend/LegendChatMessage.d.ts.map +1 -1
- package/lib/typescript/src/services/apis.d.ts +21 -1
- package/lib/typescript/src/services/apis.d.ts.map +1 -1
- package/lib/typescript/src/services/resourceCenter.d.ts.map +1 -1
- package/package.json +1 -1
- package/src/hooks/conversation/useGetConversationDetail.ts +7 -7
- package/src/hooks/flows/useCurrentConversationFlow.ts +2 -2
- package/src/hooks/flows/useFlow.ts +4 -4
- package/src/hooks/flows/useGetConversationFlowMainMenu.ts +2 -2
- package/src/hooks/stickers/useFetchStickerByCategory.ts +2 -2
- package/src/hooks/stickers/useStickerCategories.ts +2 -2
- package/src/hooks/stickers/useStickerHistory.ts +2 -2
- package/src/hooks/useLinkPreview/useFetchUrlMetadata.ts +4 -3
- package/src/index.tsx +1 -1
- package/src/screens/chat-detail/PinnedMessagesSheet.tsx +1 -0
- package/src/screens/chat-detail/legend/LegendChatMessage.tsx +20 -4
- package/src/services/apis.ts +31 -1
- package/src/services/resourceCenter.ts +5 -4
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
import { useQuery } from '@tanstack/react-query';
|
|
4
4
|
import OpenIMSDK, { SessionType } from '@droppii/openim-rn-client-sdk';
|
|
5
5
|
import { useConversationStore } from "../../store/conversation.js";
|
|
6
|
-
import { apiInstance } from "../../services/apis.js";
|
|
6
|
+
import { apiInstance, unwrapEnvelope } from "../../services/apis.js";
|
|
7
7
|
import { conversationQueryKeys } from "../query-keys.js";
|
|
8
8
|
import { ENDPOINTS } from "../../services/endpoints.js";
|
|
9
9
|
import isEmpty from 'lodash/isEmpty';
|
|
@@ -11,7 +11,7 @@ const useBotConversationData = botId => useQuery({
|
|
|
11
11
|
queryKey: conversationQueryKeys.detailByBotId(botId || ''),
|
|
12
12
|
queryFn: async () => {
|
|
13
13
|
const res = await apiInstance?.get(ENDPOINTS.chatService.getConversationByBotId(botId || ''));
|
|
14
|
-
return res
|
|
14
|
+
return unwrapEnvelope(res);
|
|
15
15
|
},
|
|
16
16
|
enabled: !!botId
|
|
17
17
|
});
|
|
@@ -20,7 +20,7 @@ export const useGetStatusConversationBot = botId => {
|
|
|
20
20
|
queryKey: conversationQueryKeys.getStatusBot(botId || ''),
|
|
21
21
|
queryFn: async () => {
|
|
22
22
|
const res = await apiInstance?.get(ENDPOINTS.chatService.getConversationStatusByBotId(botId || ''));
|
|
23
|
-
return res
|
|
23
|
+
return unwrapEnvelope(res);
|
|
24
24
|
},
|
|
25
25
|
enabled: !!botId,
|
|
26
26
|
staleTime: 0,
|
|
@@ -33,9 +33,9 @@ export const useGetConversationTarget = conversationId => useQuery({
|
|
|
33
33
|
queryFn: async () => {
|
|
34
34
|
try {
|
|
35
35
|
const res = await apiInstance?.get(ENDPOINTS.chatService.getConversationTarget(conversationId || ''));
|
|
36
|
-
return res
|
|
36
|
+
return unwrapEnvelope(res);
|
|
37
37
|
} catch {
|
|
38
|
-
return
|
|
38
|
+
return null; // fail-open: unresolved status => compose stays enabled
|
|
39
39
|
}
|
|
40
40
|
},
|
|
41
41
|
enabled: !!conversationId,
|
|
@@ -58,7 +58,7 @@ export const useGetOneConversation = ({
|
|
|
58
58
|
if (res?.conversationID) {
|
|
59
59
|
useConversationStore.getState().updateConversations([res]);
|
|
60
60
|
}
|
|
61
|
-
return res
|
|
61
|
+
return res ?? null;
|
|
62
62
|
},
|
|
63
63
|
enabled: !!targetUserId || !!targetGroupId
|
|
64
64
|
});
|
|
@@ -101,7 +101,7 @@ export const useSyncConversationById = (conversationId, hasConversation) => useQ
|
|
|
101
101
|
if (conversation) {
|
|
102
102
|
useConversationStore.getState().updateConversations([conversation]);
|
|
103
103
|
}
|
|
104
|
-
return conversation;
|
|
104
|
+
return conversation ?? null;
|
|
105
105
|
},
|
|
106
106
|
enabled: !!conversationId && !hasConversation
|
|
107
107
|
});
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["useQuery","OpenIMSDK","SessionType","useConversationStore","apiInstance","conversationQueryKeys","ENDPOINTS","isEmpty","useBotConversationData","botId","queryKey","detailByBotId","queryFn","res","get","chatService","getConversationByBotId","
|
|
1
|
+
{"version":3,"names":["useQuery","OpenIMSDK","SessionType","useConversationStore","apiInstance","unwrapEnvelope","conversationQueryKeys","ENDPOINTS","isEmpty","useBotConversationData","botId","queryKey","detailByBotId","queryFn","res","get","chatService","getConversationByBotId","enabled","useGetStatusConversationBot","getStatusBot","getConversationStatusByBotId","staleTime","gcTime","refetchOnMount","useGetConversationTarget","conversationId","conversationTarget","getConversationTarget","useGetOneConversation","targetUserId","targetGroupId","id","detailBySourceId","getOneConversation","sourceID","sessionType","Group","Single","conversationID","getState","updateConversations","useGetConversationDetail","targetConversationId","targetBotId","data","botData","isFetching","botIdLoading","conversationData","conversationLoading","groupId","isLoading","useSyncConversationById","hasConversation","detail","getMultipleConversation","conversation"],"sourceRoot":"../../../../src","sources":["hooks/conversation/useGetConversationDetail.ts"],"mappings":";;AAAA,SAASA,QAAQ,QAAQ,uBAAuB;AAChD,OAAOC,SAAS,IAAIC,WAAW,QAAQ,+BAA+B;AACtE,SAASC,oBAAoB,QAAQ,6BAA0B;AAC/D,SAASC,WAAW,EAAEC,cAAc,QAAQ,wBAAqB;AAGjE,SAASC,qBAAqB,QAAQ,kBAAe;AACrD,SAASC,SAAS,QAAQ,6BAA0B;AACpD,OAAOC,OAAO,MAAM,gBAAgB;AAepC,MAAMC,sBAAsB,GAAIC,KAAc,IAC5CV,QAAQ,CAAC;EACPW,QAAQ,EAAEL,qBAAqB,CAACM,aAAa,CAACF,KAAK,IAAI,EAAE,CAAC;EAC1DG,OAAO,EAAE,MAAAA,CAAA,KAAY;IACnB,MAAMC,GAAG,GAAG,MAAMV,WAAW,EAAEW,GAAG,CAEhCR,SAAS,CAACS,WAAW,CAACC,sBAAsB,CAACP,KAAK,IAAI,EAAE,CAAC,CA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AACA,OAAO,MAAMI,uBAAuB,GAAGA,CACrC3B,cAAsB,EACtB4B,eAAwB,KAExBtD,QAAQ,CAAC;EACPW,QAAQ,EAAEL,qBAAqB,CAACiD,MAAM,CAAC7B,cAAc,CAAC;EACtDb,OAAO,EAAE,MAAAA,CAAA,KAAY;IACnB,MAAMC,GAAG,GAAG,MAAMb,SAAS,CAACuD,uBAAuB,CAAC,CAAC9B,cAAc,CAAC,CAAC;IACrE,MAAM+B,YAAY,GAAG3C,GAAG,GAAG,CAAC,CAAC;IAC7B,IAAI2C,YAAY,EAAE;MAChBtD,oBAAoB,CAACqC,QAAQ,CAAC,CAAC,CAACC,mBAAmB,CAAC,CAACgB,YAAY,CAAC,CAAC;IACrE;IACA,OAAOA,YAAY,IAAI,IAAI;EAC7B,CAAC;EACDvC,OAAO,EAAE,CAAC,CAACQ,cAAc,IAAI,CAAC4B;AAChC,CAAC,CAAC","ignoreList":[]}
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
3
|
import { ENDPOINTS } from "../../services/endpoints.js";
|
|
4
|
-
import { apiInstance } from "../../services/apis.js";
|
|
4
|
+
import { apiInstance, unwrapEnvelope } from "../../services/apis.js";
|
|
5
5
|
export const fechtCurrentConversationFlow = async conversationId => {
|
|
6
6
|
const res = await apiInstance?.get(ENDPOINTS.chatService.conversationFlow(conversationId));
|
|
7
|
-
return res
|
|
7
|
+
return unwrapEnvelope(res) ?? undefined;
|
|
8
8
|
};
|
|
9
9
|
//# sourceMappingURL=useCurrentConversationFlow.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["ENDPOINTS","apiInstance","fechtCurrentConversationFlow","conversationId","res","get","chatService","conversationFlow","
|
|
1
|
+
{"version":3,"names":["ENDPOINTS","apiInstance","unwrapEnvelope","fechtCurrentConversationFlow","conversationId","res","get","chatService","conversationFlow","undefined"],"sourceRoot":"../../../../src","sources":["hooks/flows/useCurrentConversationFlow.ts"],"mappings":";;AAAA,SAASA,SAAS,QAAQ,6BAA0B;AAEpD,SAASC,WAAW,EAAEC,cAAc,QAAQ,wBAAqB;AAGjE,OAAO,MAAMC,4BAA4B,GAAG,MAAOC,cAAsB,IAAK;EAC5E,MAAMC,GAAG,GAAG,MAAMJ,WAAW,EAAEK,GAAG,CAChCN,SAAS,CAACO,WAAW,CAACC,gBAAgB,CAACJ,cAAc,CACvD,CAAC;EACD,OAAOF,cAAc,CAAoBG,GAAG,CAAC,IAAII,SAAS;AAC5D,CAAC","ignoreList":[]}
|
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
import { useMutation } from '@tanstack/react-query';
|
|
4
4
|
import { conversationQueryKeys } from "../query-keys.js";
|
|
5
5
|
import { useConversationStore } from "../../store/index.js";
|
|
6
|
-
import { apiInstance } from "../../services/apis.js";
|
|
6
|
+
import { apiInstance, unwrapEnvelope } from "../../services/apis.js";
|
|
7
7
|
import { ENDPOINTS } from "../../services/endpoints.js";
|
|
8
8
|
import { useSendMessage } from "../message/useSendMessage.js";
|
|
9
9
|
import { useChatDetailContext } from "../../context/ChatDetailContext.js";
|
|
@@ -29,7 +29,7 @@ export const useResetFlow = () => {
|
|
|
29
29
|
}
|
|
30
30
|
});
|
|
31
31
|
const res = await apiInstance?.post(ENDPOINTS.chatService.resetConversationFlow(conversationId), {});
|
|
32
|
-
return res
|
|
32
|
+
return unwrapEnvelope(res) ?? undefined;
|
|
33
33
|
},
|
|
34
34
|
onSuccess: data => {
|
|
35
35
|
if (data?.flowCurrentStep?.id) {
|
|
@@ -48,7 +48,7 @@ export const useCloseSupportSession = () => {
|
|
|
48
48
|
mutationKey: conversationQueryKeys.closeSession(conversationId),
|
|
49
49
|
mutationFn: async () => {
|
|
50
50
|
const res = await apiInstance?.post(ENDPOINTS.chatService.closeConversationSession(conversationId));
|
|
51
|
-
return res
|
|
51
|
+
return unwrapEnvelope(res);
|
|
52
52
|
}
|
|
53
53
|
});
|
|
54
54
|
};
|
|
@@ -68,7 +68,7 @@ export const useRunFlow = () => {
|
|
|
68
68
|
flow: payload
|
|
69
69
|
});
|
|
70
70
|
const res = await apiInstance?.post(ENDPOINTS.chatService.runConversationFlow(conversationId), payload);
|
|
71
|
-
return res
|
|
71
|
+
return unwrapEnvelope(res) ?? undefined;
|
|
72
72
|
},
|
|
73
73
|
onSuccess: data => {
|
|
74
74
|
setConverationFlowStep(data?.flowNextStep || undefined, data?.isEnd, data?.havingBotMessage);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["useMutation","conversationQueryKeys","useConversationStore","apiInstance","ENDPOINTS","useSendMessage","useChatDetailContext","trans","useResetFlow","conversationId","state","currentConversationId","mutate","runFlow","useRunFlow","sendMessage","conversationFlow","mutationKey","resetFlow","mutationFn","plainText","flow","groupId","flowCurrentStep","id","childId","actionId","res","post","chatService","resetConversationFlow","
|
|
1
|
+
{"version":3,"names":["useMutation","conversationQueryKeys","useConversationStore","apiInstance","unwrapEnvelope","ENDPOINTS","useSendMessage","useChatDetailContext","trans","useResetFlow","conversationId","state","currentConversationId","mutate","runFlow","useRunFlow","sendMessage","conversationFlow","mutationKey","resetFlow","mutationFn","plainText","flow","groupId","flowCurrentStep","id","childId","actionId","res","post","chatService","resetConversationFlow","undefined","onSuccess","data","useCloseSupportSession","closeSession","closeConversationSession","setConverationFlowStep","payload","runConversationFlow","flowNextStep","isEnd","havingBotMessage"],"sourceRoot":"../../../../src","sources":["hooks/flows/useFlow.ts"],"mappings":";;AAAA,SAASA,WAAW,QAAQ,uBAAuB;AACnD,SAASC,qBAAqB,QAAQ,kBAAe;AACrD,SAASC,oBAAoB,QAAQ,sBAAa;AAClD,SAASC,WAAW,EAAEC,cAAc,QAAQ,wBAAqB;AAEjE,SAASC,SAAS,QAAQ,6BAA0B;AAMpD,SAASC,cAAc,QAAQ,8BAA2B;AAC1D,SAASC,oBAAoB,QAAQ,oCAAiC;AACtE,SAASC,KAAK,QAAQ,4BAAmB;AAEzC,OAAO,MAAMC,YAAY,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AACJ,CAAC","ignoreList":[]}
|
|
@@ -2,14 +2,14 @@
|
|
|
2
2
|
|
|
3
3
|
import { useQuery } from '@tanstack/react-query';
|
|
4
4
|
import { conversationQueryKeys } from "../query-keys.js";
|
|
5
|
-
import { apiInstance } from "../../services/apis.js";
|
|
5
|
+
import { apiInstance, unwrapEnvelope } from "../../services/apis.js";
|
|
6
6
|
import { ENDPOINTS } from "../../services/endpoints.js";
|
|
7
7
|
export const useGetConversationFlowMainMenu = conversationId => {
|
|
8
8
|
return useQuery({
|
|
9
9
|
queryKey: [conversationQueryKeys.flowMainMenu(conversationId || '')],
|
|
10
10
|
queryFn: async () => {
|
|
11
11
|
const res = await apiInstance?.get(ENDPOINTS.chatService.conversationFlowMainMenu(conversationId || ''));
|
|
12
|
-
return res
|
|
12
|
+
return unwrapEnvelope(res) ?? [];
|
|
13
13
|
},
|
|
14
14
|
enabled: !!conversationId
|
|
15
15
|
});
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["useQuery","conversationQueryKeys","apiInstance","ENDPOINTS","useGetConversationFlowMainMenu","conversationId","queryKey","flowMainMenu","queryFn","res","get","chatService","conversationFlowMainMenu","
|
|
1
|
+
{"version":3,"names":["useQuery","conversationQueryKeys","apiInstance","unwrapEnvelope","ENDPOINTS","useGetConversationFlowMainMenu","conversationId","queryKey","flowMainMenu","queryFn","res","get","chatService","conversationFlowMainMenu","enabled"],"sourceRoot":"../../../../src","sources":["hooks/flows/useGetConversationFlowMainMenu.ts"],"mappings":";;AAAA,SAASA,QAAQ,QAAQ,uBAAuB;AAChD,SAASC,qBAAqB,QAAQ,kBAAe;AACrD,SAASC,WAAW,EAAEC,cAAc,QAAQ,wBAAqB;AAGjE,SAASC,SAAS,QAAQ,6BAA0B;AAEpD,OAAO,MAAMC,8BAA8B,GAAIC,cAAuB,IAAK;EACzE,OAAON,QAAQ,CAAC;IACdO,QAAQ,EAAE,CAACN,qBAAqB,CAACO,YAAY,CAACF,cAAc,IAAI,EAAE,CAAC,CAAC;IACpEG,OAAO,EAAE,MAAAA,CAAA,KAAY;MACnB,MAAMC,GAAG,GAAG,MAAMR,WAAW,EAAES,GAAG,CAChCP,SAAS,CAACQ,WAAW,CAACC,wBAAwB,CAACP,cAAc,IAAI,EAAE,CACrE,CAAC;MACD,OAAOH,cAAc,CAAoBO,GAAG,CAAC,IAAI,EAAE;IACrD,CAAC;IACDI,OAAO,EAAE,CAAC,CAACR;EACb,CAAC,CAAC;AACJ,CAAC","ignoreList":[]}
|
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
3
|
import { useMutation } from '@tanstack/react-query';
|
|
4
|
-
import { apiInstance } from "../../services/apis.js";
|
|
4
|
+
import { apiInstance, unwrapEnvelope } from "../../services/apis.js";
|
|
5
5
|
import { ENDPOINTS } from "../../services/endpoints.js";
|
|
6
6
|
export const useFetchStickerByCategory = () => useMutation({
|
|
7
7
|
mutationFn: async categoryId => {
|
|
8
8
|
const res = await apiInstance?.get(ENDPOINTS.chatService.stickersByCategoryId(categoryId));
|
|
9
|
-
return res
|
|
9
|
+
return unwrapEnvelope(res) ?? [];
|
|
10
10
|
}
|
|
11
11
|
});
|
|
12
12
|
//# sourceMappingURL=useFetchStickerByCategory.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["useMutation","apiInstance","ENDPOINTS","useFetchStickerByCategory","mutationFn","categoryId","res","get","chatService","stickersByCategoryId"
|
|
1
|
+
{"version":3,"names":["useMutation","apiInstance","unwrapEnvelope","ENDPOINTS","useFetchStickerByCategory","mutationFn","categoryId","res","get","chatService","stickersByCategoryId"],"sourceRoot":"../../../../src","sources":["hooks/stickers/useFetchStickerByCategory.ts"],"mappings":";;AAAA,SAASA,WAAW,QAAQ,uBAAuB;AACnD,SAASC,WAAW,EAAEC,cAAc,QAAQ,wBAAqB;AACjE,SAASC,SAAS,QAAQ,6BAA0B;AAIpD,OAAO,MAAMC,yBAAyB,GAAGA,CAAA,KACvCJ,WAAW,CAAC;EACVK,UAAU,EAAE,MAAOC,UAAkB,IAAK;IACxC,MAAMC,GAAG,GAAG,MAAMN,WAAW,EAAEO,GAAG,CAChCL,SAAS,CAACM,WAAW,CAACC,oBAAoB,CAACJ,UAAU,CACvD,CAAC;IACD,OAAOJ,cAAc,CAAgBK,GAAG,CAAC,IAAI,EAAE;EACjD;AACF,CAAC,CAAC","ignoreList":[]}
|
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
3
|
import { useQuery } from '@tanstack/react-query';
|
|
4
|
-
import { apiInstance } from "../../services/apis.js";
|
|
4
|
+
import { apiInstance, unwrapEnvelope } from "../../services/apis.js";
|
|
5
5
|
import { stickerQueryKeys } from "../query-keys.js";
|
|
6
6
|
import { ENDPOINTS } from "../../services/endpoints.js";
|
|
7
7
|
export const useStickerCategories = () => useQuery({
|
|
8
8
|
queryKey: stickerQueryKeys.categories(),
|
|
9
9
|
queryFn: async () => {
|
|
10
10
|
const res = await apiInstance?.get(ENDPOINTS.chatService.stickerCategories());
|
|
11
|
-
return res
|
|
11
|
+
return unwrapEnvelope(res) ?? [];
|
|
12
12
|
}
|
|
13
13
|
});
|
|
14
14
|
//# sourceMappingURL=useStickerCategories.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["useQuery","apiInstance","stickerQueryKeys","ENDPOINTS","useStickerCategories","queryKey","categories","queryFn","res","get","chatService","stickerCategories"
|
|
1
|
+
{"version":3,"names":["useQuery","apiInstance","unwrapEnvelope","stickerQueryKeys","ENDPOINTS","useStickerCategories","queryKey","categories","queryFn","res","get","chatService","stickerCategories"],"sourceRoot":"../../../../src","sources":["hooks/stickers/useStickerCategories.ts"],"mappings":";;AAAA,SAASA,QAAQ,QAAQ,uBAAuB;AAChD,SAASC,WAAW,EAAEC,cAAc,QAAQ,wBAAqB;AACjE,SAASC,gBAAgB,QAAQ,kBAAe;AAChD,SAASC,SAAS,QAAQ,6BAA0B;AAIpD,OAAO,MAAMC,oBAAoB,GAAGA,CAAA,KAClCL,QAAQ,CAAC;EACPM,QAAQ,EAAEH,gBAAgB,CAACI,UAAU,CAAC,CAAC;EACvCC,OAAO,EAAE,MAAAA,CAAA,KAAY;IACnB,MAAMC,GAAG,GAAG,MAAMR,WAAW,EAAES,GAAG,CAChCN,SAAS,CAACO,WAAW,CAACC,iBAAiB,CAAC,CAC1C,CAAC;IACD,OAAOV,cAAc,CAAoBO,GAAG,CAAC,IAAI,EAAE;EACrD;AACF,CAAC,CAAC","ignoreList":[]}
|
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
3
|
import { useQuery } from '@tanstack/react-query';
|
|
4
|
-
import { apiInstance } from "../../services/apis.js";
|
|
4
|
+
import { apiInstance, unwrapEnvelope } from "../../services/apis.js";
|
|
5
5
|
import { stickerQueryKeys } from "../query-keys.js";
|
|
6
6
|
import { ENDPOINTS } from "../../services/endpoints.js";
|
|
7
7
|
export const useStickerHistory = () => useQuery({
|
|
8
8
|
queryKey: stickerQueryKeys.recent(),
|
|
9
9
|
queryFn: async () => {
|
|
10
10
|
const res = await apiInstance?.get(ENDPOINTS.chatService.stickerHistory());
|
|
11
|
-
return res
|
|
11
|
+
return unwrapEnvelope(res) ?? [];
|
|
12
12
|
},
|
|
13
13
|
staleTime: 0,
|
|
14
14
|
gcTime: 0
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["useQuery","apiInstance","stickerQueryKeys","ENDPOINTS","useStickerHistory","queryKey","recent","queryFn","res","get","chatService","stickerHistory","
|
|
1
|
+
{"version":3,"names":["useQuery","apiInstance","unwrapEnvelope","stickerQueryKeys","ENDPOINTS","useStickerHistory","queryKey","recent","queryFn","res","get","chatService","stickerHistory","staleTime","gcTime"],"sourceRoot":"../../../../src","sources":["hooks/stickers/useStickerHistory.ts"],"mappings":";;AAAA,SAASA,QAAQ,QAAQ,uBAAuB;AAChD,SAASC,WAAW,EAAEC,cAAc,QAAQ,wBAAqB;AACjE,SAASC,gBAAgB,QAAQ,kBAAe;AAChD,SAASC,SAAS,QAAQ,6BAA0B;AAIpD,OAAO,MAAMC,iBAAiB,GAAGA,CAAA,KAC/BL,QAAQ,CAAC;EACPM,QAAQ,EAAEH,gBAAgB,CAACI,MAAM,CAAC,CAAC;EACnCC,OAAO,EAAE,MAAAA,CAAA,KAAY;IACnB,MAAMC,GAAG,GAAG,MAAMR,WAAW,EAAES,GAAG,CAChCN,SAAS,CAACO,WAAW,CAACC,cAAc,CAAC,CACvC,CAAC;IACD,OAAOV,cAAc,CAAgBO,GAAG,CAAC,IAAI,EAAE;EACjD,CAAC;EACDI,SAAS,EAAE,CAAC;EACZC,MAAM,EAAE;AACV,CAAC,CAAC","ignoreList":[]}
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
|
|
3
3
|
import { useQuery } from '@tanstack/react-query';
|
|
4
4
|
import { commonQueryKeys } from "../query-keys.js";
|
|
5
|
-
import { apiInstance } from "../../services/apis.js";
|
|
5
|
+
import { apiInstance, unwrapEnvelope } from "../../services/apis.js";
|
|
6
6
|
import { ENDPOINTS } from "../../services/endpoints.js";
|
|
7
7
|
import { normalizeUrl } from "../../utils/url.js";
|
|
8
8
|
export const useFetchUrlMetadata = url => useQuery({
|
|
@@ -10,8 +10,9 @@ export const useFetchUrlMetadata = url => useQuery({
|
|
|
10
10
|
queryFn: async () => {
|
|
11
11
|
const path = `${ENDPOINTS.chatService.urlMetadata}?url=${normalizeUrl(url || '')}`;
|
|
12
12
|
const res = await apiInstance?.get(path);
|
|
13
|
-
|
|
14
|
-
|
|
13
|
+
const metadata = unwrapEnvelope(res);
|
|
14
|
+
return metadata?.title ? {
|
|
15
|
+
...metadata,
|
|
15
16
|
url
|
|
16
17
|
} : null;
|
|
17
18
|
},
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["useQuery","commonQueryKeys","apiInstance","ENDPOINTS","normalizeUrl","useFetchUrlMetadata","url","queryKey","urlMetadata","queryFn","path","chatService","res","get","
|
|
1
|
+
{"version":3,"names":["useQuery","commonQueryKeys","apiInstance","unwrapEnvelope","ENDPOINTS","normalizeUrl","useFetchUrlMetadata","url","queryKey","urlMetadata","queryFn","path","chatService","res","get","metadata","title","enabled"],"sourceRoot":"../../../../src","sources":["hooks/useLinkPreview/useFetchUrlMetadata.ts"],"mappings":";;AAAA,SAASA,QAAQ,QAAQ,uBAAuB;AAChD,SAASC,eAAe,QAAQ,kBAAe;AAC/C,SAASC,WAAW,EAAEC,cAAc,QAAQ,wBAAqB;AAGjE,SAASC,SAAS,QAAQ,6BAA0B;AACpD,SAASC,YAAY,QAAQ,oBAAiB;AAE9C,OAAO,MAAMC,mBAAmB,GAAIC,GAAY,IAC9CP,QAAQ,CAAC;EACPQ,QAAQ,EAAEP,eAAe,CAACQ,WAAW,CAACJ,YAAY,CAACE,GAAG,IAAI,EAAE,CAAC,CAAC;EAC9DG,OAAO,EAAE,MAAAA,CAAA,KAAY;IACnB,MAAMC,IAAI,GAAG,GAAGP,SAAS,CAACQ,WAAW,CAACH,WAAW,QAAQJ,YAAY,CAACE,GAAG,IAAI,EAAE,CAAC,EAAE;IAClF,MAAMM,GAAG,GAAG,MAAMX,WAAW,EAAEY,GAAG,CAA6BH,IAAI,CAAC;IACpE,MAAMI,QAAQ,GAAGZ,cAAc,CAAeU,GAAG,CAAC;IAClD,OAAOE,QAAQ,EAAEC,KAAK,GAClB;MACE,GAAGD,QAAQ;MACXR;IACF,CAAC,GACD,IAAI;EACV,CAAC;EACDU,OAAO,EAAE,CAAC,CAACV;AACb,CAAC,CAAC","ignoreList":[]}
|
package/lib/module/index.js
CHANGED
|
@@ -21,7 +21,7 @@ export { Avatar } from "./components/Avatar/index.js";
|
|
|
21
21
|
export { ThreadCard } from "./components/ThreadCard/index.js";
|
|
22
22
|
export { AttachmentPreview } from "./components/AttachmentPreview/index.js";
|
|
23
23
|
export { MediaViewerModal } from "./components/MediaViewerModal.js";
|
|
24
|
-
export { Inbox } from "./screens/inbox/index.js";
|
|
24
|
+
export { Inbox, MessagesTab } from "./screens/inbox/index.js";
|
|
25
25
|
export { default as MediaViewerScreen } from "./screens/MediaView/index.js";
|
|
26
26
|
export { default as ResourceCenterScreen } from "./screens/ResourceCenter/index.js";
|
|
27
27
|
export { default as SearchConversation } from "./screens/SearchConversation/index.js";
|
package/lib/module/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["ChatAPI","setAuthToken","getAuthToken","clearAuthToken","setTokenRefreshCallback","setTokenRefreshFailedCallback","refreshAuthToken","initBaseUrl","getBaseUrl","Config","useImageAttachment","useMediaViewer","initializeAttachmentHandlers","AttachmentOrchestratorService","Avatar","ThreadCard","AttachmentPreview","MediaViewerModal","Inbox","default","MediaViewerScreen","ResourceCenterScreen","SearchConversation","SearchMessage","LoginStatus","MessageType","GroupJoinSource","registerUIUtils","UIUtils","DFlowContext"],"sourceRoot":"../../src","sources":["index.tsx"],"mappings":";;AAAA,SAASA,OAAO,QAAQ,qBAAY;AACpC,SACEC,YAAY,EACZC,YAAY,EACZC,cAAc,EACdC,uBAAuB,EACvBC,6BAA6B,EAC7BC,gBAAgB,QACX,oBAAiB;AACxB,SAASC,WAAW,EAAEC,UAAU,QAAQ,2BAAwB;AAChE,SAASC,MAAM,QAAQ,mBAAU;AACjC,cAAc,iBAAQ;AACtB,cAAc,kBAAS;AACvB,cAAc,oBAAW;AACzB,cAAc,gCAA6B;AAC3C,cAAc,mCAAgC;AAC9C,SAASC,kBAAkB,QAAQ,+BAA4B;AAC/D,SAASC,cAAc,QAAQ,2BAAwB;AAEvD,cAAc,iBAAc;AAC5B,cAAc,wBAAqB;AACnC,cAAc,uBAAoB;AAClC,cAAc,mBAAgB;AAC9B,SAASC,4BAA4B,QAAQ,wCAA+B;AAC5E,SAASC,6BAA6B,QAAQ,sCAAmC;AACjF,SAASC,MAAM,QAAQ,8BAAqB;AAC5C,SAASC,UAAU,QAAQ,kCAAyB;AACpD,SAASC,iBAAiB,QAAQ,yCAAgC;AAClE,SAASC,gBAAgB,QAAQ,kCAA+B;AAChE,SAASC,KAAK,QAAQ,0BAAiB;
|
|
1
|
+
{"version":3,"names":["ChatAPI","setAuthToken","getAuthToken","clearAuthToken","setTokenRefreshCallback","setTokenRefreshFailedCallback","refreshAuthToken","initBaseUrl","getBaseUrl","Config","useImageAttachment","useMediaViewer","initializeAttachmentHandlers","AttachmentOrchestratorService","Avatar","ThreadCard","AttachmentPreview","MediaViewerModal","Inbox","MessagesTab","default","MediaViewerScreen","ResourceCenterScreen","SearchConversation","SearchMessage","LoginStatus","MessageType","GroupJoinSource","registerUIUtils","UIUtils","DFlowContext"],"sourceRoot":"../../src","sources":["index.tsx"],"mappings":";;AAAA,SAASA,OAAO,QAAQ,qBAAY;AACpC,SACEC,YAAY,EACZC,YAAY,EACZC,cAAc,EACdC,uBAAuB,EACvBC,6BAA6B,EAC7BC,gBAAgB,QACX,oBAAiB;AACxB,SAASC,WAAW,EAAEC,UAAU,QAAQ,2BAAwB;AAChE,SAASC,MAAM,QAAQ,mBAAU;AACjC,cAAc,iBAAQ;AACtB,cAAc,kBAAS;AACvB,cAAc,oBAAW;AACzB,cAAc,gCAA6B;AAC3C,cAAc,mCAAgC;AAC9C,SAASC,kBAAkB,QAAQ,+BAA4B;AAC/D,SAASC,cAAc,QAAQ,2BAAwB;AAEvD,cAAc,iBAAc;AAC5B,cAAc,wBAAqB;AACnC,cAAc,uBAAoB;AAClC,cAAc,mBAAgB;AAC9B,SAASC,4BAA4B,QAAQ,wCAA+B;AAC5E,SAASC,6BAA6B,QAAQ,sCAAmC;AACjF,SAASC,MAAM,QAAQ,8BAAqB;AAC5C,SAASC,UAAU,QAAQ,kCAAyB;AACpD,SAASC,iBAAiB,QAAQ,yCAAgC;AAClE,SAASC,gBAAgB,QAAQ,kCAA+B;AAChE,SAASC,KAAK,EAAEC,WAAW,QAAQ,0BAAiB;AACpD,SAASC,OAAO,IAAIC,iBAAiB,QAAQ,8BAAqB;AAClE,SAASD,OAAO,IAAIE,oBAAoB,QAAQ,mCAA0B;AAE1E,SAASF,OAAO,IAAIG,kBAAkB,QAAQ,uCAA8B;AAC5E,SAASH,OAAO,IAAII,aAAa,QAAQ,kCAAyB;AAClE,cAAc,gCAAuB;AACrC,cAAc,6BAAoB;AAOlC,SACEC,WAAW,EACXC,WAAW,EACXC,eAAe,QACV,+BAA+B;AACtC,cAAc,gCAAuB;AAgBrC,SAASC,eAAe,EAAEC,OAAO,QAAQ,oBAAiB;AAE1D,SAASC,YAAY,QAAQ,kBAAe","ignoreList":[]}
|
|
@@ -73,6 +73,7 @@ const PinnedMessagesSheetContent = /*#__PURE__*/memo(({
|
|
|
73
73
|
isOutgoing: isOutgoing,
|
|
74
74
|
createdAtTime: createdAtTime,
|
|
75
75
|
onPress: handlePressMessage,
|
|
76
|
+
alwaysHandlePress: true,
|
|
76
77
|
customMessageItemFactory: customMessageItemFactory
|
|
77
78
|
}), !isOutgoing && unpinButton]
|
|
78
79
|
}), !!timeLabel && /*#__PURE__*/_jsx(KLabel.Text, {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["memo","useCallback","StyleSheet","MessageType","KContainer","KLabel","KColors","KImage","KSpacingValue","UIUtils","trans","usePinnedMessageStore","LegendChatMessage","formatMessageTime","jsx","_jsx","jsxs","_jsxs","SELF_RENDERS_TIME_FOR_INCOMING","Set","TextMessage","AtTextMessage","QuoteMessage","UrlTextMessage","PinnedMessagesSheetContent","currentUserId","unpinMessage","customMessageItemFactory","onPressMessage","messages","state","handleUnpinMessage","message","getState","length","bottomSheet","dismiss","handlePressMessage","messageId","find","m","clientMsgID","serverMsgID","View","paddingV","children","Text","typo","color","gray","normal","paddingH","marginB","map","isOutgoing","sendID","createdAtTime","sendTime","createTime","hasInternalTimeLabel","has","contentType","timeLabel","unpinButton","Touchable","center","br","width","height","background","style","styles","unpinButtonLeft","unpinButtonRight","onPress","VectorIcons","name","provider","size","dark","rowRight","rowLeft","messageRow","messageRowRight","messageRowLeft","light","marginT","displayName","UNPIN_BUTTON_GAP","create","paddingHorizontal","marginBottom","alignItems","flexDirection","justifyContent","marginRight","marginLeft","openPinnedMessagesSheet","open","header","title","text","alignment","showCloseButton","touchOutsideToDismiss","body","renderContent"],"sourceRoot":"../../../../src","sources":["screens/chat-detail/PinnedMessagesSheet.tsx"],"mappings":";;AAAA,SAASA,IAAI,EAAEC,WAAW,QAAQ,OAAO;AAEzC,SAASC,UAAU,QAAQ,cAAc;AACzC,SAASC,WAAW,QAA0B,+BAA+B;AAC7E,SACEC,UAAU,EACVC,MAAM,EACNC,OAAO,EACPC,MAAM,EACNC,aAAa,QACR,eAAe;AACtB,SAASC,OAAO,QAAQ,wBAAqB;AAC7C,SAASC,KAAK,QAAQ,4BAAmB;AACzC,SAASC,qBAAqB,QAAQ,8BAA2B;AACjE,SAASC,iBAAiB,QAAQ,+BAA4B;AAC9D,SAASC,iBAAiB,QAAQ,0BAAuB;;AAEzD;AACA;AACA;AAAA,SAAAC,GAAA,IAAAC,IAAA,EAAAC,IAAA,IAAAC,KAAA;AACA,MAAMC,8BAA8B,GAAG,IAAIC,GAAG,CAAC,CAC7ChB,WAAW,CAACiB,WAAW,EACvBjB,WAAW,CAACkB,aAAa,EACzBlB,WAAW,CAACmB,YAAY,EACxBnB,WAAW,CAACoB,cAAc,CAC3B,CAAC;AASF,MAAMC,0BAA0B,gBAAGxB,IAAI,CACrC,CAAC;EACCyB,aAAa;EACbC,YAAY;EACZC,wBAAwB;EACxBC;AAC+B,CAAC,KAAK;EACrC,MAAMC,QAAQ,GAAGlB,qBAAqB,CAAEmB,KAAK,IAAKA,KAAK,CAACD,QAAQ,CAAC;EAEjE,MAAME,kBAAkB,GAAG9B,WAAW,CACpC,MAAO+B,OAAoB,IAAK;IAC9B,MAAMN,YAAY,CAACM,OAAO,CAAC;IAC3B,IAAIrB,qBAAqB,CAACsB,QAAQ,CAAC,CAAC,CAAC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S,GAAGH,oBAAoB,GAClC,EAAE,GACF9C,iBAAiB,CAAC2C,aAAa,CAAC;MAEpC,MAAMO,WAAW,gBACfhD,IAAA,CAACX,UAAU,CAAC4D,SAAS;QACnBC,MAAM;QACNC,EAAE,EAAC,OAAO;QACVC,KAAK,EAAE,EAAG;QACVC,MAAM,EAAE,EAAG;QACXC,UAAU,EAAE/D,OAAO,CAAC+D,UAAW;QAC/BC,KAAK,EACHhB,UAAU,GAAGiB,MAAM,CAACC,eAAe,GAAGD,MAAM,CAACE,gBAC9C;QACDC,OAAO,EAAEA,CAAA,KAAM3C,kBAAkB,CAACC,OAAO,CAAE;QAAAa,QAAA,eAE3C9B,IAAA,CAACR,MAAM,CAACoE,WAAW;UACjBC,IAAI,EAAC,iBAAiB;UACtBC,QAAQ,EAAC,YAAY;UACrBC,IAAI,EAAE,EAAG;UACT9B,KAAK,EAAE1C,OAAO,CAAC2C,IAAI,CAAC8B;QAAK,CAC1B;MAAC,CACkB,CACvB;MAED,oBACE9D,KAAA,CAACb,UAAU,CAACuC,IAAI;QAEd2B,KAAK,EAAEhB,UAAU,GAAGiB,MAAM,CAACS,QAAQ,GAAGT,MAAM,CAACU,OAAQ;QAAApC,QAAA,gBAErD5B,KAAA,CAACb,UAAU,CAACuC,IAAI;UACd2B,KAAK,EAAE,CACLC,MAAM,CAACW,UAAU,EACjB5B,UAAU,GAAGiB,MAAM,CAACY,eAAe,GAAGZ,MAAM,CAACa,cAAc,CAC3D;UAAAvC,QAAA,GAEDS,UAAU,IAAIS,WAAW,eAE1BhD,IAAA,CAACH,iBAAiB;YAChBoB,OAAO,EAAEA,OAAQ;YACjBM,SAAS,EAAEA,SAAU;YACrBgB,UAAU,EAAEA,UAAW;YACvBE,aAAa,EAAEA,aAAc;YAC7BkB,OAAO,EAAErC,kBAAmB;
|
|
1
|
+
{"version":3,"names":["memo","useCallback","StyleSheet","MessageType","KContainer","KLabel","KColors","KImage","KSpacingValue","UIUtils","trans","usePinnedMessageStore","LegendChatMessage","formatMessageTime","jsx","_jsx","jsxs","_jsxs","SELF_RENDERS_TIME_FOR_INCOMING","Set","TextMessage","AtTextMessage","QuoteMessage","UrlTextMessage","PinnedMessagesSheetContent","currentUserId","unpinMessage","customMessageItemFactory","onPressMessage","messages","state","handleUnpinMessage","message","getState","length","bottomSheet","dismiss","handlePressMessage","messageId","find","m","clientMsgID","serverMsgID","View","paddingV","children","Text","typo","color","gray","normal","paddingH","marginB","map","isOutgoing","sendID","createdAtTime","sendTime","createTime","hasInternalTimeLabel","has","contentType","timeLabel","unpinButton","Touchable","center","br","width","height","background","style","styles","unpinButtonLeft","unpinButtonRight","onPress","VectorIcons","name","provider","size","dark","rowRight","rowLeft","messageRow","messageRowRight","messageRowLeft","alwaysHandlePress","light","marginT","displayName","UNPIN_BUTTON_GAP","create","paddingHorizontal","marginBottom","alignItems","flexDirection","justifyContent","marginRight","marginLeft","openPinnedMessagesSheet","open","header","title","text","alignment","showCloseButton","touchOutsideToDismiss","body","renderContent"],"sourceRoot":"../../../../src","sources":["screens/chat-detail/PinnedMessagesSheet.tsx"],"mappings":";;AAAA,SAASA,IAAI,EAAEC,WAAW,QAAQ,OAAO;AAEzC,SAASC,UAAU,QAAQ,cAAc;AACzC,SAASC,WAAW,QAA0B,+BAA+B;AAC7E,SACEC,UAAU,EACVC,MAAM,EACNC,OAAO,EACPC,MAAM,EACNC,aAAa,QACR,eAAe;AACtB,SAASC,OAAO,QAAQ,wBAAqB;AAC7C,SAASC,KAAK,QAAQ,4BAAmB;AACzC,SAASC,qBAAqB,QAAQ,8BAA2B;AACjE,SAASC,iBAAiB,QAAQ,+BAA4B;AAC9D,SAASC,iBAAiB,QAAQ,0BAAuB;;AAEzD;AACA;AACA;AAAA,SAAAC,GAAA,IAAAC,IAAA,EAAAC,IAAA,IAAAC,KAAA;AACA,MAAMC,8BAA8B,GAAG,IAAIC,GAAG,CAAC,CAC7ChB,WAAW,CAACiB,WAAW,EACvBjB,WAAW,CAACkB,aAAa,EACzB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Vf,KAAK,EAAE,MAAM;IACb2B,aAAa,EAAE,KAAK;IACpBD,UAAU,EAAE;EACd,CAAC;EACDT,cAAc,EAAE;IACdW,cAAc,EAAE;EAClB,CAAC;EACDZ,eAAe,EAAE;IACfY,cAAc,EAAE;EAClB,CAAC;EACDvB,eAAe,EAAE;IACfwB,WAAW,EAAEP;EACf,CAAC;EACDhB,gBAAgB,EAAE;IAChBwB,UAAU,EAAER;EACd;AACF,CAAC,CAAC;AASF,OAAO,MAAMS,uBAAuB,GAAGA,CAAC;EACtCzE,aAAa;EACbC,YAAY;EACZC,wBAAwB;EACxBC;AAC6B,CAAC,KAAK;EACnCnB,OAAO,CAAC0B,WAAW,CAACgE,IAAI,CAAC;IACvBC,MAAM,EAAE;MACNC,KAAK,EAAE;QAAEC,IAAI,EAAE5F,KAAK,CAAC,4BAA4B;MAAE,CAAC;MACpD6F,SAAS,EAAE,MAAM;MACjBC,eAAe,EAAE;IACnB,CAAC;IACDC,qBAAqB,EAAE,IAAI;IAC3BC,IAAI,EAAE;MACJC,aAAa,EAAEA,CAAA,kBACb5F,IAAA,CAACS,0BAA0B;QACzBC,aAAa,EAAEA,aAAc;QAC7BC,YAAY,EAAEA,YAAa;QAC3BC,wBAAwB,EAAEA,wBAAyB;QACnDC,cAAc,EAAEA;MAAe,CAChC;IAEL;EACF,CAAC,CAAC;AACJ,CAAC","ignoreList":[]}
|
|
@@ -40,7 +40,9 @@ const SYSTEM_MESSAGE_TYPES = GROUP_NOTIFICATION_TYPES;
|
|
|
40
40
|
|
|
41
41
|
// Tapping these types must keep opening the media/file as today — they never
|
|
42
42
|
// participate in tap-to-reveal-time, so no Tap gesture is attached at all for
|
|
43
|
-
// them (avoids racing their own internal touchables for the same tap).
|
|
43
|
+
// them (avoids racing their own internal touchables for the same tap). Callers
|
|
44
|
+
// that need every message type tappable regardless (e.g. navigating to the
|
|
45
|
+
// original message from a quote/pin) opt in via `alwaysHandlePress`.
|
|
44
46
|
const TIME_REVEAL_EXCLUDED_TYPES = [...MEDIA_TYPES, MessageType.FileMessage];
|
|
45
47
|
export const LegendChatMessage = /*#__PURE__*/memo(({
|
|
46
48
|
message,
|
|
@@ -51,6 +53,7 @@ export const LegendChatMessage = /*#__PURE__*/memo(({
|
|
|
51
53
|
onPressUrl,
|
|
52
54
|
onRetry,
|
|
53
55
|
onPress,
|
|
56
|
+
alwaysHandlePress,
|
|
54
57
|
onLongPress,
|
|
55
58
|
customMessageItemFactory,
|
|
56
59
|
isHighlighted,
|
|
@@ -83,7 +86,8 @@ export const LegendChatMessage = /*#__PURE__*/memo(({
|
|
|
83
86
|
});
|
|
84
87
|
}
|
|
85
88
|
const MessageComponent = messageComponentMap[message?.contentType] ?? TextMessage;
|
|
86
|
-
const
|
|
89
|
+
const effectiveOnMediaPress = onMediaPress ?? (alwaysHandlePress ? handlePress : undefined);
|
|
90
|
+
const hasMediaPress = MEDIA_TYPES.includes(message?.contentType) && !!effectiveOnMediaPress;
|
|
87
91
|
// AtTextMessage: mention+URL combo attaches its link-preview card via
|
|
88
92
|
// ex.urlMetadata (see TextMessage's doc comment) and/or the native
|
|
89
93
|
// AtTextElem.urls (SDK rc39+) for in-text link highlighting — either
|
|
@@ -91,6 +95,7 @@ export const LegendChatMessage = /*#__PURE__*/memo(({
|
|
|
91
95
|
// reply's own text via the native QuoteElem.urls (see QuotedMessage).
|
|
92
96
|
const hasUrlPress = onPressUrl && (message?.contentType === MessageType.UrlTextMessage || message?.contentType === MessageType.AtTextMessage || message?.contentType === MessageType.QuoteMessage);
|
|
93
97
|
const canRevealTime = !TIME_REVEAL_EXCLUDED_TYPES.includes(message?.contentType);
|
|
98
|
+
const shouldHandlePress = canRevealTime || alwaysHandlePress;
|
|
94
99
|
return /*#__PURE__*/_jsxs(KContainer.View, {
|
|
95
100
|
style: messageStyles.wrapper,
|
|
96
101
|
row: true,
|
|
@@ -116,13 +121,13 @@ export const LegendChatMessage = /*#__PURE__*/memo(({
|
|
|
116
121
|
style: styles.senderName,
|
|
117
122
|
children: message.senderNickname
|
|
118
123
|
}), /*#__PURE__*/_jsx(LongPressWrapper, {
|
|
119
|
-
onPress:
|
|
124
|
+
onPress: shouldHandlePress ? handlePress : undefined,
|
|
120
125
|
onLongPress: handleLongPress,
|
|
121
126
|
children: /*#__PURE__*/_jsx(MessageComponent, {
|
|
122
127
|
message: message,
|
|
123
128
|
isOutgoing: isOutgoing,
|
|
124
129
|
createdAtTime: createdAtTime,
|
|
125
|
-
onMediaPress: hasMediaPress ?
|
|
130
|
+
onMediaPress: hasMediaPress ? effectiveOnMediaPress : undefined,
|
|
126
131
|
onPressUrl: hasUrlPress ? onPressUrl : undefined,
|
|
127
132
|
isHighlighted: isHighlighted,
|
|
128
133
|
isTimeRevealed: canRevealTime && isTimeRevealed,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["KContainer","KImage","KColors","KLabel","KSpacingValue","StyleSheet","memo","useCallback","useMemo","MessageType","Gesture","GestureDetector","runOnJS","TextMessage","ImageMessage","VideoMessage","FileMessage","LinkMessage","MergedMessage","RevokedMessage","GroupNotificationMessage","MessageStatusIndicator","messageStyles","QuotedMessage","StickerMessage","GROUP_NOTIFICATION_TYPES","Avatar","TAIL_WIDTH","jsx","_jsx","jsxs","_jsxs","messageComponentMap","AtTextMessage","QuoteMessage","UrlTextMessage","PictureMessage","MergeMessage","RevokeMessage","Object","fromEntries","map","type","MEDIA_TYPES","SYSTEM_MESSAGE_TYPES","TIME_REVEAL_EXCLUDED_TYPES","LegendChatMessage","message","messageId","isOutgoing","createdAtTime","onMediaPress","onPressUrl","onRetry","onPress","onLongPress","customMessageItemFactory","isHighlighted","isTimeRevealed","showName","showAvatar","showSenderGutter","groupPosition","handlePress","handleLongPress","customNode","includes","contentType","SystemMessageComponent","View","center","style","styles","systemMessageWrapper","children","MessageComponent","hasMediaPress","hasUrlPress","canRevealTime","wrapper","row","alignItems","avatarGutter","size","source","senderFaceUrl","fullName","senderNickname","content","Text","typo","color","gray","normal","numberOfLines","marginB","senderName","LongPressWrapper","
|
|
1
|
+
{"version":3,"names":["KContainer","KImage","KColors","KLabel","KSpacingValue","StyleSheet","memo","useCallback","useMemo","MessageType","Gesture","GestureDetector","runOnJS","TextMessage","ImageMessage","VideoMessage","FileMessage","LinkMessage","MergedMessage","RevokedMessage","GroupNotificationMessage","MessageStatusIndicator","messageStyles","QuotedMessage","StickerMessage","GROUP_NOTIFICATION_TYPES","Avatar","TAIL_WIDTH","jsx","_jsx","jsxs","_jsxs","messageComponentMap","AtTextMessage","QuoteMessage","UrlTextMessage","PictureMessage","MergeMessage","RevokeMessage","Object","fromEntries","map","type","MEDIA_TYPES","SYSTEM_MESSAGE_TYPES","TIME_REVEAL_EXCLUDED_TYPES","LegendChatMessage","message","messageId","isOutgoing","createdAtTime","onMediaPress","onPressUrl","onRetry","onPress","alwaysHandlePress","onLongPress","customMessageItemFactory","isHighlighted","isTimeRevealed","showName","showAvatar","showSenderGutter","groupPosition","handlePress","handleLongPress","customNode","includes","contentType","SystemMessageComponent","View","center","style","styles","systemMessageWrapper","children","MessageComponent","effectiveOnMediaPress","undefined","hasMediaPress","hasUrlPress","canRevealTime","shouldHandlePress","wrapper","row","alignItems","avatarGutter","size","source","senderFaceUrl","fullName","senderNickname","content","Text","typo","color","gray","normal","numberOfLines","marginB","senderName","LongPressWrapper","isPinned","pinBadge","VectorIcons","name","primary","displayName","AVATAR_SIZE","create","position","marginLeft","width","marginRight","alignSelf","marginVertical","top","right","height","borderRadius","justifyContent","backgroundColor","pageBackground","shadowColor","black","shadowOffset","shadowOpacity","shadowRadius","elevation","borderWidth","borderColor","white","zIndex","Number","MAX_SAFE_INTEGER","gesture","gestures","LongPress","onStart","Tap","filter","Boolean","length","Race"],"sourceRoot":"../../../../../src","sources":["screens/chat-detail/legend/LegendChatMessage.tsx"],"mappings":";;AAAA,SACEA,UAAU,EACVC,MAAM,EACNC,OAAO,EACPC,MAAM,EACNC,aAAa,QACR,eAAe;AACtB,SAASC,UAAU,QAAQ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versationStore, useUserStore } from "../store/index.js";
|
|
5
5
|
export let apiInstance = null;
|
|
6
|
+
let responseUnwrapped = false;
|
|
6
7
|
export let ChatAPI;
|
|
7
8
|
(function (_ChatAPI) {
|
|
8
|
-
function initApiInstance(api) {
|
|
9
|
+
function initApiInstance(api, options) {
|
|
9
10
|
apiInstance = api;
|
|
11
|
+
responseUnwrapped = options?.unwrapped ?? false;
|
|
10
12
|
}
|
|
11
13
|
_ChatAPI.initApiInstance = initApiInstance;
|
|
12
14
|
const getLoginStatus = _ChatAPI.getLoginStatus = async operationID => {
|
|
@@ -18,4 +20,15 @@ export let ChatAPI;
|
|
|
18
20
|
return OpenIMSDK.logout(operationID);
|
|
19
21
|
};
|
|
20
22
|
})(ChatAPI || (ChatAPI = {}));
|
|
23
|
+
/**
|
|
24
|
+
* Reads the payload out of an apiInstance response, accounting for whichever
|
|
25
|
+
* envelope shape the injected instance produces (see `initApiInstance`'s
|
|
26
|
+
* `unwrapped` option). Consumers should use this instead of reading
|
|
27
|
+
* `res?.data?.data` / `res?.data` directly.
|
|
28
|
+
*/
|
|
29
|
+
export function unwrapEnvelope(res) {
|
|
30
|
+
const body = res?.data;
|
|
31
|
+
if (body == null) return null;
|
|
32
|
+
return (responseUnwrapped ? body : body.data) ?? null;
|
|
33
|
+
}
|
|
21
34
|
//# sourceMappingURL=apis.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["OpenIMSDK","LoginStatus","useConversationStore","useUserStore","apiInstance","ChatAPI","_ChatAPI","initApiInstance","api","getLoginStatus","operationID","Logged","logout","getState","reset"],"sourceRoot":"../../../src","sources":["services/apis.ts"],"mappings":";;AACA,OAAOA,SAAS,IAAIC,WAAW,QAAQ,+BAA+B;AACtE,SAASC,oBAAoB,EAAEC,YAAY,QAAQ,mBAAU;AAE7D,OAAO,IAAIC,WAAiC,GAAG,IAAI;AAAC,
|
|
1
|
+
{"version":3,"names":["OpenIMSDK","LoginStatus","useConversationStore","useUserStore","apiInstance","responseUnwrapped","ChatAPI","_ChatAPI","initApiInstance","api","options","unwrapped","getLoginStatus","operationID","Logged","logout","getState","reset","unwrapEnvelope","res","body","data"],"sourceRoot":"../../../src","sources":["services/apis.ts"],"mappings":";;AACA,OAAOA,SAAS,IAAIC,WAAW,QAAQ,+BAA+B;AACtE,SAASC,oBAAoB,EAAEC,YAAY,QAAQ,mBAAU;AAE7D,OAAO,IAAIC,WAAiC,GAAG,IAAI;AAanD,IAAIC,iBAAiB,GAAG,KAAK;AAAC,WAEbC,OAAO;AAAA,WAAAC,QAAA;EACf,SAASC,eAAeA,CAC7BC,GAAkB,EAClBC,OAAgC,EAC1B;IACNN,WAAW,GAAGK,GAAG;IACjBJ,iBAAiB,GAAGK,OAAO,EAAEC,SAAS,IAAI,KAAK;EACjD;EAACJ,QAAA,CAAAC,eAAA,GAAAA,eAAA;EAEM,MAAMI,cAAc,GAAAL,QAAA,CAAAK,cAAA,GAAG,MAAOC,WAAoB,IAAK;IAC5D,OAAO,CAAC,MAAMb,SAAS,CAACY,cAAc,CAACC,WAAW,CAAC,MAAMZ,WAAW,CAACa,MAAM;EAC7E,CAAC;EAEM,MAAMC,MAAM,GAAAR,QAAA,CAAAQ,MAAA,GAAG,MAAOF,WAAoB,IAAK;IACpDX,oBAAoB,CAACc,QAAQ,CAAC,CAAC,CAACC,KAAK,CAAC,CAAC;IACvCd,YAAY,CAACa,QAAQ,CAAC,CAAC,CAACC,KAAK,CAAC,CAAC;IAC/B,OAAOjB,SAAS,CAACe,MAAM,CAACF,WAAW,CAAC;EACtC,CAAC;AAAC,GAjBaP,OAAO,KAAPA,OAAO;AAoBxB;AACA;AACA;AACA;AACA;AACA;AACA,OAAO,SAASY,cAAcA,CAAIC,GAAwB,EAAY;EACpE,MAAMC,IAAI,GAAGD,GAAG,EAAEE,IAAoC;EACtD,IAAID,IAAI,IAAI,IAAI,EAAE,OAAO,IAAI;EAC7B,OAAQ,CAACf,iBAAiB,GAAGe,IAAI,GAAIA,IAAI,CAAkBC,IAAI,KAC7D,IAAI;AACR","ignoreList":[]}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
|
-
import { apiInstance } from "./apis.js";
|
|
3
|
+
import { apiInstance, unwrapEnvelope } from "./apis.js";
|
|
4
4
|
import { getApiEndpoint } from "../config/api-endpoints.js";
|
|
5
5
|
import { extractDomain } from "../utils/url.js";
|
|
6
6
|
import { DThreadResourceContentType } from "../types/chat.js";
|
|
@@ -128,12 +128,13 @@ export let ResourceCenterService;
|
|
|
128
128
|
(function (_ResourceCenterService) {
|
|
129
129
|
const fetchThreadResources = _ResourceCenterService.fetchThreadResources = async req => {
|
|
130
130
|
const res = await apiInstance?.post(getApiEndpoint('messagesResources'), req);
|
|
131
|
-
const rows = res
|
|
131
|
+
const rows = unwrapEnvelope(res) ?? [];
|
|
132
132
|
const items = rows.flatMap(parseThreadResourceItem);
|
|
133
133
|
// `pageable.totalPages`/`totalElements` come back as `0` on this endpoint even
|
|
134
134
|
// when rows are present (confirmed against staging) — unreliable, don't use it.
|
|
135
|
-
//
|
|
136
|
-
|
|
135
|
+
// Row-count-vs-pageSize is the trustworthy `hasMore` signal — `items.length` can
|
|
136
|
+
// exceed `rows.length` when a row splits into multiple items (e.g. multi-url).
|
|
137
|
+
const hasMore = rows.length >= req.pageSize;
|
|
137
138
|
return {
|
|
138
139
|
items,
|
|
139
140
|
page: req.page,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["apiInstance","getApiEndpoint","extractDomain","DThreadResourceContentType","safeJsonParse","raw","undefined","JSON","parse","parseLinkItems","chatLog","ex","content","metadata","urlMetadata","urls","length","url","map","linkUrl","matchesMetadata","linkTitle","title","linkDescription","description","linkImageUrl","image","linkDomain","parseThreadResourceItem","row","contentType","base","isRevoked","createdAt","sendTime","IMAGE","id","clientMsgID","sourceUrl","bigPicture","thumbnailUrl","snapshotPicture","VIDEO","videoUrl","snapshotUrl","duration","FILE","fileName","fileSize","mimeType","fileType","linkItems","fields","ResourceCenterService","_ResourceCenterService","fetchThreadResources","req","res","post","rows","
|
|
1
|
+
{"version":3,"names":["apiInstance","unwrapEnvelope","getApiEndpoint","extractDomain","DThreadResourceContentType","safeJsonParse","raw","undefined","JSON","parse","parseLinkItems","chatLog","ex","content","metadata","urlMetadata","urls","length","url","map","linkUrl","matchesMetadata","linkTitle","title","linkDescription","description","linkImageUrl","image","linkDomain","parseThreadResourceItem","row","contentType","base","isRevoked","createdAt","sendTime","IMAGE","id","clientMsgID","sourceUrl","bigPicture","thumbnailUrl","snapshotPicture","VIDEO","videoUrl","snapshotUrl","duration","FILE","fileName","fileSize","mimeType","fileType","linkItems","fields","ResourceCenterService","_ResourceCenterService","fetchThreadResources","req","res","post","rows","items","flatMap","hasMore","pageSize","page"],"sourceRoot":"../../../src","sources":["services/resourceCenter.ts"],"mappings":";;AAAA,SAASA,WAAW,EAAEC,cAAc,QAAQ,WAAQ;AACpD,SAASC,cAAc,QAAQ,4BAAyB;AACxD,SAASC,aAAa,QAAQ,iBAAc;AAE5C,SACEC,0BAA0B,QAKrB,kBAAe;;AAoBtB;AACA;AACA;;AAKA;AACA;AACA;;AAcA,MAAMC,aAAa,GAAOC,GAAuB,IAAoB;EACnE,IAAI,CAACA,GAAG,EAAE,OAAOC,SAAS;EAC1B,IAAI;IACF,OAAOC,IAAI,CAACC,KAAK,CAACH,GAAG,CAAC;EACxB,CAAC,CAAC,MAAM;IACN,OAAOC,SAAS;EAClB;AACF,CAAC;AAOD;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,MAAMG,cAAc,GAClBC,OAAyC,IACxB;EACjB,MAAMC,EAAE,GAAGP,aAAa,CAAeM,OAAO,CAACC,EAAE,CAAC;EAClD,MAAMC,OAAO,GAAGR,aAAa,CAAoBM,OAAO,CAACE,OAAO,CAAC;EACjE,MAAMC,QAAQ,GAAGF,EAAE,EAAEG,WAAW;EAChC,MAAMC,IAAI,GAAGH,OAAO,EAAE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AqB;AAAA,WAAAC,sBAAA;EAC7B,MAAMC,oBAAoB,GAAAD,sBAAA,CAAAC,oBAAA,GAAG,MAClCC,GAA2B,IAC+C;IAC1E,MAAMC,GAAG,GAAG,MAAM1D,WAAW,EAAE2D,IAAI,CAEjCzD,cAAc,CAAC,mBAAmB,CAAC,EAAEuD,GAAG,CAAC;IAC3C,MAAMG,IAAI,GAAG3D,cAAc,CAA8ByD,GAAG,CAAC,IAAI,EAAE;IACnE,MAAMG,KAAK,GAAGD,IAAI,CAACE,OAAO,CAACjC,uBAAuB,CAAC;IACnD;IACA;IACA;IACA;IACA,MAAMkC,OAAO,GAAGH,IAAI,CAAC3C,MAAM,IAAIwC,GAAG,CAACO,QAAQ;IAC3C,OAAO;MAAEH,KAAK;MAAEI,IAAI,EAAER,GAAG,CAACQ,IAAI;MAAEF;IAAQ,CAAC;EAC3C,CAAC;AAAC,GAfaT,qBAAqB,KAArBA,qBAAqB","ignoreList":[]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"useFetchUrlMetadata.d.ts","sourceRoot":"","sources":["../../../../../src/hooks/useLinkPreview/useFetchUrlMetadata.ts"],"names":[],"mappings":"AAQA,eAAO,MAAM,mBAAmB,GAAI,MAAM,MAAM;;;;;
|
|
1
|
+
{"version":3,"file":"useFetchUrlMetadata.d.ts","sourceRoot":"","sources":["../../../../../src/hooks/useLinkPreview/useFetchUrlMetadata.ts"],"names":[],"mappings":"AAQA,eAAO,MAAM,mBAAmB,GAAI,MAAM,MAAM;;;;;UAe5C,CAAC"}
|
|
@@ -20,7 +20,7 @@ export { Avatar } from './components/Avatar';
|
|
|
20
20
|
export { ThreadCard } from './components/ThreadCard';
|
|
21
21
|
export { AttachmentPreview } from './components/AttachmentPreview';
|
|
22
22
|
export { MediaViewerModal } from './components/MediaViewerModal';
|
|
23
|
-
export { Inbox } from './screens/inbox';
|
|
23
|
+
export { Inbox, MessagesTab } from './screens/inbox';
|
|
24
24
|
export { default as MediaViewerScreen } from './screens/MediaView';
|
|
25
25
|
export { default as ResourceCenterScreen } from './screens/ResourceCenter';
|
|
26
26
|
export type { ResourceCenterScreenProps } from './screens/ResourceCenter/types';
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/index.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,YAAY,CAAC;AACrC,OAAO,EACL,YAAY,EACZ,YAAY,EACZ,cAAc,EACd,uBAAuB,EACvB,6BAA6B,EAC7B,gBAAgB,GACjB,MAAM,iBAAiB,CAAC;AACzB,OAAO,EAAE,WAAW,EAAE,UAAU,EAAE,MAAM,wBAAwB,CAAC;AACjE,OAAO,EAAE,MAAM,EAAE,MAAM,UAAU,CAAC;AAClC,cAAc,QAAQ,CAAC;AACvB,cAAc,SAAS,CAAC;AACxB,cAAc,WAAW,CAAC;AAC1B,cAAc,6BAA6B,CAAC;AAC5C,cAAc,gCAAgC,CAAC;AAC/C,OAAO,EAAE,kBAAkB,EAAE,MAAM,4BAA4B,CAAC;AAChE,OAAO,EAAE,cAAc,EAAE,MAAM,wBAAwB,CAAC;AACxD,YAAY,EAAE,SAAS,EAAE,MAAM,wBAAwB,CAAC;AACxD,cAAc,cAAc,CAAC;AAC7B,cAAc,qBAAqB,CAAC;AACpC,cAAc,oBAAoB,CAAC;AACnC,cAAc,gBAAgB,CAAC;AAC/B,OAAO,EAAE,4BAA4B,EAAE,MAAM,+BAA+B,CAAC;AAC7E,OAAO,EAAE,6BAA6B,EAAE,MAAM,mCAAmC,CAAC;AAClF,OAAO,EAAE,MAAM,EAAE,MAAM,qBAAqB,CAAC;AAC7C,OAAO,EAAE,UAAU,EAAE,MAAM,yBAAyB,CAAC;AACrD,OAAO,EAAE,iBAAiB,EAAE,MAAM,gCAAgC,CAAC;AACnE,OAAO,EAAE,gBAAgB,EAAE,MAAM,+BAA+B,CAAC;AACjE,OAAO,EAAE,KAAK,EAAE,MAAM,iBAAi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EAAE,MAAM,0BAA0B,CAAC;AAC3E,YAAY,EAAE,yBAAyB,EAAE,MAAM,gCAAgC,CAAC;AAChF,OAAO,EAAE,OAAO,IAAI,kBAAkB,EAAE,MAAM,8BAA8B,CAAC;AAC7E,OAAO,EAAE,OAAO,IAAI,aAAa,EAAE,MAAM,yBAAyB,CAAC;AACnE,cAAc,uBAAuB,CAAC;AACtC,cAAc,oBAAoB,CAAC;AAEnC,YAAY,EACV,QAAQ,EACR,WAAW,EACX,gBAAgB,GACjB,MAAM,+BAA+B,CAAC;AACvC,OAAO,EACL,WAAW,EACX,WAAW,EACX,eAAe,GAChB,MAAM,+BAA+B,CAAC;AACvC,cAAc,uBAAuB,CAAC;AACtC,YAAY,EACV,eAAe,EACf,uBAAuB,EACvB,gBAAgB,EAChB,iBAAiB,EACjB,eAAe,EACf,qBAAqB,EACrB,aAAa,EACb,iBAAiB,EACjB,qBAAqB,EACrB,4BAA4B,EAC5B,cAAc,GACf,MAAM,uBAAuB,CAAC;AAC/B,mBAAmB,oBAAoB,CAAC;AAExC,OAAO,EAAE,eAAe,EAAE,OAAO,EAAE,MAAM,iBAAiB,CAAC;AAE3D,OAAO,EAAE,YAAY,EAAE,MAAM,eAAe,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"PinnedMessagesSheet.d.ts","sourceRoot":"","sources":["../../../../../src/screens/chat-detail/PinnedMessagesSheet.tsx"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,OAAO,CAAC;AAEvC,OAAO,EAAe,KAAK,WAAW,EAAE,MAAM,+BAA+B,CAAC;
|
|
1
|
+
{"version":3,"file":"PinnedMessagesSheet.d.ts","sourceRoot":"","sources":["../../../../../src/screens/chat-detail/PinnedMessagesSheet.tsx"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,OAAO,CAAC;AAEvC,OAAO,EAAe,KAAK,WAAW,EAAE,MAAM,+BAA+B,CAAC;AAwL9E,MAAM,WAAW,6BAA6B;IAC5C,aAAa,CAAC,EAAE,MAAM,CAAC;IACvB,YAAY,EAAE,CAAC,OAAO,EAAE,WAAW,KAAK,IAAI,GAAG,OAAO,CAAC,IAAI,CAAC,CAAC;IAC7D,wBAAwB,CAAC,EAAE,CAAC,IAAI,EAAE,WAAW,KAAK,SAAS,CAAC;IAC5D,cAAc,CAAC,EAAE,CAAC,OAAO,EAAE,WAAW,KAAK,IAAI,CAAC;CACjD;AAED,eAAO,MAAM,uBAAuB,GAAI,4EAKrC,6BAA6B,SAmB/B,CAAC"}
|
|
@@ -12,6 +12,16 @@ interface LegendChatMessageProps {
|
|
|
12
12
|
onPressUrl?: (url: string) => void;
|
|
13
13
|
onRetry?: (message: MessageItem) => void;
|
|
14
14
|
onPress?: (messageId: string) => void;
|
|
15
|
+
/**
|
|
16
|
+
* Fire `onPress` for every content type, including the ones excluded from
|
|
17
|
+
* tap-to-reveal-time (media/file). For Picture/Video/Merge — which always
|
|
18
|
+
* render their own full-bubble touchable — this also becomes the fallback
|
|
19
|
+
* `onMediaPress` when the caller doesn't supply one, since that touchable
|
|
20
|
+
* would otherwise swallow the tap before it reaches this component's own
|
|
21
|
+
* gesture wrapper. Used by callers that repurpose `onPress` for navigation
|
|
22
|
+
* (e.g. PinnedMessagesSheet) rather than the reveal-time toggle.
|
|
23
|
+
*/
|
|
24
|
+
alwaysHandlePress?: boolean;
|
|
15
25
|
onLongPress?: (messageId: string, message: MessageItem) => void;
|
|
16
26
|
customMessageItemFactory?: (m: MessageItem) => ReactNode;
|
|
17
27
|
isHighlighted?: boolean;
|
|
@@ -29,6 +39,6 @@ interface LegendChatMessageProps {
|
|
|
29
39
|
/** Position within its same-sender cluster — drives the bubble tail. */
|
|
30
40
|
groupPosition?: GroupPosition;
|
|
31
41
|
}
|
|
32
|
-
export declare const LegendChatMessage: import("react").MemoExoticComponent<({ message, messageId, isOutgoing, createdAtTime, onMediaPress, onPressUrl, onRetry, onPress, onLongPress, customMessageItemFactory, isHighlighted, isTimeRevealed, showName, showAvatar, showSenderGutter, groupPosition, }: LegendChatMessageProps) => string | number | bigint | true | Iterable<ReactNode> | Promise<string | number | bigint | boolean | import("react").ReactPortal | import("react").ReactElement<unknown, string | import("react").JSXElementConstructor<any>> | Iterable<ReactNode>> | import("react").JSX.Element>;
|
|
42
|
+
export declare const LegendChatMessage: import("react").MemoExoticComponent<({ message, messageId, isOutgoing, createdAtTime, onMediaPress, onPressUrl, onRetry, onPress, alwaysHandlePress, onLongPress, customMessageItemFactory, isHighlighted, isTimeRevealed, showName, showAvatar, showSenderGutter, groupPosition, }: LegendChatMessageProps) => string | number | bigint | true | Iterable<ReactNode> | Promise<string | number | bigint | boolean | import("react").ReactPortal | import("react").ReactElement<unknown, string | import("react").JSXElementConstructor<any>> | Iterable<ReactNode>> | import("react").JSX.Element>;
|
|
33
43
|
export {};
|
|
34
44
|
//# sourceMappingURL=LegendChatMessage.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"LegendChatMessage.d.ts","sourceRoot":"","sources":["../../../../../../src/screens/chat-detail/legend/LegendChatMessage.tsx"],"names":[],"mappings":"AASA,OAAO,KAAK,EAAoC,SAAS,EAAE,MAAM,OAAO,CAAC;AAEzE,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,+BAA+B,CAAC;AAGjE,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,+BAA+B,CAAC;AAe/D,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,kCAAkC,CAAC;AAStE,UAAU,sBAAsB;IAC9B,OAAO,EAAE,WAAW,CAAC;IACrB,yKAAyK;IACzK,SAAS,EAAE,MAAM,CAAC;IAClB,UAAU,EAAE,OAAO,CAAC;IACpB,aAAa,EAAE,MAAM,CAAC;IACtB,YAAY,CAAC,EAAE,CAAC,KAAK,EAAE,SAAS,EAAE,EAAE,KAAK,CAAC,EAAE,MAAM,KAAK,IAAI,CAAC;IAC5D,UAAU,CAAC,EAAE,CAAC,GAAG,EAAE,MAAM,KAAK,IAAI,CAAC;IACnC,OAAO,CAAC,EAAE,CAAC,OAAO,EAAE,WAAW,KAAK,IAAI,CAAC;IACzC,OAAO,CAAC,EAAE,CAAC,SAAS,EAAE,MAAM,KAAK,IAAI,CAAC;IACtC,WAAW,CAAC,EAAE,CAAC,SAAS,EAAE,MAAM,EAAE,OAAO,EAAE,WAAW,KAAK,IAAI,CAAC;IAChE,wBAAwB,CAAC,EAAE,CAAC,CAAC,EAAE,WAAW,KAAK,SAAS,CAAC;IACzD,aAAa,CAAC,EAAE,OAAO,CAAC;IACxB,cAAc,CAAC,EAAE,OAAO,CAAC;IACzB,2EAA2E;IAC3E,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB,6EAA6E;IAC7E,UAAU,CAAC,EAAE,OAAO,CAAC;IACrB;;;;OAIG;IACH,gBAAgB,CAAC,EAAE,OAAO,CAAC;IAC3B,wEAAwE;IACxE,aAAa,CAAC,EAAE,aAAa,CAAC;CAC/B;
|
|
1
|
+
{"version":3,"file":"LegendChatMessage.d.ts","sourceRoot":"","sources":["../../../../../../src/screens/chat-detail/legend/LegendChatMessage.tsx"],"names":[],"mappings":"AASA,OAAO,KAAK,EAAoC,SAAS,EAAE,MAAM,OAAO,CAAC;AAEzE,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,+BAA+B,CAAC;AAGjE,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,+BAA+B,CAAC;AAe/D,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,kCAAkC,CAAC;AAStE,UAAU,sBAAsB;IAC9B,OAAO,EAAE,WAAW,CAAC;IACrB,yKAAyK;IACzK,SAAS,EAAE,MAAM,CAAC;IAClB,UAAU,EAAE,OAAO,CAAC;IACpB,aAAa,EAAE,MAAM,CAAC;IACtB,YAAY,CAAC,EAAE,CAAC,KAAK,EAAE,SAAS,EAAE,EAAE,KAAK,CAAC,EAAE,MAAM,KAAK,IAAI,CAAC;IAC5D,UAAU,CAAC,EAAE,CAAC,GAAG,EAAE,MAAM,KAAK,IAAI,CAAC;IACnC,OAAO,CAAC,EAAE,CAAC,OAAO,EAAE,WAAW,KAAK,IAAI,CAAC;IACzC,OAAO,CAAC,EAAE,CAAC,SAAS,EAAE,MAAM,KAAK,IAAI,CAAC;IACtC;;;;;;;;OAQG;IACH,iBAAiB,CAAC,EAAE,OAAO,CAAC;IAC5B,WAAW,CAAC,EAAE,CAAC,SAAS,EAAE,MAAM,EAAE,OAAO,EAAE,WAAW,KAAK,IAAI,CAAC;IAChE,wBAAwB,CAAC,EAAE,CAAC,CAAC,EAAE,WAAW,KAAK,SAAS,CAAC;IACzD,aAAa,CAAC,EAAE,OAAO,CAAC;IACxB,cAAc,CAAC,EAAE,OAAO,CAAC;IACzB,2EAA2E;IAC3E,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB,6EAA6E;IAC7E,UAAU,CAAC,EAAE,OAAO,CAAC;IACrB;;;;OAIG;IACH,gBAAgB,CAAC,EAAE,OAAO,CAAC;IAC3B,wEAAwE;IACxE,aAAa,CAAC,EAAE,aAAa,CAAC;CAC/B;AAsCD,eAAO,MAAM,iBAAiB,uRAmBzB,sBAAsB,wRA8G1B,CAAC"}
|
|
@@ -1,8 +1,28 @@
|
|
|
1
1
|
import { type AxiosInstance } from 'axios';
|
|
2
2
|
export declare let apiInstance: AxiosInstance | null;
|
|
3
|
+
interface InitApiInstanceOptions {
|
|
4
|
+
/**
|
|
5
|
+
* Set true when the injected instance's response interceptor already
|
|
6
|
+
* strips the outer envelope (statusCode/message/pageable/data) down to
|
|
7
|
+
* just the payload (e.g. Mall's shared axios client). Defaults to false —
|
|
8
|
+
* the instance returns the raw `{ statusCode, message, pageable, data }`
|
|
9
|
+
* envelope untouched (e.g. Biz's axios client).
|
|
10
|
+
*/
|
|
11
|
+
unwrapped?: boolean;
|
|
12
|
+
}
|
|
3
13
|
export declare namespace ChatAPI {
|
|
4
|
-
function initApiInstance(api: AxiosInstance): void;
|
|
14
|
+
function initApiInstance(api: AxiosInstance, options?: InitApiInstanceOptions): void;
|
|
5
15
|
const getLoginStatus: (operationID?: string) => Promise<boolean>;
|
|
6
16
|
const logout: (operationID?: string) => Promise<unknown>;
|
|
7
17
|
}
|
|
18
|
+
/**
|
|
19
|
+
* Reads the payload out of an apiInstance response, accounting for whichever
|
|
20
|
+
* envelope shape the injected instance produces (see `initApiInstance`'s
|
|
21
|
+
* `unwrapped` option). Consumers should use this instead of reading
|
|
22
|
+
* `res?.data?.data` / `res?.data` directly.
|
|
23
|
+
*/
|
|
24
|
+
export declare function unwrapEnvelope<T>(res?: {
|
|
25
|
+
data?: unknown;
|
|
26
|
+
}): T | null;
|
|
27
|
+
export {};
|
|
8
28
|
//# sourceMappingURL=apis.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"apis.d.ts","sourceRoot":"","sources":["../../../../src/services/apis.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,aAAa,EAAE,MAAM,OAAO,CAAC;AAI3C,eAAO,IAAI,WAAW,EAAE,aAAa,GAAG,IAAW,CAAC;AAEpD,yBAAiB,OAAO,CAAC;IACvB,SAAgB,eAAe,
|
|
1
|
+
{"version":3,"file":"apis.d.ts","sourceRoot":"","sources":["../../../../src/services/apis.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,aAAa,EAAE,MAAM,OAAO,CAAC;AAI3C,eAAO,IAAI,WAAW,EAAE,aAAa,GAAG,IAAW,CAAC;AAEpD,UAAU,sBAAsB;IAC9B;;;;;;OAMG;IACH,SAAS,CAAC,EAAE,OAAO,CAAC;CACrB;AAID,yBAAiB,OAAO,CAAC;IACvB,SAAgB,eAAe,CAC7B,GAAG,EAAE,aAAa,EAClB,OAAO,CAAC,EAAE,sBAAsB,GAC/B,IAAI,CAGN;IAEM,MAAM,cAAc,GAAU,cAAc,MAAM,qBAExD,CAAC;IAEK,MAAM,MAAM,GAAU,cAAc,MAAM,qBAIhD,CAAC;CACH;AAED;;;;;GAKG;AACH,wBAAgB,cAAc,CAAC,CAAC,EAAE,GAAG,CAAC,EAAE;IAAE,IAAI,CAAC,EAAE,OAAO,CAAA;CAAE,GAAG,CAAC,GAAG,IAAI,CAKpE"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"resourceCenter.d.ts","sourceRoot":"","sources":["../../../../src/services/resourceCenter.ts"],"names":[],"mappings":"AAIA,OAAO,EAEL,KAAK,eAAe,EAGpB,KAAK,sBAAsB,EAC5B,MAAM,eAAe,CAAC;AA2KvB,yBAAiB,qBAAqB,CAAC;IAC9B,MAAM,oBAAoB,GAC/B,KAAK,sBAAsB,KAC1B,OAAO,CAAC;QAAE,KAAK,EAAE,eAAe,EAAE,CAAC;QAAC,IAAI,EAAE,MAAM,CAAC;QAAC,OAAO,EAAE,OAAO,CAAA;KAAE,
|
|
1
|
+
{"version":3,"file":"resourceCenter.d.ts","sourceRoot":"","sources":["../../../../src/services/resourceCenter.ts"],"names":[],"mappings":"AAIA,OAAO,EAEL,KAAK,eAAe,EAGpB,KAAK,sBAAsB,EAC5B,MAAM,eAAe,CAAC;AA2KvB,yBAAiB,qBAAqB,CAAC;IAC9B,MAAM,oBAAoB,GAC/B,KAAK,sBAAsB,KAC1B,OAAO,CAAC;QAAE,KAAK,EAAE,eAAe,EAAE,CAAC;QAAC,IAAI,EAAE,MAAM,CAAC;QAAC,OAAO,EAAE,OAAO,CAAA;KAAE,CAYtE,CAAC;CACH"}
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { useQuery } from '@tanstack/react-query';
|
|
2
2
|
import OpenIMSDK, { SessionType } from '@droppii/openim-rn-client-sdk';
|
|
3
3
|
import { useConversationStore } from '../../store/conversation';
|
|
4
|
-
import { apiInstance } from '../../services/apis';
|
|
4
|
+
import { apiInstance, unwrapEnvelope } from '../../services/apis';
|
|
5
5
|
import type { BaseResponse } from '../../types/auth';
|
|
6
6
|
import type { DBotStatus, DConversationTarget } from '../../types/chat';
|
|
7
7
|
import { conversationQueryKeys } from '../query-keys';
|
|
@@ -28,7 +28,7 @@ const useBotConversationData = (botId?: string) =>
|
|
|
28
28
|
const res = await apiInstance?.get<
|
|
29
29
|
BaseResponse<{ groupId: string; conversationId: string }>
|
|
30
30
|
>(ENDPOINTS.chatService.getConversationByBotId(botId || ''));
|
|
31
|
-
return
|
|
31
|
+
return unwrapEnvelope<{ groupId: string; conversationId: string }>(res);
|
|
32
32
|
},
|
|
33
33
|
enabled: !!botId,
|
|
34
34
|
});
|
|
@@ -40,7 +40,7 @@ export const useGetStatusConversationBot = (botId?: string) => {
|
|
|
40
40
|
const res = await apiInstance?.get<BaseResponse<DBotStatus>>(
|
|
41
41
|
ENDPOINTS.chatService.getConversationStatusByBotId(botId || '')
|
|
42
42
|
);
|
|
43
|
-
return res
|
|
43
|
+
return unwrapEnvelope<DBotStatus>(res);
|
|
44
44
|
},
|
|
45
45
|
enabled: !!botId,
|
|
46
46
|
staleTime: 0,
|
|
@@ -56,9 +56,9 @@ export const useGetConversationTarget = (conversationId?: string) =>
|
|
|
56
56
|
const res = await apiInstance?.get<BaseResponse<DConversationTarget>>(
|
|
57
57
|
ENDPOINTS.chatService.getConversationTarget(conversationId || '')
|
|
58
58
|
);
|
|
59
|
-
return res
|
|
59
|
+
return unwrapEnvelope<DConversationTarget>(res);
|
|
60
60
|
} catch {
|
|
61
|
-
return
|
|
61
|
+
return null; // fail-open: unresolved status => compose stays enabled
|
|
62
62
|
}
|
|
63
63
|
},
|
|
64
64
|
enabled: !!conversationId,
|
|
@@ -85,7 +85,7 @@ export const useGetOneConversation = ({
|
|
|
85
85
|
if (res?.conversationID) {
|
|
86
86
|
useConversationStore.getState().updateConversations([res]);
|
|
87
87
|
}
|
|
88
|
-
return res
|
|
88
|
+
return res ?? null;
|
|
89
89
|
},
|
|
90
90
|
enabled: !!targetUserId || !!targetGroupId,
|
|
91
91
|
});
|
|
@@ -132,7 +132,7 @@ export const useSyncConversationById = (
|
|
|
132
132
|
if (conversation) {
|
|
133
133
|
useConversationStore.getState().updateConversations([conversation]);
|
|
134
134
|
}
|
|
135
|
-
return conversation;
|
|
135
|
+
return conversation ?? null;
|
|
136
136
|
},
|
|
137
137
|
enabled: !!conversationId && !hasConversation,
|
|
138
138
|
});
|
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
import { ENDPOINTS } from '../../services/endpoints';
|
|
2
2
|
import type { BaseResponse } from '../../types/auth';
|
|
3
|
-
import { apiInstance } from '../../services/apis';
|
|
3
|
+
import { apiInstance, unwrapEnvelope } from '../../services/apis';
|
|
4
4
|
import type { IConversationFlow } from '../../types/flows';
|
|
5
5
|
|
|
6
6
|
export const fechtCurrentConversationFlow = async (conversationId: string) => {
|
|
7
7
|
const res = await apiInstance?.get<BaseResponse<IConversationFlow>>(
|
|
8
8
|
ENDPOINTS.chatService.conversationFlow(conversationId)
|
|
9
9
|
);
|
|
10
|
-
return res
|
|
10
|
+
return unwrapEnvelope<IConversationFlow>(res) ?? undefined;
|
|
11
11
|
};
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { useMutation } from '@tanstack/react-query';
|
|
2
2
|
import { conversationQueryKeys } from '../query-keys';
|
|
3
3
|
import { useConversationStore } from '../../store';
|
|
4
|
-
import { apiInstance } from '../../services/apis';
|
|
4
|
+
import { apiInstance, unwrapEnvelope } from '../../services/apis';
|
|
5
5
|
import type { BaseResponse } from '../../types/auth';
|
|
6
6
|
import { ENDPOINTS } from '../../services/endpoints';
|
|
7
7
|
import type {
|
|
@@ -34,7 +34,7 @@ export const useResetFlow = () => {
|
|
|
34
34
|
ENDPOINTS.chatService.resetConversationFlow(conversationId),
|
|
35
35
|
{}
|
|
36
36
|
);
|
|
37
|
-
return res
|
|
37
|
+
return unwrapEnvelope<IConversationFlow>(res) ?? undefined;
|
|
38
38
|
},
|
|
39
39
|
onSuccess: (data) => {
|
|
40
40
|
if (data?.flowCurrentStep?.id) {
|
|
@@ -57,7 +57,7 @@ export const useCloseSupportSession = () => {
|
|
|
57
57
|
const res = await apiInstance?.post<BaseResponse<unknown>>(
|
|
58
58
|
ENDPOINTS.chatService.closeConversationSession(conversationId)
|
|
59
59
|
);
|
|
60
|
-
return res
|
|
60
|
+
return unwrapEnvelope<unknown>(res);
|
|
61
61
|
},
|
|
62
62
|
});
|
|
63
63
|
};
|
|
@@ -77,7 +77,7 @@ export const useRunFlow = () => {
|
|
|
77
77
|
const res = await apiInstance?.post<
|
|
78
78
|
BaseResponse<IRunConversationFlowResponse>
|
|
79
79
|
>(ENDPOINTS.chatService.runConversationFlow(conversationId), payload);
|
|
80
|
-
return res
|
|
80
|
+
return unwrapEnvelope<IRunConversationFlowResponse>(res) ?? undefined;
|
|
81
81
|
},
|
|
82
82
|
onSuccess: (data) => {
|
|
83
83
|
setConverationFlowStep(
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { useQuery } from '@tanstack/react-query';
|
|
2
2
|
import { conversationQueryKeys } from '../query-keys';
|
|
3
|
-
import { apiInstance } from '../../services/apis';
|
|
3
|
+
import { apiInstance, unwrapEnvelope } from '../../services/apis';
|
|
4
4
|
import type { BaseResponse } from '../../types/auth';
|
|
5
5
|
import type { InputButtonItem } from '../../types/flows';
|
|
6
6
|
import { ENDPOINTS } from '../../services/endpoints';
|
|
@@ -12,7 +12,7 @@ export const useGetConversationFlowMainMenu = (conversationId?: string) => {
|
|
|
12
12
|
const res = await apiInstance?.get<BaseResponse<InputButtonItem[]>>(
|
|
13
13
|
ENDPOINTS.chatService.conversationFlowMainMenu(conversationId || '')
|
|
14
14
|
);
|
|
15
|
-
return
|
|
15
|
+
return unwrapEnvelope<InputButtonItem[]>(res) ?? [];
|
|
16
16
|
},
|
|
17
17
|
enabled: !!conversationId,
|
|
18
18
|
});
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { useMutation } from '@tanstack/react-query';
|
|
2
|
-
import { apiInstance } from '../../services/apis';
|
|
2
|
+
import { apiInstance, unwrapEnvelope } from '../../services/apis';
|
|
3
3
|
import { ENDPOINTS } from '../../services/endpoints';
|
|
4
4
|
import type { BaseResponse } from '../../types/auth';
|
|
5
5
|
import type { StickerItem } from '../../types/sticker';
|
|
@@ -10,6 +10,6 @@ export const useFetchStickerByCategory = () =>
|
|
|
10
10
|
const res = await apiInstance?.get<BaseResponse<StickerItem[]>>(
|
|
11
11
|
ENDPOINTS.chatService.stickersByCategoryId(categoryId)
|
|
12
12
|
);
|
|
13
|
-
return res
|
|
13
|
+
return unwrapEnvelope<StickerItem[]>(res) ?? [];
|
|
14
14
|
},
|
|
15
15
|
});
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { useQuery } from '@tanstack/react-query';
|
|
2
|
-
import { apiInstance } from '../../services/apis';
|
|
2
|
+
import { apiInstance, unwrapEnvelope } from '../../services/apis';
|
|
3
3
|
import { stickerQueryKeys } from '../query-keys';
|
|
4
4
|
import { ENDPOINTS } from '../../services/endpoints';
|
|
5
5
|
import type { BaseResponse } from '../../types/auth';
|
|
@@ -12,6 +12,6 @@ export const useStickerCategories = () =>
|
|
|
12
12
|
const res = await apiInstance?.get<BaseResponse<StickerCategory[]>>(
|
|
13
13
|
ENDPOINTS.chatService.stickerCategories()
|
|
14
14
|
);
|
|
15
|
-
return res
|
|
15
|
+
return unwrapEnvelope<StickerCategory[]>(res) ?? [];
|
|
16
16
|
},
|
|
17
17
|
});
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { useQuery } from '@tanstack/react-query';
|
|
2
|
-
import { apiInstance } from '../../services/apis';
|
|
2
|
+
import { apiInstance, unwrapEnvelope } from '../../services/apis';
|
|
3
3
|
import { stickerQueryKeys } from '../query-keys';
|
|
4
4
|
import { ENDPOINTS } from '../../services/endpoints';
|
|
5
5
|
import type { BaseResponse } from '../../types/auth';
|
|
@@ -12,7 +12,7 @@ export const useStickerHistory = () =>
|
|
|
12
12
|
const res = await apiInstance?.get<BaseResponse<StickerItem[]>>(
|
|
13
13
|
ENDPOINTS.chatService.stickerHistory()
|
|
14
14
|
);
|
|
15
|
-
return res
|
|
15
|
+
return unwrapEnvelope<StickerItem[]>(res) ?? [];
|
|
16
16
|
},
|
|
17
17
|
staleTime: 0,
|
|
18
18
|
gcTime: 0,
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { useQuery } from '@tanstack/react-query';
|
|
2
2
|
import { commonQueryKeys } from '../query-keys';
|
|
3
|
-
import { apiInstance } from '../../services/apis';
|
|
3
|
+
import { apiInstance, unwrapEnvelope } from '../../services/apis';
|
|
4
4
|
import type { BaseResponse } from '../../types/auth';
|
|
5
5
|
import type { IUrlMetadata } from '../../types/common';
|
|
6
6
|
import { ENDPOINTS } from '../../services/endpoints';
|
|
@@ -12,9 +12,10 @@ export const useFetchUrlMetadata = (url?: string) =>
|
|
|
12
12
|
queryFn: async () => {
|
|
13
13
|
const path = `${ENDPOINTS.chatService.urlMetadata}?url=${normalizeUrl(url || '')}`;
|
|
14
14
|
const res = await apiInstance?.get<BaseResponse<IUrlMetadata>>(path);
|
|
15
|
-
|
|
15
|
+
const metadata = unwrapEnvelope<IUrlMetadata>(res);
|
|
16
|
+
return metadata?.title
|
|
16
17
|
? {
|
|
17
|
-
...
|
|
18
|
+
...metadata,
|
|
18
19
|
url,
|
|
19
20
|
}
|
|
20
21
|
: null;
|
package/src/index.tsx
CHANGED
|
@@ -27,7 +27,7 @@ export { Avatar } from './components/Avatar';
|
|
|
27
27
|
export { ThreadCard } from './components/ThreadCard';
|
|
28
28
|
export { AttachmentPreview } from './components/AttachmentPreview';
|
|
29
29
|
export { MediaViewerModal } from './components/MediaViewerModal';
|
|
30
|
-
export { Inbox } from './screens/inbox';
|
|
30
|
+
export { Inbox, MessagesTab } from './screens/inbox';
|
|
31
31
|
export { default as MediaViewerScreen } from './screens/MediaView';
|
|
32
32
|
export { default as ResourceCenterScreen } from './screens/ResourceCenter';
|
|
33
33
|
export type { ResourceCenterScreenProps } from './screens/ResourceCenter/types';
|
|
@@ -46,6 +46,16 @@ interface LegendChatMessageProps {
|
|
|
46
46
|
onPressUrl?: (url: string) => void;
|
|
47
47
|
onRetry?: (message: MessageItem) => void;
|
|
48
48
|
onPress?: (messageId: string) => void;
|
|
49
|
+
/**
|
|
50
|
+
* Fire `onPress` for every content type, including the ones excluded from
|
|
51
|
+
* tap-to-reveal-time (media/file). For Picture/Video/Merge — which always
|
|
52
|
+
* render their own full-bubble touchable — this also becomes the fallback
|
|
53
|
+
* `onMediaPress` when the caller doesn't supply one, since that touchable
|
|
54
|
+
* would otherwise swallow the tap before it reaches this component's own
|
|
55
|
+
* gesture wrapper. Used by callers that repurpose `onPress` for navigation
|
|
56
|
+
* (e.g. PinnedMessagesSheet) rather than the reveal-time toggle.
|
|
57
|
+
*/
|
|
58
|
+
alwaysHandlePress?: boolean;
|
|
49
59
|
onLongPress?: (messageId: string, message: MessageItem) => void;
|
|
50
60
|
customMessageItemFactory?: (m: MessageItem) => ReactNode;
|
|
51
61
|
isHighlighted?: boolean;
|
|
@@ -92,7 +102,9 @@ const SYSTEM_MESSAGE_TYPES: number[] = GROUP_NOTIFICATION_TYPES;
|
|
|
92
102
|
|
|
93
103
|
// Tapping these types must keep opening the media/file as today — they never
|
|
94
104
|
// participate in tap-to-reveal-time, so no Tap gesture is attached at all for
|
|
95
|
-
// them (avoids racing their own internal touchables for the same tap).
|
|
105
|
+
// them (avoids racing their own internal touchables for the same tap). Callers
|
|
106
|
+
// that need every message type tappable regardless (e.g. navigating to the
|
|
107
|
+
// original message from a quote/pin) opt in via `alwaysHandlePress`.
|
|
96
108
|
const TIME_REVEAL_EXCLUDED_TYPES: number[] = [
|
|
97
109
|
...MEDIA_TYPES,
|
|
98
110
|
MessageType.FileMessage,
|
|
@@ -108,6 +120,7 @@ export const LegendChatMessage = memo(
|
|
|
108
120
|
onPressUrl,
|
|
109
121
|
onRetry,
|
|
110
122
|
onPress,
|
|
123
|
+
alwaysHandlePress,
|
|
111
124
|
onLongPress,
|
|
112
125
|
customMessageItemFactory,
|
|
113
126
|
isHighlighted,
|
|
@@ -148,8 +161,10 @@ export const LegendChatMessage = memo(
|
|
|
148
161
|
const MessageComponent: ComponentType<MessageProps> =
|
|
149
162
|
messageComponentMap[message?.contentType] ?? TextMessage;
|
|
150
163
|
|
|
164
|
+
const effectiveOnMediaPress =
|
|
165
|
+
onMediaPress ?? (alwaysHandlePress ? handlePress : undefined);
|
|
151
166
|
const hasMediaPress =
|
|
152
|
-
MEDIA_TYPES.includes(message?.contentType) &&
|
|
167
|
+
MEDIA_TYPES.includes(message?.contentType) && !!effectiveOnMediaPress;
|
|
153
168
|
// AtTextMessage: mention+URL combo attaches its link-preview card via
|
|
154
169
|
// ex.urlMetadata (see TextMessage's doc comment) and/or the native
|
|
155
170
|
// AtTextElem.urls (SDK rc39+) for in-text link highlighting — either
|
|
@@ -163,6 +178,7 @@ export const LegendChatMessage = memo(
|
|
|
163
178
|
const canRevealTime = !TIME_REVEAL_EXCLUDED_TYPES.includes(
|
|
164
179
|
message?.contentType
|
|
165
180
|
);
|
|
181
|
+
const shouldHandlePress = canRevealTime || alwaysHandlePress;
|
|
166
182
|
|
|
167
183
|
return (
|
|
168
184
|
<KContainer.View style={messageStyles.wrapper} row alignItems>
|
|
@@ -195,14 +211,14 @@ export const LegendChatMessage = memo(
|
|
|
195
211
|
</KLabel.Text>
|
|
196
212
|
)}
|
|
197
213
|
<LongPressWrapper
|
|
198
|
-
onPress={
|
|
214
|
+
onPress={shouldHandlePress ? handlePress : undefined}
|
|
199
215
|
onLongPress={handleLongPress}
|
|
200
216
|
>
|
|
201
217
|
<MessageComponent
|
|
202
218
|
message={message}
|
|
203
219
|
isOutgoing={isOutgoing}
|
|
204
220
|
createdAtTime={createdAtTime}
|
|
205
|
-
onMediaPress={hasMediaPress ?
|
|
221
|
+
onMediaPress={hasMediaPress ? effectiveOnMediaPress : undefined}
|
|
206
222
|
onPressUrl={hasUrlPress ? onPressUrl : undefined}
|
|
207
223
|
isHighlighted={isHighlighted}
|
|
208
224
|
isTimeRevealed={canRevealTime && isTimeRevealed}
|
package/src/services/apis.ts
CHANGED
|
@@ -4,9 +4,26 @@ import { useConversationStore, useUserStore } from '../store';
|
|
|
4
4
|
|
|
5
5
|
export let apiInstance: AxiosInstance | null = null;
|
|
6
6
|
|
|
7
|
+
interface InitApiInstanceOptions {
|
|
8
|
+
/**
|
|
9
|
+
* Set true when the injected instance's response interceptor already
|
|
10
|
+
* strips the outer envelope (statusCode/message/pageable/data) down to
|
|
11
|
+
* just the payload (e.g. Mall's shared axios client). Defaults to false —
|
|
12
|
+
* the instance returns the raw `{ statusCode, message, pageable, data }`
|
|
13
|
+
* envelope untouched (e.g. Biz's axios client).
|
|
14
|
+
*/
|
|
15
|
+
unwrapped?: boolean;
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
let responseUnwrapped = false;
|
|
19
|
+
|
|
7
20
|
export namespace ChatAPI {
|
|
8
|
-
export function initApiInstance(
|
|
21
|
+
export function initApiInstance(
|
|
22
|
+
api: AxiosInstance,
|
|
23
|
+
options?: InitApiInstanceOptions
|
|
24
|
+
): void {
|
|
9
25
|
apiInstance = api;
|
|
26
|
+
responseUnwrapped = options?.unwrapped ?? false;
|
|
10
27
|
}
|
|
11
28
|
|
|
12
29
|
export const getLoginStatus = async (operationID?: string) => {
|
|
@@ -19,3 +36,16 @@ export namespace ChatAPI {
|
|
|
19
36
|
return OpenIMSDK.logout(operationID);
|
|
20
37
|
};
|
|
21
38
|
}
|
|
39
|
+
|
|
40
|
+
/**
|
|
41
|
+
* Reads the payload out of an apiInstance response, accounting for whichever
|
|
42
|
+
* envelope shape the injected instance produces (see `initApiInstance`'s
|
|
43
|
+
* `unwrapped` option). Consumers should use this instead of reading
|
|
44
|
+
* `res?.data?.data` / `res?.data` directly.
|
|
45
|
+
*/
|
|
46
|
+
export function unwrapEnvelope<T>(res?: { data?: unknown }): T | null {
|
|
47
|
+
const body = res?.data as { data?: T } | T | undefined;
|
|
48
|
+
if (body == null) return null;
|
|
49
|
+
return ((responseUnwrapped ? body : (body as { data?: T }).data) ??
|
|
50
|
+
null) as T | null;
|
|
51
|
+
}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { apiInstance } from './apis';
|
|
1
|
+
import { apiInstance, unwrapEnvelope } from './apis';
|
|
2
2
|
import { getApiEndpoint } from '../config/api-endpoints';
|
|
3
3
|
import { extractDomain } from '../utils/url';
|
|
4
4
|
import type { BaseResponse } from '../types/auth';
|
|
@@ -186,12 +186,13 @@ export namespace ResourceCenterService {
|
|
|
186
186
|
const res = await apiInstance?.post<
|
|
187
187
|
BaseResponse<DThreadResourceListResponse>
|
|
188
188
|
>(getApiEndpoint('messagesResources'), req);
|
|
189
|
-
const rows = res
|
|
189
|
+
const rows = unwrapEnvelope<DThreadResourceListResponse>(res) ?? [];
|
|
190
190
|
const items = rows.flatMap(parseThreadResourceItem);
|
|
191
191
|
// `pageable.totalPages`/`totalElements` come back as `0` on this endpoint even
|
|
192
192
|
// when rows are present (confirmed against staging) — unreliable, don't use it.
|
|
193
|
-
//
|
|
194
|
-
|
|
193
|
+
// Row-count-vs-pageSize is the trustworthy `hasMore` signal — `items.length` can
|
|
194
|
+
// exceed `rows.length` when a row splits into multiple items (e.g. multi-url).
|
|
195
|
+
const hasMore = rows.length >= req.pageSize;
|
|
195
196
|
return { items, page: req.page, hasMore };
|
|
196
197
|
};
|
|
197
198
|
}
|