@esvndev/es-react-template-chat 0.0.104 → 0.0.105

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/index.js CHANGED
@@ -91777,6 +91777,7 @@ const IconFileTypeColor = (props) => {
91777
91777
  return jsxRuntime.jsx("img", { ...props, src: icon, style: { width: width ? width : 24, height: height ? height : 'auto', ...props.style } });
91778
91778
  };
91779
91779
 
91780
+ const MySwal$1 = withReactContent(Swal);
91780
91781
  const DateHeader = React.memo(({ label }) => (jsxRuntime.jsx("div", { className: "d-flex justify-content-center", children: jsxRuntime.jsx("div", { style: {
91781
91782
  backgroundColor: "rgba(0,0,0,0.2)",
91782
91783
  padding: "2px 15px",
@@ -92537,6 +92538,60 @@ const ChatLog = (props) => {
92537
92538
  console.error("No valid path found in param");
92538
92539
  }
92539
92540
  }, [clickedImageFile, downloadFile]);
92541
+ React.useCallback(async (param) => {
92542
+ try {
92543
+ const result = await MySwal$1.fire({
92544
+ title: "Xác nhận",
92545
+ html: "Tin nhắn sẽ bị xóa vĩnh viễn. <br> Bạn có chắc muốn xóa?",
92546
+ allowOutsideClick: false,
92547
+ showCancelButton: true,
92548
+ confirmButtonText: "Xoá",
92549
+ cancelButtonText: "Hủy",
92550
+ customClass: {
92551
+ confirmButton: "btn btn-primary",
92552
+ cancelButton: "btn btn-danger ms-1"
92553
+ },
92554
+ buttonsStyling: false
92555
+ });
92556
+ if (result.value) {
92557
+ const data = { id: param.id, chatRoomId: groupChatUsers.id };
92558
+ await deleteMessageApi(data);
92559
+ }
92560
+ else if (result.dismiss === MySwal$1.DismissReason.cancel) {
92561
+ console.log("Hủy xóa tin nhắn");
92562
+ }
92563
+ }
92564
+ catch (error) {
92565
+ console.error("Error deleting message:", error);
92566
+ }
92567
+ }, [deleteMessageApi, groupChatUsers?.id]);
92568
+ React.useCallback(async (param) => {
92569
+ try {
92570
+ const result = await MySwal$1.fire({
92571
+ title: "Xác nhận",
92572
+ html: "Bạn có chắc muốn thu hồi tin nhắn này?<br>Tin nhắn sẽ bị ẩn với tất cả mọi người.",
92573
+ allowOutsideClick: false,
92574
+ showCancelButton: true,
92575
+ confirmButtonText: "Thu hồi",
92576
+ cancelButtonText: "Hủy",
92577
+ customClass: {
92578
+ confirmButton: "btn btn-primary",
92579
+ cancelButton: "btn btn-danger ms-1"
92580
+ },
92581
+ buttonsStyling: false
92582
+ });
92583
+ if (result.value) {
92584
+ const data = { id: param.id, chatRoomId: groupChatUsers.id };
92585
+ await recallMessageApi(data);
92586
+ }
92587
+ else if (result.dismiss === MySwal$1.DismissReason.cancel) {
92588
+ console.log("Hủy thu hồi tin nhắn");
92589
+ }
92590
+ }
92591
+ catch (error) {
92592
+ console.error("Error recalling message:", error);
92593
+ }
92594
+ }, [recallMessageApi, groupChatUsers?.id]);
92540
92595
  return (jsxRuntime.jsx("div", { id: "chat-app-window", className: "chat-app-window", ref: containerChatRef, children: jsxRuntime.jsxs("div", { className: classnames("start-chat-area", {
92541
92596
  "d-none": contactId || chatRoomId
92542
92597
  }), children: [jsxRuntime.jsx("div", { className: "start-chat-icon mb-1", children: jsxRuntime.jsx(SvgMessageSquare, {}) }), jsxRuntime.jsx("h4", { className: "sidebar-toggle start-chat-text", children: "B\u1EAFt \u0111\u1EA7u tr\u00F2 chuy\u1EC7n" })] }) }));