mr-chat-bird 1.0.8 → 1.0.9

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
@@ -38,7 +38,7 @@ module.exports = __toCommonJS(index_exports);
38
38
  var import_styles = require("@mantine/core/styles.css");
39
39
  var import_styles2 = require("@mantine/tiptap/styles.css");
40
40
  var import_styles3 = require("@mantine/notifications/styles.css");
41
- var import_react9 = __toESM(require("react"));
41
+ var import_react10 = __toESM(require("react"));
42
42
  var import_core9 = require("@mantine/core");
43
43
  var import_notifications2 = require("@mantine/notifications");
44
44
 
@@ -119,6 +119,7 @@ var createAppTheme = (primaryColor) => (0, import_core.createTheme)({
119
119
  });
120
120
 
121
121
  // src/store/provider.tsx
122
+ var import_react = __toESM(require("react"));
122
123
  var import_react_redux = require("react-redux");
123
124
 
124
125
  // src/store/store.ts
@@ -326,11 +327,11 @@ var store = (0, import_toolkit2.configureStore)({
326
327
 
327
328
  // src/store/provider.tsx
328
329
  function ReduxProvider({ children }) {
329
- return /* @__PURE__ */ React.createElement(import_react_redux.Provider, { store }, children);
330
+ return /* @__PURE__ */ import_react.default.createElement(import_react_redux.Provider, { store }, children);
330
331
  }
331
332
 
332
333
  // src/store/socket/index.tsx
333
- var import_react = require("react");
334
+ var import_react2 = require("react");
334
335
 
335
336
  // src/lib/socket.ts
336
337
  var import_socket = require("socket.io-client");
@@ -358,7 +359,7 @@ var getSocket = (userId) => {
358
359
 
359
360
  // src/store/socket/index.tsx
360
361
  function SocketProvider({ children, userId }) {
361
- (0, import_react.useEffect)(() => {
362
+ (0, import_react2.useEffect)(() => {
362
363
  if (!userId) return;
363
364
  const socket2 = getSocket(userId);
364
365
  if (!socket2) return;
@@ -386,7 +387,7 @@ var import_core7 = require("@mantine/core");
386
387
  var import_icons_react3 = require("@tabler/icons-react");
387
388
 
388
389
  // src/components/RichTextEditor/RichTextEditor.tsx
389
- var import_react3 = require("react");
390
+ var import_react4 = require("react");
390
391
  var import_icons_react = require("@tabler/icons-react");
391
392
  var import_extension_highlight = __toESM(require("@tiptap/extension-highlight"));
392
393
  var import_extension_subscript = __toESM(require("@tiptap/extension-subscript"));
@@ -4745,16 +4746,16 @@ var Underline = Mark.create({
4745
4746
  var index_default = Underline;
4746
4747
 
4747
4748
  // src/components/RichTextEditor/RichTextEditor.tsx
4748
- var import_react4 = require("@tiptap/react");
4749
+ var import_react5 = require("@tiptap/react");
4749
4750
  var import_starter_kit = __toESM(require("@tiptap/starter-kit"));
4750
4751
  var import_tiptap = require("@mantine/tiptap");
4751
4752
  var import_core5 = require("@mantine/core");
4752
4753
 
4753
4754
  // src/components/EmojiPickerPopover/EmojiPickerPopover.tsx
4754
- var import_react2 = require("react");
4755
+ var import_react3 = require("react");
4755
4756
  var import_core3 = require("@mantine/core");
4756
4757
  var import_data = __toESM(require("@emoji-mart/data"));
4757
- var EmojiPicker = (0, import_react2.lazy)(() => import("@emoji-mart/react"));
4758
+ var EmojiPicker = (0, import_react3.lazy)(() => import("@emoji-mart/react"));
4758
4759
  function EmojiPickerPopover({
4759
4760
  onSelect,
4760
4761
  action,
@@ -4762,7 +4763,7 @@ function EmojiPickerPopover({
4762
4763
  offset = 8,
4763
4764
  position = "bottom-start"
4764
4765
  }) {
4765
- const [opened, setOpened] = (0, import_react2.useState)(false);
4766
+ const [opened, setOpened] = (0, import_react3.useState)(false);
4766
4767
  return /* @__PURE__ */ React.createElement(
4767
4768
  import_core3.Popover,
4768
4769
  {
@@ -4776,14 +4777,14 @@ function EmojiPickerPopover({
4776
4777
  trapFocus: false,
4777
4778
  closeOnEscape: true
4778
4779
  },
4779
- /* @__PURE__ */ React.createElement(import_core3.Popover.Target, null, (0, import_react2.cloneElement)(action, {
4780
+ /* @__PURE__ */ React.createElement(import_core3.Popover.Target, null, (0, import_react3.cloneElement)(action, {
4780
4781
  onClick: (e) => {
4781
4782
  action.props?.onClick?.(e);
4782
4783
  setOpened((prev) => !prev);
4783
4784
  }
4784
4785
  })),
4785
4786
  /* @__PURE__ */ React.createElement(import_core3.Popover.Dropdown, { p: 0 }, /* @__PURE__ */ React.createElement(
4786
- import_react2.Suspense,
4787
+ import_react3.Suspense,
4787
4788
  {
4788
4789
  fallback: /* @__PURE__ */ React.createElement("div", { style: { padding: 12, width: 320 } }, /* @__PURE__ */ React.createElement(import_core3.Skeleton, { height: 280, radius: "md" }))
4789
4790
  },
@@ -4849,10 +4850,10 @@ function CustomRichTextEditor({
4849
4850
  onChange,
4850
4851
  onSubmit
4851
4852
  }) {
4852
- const [charCount, setCharCount] = (0, import_react3.useState)(0);
4853
- const [showWarning, setShowWarning] = (0, import_react3.useState)(false);
4854
- const [showToolbar, setShowToolbar] = (0, import_react3.useState)(false);
4855
- const editor = (0, import_react4.useEditor)({
4853
+ const [charCount, setCharCount] = (0, import_react4.useState)(0);
4854
+ const [showWarning, setShowWarning] = (0, import_react4.useState)(false);
4855
+ const [showToolbar, setShowToolbar] = (0, import_react4.useState)(false);
4856
+ const editor = (0, import_react5.useEditor)({
4856
4857
  extensions: [
4857
4858
  import_starter_kit.default,
4858
4859
  EmojiNode,
@@ -5001,11 +5002,11 @@ function CustomRichTextEditor({
5001
5002
 
5002
5003
  // src/components/ChatUserList/ChatUserMessage.tsx
5003
5004
  var import_react_redux2 = require("react-redux");
5004
- var import_react7 = require("react");
5005
+ var import_react8 = require("react");
5005
5006
  var import_dompurify = __toESM(require("dompurify"));
5006
5007
 
5007
5008
  // src/components/VirtualizedList/ChatScrollContainer.tsx
5008
- var import_react5 = __toESM(require("react"));
5009
+ var import_react6 = __toESM(require("react"));
5009
5010
  function ChatScrollContainer({
5010
5011
  data: data2,
5011
5012
  renderItem,
@@ -5013,18 +5014,18 @@ function ChatScrollContainer({
5013
5014
  hasMore,
5014
5015
  scrollToBottomTrigger
5015
5016
  }) {
5016
- const containerRef = (0, import_react5.useRef)(null);
5017
- const isFetchingRef = (0, import_react5.useRef)(false);
5018
- const isInitialLoadRef = (0, import_react5.useRef)(true);
5019
- const prevLengthRef = (0, import_react5.useRef)(0);
5020
- (0, import_react5.useEffect)(() => {
5017
+ const containerRef = (0, import_react6.useRef)(null);
5018
+ const isFetchingRef = (0, import_react6.useRef)(false);
5019
+ const isInitialLoadRef = (0, import_react6.useRef)(true);
5020
+ const prevLengthRef = (0, import_react6.useRef)(0);
5021
+ (0, import_react6.useEffect)(() => {
5021
5022
  const el = containerRef.current;
5022
5023
  if (!el) return;
5023
5024
  setTimeout(() => {
5024
5025
  el.scrollTop = el.scrollHeight;
5025
5026
  }, 100);
5026
5027
  }, [scrollToBottomTrigger]);
5027
- (0, import_react5.useEffect)(() => {
5028
+ (0, import_react6.useEffect)(() => {
5028
5029
  const el = containerRef.current;
5029
5030
  if (!el || !data2.length) return;
5030
5031
  if (isInitialLoadRef.current) {
@@ -5054,7 +5055,7 @@ function ChatScrollContainer({
5054
5055
  isFetchingRef.current = false;
5055
5056
  }, 0);
5056
5057
  };
5057
- return /* @__PURE__ */ import_react5.default.createElement(
5058
+ return /* @__PURE__ */ import_react6.default.createElement(
5058
5059
  "div",
5059
5060
  {
5060
5061
  ref: containerRef,
@@ -5066,12 +5067,12 @@ function ChatScrollContainer({
5066
5067
  flexDirection: "column"
5067
5068
  }
5068
5069
  },
5069
- data2.map((item, index) => /* @__PURE__ */ import_react5.default.createElement("div", { key: item?.id || index }, renderItem(item, index)))
5070
+ data2.map((item, index) => /* @__PURE__ */ import_react6.default.createElement("div", { key: item?.id || index }, renderItem(item, index)))
5070
5071
  );
5071
5072
  }
5072
5073
 
5073
5074
  // src/components/UserProfile/UserProfileDrawer.tsx
5074
- var import_react6 = require("react");
5075
+ var import_react7 = require("react");
5075
5076
  var import_core6 = require("@mantine/core");
5076
5077
  var import_icons_react2 = require("@tabler/icons-react");
5077
5078
  function UserProfileDrawer({
@@ -5081,9 +5082,9 @@ function UserProfileDrawer({
5081
5082
  onDeleteMessages,
5082
5083
  onBlock
5083
5084
  }) {
5084
- const [visible, setVisible] = (0, import_react6.useState)(opened);
5085
- const [showImagePreview, setShowImagePreview] = (0, import_react6.useState)(false);
5086
- (0, import_react6.useEffect)(() => {
5085
+ const [visible, setVisible] = (0, import_react7.useState)(opened);
5086
+ const [showImagePreview, setShowImagePreview] = (0, import_react7.useState)(false);
5087
+ (0, import_react7.useEffect)(() => {
5087
5088
  if (opened) setVisible(true);
5088
5089
  }, [opened]);
5089
5090
  const handleClose = () => {
@@ -5147,9 +5148,9 @@ function ChatUserMessage({
5147
5148
  const messageList = (0, import_react_redux2.useSelector)(
5148
5149
  (state) => state.chat.messageList
5149
5150
  );
5150
- const [page, setPage] = (0, import_react7.useState)(0);
5151
- const [scrollTrigger, setScrollTrigger] = (0, import_react7.useState)(0);
5152
- const [showUserInfo, setShowUserInfo] = (0, import_react7.useState)(false);
5151
+ const [page, setPage] = (0, import_react8.useState)(0);
5152
+ const [scrollTrigger, setScrollTrigger] = (0, import_react8.useState)(0);
5153
+ const [showUserInfo, setShowUserInfo] = (0, import_react8.useState)(false);
5153
5154
  const messages = messageList?.rows?.data || [];
5154
5155
  const isEmpty = messages.length === 0;
5155
5156
  const loadOlderMessages = () => {
@@ -5165,7 +5166,7 @@ function ChatUserMessage({
5165
5166
  );
5166
5167
  setPage(nextPage);
5167
5168
  };
5168
- (0, import_react7.useEffect)(() => {
5169
+ (0, import_react8.useEffect)(() => {
5169
5170
  if (chatId) {
5170
5171
  setPage(0);
5171
5172
  dispatch(
@@ -5177,7 +5178,7 @@ function ChatUserMessage({
5177
5178
  );
5178
5179
  }
5179
5180
  }, [chatId]);
5180
- (0, import_react7.useEffect)(() => {
5181
+ (0, import_react8.useEffect)(() => {
5181
5182
  if (!senderDetails?.userId) return;
5182
5183
  const socket2 = getSocket(senderDetails?.userId || "");
5183
5184
  if (!socket2) return;
@@ -5382,7 +5383,7 @@ function ChatUserMessage({
5382
5383
 
5383
5384
  // src/components/ChatUserList/ChatUserList.tsx
5384
5385
  var import_react_redux3 = require("react-redux");
5385
- var import_react8 = require("react");
5386
+ var import_react9 = require("react");
5386
5387
 
5387
5388
  // src/components/ChatUserList/users_list.json
5388
5389
  var users_list_default = [
@@ -6093,21 +6094,21 @@ function ChatUserList() {
6093
6094
  const chatList = (0, import_react_redux3.useSelector)(
6094
6095
  (state) => state.chat.messagedUserList
6095
6096
  );
6096
- const [page, setPage] = (0, import_react8.useState)(0);
6097
- const [chatId, setChatId] = (0, import_react8.useState)("");
6098
- const [enableChat, setEnableChat] = (0, import_react8.useState)(false);
6099
- const [receiverSearchValue, setReceiverSearchValue] = (0, import_react8.useState)("");
6100
- const [receiverDetails, setReceiverDetails] = (0, import_react8.useState)();
6101
- const [receiverUserDetails, setReceiverUserDetails] = (0, import_react8.useState)();
6102
- const [senderSearchValue, setSenderSearchValue] = (0, import_react8.useState)("");
6103
- const [senderDetails, setSenderDetails] = (0, import_react8.useState)("");
6104
- const [senderUserDetails, setSenderUserDetails] = (0, import_react8.useState)();
6105
- (0, import_react8.useEffect)(() => {
6097
+ const [page, setPage] = (0, import_react9.useState)(0);
6098
+ const [chatId, setChatId] = (0, import_react9.useState)("");
6099
+ const [enableChat, setEnableChat] = (0, import_react9.useState)(false);
6100
+ const [receiverSearchValue, setReceiverSearchValue] = (0, import_react9.useState)("");
6101
+ const [receiverDetails, setReceiverDetails] = (0, import_react9.useState)();
6102
+ const [receiverUserDetails, setReceiverUserDetails] = (0, import_react9.useState)();
6103
+ const [senderSearchValue, setSenderSearchValue] = (0, import_react9.useState)("");
6104
+ const [senderDetails, setSenderDetails] = (0, import_react9.useState)("");
6105
+ const [senderUserDetails, setSenderUserDetails] = (0, import_react9.useState)();
6106
+ (0, import_react9.useEffect)(() => {
6106
6107
  if (senderUserDetails) {
6107
6108
  setSenderDetails(senderUserDetails);
6108
6109
  }
6109
6110
  }, [senderUserDetails]);
6110
- (0, import_react8.useEffect)(() => {
6111
+ (0, import_react9.useEffect)(() => {
6111
6112
  if (!senderUserDetails) return;
6112
6113
  dispatch(
6113
6114
  fetchMessageListByUserId({ userId: senderUserDetails.userId, page: 0 })
@@ -6139,7 +6140,7 @@ function ChatUserList() {
6139
6140
  setChatId("");
6140
6141
  setEnableChat(true);
6141
6142
  };
6142
- (0, import_react8.useEffect)(() => {
6143
+ (0, import_react9.useEffect)(() => {
6143
6144
  if (!senderDetails?.userId) return;
6144
6145
  const socket2 = getSocket(senderDetails.userId);
6145
6146
  if (!socket2) return;
@@ -6147,7 +6148,7 @@ function ChatUserList() {
6147
6148
  socket2.connect();
6148
6149
  }
6149
6150
  }, [senderDetails?.userId]);
6150
- (0, import_react8.useEffect)(() => {
6151
+ (0, import_react9.useEffect)(() => {
6151
6152
  if (!senderUserDetails?.userId) return;
6152
6153
  const socket2 = getSocket(senderDetails.userId);
6153
6154
  if (!socket2) return;
@@ -6169,7 +6170,7 @@ function ChatUserList() {
6169
6170
  socket2.off("newChat", handleNewChat);
6170
6171
  };
6171
6172
  }, [senderDetails.userId]);
6172
- (0, import_react8.useEffect)(() => {
6173
+ (0, import_react9.useEffect)(() => {
6173
6174
  if (!senderDetails?.userId) return;
6174
6175
  const socket2 = getSocket(senderDetails?.userId || "");
6175
6176
  if (!socket2) return;
@@ -6404,9 +6405,9 @@ function ChatUserList() {
6404
6405
 
6405
6406
  // src/components/MrChat/index.tsx
6406
6407
  function MrChat(props) {
6407
- const [primaryColor] = (0, import_react9.useState)("customBrand");
6408
+ const [primaryColor] = (0, import_react10.useState)("customBrand");
6408
6409
  const theme = createAppTheme(primaryColor);
6409
- return /* @__PURE__ */ import_react9.default.createElement(ReduxProvider, null, /* @__PURE__ */ import_react9.default.createElement(SocketProvider, null, /* @__PURE__ */ import_react9.default.createElement(import_core9.MantineProvider, { defaultColorScheme: "light", theme }, /* @__PURE__ */ import_react9.default.createElement(import_notifications2.Notifications, null), /* @__PURE__ */ import_react9.default.createElement(ChatUserList, { ...props }))));
6410
+ return /* @__PURE__ */ import_react10.default.createElement(ReduxProvider, null, /* @__PURE__ */ import_react10.default.createElement(SocketProvider, null, /* @__PURE__ */ import_react10.default.createElement(import_core9.MantineProvider, { defaultColorScheme: "light", theme }, /* @__PURE__ */ import_react10.default.createElement(import_notifications2.Notifications, null), /* @__PURE__ */ import_react10.default.createElement(ChatUserList, { ...props }))));
6410
6411
  }
6411
6412
  // Annotate the CommonJS export names for ESM import in node:
6412
6413
  0 && (module.exports = {
package/dist/index.mjs CHANGED
@@ -2,7 +2,7 @@
2
2
  import "@mantine/core/styles.css";
3
3
  import "@mantine/tiptap/styles.css";
4
4
  import "@mantine/notifications/styles.css";
5
- import React3, { useState as useState6 } from "react";
5
+ import React4, { useState as useState6 } from "react";
6
6
  import { MantineProvider } from "@mantine/core";
7
7
  import { Notifications } from "@mantine/notifications";
8
8
 
@@ -83,6 +83,7 @@ var createAppTheme = (primaryColor) => createTheme({
83
83
  });
84
84
 
85
85
  // src/store/provider.tsx
86
+ import React2 from "react";
86
87
  import { Provider } from "react-redux";
87
88
 
88
89
  // src/store/store.ts
@@ -290,7 +291,7 @@ var store = configureStore({
290
291
 
291
292
  // src/store/provider.tsx
292
293
  function ReduxProvider({ children }) {
293
- return /* @__PURE__ */ React.createElement(Provider, { store }, children);
294
+ return /* @__PURE__ */ React2.createElement(Provider, { store }, children);
294
295
  }
295
296
 
296
297
  // src/store/socket/index.tsx
@@ -4997,7 +4998,7 @@ import { useEffect as useEffect4, useState as useState4 } from "react";
4997
4998
  import DOMPurify from "dompurify";
4998
4999
 
4999
5000
  // src/components/VirtualizedList/ChatScrollContainer.tsx
5000
- import React2, { useRef, useEffect as useEffect2 } from "react";
5001
+ import React3, { useRef, useEffect as useEffect2 } from "react";
5001
5002
  function ChatScrollContainer({
5002
5003
  data: data2,
5003
5004
  renderItem,
@@ -5046,7 +5047,7 @@ function ChatScrollContainer({
5046
5047
  isFetchingRef.current = false;
5047
5048
  }, 0);
5048
5049
  };
5049
- return /* @__PURE__ */ React2.createElement(
5050
+ return /* @__PURE__ */ React3.createElement(
5050
5051
  "div",
5051
5052
  {
5052
5053
  ref: containerRef,
@@ -5058,7 +5059,7 @@ function ChatScrollContainer({
5058
5059
  flexDirection: "column"
5059
5060
  }
5060
5061
  },
5061
- data2.map((item, index) => /* @__PURE__ */ React2.createElement("div", { key: item?.id || index }, renderItem(item, index)))
5062
+ data2.map((item, index) => /* @__PURE__ */ React3.createElement("div", { key: item?.id || index }, renderItem(item, index)))
5062
5063
  );
5063
5064
  }
5064
5065
 
@@ -6402,7 +6403,7 @@ function ChatUserList() {
6402
6403
  function MrChat(props) {
6403
6404
  const [primaryColor] = useState6("customBrand");
6404
6405
  const theme = createAppTheme(primaryColor);
6405
- return /* @__PURE__ */ React3.createElement(ReduxProvider, null, /* @__PURE__ */ React3.createElement(SocketProvider, null, /* @__PURE__ */ React3.createElement(MantineProvider, { defaultColorScheme: "light", theme }, /* @__PURE__ */ React3.createElement(Notifications, null), /* @__PURE__ */ React3.createElement(ChatUserList, { ...props }))));
6406
+ return /* @__PURE__ */ React4.createElement(ReduxProvider, null, /* @__PURE__ */ React4.createElement(SocketProvider, null, /* @__PURE__ */ React4.createElement(MantineProvider, { defaultColorScheme: "light", theme }, /* @__PURE__ */ React4.createElement(Notifications, null), /* @__PURE__ */ React4.createElement(ChatUserList, { ...props }))));
6406
6407
  }
6407
6408
  export {
6408
6409
  MrChat
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "mr-chat-bird",
3
- "version": "1.0.8",
3
+ "version": "1.0.9",
4
4
  "private": false,
5
5
  "license": "MIT",
6
6
  "main": "./dist/index.js",