@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.mjs CHANGED
@@ -91728,6 +91728,7 @@ const IconFileTypeColor = (props) => {
91728
91728
  return jsx("img", { ...props, src: icon, style: { width: width ? width : 24, height: height ? height : 'auto', ...props.style } });
91729
91729
  };
91730
91730
 
91731
+ const MySwal$1 = withReactContent(Swal);
91731
91732
  const DateHeader = memo(({ label }) => (jsx("div", { className: "d-flex justify-content-center", children: jsx("div", { style: {
91732
91733
  backgroundColor: "rgba(0,0,0,0.2)",
91733
91734
  padding: "2px 15px",
@@ -92488,6 +92489,60 @@ const ChatLog = (props) => {
92488
92489
  console.error("No valid path found in param");
92489
92490
  }
92490
92491
  }, [clickedImageFile, downloadFile]);
92492
+ useCallback(async (param) => {
92493
+ try {
92494
+ const result = await MySwal$1.fire({
92495
+ title: "Xác nhận",
92496
+ html: "Tin nhắn sẽ bị xóa vĩnh viễn. <br> Bạn có chắc muốn xóa?",
92497
+ allowOutsideClick: false,
92498
+ showCancelButton: true,
92499
+ confirmButtonText: "Xoá",
92500
+ cancelButtonText: "Hủy",
92501
+ customClass: {
92502
+ confirmButton: "btn btn-primary",
92503
+ cancelButton: "btn btn-danger ms-1"
92504
+ },
92505
+ buttonsStyling: false
92506
+ });
92507
+ if (result.value) {
92508
+ const data = { id: param.id, chatRoomId: groupChatUsers.id };
92509
+ await deleteMessageApi(data);
92510
+ }
92511
+ else if (result.dismiss === MySwal$1.DismissReason.cancel) {
92512
+ console.log("Hủy xóa tin nhắn");
92513
+ }
92514
+ }
92515
+ catch (error) {
92516
+ console.error("Error deleting message:", error);
92517
+ }
92518
+ }, [deleteMessageApi, groupChatUsers?.id]);
92519
+ useCallback(async (param) => {
92520
+ try {
92521
+ const result = await MySwal$1.fire({
92522
+ title: "Xác nhận",
92523
+ 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.",
92524
+ allowOutsideClick: false,
92525
+ showCancelButton: true,
92526
+ confirmButtonText: "Thu hồi",
92527
+ cancelButtonText: "Hủy",
92528
+ customClass: {
92529
+ confirmButton: "btn btn-primary",
92530
+ cancelButton: "btn btn-danger ms-1"
92531
+ },
92532
+ buttonsStyling: false
92533
+ });
92534
+ if (result.value) {
92535
+ const data = { id: param.id, chatRoomId: groupChatUsers.id };
92536
+ await recallMessageApi(data);
92537
+ }
92538
+ else if (result.dismiss === MySwal$1.DismissReason.cancel) {
92539
+ console.log("Hủy thu hồi tin nhắn");
92540
+ }
92541
+ }
92542
+ catch (error) {
92543
+ console.error("Error recalling message:", error);
92544
+ }
92545
+ }, [recallMessageApi, groupChatUsers?.id]);
92491
92546
  return (jsx("div", { id: "chat-app-window", className: "chat-app-window", ref: containerChatRef, children: jsxs("div", { className: classnames("start-chat-area", {
92492
92547
  "d-none": contactId || chatRoomId
92493
92548
  }), children: [jsx("div", { className: "start-chat-icon mb-1", children: jsx(SvgMessageSquare, {}) }), jsx("h4", { className: "sidebar-toggle start-chat-text", children: "B\u1EAFt \u0111\u1EA7u tr\u00F2 chuy\u1EC7n" })] }) }));