@droppii-org/chat-sdk 0.1.15 → 0.1.17
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/assets/droppiiFontSelection.json +14521 -14521
- package/dist/assets/sdk/sql-wasm.wasm +0 -0
- package/dist/assets/svg/cannedResponse.tsx +48 -48
- package/dist/assets/svg/document.tsx +37 -37
- package/dist/assets/svg/index.ts +2 -2
- package/dist/components/message/GroupMembersDrawer.d.ts +7 -0
- package/dist/components/message/GroupMembersDrawer.d.ts.map +1 -0
- package/dist/components/message/GroupMembersDrawer.js +104 -0
- package/dist/components/message/MessageHeader.d.ts.map +1 -1
- package/dist/components/message/MessageHeader.js +4 -1
- package/dist/components/message/MessageList.d.ts.map +1 -1
- package/dist/components/message/MessageList.js +8 -7
- package/dist/components/message/footer/ComposerTabs.d.ts +2 -1
- package/dist/components/message/footer/ComposerTabs.d.ts.map +1 -1
- package/dist/components/message/footer/ComposerTabs.js +12 -4
- package/dist/components/message/footer/index.d.ts.map +1 -1
- package/dist/components/message/footer/index.js +15 -6
- package/dist/components/message/item/index.js +24 -20
- package/dist/components/thread/ManualAssignPopover.d.ts.map +1 -1
- package/dist/components/thread/ManualAssignPopover.js +16 -3
- package/dist/hooks/global/useGlobalEvent.d.ts.map +1 -1
- package/dist/hooks/global/useGlobalEvent.js +24 -1
- package/dist/hooks/group/useGroupMembers.d.ts +10 -0
- package/dist/hooks/group/useGroupMembers.d.ts.map +1 -0
- package/dist/hooks/group/useGroupMembers.js +44 -0
- package/dist/hooks/message/useConversationMessages.d.ts.map +1 -1
- package/dist/hooks/message/useConversationMessages.js +4 -3
- 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 +19 -6
- package/dist/hooks/message/useSendMessage.d.ts.map +1 -1
- package/dist/hooks/message/useSendMessage.js +42 -6
- package/dist/hooks/session/useCloseSession.d.ts.map +1 -1
- package/dist/hooks/session/useCloseSession.js +19 -12
- package/dist/hooks/session/useJoinGroupFlow.d.ts.map +1 -1
- package/dist/hooks/session/useJoinGroupFlow.js +27 -14
- package/dist/hooks/session/useUpdateSession.d.ts +1 -1
- package/dist/hooks/session/useUpdateSession.d.ts.map +1 -1
- package/dist/hooks/session/useUpdateSession.js +20 -12
- package/dist/locales/i18n.ts +18 -18
- package/dist/locales/vi/common.json +122 -113
- package/dist/store/conversation.d.ts.map +1 -1
- package/dist/store/conversation.js +7 -5
- package/dist/styles/global.css +1 -1
- package/dist/tsconfig.tsbuildinfo +1 -1
- package/dist/utils/messageEx.d.ts +5 -0
- package/dist/utils/messageEx.d.ts.map +1 -0
- package/dist/utils/messageEx.js +11 -0
- package/package.json +10 -11
|
File without changes
|
|
@@ -1,48 +1,48 @@
|
|
|
1
|
-
interface ISvgProps {
|
|
2
|
-
size?: number;
|
|
3
|
-
className?: string;
|
|
4
|
-
}
|
|
5
|
-
|
|
6
|
-
const CannedResponseIcon = (props: ISvgProps) => (
|
|
7
|
-
<svg
|
|
8
|
-
width={props.size || 18}
|
|
9
|
-
height={props.size || 18}
|
|
10
|
-
viewBox={`${0} ${0} ${props.size || 18} ${props.size || 18}`}
|
|
11
|
-
fill="none"
|
|
12
|
-
xmlns="http://www.w3.org/2000/svg"
|
|
13
|
-
className={props?.className}
|
|
14
|
-
>
|
|
15
|
-
<g clipPath="url(#clip0_4070_70030)">
|
|
16
|
-
<path
|
|
17
|
-
fillRule="evenodd"
|
|
18
|
-
clipRule="evenodd"
|
|
19
|
-
d="M6.66732 0.833374C7.12755 0.833374 7.50065 1.20647 7.50065 1.66671L5.00065 18.3334C5.00065 18.7936 4.62755 19.1667 4.16732 19.1667C3.70708 19.1667 3.33398 18.7936 3.33398 18.3334L5.83398 1.66671C5.83398 1.20647 6.20708 0.833374 6.66732 0.833374Z"
|
|
20
|
-
fill="currentColor"
|
|
21
|
-
/>
|
|
22
|
-
<path
|
|
23
|
-
fillRule="evenodd"
|
|
24
|
-
clipRule="evenodd"
|
|
25
|
-
d="M14.9993 0.833374C15.4596 0.833374 15.8327 1.20647 15.8327 1.66671L13.3327 18.3334C13.3327 18.7936 12.9596 19.1667 12.4993 19.1667C12.0391 19.1667 11.666 18.7936 11.666 18.3334L14.166 1.66671C14.166 1.20647 14.5391 0.833374 14.9993 0.833374Z"
|
|
26
|
-
fill="currentColor"
|
|
27
|
-
/>
|
|
28
|
-
<path
|
|
29
|
-
fillRule="evenodd"
|
|
30
|
-
clipRule="evenodd"
|
|
31
|
-
d="M19.1673 5.83333C19.1673 6.29357 18.7942 6.66667 18.334 6.66667H1.66732C1.20708 6.66667 0.833984 6.29357 0.833984 5.83333C0.833984 5.37309 1.20708 5 1.66732 5H18.334C18.7942 5 19.1673 5.3731 19.1673 5.83333Z"
|
|
32
|
-
fill="currentColor"
|
|
33
|
-
/>
|
|
34
|
-
<path
|
|
35
|
-
fillRule="evenodd"
|
|
36
|
-
clipRule="evenodd"
|
|
37
|
-
d="M19.1673 14.1667C19.1673 14.627 18.7942 15 18.334 15H1.66732C1.20708 15 0.833984 14.627 0.833984 14.1667C0.833984 13.7065 1.20708 13.3334 1.66732 13.3334H18.334C18.7942 13.3334 19.1673 13.7065 19.1673 14.1667Z"
|
|
38
|
-
fill="currentColor"
|
|
39
|
-
/>
|
|
40
|
-
</g>
|
|
41
|
-
<defs>
|
|
42
|
-
<clipPath id="clip0_4070_70030">
|
|
43
|
-
<rect width={props.size || 18} height={props.size || 18} fill="white" />
|
|
44
|
-
</clipPath>
|
|
45
|
-
</defs>
|
|
46
|
-
</svg>
|
|
47
|
-
);
|
|
48
|
-
export default CannedResponseIcon;
|
|
1
|
+
interface ISvgProps {
|
|
2
|
+
size?: number;
|
|
3
|
+
className?: string;
|
|
4
|
+
}
|
|
5
|
+
|
|
6
|
+
const CannedResponseIcon = (props: ISvgProps) => (
|
|
7
|
+
<svg
|
|
8
|
+
width={props.size || 18}
|
|
9
|
+
height={props.size || 18}
|
|
10
|
+
viewBox={`${0} ${0} ${props.size || 18} ${props.size || 18}`}
|
|
11
|
+
fill="none"
|
|
12
|
+
xmlns="http://www.w3.org/2000/svg"
|
|
13
|
+
className={props?.className}
|
|
14
|
+
>
|
|
15
|
+
<g clipPath="url(#clip0_4070_70030)">
|
|
16
|
+
<path
|
|
17
|
+
fillRule="evenodd"
|
|
18
|
+
clipRule="evenodd"
|
|
19
|
+
d="M6.66732 0.833374C7.12755 0.833374 7.50065 1.20647 7.50065 1.66671L5.00065 18.3334C5.00065 18.7936 4.62755 19.1667 4.16732 19.1667C3.70708 19.1667 3.33398 18.7936 3.33398 18.3334L5.83398 1.66671C5.83398 1.20647 6.20708 0.833374 6.66732 0.833374Z"
|
|
20
|
+
fill="currentColor"
|
|
21
|
+
/>
|
|
22
|
+
<path
|
|
23
|
+
fillRule="evenodd"
|
|
24
|
+
clipRule="evenodd"
|
|
25
|
+
d="M14.9993 0.833374C15.4596 0.833374 15.8327 1.20647 15.8327 1.66671L13.3327 18.3334C13.3327 18.7936 12.9596 19.1667 12.4993 19.1667C12.0391 19.1667 11.666 18.7936 11.666 18.3334L14.166 1.66671C14.166 1.20647 14.5391 0.833374 14.9993 0.833374Z"
|
|
26
|
+
fill="currentColor"
|
|
27
|
+
/>
|
|
28
|
+
<path
|
|
29
|
+
fillRule="evenodd"
|
|
30
|
+
clipRule="evenodd"
|
|
31
|
+
d="M19.1673 5.83333C19.1673 6.29357 18.7942 6.66667 18.334 6.66667H1.66732C1.20708 6.66667 0.833984 6.29357 0.833984 5.83333C0.833984 5.37309 1.20708 5 1.66732 5H18.334C18.7942 5 19.1673 5.3731 19.1673 5.83333Z"
|
|
32
|
+
fill="currentColor"
|
|
33
|
+
/>
|
|
34
|
+
<path
|
|
35
|
+
fillRule="evenodd"
|
|
36
|
+
clipRule="evenodd"
|
|
37
|
+
d="M19.1673 14.1667C19.1673 14.627 18.7942 15 18.334 15H1.66732C1.20708 15 0.833984 14.627 0.833984 14.1667C0.833984 13.7065 1.20708 13.3334 1.66732 13.3334H18.334C18.7942 13.3334 19.1673 13.7065 19.1673 14.1667Z"
|
|
38
|
+
fill="currentColor"
|
|
39
|
+
/>
|
|
40
|
+
</g>
|
|
41
|
+
<defs>
|
|
42
|
+
<clipPath id="clip0_4070_70030">
|
|
43
|
+
<rect width={props.size || 18} height={props.size || 18} fill="white" />
|
|
44
|
+
</clipPath>
|
|
45
|
+
</defs>
|
|
46
|
+
</svg>
|
|
47
|
+
);
|
|
48
|
+
export default CannedResponseIcon;
|
|
@@ -1,37 +1,37 @@
|
|
|
1
|
-
export const documentIcon = (
|
|
2
|
-
<svg
|
|
3
|
-
width="40"
|
|
4
|
-
height="40"
|
|
5
|
-
viewBox="0 0 40 40"
|
|
6
|
-
fill="none"
|
|
7
|
-
xmlns="http://www.w3.org/2000/svg"
|
|
8
|
-
>
|
|
9
|
-
<path
|
|
10
|
-
d="M10.1923 5.83301L23.4363 5.83301L34.1656 14.2054V29.8639C34.1656 31.8997 32.5286 34.1663 29.8068 34.1663C27.0849 34.1663 10.1923 34.1663 10.1923 34.1663C7.4704 34.1663 5.8335 31.8997 5.8335 29.8639V10.0305C5.8335 7.99475 7.4704 5.83301 10.1923 5.83301Z"
|
|
11
|
-
fill="#24B0FF"
|
|
12
|
-
></path>
|
|
13
|
-
<path
|
|
14
|
-
d="M10.8335 28.1394V20.833H16.0309V22.4222H12.7026V23.5916H15.3612V25.1708H12.7026V28.1394H10.8335Z"
|
|
15
|
-
fill="#edf6ff"
|
|
16
|
-
></path>
|
|
17
|
-
<path
|
|
18
|
-
d="M19.0073 28.0885V20.833H20.8613V26.5118H24.0146V28.0885L19.0073 28.0885Z"
|
|
19
|
-
fill="#edf6ff"
|
|
20
|
-
></path>
|
|
21
|
-
<path
|
|
22
|
-
d="M16.5918 28.1001V20.833H18.4485V28.1001H16.5918Z"
|
|
23
|
-
fill="#edf6ff"
|
|
24
|
-
></path>
|
|
25
|
-
<path
|
|
26
|
-
d="M24.5737 20.833V28.1393H29.7723V26.5573H26.439L26.4422 25.1708H29.1017V23.5916H26.4422V22.4222H29.7723V20.833H24.5737Z"
|
|
27
|
-
fill="#edf6ff"
|
|
28
|
-
></path>
|
|
29
|
-
<path
|
|
30
|
-
opacity="0.302"
|
|
31
|
-
fillRule="evenodd"
|
|
32
|
-
clipRule="evenodd"
|
|
33
|
-
d="M23.2686 5.83301V14.2281H34.1655L23.2686 5.83301Z"
|
|
34
|
-
fill="#edf6ff"
|
|
35
|
-
></path>
|
|
36
|
-
</svg>
|
|
37
|
-
);
|
|
1
|
+
export const documentIcon = (
|
|
2
|
+
<svg
|
|
3
|
+
width="40"
|
|
4
|
+
height="40"
|
|
5
|
+
viewBox="0 0 40 40"
|
|
6
|
+
fill="none"
|
|
7
|
+
xmlns="http://www.w3.org/2000/svg"
|
|
8
|
+
>
|
|
9
|
+
<path
|
|
10
|
+
d="M10.1923 5.83301L23.4363 5.83301L34.1656 14.2054V29.8639C34.1656 31.8997 32.5286 34.1663 29.8068 34.1663C27.0849 34.1663 10.1923 34.1663 10.1923 34.1663C7.4704 34.1663 5.8335 31.8997 5.8335 29.8639V10.0305C5.8335 7.99475 7.4704 5.83301 10.1923 5.83301Z"
|
|
11
|
+
fill="#24B0FF"
|
|
12
|
+
></path>
|
|
13
|
+
<path
|
|
14
|
+
d="M10.8335 28.1394V20.833H16.0309V22.4222H12.7026V23.5916H15.3612V25.1708H12.7026V28.1394H10.8335Z"
|
|
15
|
+
fill="#edf6ff"
|
|
16
|
+
></path>
|
|
17
|
+
<path
|
|
18
|
+
d="M19.0073 28.0885V20.833H20.8613V26.5118H24.0146V28.0885L19.0073 28.0885Z"
|
|
19
|
+
fill="#edf6ff"
|
|
20
|
+
></path>
|
|
21
|
+
<path
|
|
22
|
+
d="M16.5918 28.1001V20.833H18.4485V28.1001H16.5918Z"
|
|
23
|
+
fill="#edf6ff"
|
|
24
|
+
></path>
|
|
25
|
+
<path
|
|
26
|
+
d="M24.5737 20.833V28.1393H29.7723V26.5573H26.439L26.4422 25.1708H29.1017V23.5916H26.4422V22.4222H29.7723V20.833H24.5737Z"
|
|
27
|
+
fill="#edf6ff"
|
|
28
|
+
></path>
|
|
29
|
+
<path
|
|
30
|
+
opacity="0.302"
|
|
31
|
+
fillRule="evenodd"
|
|
32
|
+
clipRule="evenodd"
|
|
33
|
+
d="M23.2686 5.83301V14.2281H34.1655L23.2686 5.83301Z"
|
|
34
|
+
fill="#edf6ff"
|
|
35
|
+
></path>
|
|
36
|
+
</svg>
|
|
37
|
+
);
|
package/dist/assets/svg/index.ts
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
export * from "./document";
|
|
2
|
-
export * from "./cannedResponse";
|
|
1
|
+
export * from "./document";
|
|
2
|
+
export * from "./cannedResponse";
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
interface GroupMembersDrawerProps {
|
|
2
|
+
groupID?: string;
|
|
3
|
+
disabled?: boolean;
|
|
4
|
+
}
|
|
5
|
+
declare const GroupMembersDrawer: ({ groupID, disabled, }: GroupMembersDrawerProps) => import("react/jsx-runtime").JSX.Element;
|
|
6
|
+
export default GroupMembersDrawer;
|
|
7
|
+
//# sourceMappingURL=GroupMembersDrawer.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"GroupMembersDrawer.d.ts","sourceRoot":"","sources":["../../../src/components/message/GroupMembersDrawer.tsx"],"names":[],"mappings":"AAUA,UAAU,uBAAuB;IAC/B,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,QAAQ,CAAC,EAAE,OAAO,CAAC;CACpB;AAsCD,QAAA,MAAM,kBAAkB,GAAI,wBAGzB,uBAAuB,4CAwLzB,CAAC;AAEF,eAAe,kBAAkB,CAAC"}
|
|
@@ -0,0 +1,104 @@
|
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-runtime";
|
|
2
|
+
import { GroupMemberRole } from "@openim/wasm-client-sdk";
|
|
3
|
+
import { Avatar, Button, Drawer, Dropdown, Empty, Spin } from "antd";
|
|
4
|
+
import { useEffect, useMemo, useState } from "react";
|
|
5
|
+
import { useTranslation } from "react-i18next";
|
|
6
|
+
import useAuthStore from "../../store/auth";
|
|
7
|
+
import useConversationStore from "../../store/conversation";
|
|
8
|
+
import { useGroupMembers } from "../../hooks/group/useGroupMembers";
|
|
9
|
+
import { Icon } from "../icon";
|
|
10
|
+
const getMemberDisplayName = (member) => {
|
|
11
|
+
return member.nickname || member.userID || "";
|
|
12
|
+
};
|
|
13
|
+
const getMemberRoleLabel = ({ member, customerUserID, t, }) => {
|
|
14
|
+
if (member.userID === customerUserID ||
|
|
15
|
+
member.roleLevel === GroupMemberRole.Owner) {
|
|
16
|
+
return t("group_creator");
|
|
17
|
+
}
|
|
18
|
+
if (member.roleLevel === GroupMemberRole.Admin) {
|
|
19
|
+
return t("group_admin");
|
|
20
|
+
}
|
|
21
|
+
return t("group_member");
|
|
22
|
+
};
|
|
23
|
+
const GroupMembersDrawer = ({ groupID, disabled = false, }) => {
|
|
24
|
+
var _a, _b;
|
|
25
|
+
const { t } = useTranslation();
|
|
26
|
+
const [isOpen, setIsOpen] = useState(false);
|
|
27
|
+
const authUserID = useAuthStore((state) => state.userID);
|
|
28
|
+
const conversationData = useConversationStore((state) => state.conversationData);
|
|
29
|
+
const { members, isLoading, error } = useGroupMembers(groupID);
|
|
30
|
+
let customerUserID = "";
|
|
31
|
+
try {
|
|
32
|
+
const exConversationInfo = JSON.parse((conversationData === null || conversationData === void 0 ? void 0 : conversationData.ex) || "{}");
|
|
33
|
+
customerUserID = ((_b = (_a = exConversationInfo === null || exConversationInfo === void 0 ? void 0 : exConversationInfo.sessionInfo) === null || _a === void 0 ? void 0 : _a.data) === null || _b === void 0 ? void 0 : _b.ownerId) || "";
|
|
34
|
+
}
|
|
35
|
+
catch (error) {
|
|
36
|
+
console.error("Error parsing conversation extra info:", error);
|
|
37
|
+
}
|
|
38
|
+
const sortedMembers = useMemo(() => {
|
|
39
|
+
return [...members]
|
|
40
|
+
.map((member) => ({
|
|
41
|
+
userID: member.userID,
|
|
42
|
+
nickname: getMemberDisplayName(member),
|
|
43
|
+
faceURL: member.faceURL,
|
|
44
|
+
isCustomer: Boolean(customerUserID) && member.userID === customerUserID,
|
|
45
|
+
isCurrentUser: member.userID === authUserID,
|
|
46
|
+
roleLabel: getMemberRoleLabel({
|
|
47
|
+
member,
|
|
48
|
+
customerUserID,
|
|
49
|
+
t,
|
|
50
|
+
}),
|
|
51
|
+
}))
|
|
52
|
+
.sort((memberA, memberB) => {
|
|
53
|
+
if (memberA.isCustomer !== memberB.isCustomer) {
|
|
54
|
+
return memberA.isCustomer ? -1 : 1;
|
|
55
|
+
}
|
|
56
|
+
return memberA.nickname.localeCompare(memberB.nickname, "vi", {
|
|
57
|
+
sensitivity: "base",
|
|
58
|
+
});
|
|
59
|
+
});
|
|
60
|
+
}, [authUserID, members, customerUserID, t]);
|
|
61
|
+
const handleOpenDrawer = () => {
|
|
62
|
+
if (!groupID || disabled) {
|
|
63
|
+
return;
|
|
64
|
+
}
|
|
65
|
+
setIsOpen(true);
|
|
66
|
+
};
|
|
67
|
+
const handleCloseDrawer = () => {
|
|
68
|
+
setIsOpen(false);
|
|
69
|
+
};
|
|
70
|
+
const handleLeaveGroup = () => { };
|
|
71
|
+
useEffect(() => {
|
|
72
|
+
setIsOpen(false);
|
|
73
|
+
}, [groupID]);
|
|
74
|
+
const renderContent = () => {
|
|
75
|
+
if (isLoading) {
|
|
76
|
+
return (_jsx("div", { className: "flex items-center justify-center h-full min-h-40", children: _jsx(Spin, {}) }));
|
|
77
|
+
}
|
|
78
|
+
if (error) {
|
|
79
|
+
return (_jsx("div", { className: "flex items-center justify-center h-full min-h-40 px-6 text-center text-sm text-gray-500", children: t(error) }));
|
|
80
|
+
}
|
|
81
|
+
if (!sortedMembers.length) {
|
|
82
|
+
return _jsx(Empty, { description: t("no_group_members") });
|
|
83
|
+
}
|
|
84
|
+
return (_jsx("div", { className: "flex flex-col", children: sortedMembers.map((member) => {
|
|
85
|
+
const menuItems = [
|
|
86
|
+
{
|
|
87
|
+
key: "leave-group",
|
|
88
|
+
label: t("leave_group"),
|
|
89
|
+
icon: _jsx(Icon, { icon: "logout-b", size: 16 }),
|
|
90
|
+
onClick: handleLeaveGroup,
|
|
91
|
+
danger: true,
|
|
92
|
+
},
|
|
93
|
+
];
|
|
94
|
+
return (_jsxs("div", { className: "flex items-center gap-3 px-4 py-3 border-b border-gray-100", children: [_jsx(Avatar, { src: member.faceURL, size: 40, className: "shrink-0", children: member.nickname.charAt(0) || "A" }), _jsxs("div", { className: "flex-1 min-w-0", children: [_jsxs("div", { className: "flex items-center gap-2 min-w-0", children: [_jsx("p", { className: "text-sm font-medium text-gray-900 truncate", children: member.nickname }), member.isCurrentUser && (_jsx("span", { className: "text-xs text-blue-500 shrink-0", children: t("current_account") }))] }), _jsx("p", { className: "text-sm text-gray-500 truncate", children: member.roleLabel })] }), member.isCurrentUser && (_jsx(Dropdown, { menu: { items: menuItems }, trigger: ["click"], placement: "bottomRight", children: _jsx("button", { type: "button", className: "flex items-center justify-center w-8 h-8 rounded-full text-gray-500 hover:bg-gray-100", onClick: (event) => event.stopPropagation(), children: _jsx(Icon, { icon: "more-horizontal-b", size: 18 }) }) }))] }, member.userID));
|
|
95
|
+
}) }));
|
|
96
|
+
};
|
|
97
|
+
return (_jsxs(_Fragment, { children: [_jsx(Button, { type: "text", shape: "default", className: "text-gray-500 w-8 h-8 p-0", onClick: handleOpenDrawer, disabled: disabled || !groupID, children: _jsx(Icon, { icon: "user-two-check-b", size: 22 }) }), _jsx(Drawer, { open: isOpen, onClose: handleCloseDrawer, mask: false, closeIcon: false, styles: {
|
|
98
|
+
body: {
|
|
99
|
+
padding: 0,
|
|
100
|
+
height: "100%",
|
|
101
|
+
},
|
|
102
|
+
}, getContainer: false, width: 360, children: _jsxs("div", { className: "flex flex-col h-full bg-white", children: [_jsxs("div", { className: "flex items-center justify-between px-4 py-3 border-b border-gray-100", children: [_jsx("span", { className: "text-lg font-medium", children: t("members") }), _jsx(Button, { type: "text", shape: "default", className: "text-gray-500 w-8 h-8 p-0", onClick: handleCloseDrawer, children: _jsx(Icon, { icon: "close-b", size: 22 }) })] }), _jsx("div", { className: "flex-1 overflow-y-auto", children: renderContent() })] }) })] }));
|
|
103
|
+
};
|
|
104
|
+
export default GroupMembersDrawer;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"MessageHeader.d.ts","sourceRoot":"","sources":["../../../src/components/message/MessageHeader.tsx"],"names":[],"mappings":"AASA,OAAO,EAAE,aAAa,EAAE,UAAU,EAAE,MAAM,kBAAkB,CAAC;AAG7D,OAAO,EAAE,gBAAgB,EAAE,MAAM,iBAAiB,CAAC;
|
|
1
|
+
{"version":3,"file":"MessageHeader.d.ts","sourceRoot":"","sources":["../../../src/components/message/MessageHeader.tsx"],"names":[],"mappings":"AASA,OAAO,EAAE,aAAa,EAAE,UAAU,EAAE,MAAM,kBAAkB,CAAC;AAG7D,OAAO,EAAE,gBAAgB,EAAE,MAAM,iBAAiB,CAAC;AAOnD,UAAU,kBAAkB;IAC1B,OAAO,CAAC,EAAE,MAAM,IAAI,CAAC;IACrB,cAAc,CAAC,EAAE,gBAAgB,CAAC;CACnC;AAED,KAAK,sBAAsB,GAAG,aAAa,GAAG,UAAU,CAAC;AAEzD,MAAM,WAAW,mBAAmB;IAClC,KAAK,EAAE,MAAM,CAAC;IACd,KAAK,EAAE,sBAAsB,CAAC;IAC9B,kBAAkB,EAAE,MAAM,CAAC;IAC3B,oBAAoB,EAAE,MAAM,CAAC;IAC7B,oBAAoB,EAAE,MAAM,CAAC;CAC9B;AAED,QAAA,MAAM,aAAa,GAAI,6BAA6B,kBAAkB,4CA0MrE,CAAC;AAEF,eAAe,aAAa,CAAC"}
|
|
@@ -12,7 +12,9 @@ import SelectSession from "./SelectSession";
|
|
|
12
12
|
import { useUpdateSession } from "../../hooks/session/useUpdateSession";
|
|
13
13
|
import useAuthStore from "../../store/auth";
|
|
14
14
|
import SearchDrawer from "../searchConversation/SearchDrawer";
|
|
15
|
+
import { useIsJoinedGroup } from "../../hooks/session/useIsJoinedGroup";
|
|
15
16
|
import { isGroupSession } from "../../utils/imCommon";
|
|
17
|
+
import GroupMembersDrawer from "./GroupMembersDrawer";
|
|
16
18
|
const MessageHeader = ({ onClose, currentSession }) => {
|
|
17
19
|
var _a, _b;
|
|
18
20
|
const { t } = useTranslation();
|
|
@@ -22,6 +24,7 @@ const MessageHeader = ({ onClose, currentSession }) => {
|
|
|
22
24
|
const { mutate: updateSession } = useUpdateSession();
|
|
23
25
|
const { avatar, displayName } = useConversationDisplayData(conversationData);
|
|
24
26
|
const shouldShowMemberCount = isGroupSession(conversationData === null || conversationData === void 0 ? void 0 : conversationData.conversationType);
|
|
27
|
+
const { isJoined } = useIsJoinedGroup(conversationData === null || conversationData === void 0 ? void 0 : conversationData.groupID);
|
|
25
28
|
const [currentSessionStatus, setCurrentSessionStatus] = useState(SessionStatus.UNASSIGNED);
|
|
26
29
|
const [currentSessionTag, setCurrentSessionTag] = useState(SessionTag.NONE);
|
|
27
30
|
const statusOptions = useMemo(() => {
|
|
@@ -125,6 +128,6 @@ const MessageHeader = ({ onClose, currentSession }) => {
|
|
|
125
128
|
setCurrentSessionStatus(currentSession.status);
|
|
126
129
|
}
|
|
127
130
|
}, [currentSession]);
|
|
128
|
-
return (_jsxs("div", { className: "px-4 py-3 flex items-center border-b gap-3 bg-white flex-wrap", children: [_jsx(Avatar, { src: avatar, size: "large", className: "min-w-10 min-h-10", children: ((_a = displayName === null || displayName === void 0 ? void 0 : displayName.charAt) === null || _a === void 0 ? void 0 : _a.call(displayName, 0)) || "A" }), _jsxs("div", { className: "flex flex-col overflow-hidden flex-1", children: [_jsx("p", { className: "text-base truncate", children: displayName || "" }), shouldShowMemberCount && (_jsx("p", { className: "text-xs text-gray-500 truncate", children: t("member_count", { count: (_b = currentGroupInfo === null || currentGroupInfo === void 0 ? void 0 : currentGroupInfo.memberCount) !== null && _b !== void 0 ? _b : 0 }) }))] }), _jsxs("div", { className: "flex items-center gap-2 justify-end overflow-hidden", children: [isCx && (_jsx(SelectSession, { placeholder: t("select_tag"), options: tagOptions, value: currentSessionTag, onChange: (value) => handleUpdateSession(value, "tag", value === currentSessionTag), excludeOptions: [SessionTag.SLOW_PROCESSING, SessionTag.NONE] })), isCx && (_jsx(SelectSession, { placeholder: t("select_status"), options: statusOptions, value: currentSessionStatus, onChange: (value) => handleUpdateSession(value, "status", value === currentSessionStatus) })), _jsx(SearchDrawer, {}), _jsx(MediaCollection, {}), _jsx(Button, { type: "text", shape: "default", className: "text-gray-500 w-8 h-8 p-0", children: _jsx(Icon, { icon: "align-justify-o", size: 22 }) }), !!onClose && (_jsx(Button, { type: "text", shape: "default", className: "text-gray-500 w-8 h-8 p-0", onClick: onClose, children: _jsx(Icon, { icon: "close-b", size: 22 }) }))] })] }));
|
|
131
|
+
return (_jsxs("div", { className: "px-4 py-3 flex items-center border-b gap-3 bg-white flex-wrap", children: [_jsx(Avatar, { src: avatar, size: "large", className: "min-w-10 min-h-10", children: ((_a = displayName === null || displayName === void 0 ? void 0 : displayName.charAt) === null || _a === void 0 ? void 0 : _a.call(displayName, 0)) || "A" }), _jsxs("div", { className: "flex flex-col overflow-hidden flex-1", children: [_jsx("p", { className: "text-base truncate", children: displayName || "" }), shouldShowMemberCount && (_jsx("p", { className: "text-xs text-gray-500 truncate", children: t("member_count", { count: (_b = currentGroupInfo === null || currentGroupInfo === void 0 ? void 0 : currentGroupInfo.memberCount) !== null && _b !== void 0 ? _b : 0 }) }))] }), _jsxs("div", { className: "flex items-center gap-2 justify-end overflow-hidden", children: [isCx && (_jsx(SelectSession, { placeholder: t("select_tag"), options: tagOptions, value: currentSessionTag, onChange: (value) => handleUpdateSession(value, "tag", value === currentSessionTag), excludeOptions: [SessionTag.SLOW_PROCESSING, SessionTag.NONE] })), isCx && (_jsx(SelectSession, { placeholder: t("select_status"), options: statusOptions, value: currentSessionStatus, onChange: (value) => handleUpdateSession(value, "status", value === currentSessionStatus) })), _jsx(SearchDrawer, {}), shouldShowMemberCount && isJoined === true && (_jsx(GroupMembersDrawer, { groupID: conversationData === null || conversationData === void 0 ? void 0 : conversationData.groupID })), _jsx(MediaCollection, {}), _jsx(Button, { type: "text", shape: "default", className: "text-gray-500 w-8 h-8 p-0", children: _jsx(Icon, { icon: "align-justify-o", size: 22 }) }), !!onClose && (_jsx(Button, { type: "text", shape: "default", className: "text-gray-500 w-8 h-8 p-0", onClick: onClose, children: _jsx(Icon, { icon: "close-b", size: 22 }) }))] })] }));
|
|
129
132
|
};
|
|
130
133
|
export default MessageHeader;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"MessageList.d.ts","sourceRoot":"","sources":["../../../src/components/message/MessageList.tsx"],"names":[],"mappings":"AA2BA,UAAU,gBAAgB;IACxB,cAAc,EAAE,MAAM,CAAC;IACvB,iBAAiB,CAAC,EAAE,MAAM,CAAC;IAC3B,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,OAAO,CAAC,EAAE,MAAM,IAAI,CAAC;IACrB,qBAAqB,CAAC,EAAE,MAAM,IAAI,CAAC;CACpC;AAGD,QAAA,MAAM,WAAW,GAAI,OAAO,gBAAgB,
|
|
1
|
+
{"version":3,"file":"MessageList.d.ts","sourceRoot":"","sources":["../../../src/components/message/MessageList.tsx"],"names":[],"mappings":"AA2BA,UAAU,gBAAgB;IACxB,cAAc,EAAE,MAAM,CAAC;IACvB,iBAAiB,CAAC,EAAE,MAAM,CAAC;IAC3B,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,OAAO,CAAC,EAAE,MAAM,IAAI,CAAC;IACrB,qBAAqB,CAAC,EAAE,MAAM,IAAI,CAAC;CACpC;AAGD,QAAA,MAAM,WAAW,GAAI,OAAO,gBAAgB,4CA6U3C,CAAC;AAEF,eAAe,WAAW,CAAC"}
|
|
@@ -43,18 +43,19 @@ const MessageList = (props) => {
|
|
|
43
43
|
groupId: conversationData === null || conversationData === void 0 ? void 0 : conversationData.groupID,
|
|
44
44
|
userID: user === null || user === void 0 ? void 0 : user.userID,
|
|
45
45
|
});
|
|
46
|
-
const { getMoreOldMessages, moreOldLoading, loadState, getMoreNewMessages, moreNewLoading, latestLoadState, } = useConversationMessages({
|
|
47
|
-
conversationId,
|
|
48
|
-
searchClientMsgID,
|
|
49
|
-
restrictToLastSession: isNotGroupMember,
|
|
50
|
-
customerUserID,
|
|
51
|
-
});
|
|
52
46
|
const { handleJoinGroup, isJoining } = useJoinGroupFlow({
|
|
53
47
|
groupId: conversationData === null || conversationData === void 0 ? void 0 : conversationData.groupID,
|
|
54
48
|
latestConversationSessionId: latestConversationSession === null || latestConversationSession === void 0 ? void 0 : latestConversationSession.id,
|
|
55
49
|
refetchConversationSessions,
|
|
56
50
|
refetchIsJoined,
|
|
57
51
|
});
|
|
52
|
+
const shouldRestrictToLastSession = isNotGroupMember || isJoining;
|
|
53
|
+
const { getMoreOldMessages, moreOldLoading, loadState, getMoreNewMessages, moreNewLoading, latestLoadState, } = useConversationMessages({
|
|
54
|
+
conversationId,
|
|
55
|
+
searchClientMsgID,
|
|
56
|
+
restrictToLastSession: shouldRestrictToLastSession,
|
|
57
|
+
customerUserID,
|
|
58
|
+
});
|
|
58
59
|
const handleOpenRevoke = useCallback((clientMsgID) => {
|
|
59
60
|
setSelectedItem(clientMsgID);
|
|
60
61
|
openConfirmRevoke();
|
|
@@ -202,6 +203,6 @@ const MessageList = (props) => {
|
|
|
202
203
|
handleMarkConversationMessageAsRead();
|
|
203
204
|
loadMoreNewMessage();
|
|
204
205
|
}
|
|
205
|
-
}, children: loadState.messageList.map((message, _, array) => (_jsx(MessageItem, { message: message, allMessages: array, contextMenuOpen: openMenuId === message.clientMsgID, onContextMenuOpenChange: (open) => setOpenMenuId(open ? message.clientMsgID : null), onRevokeMessage: handleOpenRevoke, onQuoteMessage: setQuotedMessage, onPressQuoteMessage: onPressQuoteMessage }, message.clientMsgID))) }) }), moreNewLoading && (_jsx("div", { className: "flex items-center justify-center py-2", children: _jsx(Spin, {}) })),
|
|
206
|
+
}, children: loadState.messageList.map((message, _, array) => (_jsx(MessageItem, { message: message, allMessages: array, contextMenuOpen: openMenuId === message.clientMsgID, onContextMenuOpenChange: (open) => setOpenMenuId(open ? message.clientMsgID : null), onRevokeMessage: handleOpenRevoke, onQuoteMessage: setQuotedMessage, onPressQuoteMessage: onPressQuoteMessage }, message.clientMsgID))) }) }), moreNewLoading && (_jsx("div", { className: "flex items-center justify-center py-2", children: _jsx(Spin, {}) })), shouldRestrictToLastSession ? (_jsxs("div", { className: "border-t bg-white py-4 flex flex-col items-center gap-2", children: [_jsx("p", { className: "text-sm text-gray-500", children: t("join_group_required") }), _jsx(Button, { type: "primary", onClick: handleJoinGroup, loading: isJoining, children: t("join_group") })] })) : (_jsx(MessageFooter, { currentSession: latestConversationSession, openCreateCannedModal: openCreateCannedModal })), _jsx(Modal, { centered: true, open: showConfirmRevoke, onOk: onRevokeMessage, onCancel: handleCloseRevoke, title: t("revoke_message_confirm_title"), okText: t("revoke"), cancelText: t("cancel"), okType: "danger", confirmLoading: isRevoking, getContainer: false, forceRender: true, children: _jsx("p", { children: t("revoke_message_confirm_message") }) })] }));
|
|
206
207
|
};
|
|
207
208
|
export default MessageList;
|
|
@@ -2,8 +2,9 @@ interface ComposerTabsProps {
|
|
|
2
2
|
canUseInternal: boolean;
|
|
3
3
|
hintText: string;
|
|
4
4
|
isInternal: boolean;
|
|
5
|
+
lockToInternal: boolean;
|
|
5
6
|
setIsInternal: (isInternal: boolean) => void;
|
|
6
7
|
}
|
|
7
|
-
declare const ComposerTabs: ({ canUseInternal, hintText, isInternal, setIsInternal, }: ComposerTabsProps) => import("react/jsx-runtime").JSX.Element | null;
|
|
8
|
+
declare const ComposerTabs: ({ canUseInternal, hintText, isInternal, lockToInternal, setIsInternal, }: ComposerTabsProps) => import("react/jsx-runtime").JSX.Element | null;
|
|
8
9
|
export default ComposerTabs;
|
|
9
10
|
//# sourceMappingURL=ComposerTabs.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ComposerTabs.d.ts","sourceRoot":"","sources":["../../../../src/components/message/footer/ComposerTabs.tsx"],"names":[],"mappings":"AAOA,UAAU,iBAAiB;IACzB,cAAc,EAAE,OAAO,CAAC;IACxB,QAAQ,EAAE,MAAM,CAAC;IACjB,UAAU,EAAE,OAAO,CAAC;IACpB,aAAa,EAAE,CAAC,UAAU,EAAE,OAAO,KAAK,IAAI,CAAC;CAC9C;AAeD,QAAA,MAAM,YAAY,GAAI,
|
|
1
|
+
{"version":3,"file":"ComposerTabs.d.ts","sourceRoot":"","sources":["../../../../src/components/message/footer/ComposerTabs.tsx"],"names":[],"mappings":"AAOA,UAAU,iBAAiB;IACzB,cAAc,EAAE,OAAO,CAAC;IACxB,QAAQ,EAAE,MAAM,CAAC;IACjB,UAAU,EAAE,OAAO,CAAC;IACpB,cAAc,EAAE,OAAO,CAAC;IACxB,aAAa,EAAE,CAAC,UAAU,EAAE,OAAO,KAAK,IAAI,CAAC;CAC9C;AAeD,QAAA,MAAM,YAAY,GAAI,0EAMnB,iBAAiB,mDAoDnB,CAAC;AAEF,eAAe,YAAY,CAAC"}
|
|
@@ -16,19 +16,27 @@ const COMPOSER_TABS = [
|
|
|
16
16
|
labelKey: "internal",
|
|
17
17
|
},
|
|
18
18
|
];
|
|
19
|
-
const ComposerTabs = ({ canUseInternal, hintText, isInternal, setIsInternal, }) => {
|
|
19
|
+
const ComposerTabs = ({ canUseInternal, hintText, isInternal, lockToInternal, setIsInternal, }) => {
|
|
20
20
|
const { t } = useTranslation();
|
|
21
21
|
const items = useMemo(() => COMPOSER_TABS.map((tab) => ({
|
|
22
22
|
key: String(tab.isInternal),
|
|
23
|
+
disabled: lockToInternal && !tab.isInternal,
|
|
23
24
|
label: (_jsx("span", { className: clsx("text-sm font-semibold", isInternal === tab.isInternal
|
|
24
25
|
? tab.activeClassName
|
|
25
|
-
:
|
|
26
|
+
: lockToInternal && !tab.isInternal
|
|
27
|
+
? "text-gray-300"
|
|
28
|
+
: "text-gray-500"), children: t(tab.labelKey) })),
|
|
26
29
|
children: null,
|
|
27
|
-
})), [isInternal, t]);
|
|
30
|
+
})), [isInternal, lockToInternal, t]);
|
|
28
31
|
if (!canUseInternal) {
|
|
29
32
|
return null;
|
|
30
33
|
}
|
|
31
|
-
return (_jsx(Tabs, { activeKey: String(isInternal), items: items, onChange: (value) =>
|
|
34
|
+
return (_jsx(Tabs, { activeKey: String(isInternal), items: items, onChange: (value) => {
|
|
35
|
+
if (lockToInternal && value !== "true") {
|
|
36
|
+
return;
|
|
37
|
+
}
|
|
38
|
+
setIsInternal(value === "true");
|
|
39
|
+
}, tabBarExtraContent: {
|
|
32
40
|
left: _jsx("p", { className: "pr-4 text-sm text-gray-500", children: hintText }),
|
|
33
41
|
}, className: clsx("[&_.ant-tabs-content-holder]:hidden [&_.ant-tabs-ink-bar]:hidden [&_.ant-tabs-nav]:mb-0 [&_.ant-tabs-nav]:px-4 [&_.ant-tabs-nav]:pt-0 [&_.ant-tabs-nav]:before:border-b-0 [&_.ant-tabs-nav-wrap]:justify-end [&_.ant-tabs-extra-content]:flex [&_.ant-tabs-extra-content]:items-center [&_.ant-tabs-extra-content]:overflow-hidden [&_.ant-tabs-extra-content]:text-ellipsis [&_.ant-tabs-tab]:mb-0 [&_.ant-tabs-tab]:rounded-t-[16px] [&_.ant-tabs-tab]:border [&_.ant-tabs-tab]:border-b-0 [&_.ant-tabs-tab]:border-transparent [&_.ant-tabs-tab]:px-3 [&_.ant-tabs-tab]:py-1.5 [&_.ant-tabs-tab]:leading-5 [&_.ant-tabs-tab-btn]:leading-5", isInternal
|
|
34
42
|
? "[&_.ant-tabs-tab-active]:border-orange-200 [&_.ant-tabs-tab-active]:bg-orange-50"
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/components/message/footer/index.tsx"],"names":[],"mappings":"AAgBA,OAAO,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/components/message/footer/index.tsx"],"names":[],"mappings":"AAgBA,OAAO,EAAe,wBAAwB,EAAE,MAAM,qBAAqB,CAAC;AAK5E,OAAO,EAAE,gBAAgB,EAAE,MAAM,oBAAoB,CAAC;AAYtD,UAAU,kBAAkB;IAC1B,cAAc,CAAC,EAAE,gBAAgB,CAAC;IAClC,qBAAqB,CAAC,EAAE,MAAM,IAAI,CAAC;CACpC;AASD,eAAO,MAAM,oBAAoB,mDAY/B,CAAC;AAEH,eAAO,MAAM,uBAAuB,gCAAyC,CAAC;AAE9E,QAAA,MAAM,qBAAqB,GAAI,4CAG5B,kBAAkB,4CA+JpB,CAAC;AAEF,eAAe,qBAAqB,CAAC"}
|
|
@@ -8,7 +8,7 @@ import { editorTheme, editorNodes, editorOnError } from "./editorConfig";
|
|
|
8
8
|
import { createContext, useCallback, useContext, useEffect, useMemo, useState, } from "react";
|
|
9
9
|
import EnterHandler from "./EnterHandler";
|
|
10
10
|
import ActionBar from "./ActionBar";
|
|
11
|
-
import { AccountType
|
|
11
|
+
import { AccountType } from "../../../types/chat";
|
|
12
12
|
import { useSendMessage } from "../../../hooks/message/useSendMessage";
|
|
13
13
|
import { Popover } from "antd";
|
|
14
14
|
import FilePreview from "./FilePreview";
|
|
@@ -19,6 +19,7 @@ import CannedResponse from "../../cannedResponse";
|
|
|
19
19
|
import { CannedResponseTriggerPlugin } from "./CannedResponsePlugin";
|
|
20
20
|
import { useBoolean } from "ahooks";
|
|
21
21
|
import useAuthStore from "../../../store/auth";
|
|
22
|
+
import useConversationStore from "../../../store/conversation";
|
|
22
23
|
import { useCurrentUserAccountType } from "../../../hooks/user/useCurrentUserAccountType";
|
|
23
24
|
import ComposerTabs from "./ComposerTabs";
|
|
24
25
|
import ComposerEditor from "./ComposerEditor";
|
|
@@ -47,22 +48,30 @@ const MessageFooterProvider = ({ currentSession, openCreateCannedModal, }) => {
|
|
|
47
48
|
const { sendTextMessage, sendMergeMessage } = useSendMessage();
|
|
48
49
|
const accountType = useCurrentUserAccountType();
|
|
49
50
|
const [listUploadFiles, setListUploadFiles] = useState([]);
|
|
50
|
-
const [isOpenCanned, { setTrue: openCanned, setFalse: closeCanned }
|
|
51
|
+
const [isOpenCanned, { setTrue: openCanned, setFalse: closeCanned }] = useBoolean(false);
|
|
51
52
|
const isCrm = useAuthStore((state) => state.isCrm);
|
|
52
53
|
const [cannedQuery, setCannedQuery] = useState("");
|
|
53
54
|
const [activeCannedIndex, setActiveCannedIndex] = useState(0);
|
|
54
55
|
const [maxActiveCannedIndex, setMaxActiveCannedIndex] = useState(0);
|
|
55
56
|
const [isInternal, setIsInternal] = useState(false);
|
|
56
57
|
const canUseInternal = isCrm && accountType === AccountType.Staff;
|
|
58
|
+
const quotedMessage = useConversationStore((state) => state.quotedMessage);
|
|
59
|
+
const lockToInternal = Boolean((quotedMessage === null || quotedMessage === void 0 ? void 0 : quotedMessage.clientMsgID) && (quotedMessage === null || quotedMessage === void 0 ? void 0 : quotedMessage.isInternal));
|
|
57
60
|
useEffect(() => {
|
|
58
61
|
if (!canUseInternal && isInternal) {
|
|
59
62
|
setIsInternal(false);
|
|
60
63
|
}
|
|
61
64
|
}, [canUseInternal, isInternal]);
|
|
65
|
+
useEffect(() => {
|
|
66
|
+
if (!canUseInternal ||
|
|
67
|
+
!(quotedMessage === null || quotedMessage === void 0 ? void 0 : quotedMessage.clientMsgID) ||
|
|
68
|
+
!quotedMessage.isInternal) {
|
|
69
|
+
return;
|
|
70
|
+
}
|
|
71
|
+
setIsInternal(true);
|
|
72
|
+
}, [canUseInternal, quotedMessage]);
|
|
62
73
|
const placeholderText = useMemo(() => {
|
|
63
|
-
return isInternal
|
|
64
|
-
? t("enter_internal_message")
|
|
65
|
-
: t("enter_message");
|
|
74
|
+
return isInternal ? t("enter_internal_message") : t("enter_message");
|
|
66
75
|
}, [isInternal, t]);
|
|
67
76
|
const onSendMessage = useCallback(async ({ plainText, richText, type, isInternal, }) => {
|
|
68
77
|
if (type === "text") {
|
|
@@ -108,6 +117,6 @@ const MessageFooterProvider = ({ currentSession, openCreateCannedModal, }) => {
|
|
|
108
117
|
setMaxActiveCannedIndex,
|
|
109
118
|
}, children: _jsxs(LexicalComposer, { initialConfig: initialConfig, children: [_jsx(Popover, { open: isOpenCanned, content: _jsx(CannedResponse, { onClose: closeCanned, openCreateCannedModal: onOpenCreateCannedModal, cannedQuery: cannedQuery }), placement: "topLeft", trigger: "click", arrow: false, classNames: {
|
|
110
119
|
body: "mx-1 !p-0",
|
|
111
|
-
}, destroyOnHidden: true, children: _jsxs("div", { className: "border-t pb-2 flex flex-col gap-1 bg-white", children: [_jsx(QuotedMessageFooter, {}), listUploadFiles.length > 0 && _jsx(FilePreview, {}), _jsx(ToolbarPlugin, {}), _jsxs("div", { children: [_jsx(ComposerTabs, { canUseInternal: canUseInternal, hintText: t("canned_response_hint"), isInternal: isInternal, setIsInternal: setIsInternal }), _jsx(ComposerEditor, { isInternal: isInternal, placeholderText: placeholderText })] }), _jsx(ActionBar, {})] }) }), _jsx(LinkPlugin, {}), _jsx(ListPlugin, {}), _jsx(EnterHandler, {}), _jsx(PasteAndDropPlugin, {}), isCrm && (_jsx(CannedResponseTriggerPlugin, { onClose: closeCanned, onOpen: onOpenCanned }))] }) }));
|
|
120
|
+
}, destroyOnHidden: true, children: _jsxs("div", { className: "border-t pb-2 flex flex-col gap-1 bg-white", children: [_jsx(QuotedMessageFooter, {}), listUploadFiles.length > 0 && _jsx(FilePreview, {}), _jsx(ToolbarPlugin, {}), _jsxs("div", { children: [_jsx(ComposerTabs, { canUseInternal: canUseInternal, hintText: t("canned_response_hint"), isInternal: isInternal, lockToInternal: lockToInternal, setIsInternal: setIsInternal }), _jsx(ComposerEditor, { isInternal: isInternal, placeholderText: placeholderText })] }), _jsx(ActionBar, {})] }) }), _jsx(LinkPlugin, {}), _jsx(ListPlugin, {}), _jsx(EnterHandler, {}), _jsx(PasteAndDropPlugin, {}), isCrm && (_jsx(CannedResponseTriggerPlugin, { onClose: closeCanned, onOpen: onOpenCanned }))] }) }));
|
|
112
121
|
};
|
|
113
122
|
export default MessageFooterProvider;
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { createElement as _createElement } from "react";
|
|
1
2
|
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
3
|
import dayjs from "dayjs";
|
|
3
4
|
import clsx from "clsx";
|
|
@@ -54,11 +55,11 @@ const MessageItem = ({ message, allMessages, contextMenuOpen, onContextMenuOpenC
|
|
|
54
55
|
const { isReplyable, isRevocable, isMine } = useMemo(() => {
|
|
55
56
|
const isMyMessage = (message === null || message === void 0 ? void 0 : message.sendID) === userID;
|
|
56
57
|
const isOlderThanOneDay = dayjs().diff(dayjs(message === null || message === void 0 ? void 0 : message.sendTime), "days", true) >= 1;
|
|
58
|
+
const status = message.status;
|
|
59
|
+
const isDeliveredForUi = status !== MessageStatus.Sending && status !== MessageStatus.Failed;
|
|
57
60
|
return {
|
|
58
|
-
isReplyable:
|
|
59
|
-
isRevocable: isMyMessage &&
|
|
60
|
-
message.status === MessageStatus.Succeed &&
|
|
61
|
-
!isOlderThanOneDay,
|
|
61
|
+
isReplyable: isDeliveredForUi,
|
|
62
|
+
isRevocable: isMyMessage && isDeliveredForUi && !isOlderThanOneDay,
|
|
62
63
|
isMine: isMyMessage,
|
|
63
64
|
};
|
|
64
65
|
}, [userID, message]);
|
|
@@ -133,28 +134,31 @@ const MessageItem = ({ message, allMessages, contextMenuOpen, onContextMenuOpenC
|
|
|
133
134
|
}
|
|
134
135
|
const messageContainerProps = {
|
|
135
136
|
className: "flex flex-col gap-2 py-1 px-3 sm:px-4 min-w-0",
|
|
136
|
-
key: message === null || message === void 0 ? void 0 : message.clientMsgID,
|
|
137
137
|
id: `${MSG_ITEM_PREFIX}${message === null || message === void 0 ? void 0 : message.clientMsgID}`,
|
|
138
138
|
};
|
|
139
139
|
const timeBreakNode = showTimeBreak ? (_jsx("div", { className: "flex justify-center", children: _jsx("span", { className: "text-xs text-gray-600 text-center bg-neutral-100 px-2 py-1 rounded-full", children: formatTimestamp(message.sendTime, {
|
|
140
140
|
dateMonthFormat: "DD MMMM",
|
|
141
141
|
}) }) })) : null;
|
|
142
142
|
if (isSystemLogMessage) {
|
|
143
|
-
return (
|
|
143
|
+
return (_createElement("div", Object.assign({}, messageContainerProps, { key: message === null || message === void 0 ? void 0 : message.clientMsgID }),
|
|
144
|
+
timeBreakNode,
|
|
145
|
+
_jsx(SystemLogMessageItem, { message: message })));
|
|
144
146
|
}
|
|
145
|
-
return (
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
147
|
+
return (_createElement("div", Object.assign({}, messageContainerProps, { key: message === null || message === void 0 ? void 0 : message.clientMsgID }),
|
|
148
|
+
timeBreakNode,
|
|
149
|
+
_jsx("div", { className: clsx("flex min-w-0", isMine ? "justify-end" : "justify-start"), children: _jsxs("div", { className: clsx("flex flex-1 items-end gap-2 min-w-0", isMine ? "justify-end" : "justify-start"), children: [showSenderInfo && (_jsx("div", { className: "flex items-center justify-center w-[32px] h-[32px]", children: showSenderAvatar && (_jsx(Avatar, { src: message === null || message === void 0 ? void 0 : message.senderFaceUrl, children: ((_c = (_b = message === null || message === void 0 ? void 0 : message.senderNickname) === null || _b === void 0 ? void 0 : _b.charAt) === null || _c === void 0 ? void 0 : _c.call(_b, 0)) || "A" })) })), _jsxs("div", { className: clsx("flex flex-col max-w-[75%] min-w-0", isMine ? "items-end" : "items-start"), children: [showSenderName && showSenderInfo && (_jsx("span", { className: "text-xs font-bold mb-1 px-3 mt-2", children: message === null || message === void 0 ? void 0 : message.senderNickname })), _jsxs("div", { className: clsx("flex flex-col flex-1 w-full", isMine ? "items-end" : "items-start"), children: [(message === null || message === void 0 ? void 0 : message.quoteElem) && (_jsx(QuoteMessageItem, { message: message, isMine: isMine, onPressQuoteMessage: onPressQuoteMessage })), _jsxs("div", { className: "flex items-end gap-1.5", children: [isMine && (_jsx(MessageStatusIndicator, { message: message, isLatest: isLatestMine })), _jsx(Dropdown, { menu: { items: contextMenuItems }, trigger: hasContextMenu ? ["contextMenu"] : [], open: contextMenuOpen, onOpenChange: onContextMenuOpenChange, children: _jsxs("div", { className: clsx("px-3 py-2 rounded-2xl max-w-full min-w-0 break-normal flex flex-col flex-1 text-gray-900 gap-1 w-fit", isMine
|
|
150
|
+
? isInternalMessage
|
|
151
|
+
? "bg-orange-100"
|
|
152
|
+
: "bg-blue-100"
|
|
153
|
+
: isInternalMessage
|
|
154
|
+
? "bg-orange-100"
|
|
155
|
+
: "bg-white"), style: {
|
|
156
|
+
wordBreak: "break-word",
|
|
157
|
+
overflowWrap: "anywhere",
|
|
158
|
+
}, id: `${MSG_ITEM_CONTENT_PREFIX}${message === null || message === void 0 ? void 0 : message.clientMsgID}`, children: [(message === null || message === void 0 ? void 0 : message.contentType) === MessageType.MergeMessage ? (_jsxs("div", { children: [(_e = (_d = message === null || message === void 0 ? void 0 : message.mergeElem) === null || _d === void 0 ? void 0 : _d.multiMessage) === null || _e === void 0 ? void 0 : _e.map((item) => {
|
|
159
|
+
return renderMessageByType(item);
|
|
160
|
+
}), (message === null || message === void 0 ? void 0 : message.textElem) && (_jsx(TextMessageItem, { message: message }))] })) : (renderMessageByType(message)), _jsx("span", { className: clsx("text-xs text-gray-500 text-right"), children: dayjs(message === null || message === void 0 ? void 0 : message.sendTime).format("HH:mm") })] }) })] })] }), isMine && message.status === MessageStatus.Failed && (_jsx("span", { className: "text-red-500 text-xs mt-1", children: isMediaResendable(message) ? (_jsx(Trans, { i18nKey: "message_send_failed", components: {
|
|
161
|
+
bold: (_jsx("strong", { className: "cursor-pointer", onClick: () => resendMessage(message) })),
|
|
162
|
+
} })) : (t("message_send_failed_no_retry")) }))] })] }) })));
|
|
159
163
|
};
|
|
160
164
|
export default MessageItem;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ManualAssignPopover.d.ts","sourceRoot":"","sources":["../../../src/components/thread/ManualAssignPopover.tsx"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"ManualAssignPopover.d.ts","sourceRoot":"","sources":["../../../src/components/thread/ManualAssignPopover.tsx"],"names":[],"mappings":"AAiBA,UAAU,aAAa;IACrB,MAAM,EAAE,MAAM,CAAC;IACf,QAAQ,EAAE,MAAM,CAAC;IACjB,QAAQ,EAAE,MAAM,CAAC;IACjB,EAAE,EAAE,MAAM,CAAC;CACZ;AAED,UAAU,wBAAwB;IAChC,SAAS,EAAE,MAAM,CAAC;IAClB,SAAS,EAAE,aAAa,CAAC;IACzB,MAAM,CAAC,EAAE,MAAM,CAAC;CACjB;AAqDD,QAAA,MAAM,mBAAmB,GAAI,+CAI1B,wBAAwB,4CAmL1B,CAAC;AAEF,eAAe,mBAAmB,CAAC"}
|