@webinex/chatify 2.0.0-alpha13 → 2.0.0-alpha14

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.
Files changed (143) hide show
  1. package/dist/{Chatify-CwAfN1wu.js → Chatify-CP2jgo8d.js} +191 -118
  2. package/dist/Chatify-CP2jgo8d.js.map +1 -0
  3. package/dist/Chatify.css +28 -0
  4. package/dist/audit.js +3 -2
  5. package/dist/audit.js.map +1 -1
  6. package/dist/index.js +1 -1
  7. package/dist/types/audit/index.d.ts +17 -15
  8. package/dist/types/ui/Chat/ChatContext.d.ts +2 -0
  9. package/dist/types/ui/Chat/ChatPanel.d.ts +7 -0
  10. package/dist/types/ui/Chat/ChatView.d.ts +4 -2
  11. package/dist/types/ui/ChatGroup/ChatGroupContext.d.ts +4 -1
  12. package/dist/types/ui/ChatGroup/ChatGroupPanel.d.ts +21 -2
  13. package/dist/types/ui/Conversation/Conversation.d.ts +1 -0
  14. package/dist/types/ui/Conversation/ConversationContext.d.ts +1 -0
  15. package/dist/types/ui/Conversation/ConversationHeader.d.ts +4 -1
  16. package/dist/types/ui/localizer.d.ts +4 -1
  17. package/dist/types/ui/useCompact.d.ts +4 -0
  18. package/package.json +81 -81
  19. package/src/audit/AuditChatList.tsx +25 -25
  20. package/src/audit/AuditConversationPanel.tsx +49 -48
  21. package/src/audit/AuditPanel.tsx +76 -76
  22. package/src/audit/AuditPanelCustomizeValue.ts +11 -11
  23. package/src/audit/AuditSearch.tsx +89 -89
  24. package/src/audit/AuditSearchValue.tsx +42 -42
  25. package/src/audit/auditApi.tsx +113 -113
  26. package/src/audit/index.d.ts +18 -18
  27. package/src/audit/index.tsx +28 -28
  28. package/src/audit/styles.scss +72 -72
  29. package/src/core/api/api.ts +675 -675
  30. package/src/core/api/baseApi.ts +38 -38
  31. package/src/core/api/index.ts +1 -1
  32. package/src/core/client.ts +298 -298
  33. package/src/core/constants.ts +1 -1
  34. package/src/core/debounce.ts +90 -90
  35. package/src/core/index.ts +4 -4
  36. package/src/core/types.tsx +182 -182
  37. package/src/index.ts +2 -2
  38. package/src/styles/aside.scss +34 -26
  39. package/src/styles/chat-list.scss +138 -138
  40. package/src/styles/chat.scss +11 -11
  41. package/src/styles/conversation.scss +199 -200
  42. package/src/styles/index.scss +227 -220
  43. package/src/styles/input.scss +148 -148
  44. package/src/styles/keyframes.scss +14 -14
  45. package/src/styles/members.scss +30 -13
  46. package/src/styles/mixins.scss +38 -25
  47. package/src/styles/variables.scss +13 -13
  48. package/src/ui/Chat/ChatContext.tsx +32 -30
  49. package/src/ui/Chat/ChatEditableHeaderName.tsx +63 -63
  50. package/src/ui/Chat/ChatHeaderActions.tsx +19 -19
  51. package/src/ui/Chat/ChatPanel.tsx +46 -30
  52. package/src/ui/Chat/ChatView.tsx +122 -115
  53. package/src/ui/Chat/Members/ChatMembersButton.tsx +9 -9
  54. package/src/ui/Chat/Members/ChatMembersPanel.tsx +128 -112
  55. package/src/ui/Chat/Members/ChatMembersPreview.tsx +25 -25
  56. package/src/ui/Chat/Members/index.ts +13 -13
  57. package/src/ui/Chat/index.ts +6 -6
  58. package/src/ui/ChatGroup/AutoReply/AutoReplyButton.tsx +21 -21
  59. package/src/ui/ChatGroup/AutoReply/AutoReplyForm.tsx +50 -50
  60. package/src/ui/ChatGroup/AutoReply/AutoReplyPanel.tsx +94 -94
  61. package/src/ui/ChatGroup/AutoReply/AutoReplyPeriodInput.tsx +22 -22
  62. package/src/ui/ChatGroup/AutoReply/AutoReplyTextInput.tsx +22 -22
  63. package/src/ui/ChatGroup/AutoReply/index.ts +19 -19
  64. package/src/ui/ChatGroup/ChatGroupContext.tsx +63 -61
  65. package/src/ui/ChatGroup/ChatGroupPanel.tsx +110 -75
  66. package/src/ui/ChatGroup/Create/CreateChatButton.tsx +15 -15
  67. package/src/ui/ChatGroup/Create/CreateChatForm.tsx +36 -36
  68. package/src/ui/ChatGroup/Create/CreateChatMemberInput.tsx +65 -65
  69. package/src/ui/ChatGroup/Create/CreateChatNameInput.tsx +25 -25
  70. package/src/ui/ChatGroup/Create/CreateChatPanel.tsx +45 -45
  71. package/src/ui/ChatGroup/Create/index.ts +19 -19
  72. package/src/ui/ChatGroup/Layout/ChatGroupActions.tsx +15 -15
  73. package/src/ui/ChatGroup/Layout/ChatGroupAside.tsx +12 -12
  74. package/src/ui/ChatGroup/Layout/ChatGroupBody.tsx +17 -10
  75. package/src/ui/ChatGroup/Layout/ChatGroupFooter.tsx +3 -3
  76. package/src/ui/ChatGroup/Layout/ChatGroupHeader.tsx +5 -5
  77. package/src/ui/ChatGroup/Layout/ChatGroupMain.tsx +21 -19
  78. package/src/ui/ChatGroup/Layout/index.ts +22 -22
  79. package/src/ui/ChatGroup/List/ChatListPanel.tsx +28 -28
  80. package/src/ui/ChatGroup/List/index.ts +8 -8
  81. package/src/ui/ChatGroup/index.ts +6 -6
  82. package/src/ui/Chatify.tsx +15 -15
  83. package/src/ui/Conversation/Conversation.tsx +96 -92
  84. package/src/ui/Conversation/ConversationActions.tsx +12 -12
  85. package/src/ui/Conversation/ConversationBody.tsx +28 -28
  86. package/src/ui/Conversation/ConversationContext.ts +31 -30
  87. package/src/ui/Conversation/ConversationHeader.tsx +35 -19
  88. package/src/ui/Conversation/ConversationName.tsx +7 -7
  89. package/src/ui/Conversation/InputBox/InputBox.tsx +126 -126
  90. package/src/ui/Conversation/InputBox/InputBoxFile.tsx +38 -38
  91. package/src/ui/Conversation/InputBox/InputBoxFileList.tsx +21 -21
  92. package/src/ui/Conversation/InputBox/InputFilesBox.tsx +78 -78
  93. package/src/ui/Conversation/InputBox/InputSubmitButtonBox.tsx +26 -26
  94. package/src/ui/Conversation/InputBox/InputTextBox.tsx +63 -61
  95. package/src/ui/Conversation/InputBox/index.ts +23 -23
  96. package/src/ui/Conversation/Message/MessageAuthor.tsx +13 -13
  97. package/src/ui/Conversation/Message/MessageBox.tsx +20 -20
  98. package/src/ui/Conversation/Message/MessageContent.tsx +15 -15
  99. package/src/ui/Conversation/Message/MessageFile.tsx +54 -54
  100. package/src/ui/Conversation/Message/MessageFileList.tsx +14 -14
  101. package/src/ui/Conversation/Message/MessageInfoBox.tsx +28 -28
  102. package/src/ui/Conversation/Message/MessageRow.tsx +28 -28
  103. package/src/ui/Conversation/Message/MessageText.tsx +7 -7
  104. package/src/ui/Conversation/Message/index.ts +28 -28
  105. package/src/ui/Conversation/NextObserver/NextMessagesObserver.tsx +47 -47
  106. package/src/ui/Conversation/NextObserver/index.ts +1 -1
  107. package/src/ui/Conversation/ReadObserver/MessageReadObserver.tsx +49 -49
  108. package/src/ui/Conversation/ReadObserver/index.ts +1 -1
  109. package/src/ui/Conversation/SendingMessage/SendingMessageBox.tsx +16 -16
  110. package/src/ui/Conversation/SendingMessage/SendingMessageContent.tsx +13 -13
  111. package/src/ui/Conversation/SendingMessage/SendingMessageInfoBox.tsx +13 -13
  112. package/src/ui/Conversation/SendingMessage/SendingMessageText.tsx +7 -7
  113. package/src/ui/Conversation/SendingMessage/index.ts +16 -16
  114. package/src/ui/Conversation/SystemMessage/SystemMessageBox.tsx +20 -20
  115. package/src/ui/Conversation/SystemMessage/SystemMessageRow.tsx +28 -28
  116. package/src/ui/Conversation/SystemMessage/index.ts +10 -10
  117. package/src/ui/Conversation/index.ts +13 -13
  118. package/src/ui/Thread/ThreadActions.tsx +22 -22
  119. package/src/ui/Thread/ThreadContext.ts +13 -13
  120. package/src/ui/Thread/ThreadPanel.tsx +128 -127
  121. package/src/ui/Thread/index.tsx +3 -3
  122. package/src/ui/color.ts +20 -20
  123. package/src/ui/common/Avatar.tsx +20 -20
  124. package/src/ui/common/ChatList/ChatList.tsx +83 -84
  125. package/src/ui/common/ChatList/ChatListItemAvatar.tsx +22 -22
  126. package/src/ui/common/ChatList/ChatListItemBox.tsx +32 -32
  127. package/src/ui/common/ChatList/ChatListItemLastMessage.tsx +15 -15
  128. package/src/ui/common/ChatList/ChatListItemLastMessageAuthor.tsx +15 -15
  129. package/src/ui/common/ChatList/ChatListItemLastMessageContent.tsx +21 -21
  130. package/src/ui/common/ChatList/ChatListItemLastMessageSentAt.tsx +22 -22
  131. package/src/ui/common/ChatList/ChatListItemName.tsx +8 -8
  132. package/src/ui/common/ChatList/ChatListItemUnreadCount.tsx +12 -12
  133. package/src/ui/common/ChatList/ChatListValue.ts +9 -9
  134. package/src/ui/common/ChatList/index.ts +32 -32
  135. package/src/ui/common/Icon.tsx +48 -48
  136. package/src/ui/common/MessageSkeleton.tsx +20 -20
  137. package/src/ui/common/index.ts +14 -14
  138. package/src/ui/customize.tsx +51 -51
  139. package/src/ui/index.ts +11 -11
  140. package/src/ui/localizer.tsx +148 -137
  141. package/src/ui/useCompact.tsx +32 -0
  142. package/src/ui/useFormatter.tsx +17 -17
  143. package/dist/Chatify-CwAfN1wu.js.map +0 -1
@@ -2,14 +2,14 @@ import './Chatify.css';var __defProp = Object.defineProperty;
2
2
  var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
3
3
  var __publicField = (obj, key, value) => __defNormalProp(obj, typeof key !== "symbol" ? key + "" : key, value);
4
4
  import { jsx, jsxs, Fragment } from "react/jsx-runtime";
5
- import { Button, Avatar as Avatar$1, List, Space, Tooltip, Input, Skeleton, Menu, Row, Col, Form, DatePicker, Checkbox } from "antd";
5
+ import { Button, Avatar as Avatar$1, List, Space, Tooltip, Row, Col, Input, Skeleton, Menu, Form, DatePicker, Checkbox } from "antd";
6
6
  import React, { useContext, useState, useMemo, forwardRef, useCallback, useRef, useEffect, memo, useLayoutEffect } from "react";
7
- import { SettingOutlined, DownloadOutlined, DeleteOutlined, EyeInvisibleOutlined, EyeOutlined, TeamOutlined, CloseOutlined, EditOutlined, UsergroupAddOutlined, UserAddOutlined, UsergroupDeleteOutlined, UserDeleteOutlined, SendOutlined, PaperClipOutlined } from "@ant-design/icons";
7
+ import { SettingOutlined, DownloadOutlined, DeleteOutlined, EyeInvisibleOutlined, EyeOutlined, TeamOutlined, CloseOutlined, EditOutlined, UsergroupAddOutlined, UserAddOutlined, UsergroupDeleteOutlined, UserDeleteOutlined, SendOutlined, PaperClipOutlined, LeftOutlined } from "@ant-design/icons";
8
8
  import { createApi, fakeBaseQuery } from "@reduxjs/toolkit/query/react";
9
9
  import { useSelector } from "react-redux";
10
10
  import * as SignalR from "@microsoft/signalr";
11
- import { isHotkey } from "is-hotkey";
12
11
  import dayjs from "dayjs";
12
+ import { isHotkey } from "is-hotkey";
13
13
  const DEFAULT_COLOR_OPTIONS = {
14
14
  saturation: 100,
15
15
  lightness: 75
@@ -80,15 +80,16 @@ function useChatContext() {
80
80
  return useContext(ChatReactContext);
81
81
  }
82
82
  function ChatContext(props) {
83
- const { id, children } = props;
83
+ const { id, children, compact } = props;
84
84
  const [showMembers, onShowMembers] = useState(false);
85
85
  const value = useMemo(
86
86
  () => ({
87
87
  id,
88
88
  showMembers,
89
- onShowMembers
89
+ onShowMembers,
90
+ compact
90
91
  }),
91
- [id, showMembers]
92
+ [id, showMembers, compact]
92
93
  );
93
94
  return /* @__PURE__ */ jsx(ChatReactContext.Provider, { value, children });
94
95
  }
@@ -931,6 +932,69 @@ const _Avatar = forwardRef(
931
932
  );
932
933
  _Avatar.displayName = "Avatar";
933
934
  const Avatar = customize("Avatar", _Avatar);
935
+ const LocalizerContext = React.createContext(null);
936
+ function useLocalizer() {
937
+ return useContext(LocalizerContext);
938
+ }
939
+ const base = {
940
+ isToday: (value) => dayjs(value).isSame(dayjs(), "day"),
941
+ timestamp: (value) => dayjs(value).format("HH:mm"),
942
+ dateTime: (value) => dayjs(value).format("DD/MM/YYYY HH:mm"),
943
+ message: {
944
+ read: () => "Read",
945
+ reading: () => "Reading...",
946
+ sending: () => "Sending..."
947
+ },
948
+ addChat: {
949
+ title: () => "Add chat",
950
+ name: {
951
+ label: () => "Name",
952
+ required: () => `Name is required`,
953
+ max250: () => "Max 250 characters allowed"
954
+ },
955
+ members: {
956
+ label: () => "Members",
957
+ required: () => "Members is required"
958
+ },
959
+ submitBtn: () => "Submit"
960
+ },
961
+ system: {
962
+ "chatify://chat-created": () => "Chat created",
963
+ "chatify://member-added": () => "New member added",
964
+ "chatify://member-removed": () => "Member removed",
965
+ "chatify://chat-name-changed": (_, { newName }) => `Chat name changed to '${newName}'`
966
+ },
967
+ input: {
968
+ placeholder: (type) => type === "default" ? "Start typing... (Press Enter to send, and Shift+Enter to start a new line)" : "Type a message..."
969
+ },
970
+ settings: {
971
+ members: () => "Members"
972
+ },
973
+ size: {
974
+ bytes: (value) => `${value.toLocaleString(void 0, { minimumFractionDigits: 0, maximumFractionDigits: 2 })} bytes`,
975
+ kb: (value) => `${value.toLocaleString(void 0, { minimumFractionDigits: 0, maximumFractionDigits: 2 })} KB`,
976
+ mb: (value) => `${value.toLocaleString(void 0, { minimumFractionDigits: 0, maximumFractionDigits: 2 })} MB`
977
+ },
978
+ chatList: {
979
+ topShown: (count) => `Latest active ${count} chat${count !== 1 ? "s" : ""} shown`
980
+ },
981
+ members: {
982
+ title: (chatName) => `Members of ${chatName}`
983
+ },
984
+ autoReply: {
985
+ buttonTitle: () => "Auto-reply",
986
+ title: () => "Auto-reply",
987
+ period: {
988
+ label: () => "Period",
989
+ required: () => "Please select start and end date",
990
+ format: () => "DD/MM/YYYY"
991
+ },
992
+ text: { label: () => "Message", required: () => "Please enter message" },
993
+ submitBtn: () => "Submit",
994
+ clearBtn: () => "Clear"
995
+ }
996
+ };
997
+ const defaultLocalizer = base;
934
998
  function useAdd(chatId2, accountId, withHistory) {
935
999
  const [add, state] = chatifyApi.useAddChatMemberMutation();
936
1000
  const onAdd = useCallback(
@@ -990,7 +1054,8 @@ const ChatMemberListItem = customize("ChatMemberListItem", (props) => {
990
1054
  );
991
1055
  });
992
1056
  const ChatMembersPanel = customize("ChatMembersPanel", () => {
993
- const { id } = useChatContext();
1057
+ const { id, compact, onShowMembers } = useChatContext();
1058
+ const localizer = useLocalizer();
994
1059
  const { data: chat } = chatifyApi.useGetChatQuery({ id });
995
1060
  const { data: accounts } = chatifyApi.useGetAccountListQuery({});
996
1061
  const ordered = useMemo(
@@ -1002,14 +1067,20 @@ const ChatMembersPanel = customize("ChatMembersPanel", () => {
1002
1067
  if (!(chat == null ? void 0 : chat.members) || !accounts) {
1003
1068
  return null;
1004
1069
  }
1005
- return /* @__PURE__ */ jsx("div", { className: "wxchtf-chat-members-panel", children: /* @__PURE__ */ jsx(
1006
- List,
1007
- {
1008
- className: "wxchtf-chat-members-list",
1009
- dataSource: ordered,
1010
- renderItem: (item) => /* @__PURE__ */ jsx(ChatMemberListItem, { id: item.id, chatId: id })
1011
- }
1012
- ) });
1070
+ return /* @__PURE__ */ jsxs("div", { className: "wxchtf-chat-members-panel", children: [
1071
+ compact && /* @__PURE__ */ jsx("div", { className: "wxchtf-chat-members-panel-header", children: /* @__PURE__ */ jsxs(Row, { wrap: false, align: "middle", gutter: 10, children: [
1072
+ /* @__PURE__ */ jsx(Col, { flex: "none", children: /* @__PURE__ */ jsx(Button, { type: "text", icon: /* @__PURE__ */ jsx(LeftOutlined, {}), onClick: () => onShowMembers(false) }) }),
1073
+ /* @__PURE__ */ jsx(Col, { children: /* @__PURE__ */ jsx("span", { className: "wxchtf-chat-members-panel-title", children: localizer.members.title(chat.name) }) })
1074
+ ] }) }),
1075
+ /* @__PURE__ */ jsx(
1076
+ List,
1077
+ {
1078
+ className: "wxchtf-chat-members-list",
1079
+ dataSource: ordered,
1080
+ renderItem: (item) => /* @__PURE__ */ jsx(ChatMemberListItem, { id: item.id, chatId: id })
1081
+ }
1082
+ )
1083
+ ] });
1013
1084
  });
1014
1085
  const ChatMembersPreview = customize("ChatMembersPreview", () => {
1015
1086
  const { id } = useChatContext();
@@ -1086,66 +1157,10 @@ const InputFileButton = customize("InputFileButton", (props) => {
1086
1157
  const InputFilesBox = customize("InputFilesBox", (props) => {
1087
1158
  return /* @__PURE__ */ jsx("div", { className: "wxchtf-add-files-box", children: /* @__PURE__ */ jsx(InputFileButton, { ...props }) });
1088
1159
  });
1089
- const LocalizerContext = React.createContext(null);
1090
- function useLocalizer() {
1091
- return useContext(LocalizerContext);
1160
+ const ConversationContext = React.createContext(void 0);
1161
+ function useConversation$1() {
1162
+ return React.useContext(ConversationContext);
1092
1163
  }
1093
- const base = {
1094
- isToday: (value) => dayjs(value).isSame(dayjs(), "day"),
1095
- timestamp: (value) => dayjs(value).format("HH:mm"),
1096
- dateTime: (value) => dayjs(value).format("DD/MM/YYYY HH:mm"),
1097
- message: {
1098
- read: () => "Read",
1099
- reading: () => "Reading...",
1100
- sending: () => "Sending..."
1101
- },
1102
- addChat: {
1103
- title: () => "Add chat",
1104
- name: {
1105
- label: () => "Name",
1106
- required: () => `Name is required`,
1107
- max250: () => "Max 250 characters allowed"
1108
- },
1109
- members: {
1110
- label: () => "Members",
1111
- required: () => "Members is required"
1112
- },
1113
- submitBtn: () => "Submit"
1114
- },
1115
- system: {
1116
- "chatify://chat-created": () => "Chat created",
1117
- "chatify://member-added": () => "New member added",
1118
- "chatify://member-removed": () => "Member removed",
1119
- "chatify://chat-name-changed": (_, { newName }) => `Chat name changed to '${newName}'`
1120
- },
1121
- input: {
1122
- placeholder: () => "Start typing... (Press Enter to send, and Shift+Enter to start a new line)"
1123
- },
1124
- settings: {
1125
- members: () => "Members"
1126
- },
1127
- size: {
1128
- bytes: (value) => `${value.toLocaleString(void 0, { minimumFractionDigits: 0, maximumFractionDigits: 2 })} bytes`,
1129
- kb: (value) => `${value.toLocaleString(void 0, { minimumFractionDigits: 0, maximumFractionDigits: 2 })} KB`,
1130
- mb: (value) => `${value.toLocaleString(void 0, { minimumFractionDigits: 0, maximumFractionDigits: 2 })} MB`
1131
- },
1132
- chatList: {
1133
- topShown: (count) => `Latest active ${count} chat${count !== 1 ? "s" : ""} shown`
1134
- },
1135
- autoReply: {
1136
- buttonTitle: () => "Auto-reply",
1137
- title: () => "Auto-reply",
1138
- period: {
1139
- label: () => "Period",
1140
- required: () => "Please select start and end date",
1141
- format: () => "DD/MM/YYYY"
1142
- },
1143
- text: { label: () => "Message", required: () => "Please enter message" },
1144
- submitBtn: () => "Submit",
1145
- clearBtn: () => "Clear"
1146
- }
1147
- };
1148
- const defaultLocalizer = base;
1149
1164
  const isEnter$1 = isHotkey("enter");
1150
1165
  const isCtrlEnter = isHotkey("ctrl+enter");
1151
1166
  const AUTO_SIZE = { maxRows: 5, minRows: 1 };
@@ -1154,6 +1169,7 @@ const InputTextBox = customize(
1154
1169
  memo((props) => {
1155
1170
  const { value, onChange, onSend, disabled, inputRef } = props;
1156
1171
  const localizer = useLocalizer();
1172
+ const { compact } = useConversation$1();
1157
1173
  const onInputChange = useCallback(
1158
1174
  (e) => onChange(e.target.value),
1159
1175
  [onChange]
@@ -1179,7 +1195,7 @@ const InputTextBox = customize(
1179
1195
  onChange: onInputChange,
1180
1196
  autoSize: AUTO_SIZE,
1181
1197
  className: "wxchtf-text-input-textarea",
1182
- placeholder: localizer.input.placeholder(),
1198
+ placeholder: localizer.input.placeholder(compact ? "compact" : "default"),
1183
1199
  onKeyDown
1184
1200
  }
1185
1201
  ) });
@@ -1199,10 +1215,6 @@ const InputSubmitButtonBox = customize("InputSubmitButtonBox", (props) => {
1199
1215
  }
1200
1216
  ) });
1201
1217
  });
1202
- const ConversationContext = React.createContext(void 0);
1203
- function useConversation$1() {
1204
- return React.useContext(ConversationContext);
1205
- }
1206
1218
  const MessageSkeleton = customize("MessageSkeleton", (props) => {
1207
1219
  const { count = 1 } = props;
1208
1220
  return /* @__PURE__ */ jsx(Fragment, { children: Array.from(Array(count)).map((_, index) => /* @__PURE__ */ jsxs("div", { className: "wxchtf-message-skeleton", children: [
@@ -1656,10 +1668,14 @@ const ConversationName = customize("ConversationName", () => {
1656
1668
  const { name } = useConversation$1();
1657
1669
  return /* @__PURE__ */ jsx("span", { className: "wxchtf-conversation-name", children: name });
1658
1670
  });
1659
- const ConversationHeader = customize("ConversationHeader", () => {
1660
- return /* @__PURE__ */ jsx("div", { className: "wxchtf-conversation-header", children: /* @__PURE__ */ jsxs(Row, { justify: "space-between", align: "middle", children: [
1661
- /* @__PURE__ */ jsx(Col, { children: /* @__PURE__ */ jsx(ConversationName, {}) }),
1662
- /* @__PURE__ */ jsx(Col, { className: "wxchtf-conversation-actions", children: /* @__PURE__ */ jsx(ConversationActions, {}) })
1671
+ const ConversationHeader = customize("ConversationHeader", (props) => {
1672
+ const { onBackClick } = props;
1673
+ return /* @__PURE__ */ jsx("div", { className: "wxchtf-conversation-header", children: /* @__PURE__ */ jsxs(Row, { gutter: 10, children: [
1674
+ onBackClick && /* @__PURE__ */ jsx(Col, { flex: "none", children: /* @__PURE__ */ jsx(Button, { type: "text", icon: /* @__PURE__ */ jsx(LeftOutlined, {}), onClick: onBackClick }) }),
1675
+ /* @__PURE__ */ jsx(Col, { flex: "auto", children: /* @__PURE__ */ jsxs(Row, { justify: "space-between", align: "middle", children: [
1676
+ /* @__PURE__ */ jsx(Col, { children: /* @__PURE__ */ jsx(ConversationName, {}) }),
1677
+ /* @__PURE__ */ jsx(Col, { className: "wxchtf-conversation-actions", children: /* @__PURE__ */ jsx(ConversationActions, {}) })
1678
+ ] }) })
1663
1679
  ] }) });
1664
1680
  });
1665
1681
  const Conversation = customize("Conversation", (props) => {
@@ -1673,7 +1689,9 @@ const Conversation = customize("Conversation", (props) => {
1673
1689
  onSend,
1674
1690
  isReading,
1675
1691
  noReadTracking,
1676
- onClose
1692
+ onClose,
1693
+ compact,
1694
+ onBackClick
1677
1695
  } = props;
1678
1696
  const { id, active, name, lastReadMessageId } = value;
1679
1697
  const context = useMemo(
@@ -1690,7 +1708,8 @@ const Conversation = customize("Conversation", (props) => {
1690
1708
  onSend,
1691
1709
  isReading,
1692
1710
  noReadTracking,
1693
- onClose
1711
+ onClose,
1712
+ compact
1694
1713
  }),
1695
1714
  [
1696
1715
  id,
@@ -1709,7 +1728,7 @@ const Conversation = customize("Conversation", (props) => {
1709
1728
  ]
1710
1729
  );
1711
1730
  return /* @__PURE__ */ jsx(ConversationContext.Provider, { value: context, children: /* @__PURE__ */ jsx("div", { className: "wxchtf-conversation", children: /* @__PURE__ */ jsxs("div", { className: "wxchtf-conversation-main", children: [
1712
- /* @__PURE__ */ jsx(ConversationHeader, {}),
1731
+ /* @__PURE__ */ jsx(ConversationHeader, { onBackClick }),
1713
1732
  /* @__PURE__ */ jsx(ConversationBody, {}),
1714
1733
  active && /* @__PURE__ */ jsx(InputBox, {})
1715
1734
  ] }) }) });
@@ -1757,12 +1776,12 @@ const ChatEditableHeaderName = customize("ChatEditableHeaderName", () => {
1757
1776
  return /* @__PURE__ */ jsx(Tooltip, { title: "Click to edit name...", children: /* @__PURE__ */ jsx("span", { className: "wxchtf-conversation-name --editable", onClick: () => setEdit(true), children: name }) });
1758
1777
  });
1759
1778
  const ChatHeaderActions = customize("ChatHeaderActions", () => {
1760
- const { active } = useConversation$1();
1779
+ const { active, compact } = useConversation$1();
1761
1780
  if (!active) {
1762
1781
  return null;
1763
1782
  }
1764
1783
  return /* @__PURE__ */ jsxs("div", { className: "wxchtf-chat-members", children: [
1765
- /* @__PURE__ */ jsx(ChatMembersPreview, {}),
1784
+ !compact && /* @__PURE__ */ jsx(ChatMembersPreview, {}),
1766
1785
  /* @__PURE__ */ jsx(ChatMembersButton, {})
1767
1786
  ] });
1768
1787
  });
@@ -1771,7 +1790,8 @@ const DEFAULT_CHAT_VIEW_CUSTOMIZE_VALUE = {
1771
1790
  ConversationActions: () => /* @__PURE__ */ jsx(ChatHeaderActions, {})
1772
1791
  };
1773
1792
  function useConversation(props) {
1774
- const { value: chat } = props;
1793
+ const { value: chat, onBackClick } = props;
1794
+ const { compact } = useChatContext();
1775
1795
  const { id, name, active, lastReadMessageId } = chat;
1776
1796
  const { data: messageList } = chatifyApi.useGetChatMessageListQuery({ chatId: id });
1777
1797
  const { messages, hasMore } = messageList ?? {};
@@ -1794,7 +1814,9 @@ function useConversation(props) {
1794
1814
  nextLoading: isFetchNextLoading,
1795
1815
  onRead,
1796
1816
  onSend,
1797
- isReading: (id2) => readQueue.some((x) => chatId(x.value) === chatId(id2) && id2 <= x.value)
1817
+ isReading: (id2) => readQueue.some((x) => chatId(x.value) === chatId(id2) && id2 <= x.value),
1818
+ compact: compact ?? false,
1819
+ onBackClick
1798
1820
  };
1799
1821
  return result;
1800
1822
  }, [
@@ -1808,41 +1830,76 @@ function useConversation(props) {
1808
1830
  messages,
1809
1831
  hasMore,
1810
1832
  lastReadMessageId,
1811
- readQueue
1833
+ readQueue,
1834
+ compact,
1835
+ onBackClick
1812
1836
  ]);
1813
1837
  return conversation;
1814
1838
  }
1815
1839
  function Content$1(props) {
1816
1840
  const conversation = useConversation(props);
1817
- const { showMembers } = useChatContext();
1841
+ const { compact, showMembers } = useChatContext();
1818
1842
  if (!conversation) {
1819
1843
  return null;
1820
1844
  }
1821
1845
  return /* @__PURE__ */ jsxs("div", { className: "wxchtf-chat", children: [
1822
- /* @__PURE__ */ jsx(Conversation, { ...conversation }),
1846
+ (!compact || !showMembers) && /* @__PURE__ */ jsx(Conversation, { ...conversation }),
1823
1847
  showMembers && /* @__PURE__ */ jsx(ChatMembersPanel, {})
1824
1848
  ] });
1825
1849
  }
1826
1850
  const ChatView = customize("ChatView", (props) => {
1827
- const { value } = props;
1851
+ const { value, compact, onBackClick } = props;
1828
1852
  const customized = useCustomizeContext();
1829
1853
  const customize2 = useMemo(
1830
1854
  () => ({ ...customized ?? {}, ...DEFAULT_CHAT_VIEW_CUSTOMIZE_VALUE }),
1831
1855
  [customized]
1832
1856
  );
1833
- return /* @__PURE__ */ jsx(CustomizeContext.Provider, { value: customize2, children: /* @__PURE__ */ jsx(ChatContext, { id: value.id, children: /* @__PURE__ */ jsx(Content$1, { value }) }) });
1857
+ return /* @__PURE__ */ jsx(CustomizeContext.Provider, { value: customize2, children: /* @__PURE__ */ jsx(ChatContext, { id: value.id, compact: compact ?? false, children: /* @__PURE__ */ jsx(Content$1, { value, onBackClick }) }) });
1834
1858
  });
1859
+ function useCompact(thresholdOrCompact = 768) {
1860
+ const ref = useRef(null);
1861
+ const [size, setSize] = useState();
1862
+ const automatic = typeof thresholdOrCompact === "number";
1863
+ useEffect(() => {
1864
+ if (!automatic) {
1865
+ setSize(void 0);
1866
+ return;
1867
+ }
1868
+ const el = ref.current;
1869
+ if (!el) return;
1870
+ const observer = new ResizeObserver(() => {
1871
+ const { width, height } = el.getBoundingClientRect();
1872
+ setSize({ width, height });
1873
+ });
1874
+ observer.observe(el);
1875
+ return () => observer.disconnect();
1876
+ }, [automatic]);
1877
+ if (typeof thresholdOrCompact === "boolean") {
1878
+ return [ref, thresholdOrCompact, size];
1879
+ }
1880
+ const compact = size != null ? size.width < thresholdOrCompact : void 0;
1881
+ return [ref, compact, size];
1882
+ }
1835
1883
  function ChatPanel(props) {
1836
- const { id, className = "", customize: customize2, localizer = defaultLocalizer, style } = props;
1884
+ const { id, className = "", customize: customize2, localizer = defaultLocalizer, style, compact: compactProp } = props;
1837
1885
  const { data: chat } = chatifyApi.useGetChatQuery({ id });
1838
- return /* @__PURE__ */ jsx("div", { className: `wxchtf-chatify wxchtf-chat-panel ${className}`, style, children: /* @__PURE__ */ jsx(LocalizerContext.Provider, { value: localizer, children: /* @__PURE__ */ jsx(CustomizeContext.Provider, { value: customize2, children: chat && /* @__PURE__ */ jsx(ChatView, { value: chat }, id) }) }) });
1886
+ const [ref, compact] = useCompact(compactProp);
1887
+ return /* @__PURE__ */ jsx(
1888
+ "div",
1889
+ {
1890
+ className: ["wxchtf-chatify", "wxchtf-chat-panel", compact && "--compact", className].filter(Boolean).join(" "),
1891
+ style,
1892
+ ref,
1893
+ children: /* @__PURE__ */ jsx(LocalizerContext.Provider, { value: localizer, children: /* @__PURE__ */ jsx(CustomizeContext.Provider, { value: customize2, children: chat && /* @__PURE__ */ jsx(ChatView, { value: chat, compact }, id) }) })
1894
+ }
1895
+ );
1839
1896
  }
1840
1897
  const ChatGroupReactContext = React.createContext(null);
1841
1898
  function useChatGroupContext() {
1842
1899
  return useContext(ChatGroupReactContext);
1843
1900
  }
1844
1901
  function ChatGroupContext(props) {
1845
- const { children } = props;
1902
+ const { children, compact } = props;
1846
1903
  const [state, setState] = useState({
1847
1904
  chatId: null,
1848
1905
  view: null,
@@ -1851,6 +1908,7 @@ function ChatGroupContext(props) {
1851
1908
  const value = useMemo(
1852
1909
  () => ({
1853
1910
  ...state,
1911
+ compact,
1854
1912
  openChat: (chatId2) => setState((prev) => ({ ...prev, view: "chat", chatId: chatId2 })),
1855
1913
  none: () => setState((prev) => ({ ...prev, view: null, chatId: null })),
1856
1914
  toggleMembers: () => setState((prev) => ({ ...prev, showMembers: !prev.showMembers })),
@@ -1873,7 +1931,7 @@ function ChatGroupContext(props) {
1873
1931
  }
1874
1932
  })
1875
1933
  }),
1876
- [state]
1934
+ [state, compact]
1877
1935
  );
1878
1936
  return /* @__PURE__ */ jsx(ChatGroupReactContext.Provider, { value, children });
1879
1937
  }
@@ -2155,48 +2213,62 @@ const ChatGroupHeader = customize("ChatGroupHeader", () => {
2155
2213
  });
2156
2214
  const ChatGroupFooter = customize("ChatGroupFooter", () => /* @__PURE__ */ jsx("div", { className: "wxchtf-footer" }));
2157
2215
  const ChatGroupMain = customize("ChatGroupMain", () => {
2158
- const { chatId: chatId2, view } = useChatGroupContext();
2216
+ const { chatId: chatId2, view, compact, none } = useChatGroupContext();
2159
2217
  const chat = chatifyApi.useChatListItem(chatId2);
2160
2218
  return /* @__PURE__ */ jsxs("div", { className: "wxchtf-main", children: [
2161
- view === "chat" && chat && /* @__PURE__ */ jsx(ChatView, { value: chat }, chatId2),
2219
+ view === "chat" && chat && /* @__PURE__ */ jsx(ChatView, { value: chat, compact, onBackClick: compact ? none : void 0 }, chatId2),
2162
2220
  view === "new-chat" && /* @__PURE__ */ jsx(CreateChatPanel, {}),
2163
2221
  view === "auto-reply" && /* @__PURE__ */ jsx(AutoReplyPanel, {})
2164
2222
  ] });
2165
2223
  });
2166
- const ChatGroupBody = customize("ChatGroupBody", () => /* @__PURE__ */ jsxs("div", { className: "wxchtf-body", children: [
2167
- /* @__PURE__ */ jsx(ChatGroupAside, {}),
2168
- /* @__PURE__ */ jsx(ChatGroupMain, {})
2169
- ] }));
2224
+ const ChatGroupBody = customize("ChatGroupBody", () => {
2225
+ const { compact, view } = useChatGroupContext();
2226
+ const isAsideShown = !compact || !view;
2227
+ const isMainShown = !compact || view;
2228
+ return /* @__PURE__ */ jsxs("div", { className: "wxchtf-body", children: [
2229
+ isAsideShown && /* @__PURE__ */ jsx(ChatGroupAside, {}),
2230
+ isMainShown && /* @__PURE__ */ jsx(ChatGroupMain, {})
2231
+ ] });
2232
+ });
2170
2233
  function Content(props) {
2171
- const { className = "", style } = props;
2234
+ const { className = "", style, containerRef } = props;
2172
2235
  const { data: chats } = chatifyApi.useGetChatListQuery();
2173
- const { openChat, none, chatId: chatId2 } = useChatGroupContext();
2236
+ const { openChat, none, chatId: chatId2, compact } = useChatGroupContext();
2174
2237
  const openFirstChatRef = useRef(false);
2175
2238
  useEffect(() => {
2176
- if (chats && !chats.some((x) => x.id === chatId2)) {
2239
+ if (chats && chatId2 && !chats.some((x) => x.id === chatId2)) {
2177
2240
  chats.length ? openChat(chats[0].id) : none();
2178
2241
  }
2179
2242
  }, [chats, chatId2]);
2180
2243
  useEffect(() => {
2181
- if (chats && !openFirstChatRef.current) {
2244
+ if (chats && !openFirstChatRef.current && !compact) {
2182
2245
  openFirstChatRef.current = true;
2183
2246
  chats.length && openChat(chats[0].id);
2184
2247
  }
2185
- }, [chats]);
2186
- return /* @__PURE__ */ jsxs("div", { className: className + " wxchtf-chatify wxchtf-chat-group", style, children: [
2187
- /* @__PURE__ */ jsx(ChatGroupHeader, {}),
2188
- /* @__PURE__ */ jsx(ChatGroupBody, {}),
2189
- /* @__PURE__ */ jsx(ChatGroupFooter, {})
2190
- ] });
2248
+ }, [chats, compact]);
2249
+ return /* @__PURE__ */ jsxs(
2250
+ "div",
2251
+ {
2252
+ className: ["wxchtf-chatify", "wxchtf-chat-group", compact && "--compact", className].filter(Boolean).join(" "),
2253
+ style,
2254
+ ref: containerRef,
2255
+ children: [
2256
+ /* @__PURE__ */ jsx(ChatGroupHeader, {}),
2257
+ /* @__PURE__ */ jsx(ChatGroupBody, {}),
2258
+ /* @__PURE__ */ jsx(ChatGroupFooter, {})
2259
+ ]
2260
+ }
2261
+ );
2191
2262
  }
2192
2263
  const DEFAULT_CUSTOMIZE$1 = {
2193
2264
  ChatGroupHeader: null,
2194
2265
  ChatGroupFooter: null
2195
2266
  };
2196
2267
  const ChatGroupPanel = (props) => {
2197
- const { localizer = defaultLocalizer, customize: customize2 = DEFAULT_CUSTOMIZE$1 } = props;
2268
+ const { localizer = defaultLocalizer, customize: customize2 = DEFAULT_CUSTOMIZE$1, compact: compactProp } = props;
2198
2269
  const customizeValue = useMemo(() => Object.assign({}, DEFAULT_CUSTOMIZE$1, customize2), [customize2]);
2199
- return /* @__PURE__ */ jsx(LocalizerContext.Provider, { value: localizer, children: /* @__PURE__ */ jsx(CustomizeContext.Provider, { value: customizeValue, children: /* @__PURE__ */ jsx(ChatGroupContext, { children: /* @__PURE__ */ jsx(Content, { ...props }) }) }) });
2270
+ const [containerRef, compact] = useCompact(compactProp);
2271
+ return /* @__PURE__ */ jsx(LocalizerContext.Provider, { value: localizer, children: /* @__PURE__ */ jsx(CustomizeContext.Provider, { value: customizeValue, children: /* @__PURE__ */ jsx(ChatGroupContext, { compact: compact ?? true, children: /* @__PURE__ */ jsx(Content, { ...props, containerRef }) }) }) });
2200
2272
  };
2201
2273
  const ThreadContext = React.createContext(null);
2202
2274
  function useThreadContext() {
@@ -2238,6 +2310,7 @@ function usePanelState(props) {
2238
2310
  onRead,
2239
2311
  onSend,
2240
2312
  noReadTracking: !watch,
2313
+ compact: false,
2241
2314
  isReading: (id2) => readQueue.some(
2242
2315
  (unit) => parseThreadMessageId(unit.value)[0] === parseThreadMessageId(id2)[0] && id2 <= unit.value
2243
2316
  )
@@ -2393,4 +2466,4 @@ export {
2393
2466
  CreateChatPanel as y,
2394
2467
  CreateChatButton as z
2395
2468
  };
2396
- //# sourceMappingURL=Chatify-CwAfN1wu.js.map
2469
+ //# sourceMappingURL=Chatify-CP2jgo8d.js.map