mr-chat-bird 1.0.2 → 1.0.4

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
@@ -289,8 +289,9 @@ var store = configureStore({
289
289
  });
290
290
 
291
291
  // src/store/provider.tsx
292
+ import { jsx } from "react/jsx-runtime";
292
293
  function ReduxProvider({ children }) {
293
- return /* @__PURE__ */ React.createElement(Provider, { store }, children);
294
+ return /* @__PURE__ */ jsx(Provider, { store, children });
294
295
  }
295
296
 
296
297
  // src/store/socket/index.tsx
@@ -321,6 +322,7 @@ var getSocket = (userId) => {
321
322
  };
322
323
 
323
324
  // src/store/socket/index.tsx
325
+ import { Fragment, jsx as jsx2 } from "react/jsx-runtime";
324
326
  function SocketProvider({ children, userId }) {
325
327
  useEffect(() => {
326
328
  if (!userId) return;
@@ -337,7 +339,7 @@ function SocketProvider({ children, userId }) {
337
339
  }
338
340
  };
339
341
  }, [userId]);
340
- return /* @__PURE__ */ React.createElement(React.Fragment, null, children);
342
+ return /* @__PURE__ */ jsx2(Fragment, { children });
341
343
  }
342
344
 
343
345
  // src/components/ChatUserList/ChatUserList.tsx
@@ -387,7 +389,7 @@ import { TextSelection as TextSelection2 } from "@tiptap/pm/state";
387
389
  import { TextSelection as TextSelection3 } from "@tiptap/pm/state";
388
390
  import { Selection, TextSelection as TextSelection4 } from "@tiptap/pm/state";
389
391
  import { Fragment as Fragment2 } from "@tiptap/pm/model";
390
- import { DOMParser, Fragment, Node as ProseMirrorNode, Schema } from "@tiptap/pm/model";
392
+ import { DOMParser, Fragment as Fragment3, Node as ProseMirrorNode, Schema } from "@tiptap/pm/model";
391
393
  import { Selection as Selection2 } from "@tiptap/pm/state";
392
394
  import { ReplaceAroundStep, ReplaceStep } from "@tiptap/pm/transform";
393
395
  import {
@@ -423,7 +425,7 @@ import { TextSelection as TextSelection5 } from "@tiptap/pm/state";
423
425
  import { sinkListItem as originalSinkListItem } from "@tiptap/pm/schema-list";
424
426
  import { NodeSelection as NodeSelection3, TextSelection as TextSelection6 } from "@tiptap/pm/state";
425
427
  import { canSplit } from "@tiptap/pm/transform";
426
- import { Fragment as Fragment3, Slice } from "@tiptap/pm/model";
428
+ import { Fragment as Fragment32, Slice } from "@tiptap/pm/model";
427
429
  import { TextSelection as TextSelection7 } from "@tiptap/pm/state";
428
430
  import { canSplit as canSplit2 } from "@tiptap/pm/transform";
429
431
  import { TextSelection as TextSelection8 } from "@tiptap/pm/state";
@@ -1013,7 +1015,7 @@ function elementFromString(value) {
1013
1015
  return removeWhitespaces(html);
1014
1016
  }
1015
1017
  function createNodeFromContent(content, schema, options) {
1016
- if (content instanceof ProseMirrorNode || content instanceof Fragment) {
1018
+ if (content instanceof ProseMirrorNode || content instanceof Fragment3) {
1017
1019
  return content;
1018
1020
  }
1019
1021
  options = {
@@ -1027,7 +1029,7 @@ function createNodeFromContent(content, schema, options) {
1027
1029
  try {
1028
1030
  const isArrayContent = Array.isArray(content) && content.length > 0;
1029
1031
  if (isArrayContent) {
1030
- return Fragment.fromArray(content.map((item) => schema.nodeFromJSON(item)));
1032
+ return Fragment3.fromArray(content.map((item) => schema.nodeFromJSON(item)));
1031
1033
  }
1032
1034
  const node = schema.nodeFromJSON(content);
1033
1035
  if (options.errorOnInvalidContent) {
@@ -2451,10 +2453,10 @@ var splitListItem = (typeOrName, overrideAttrs = {}) => ({ tr, state, dispatch,
2451
2453
  return false;
2452
2454
  }
2453
2455
  if (dispatch) {
2454
- let wrap = Fragment3.empty;
2456
+ let wrap = Fragment32.empty;
2455
2457
  const depthBefore = $from.index(-1) ? 1 : $from.index(-2) ? 2 : 3;
2456
2458
  for (let d = $from.depth - depthBefore; d >= $from.depth - 3; d -= 1) {
2457
- wrap = Fragment3.from($from.node(d).copy(wrap));
2459
+ wrap = Fragment32.from($from.node(d).copy(wrap));
2458
2460
  }
2459
2461
  const depthAfter = (
2460
2462
  // eslint-disable-next-line no-nested-ternary
@@ -2465,7 +2467,7 @@ var splitListItem = (typeOrName, overrideAttrs = {}) => ({ tr, state, dispatch,
2465
2467
  ...overrideAttrs
2466
2468
  };
2467
2469
  const nextType2 = ((_a = type.contentMatch.defaultType) == null ? void 0 : _a.createAndFill(newNextTypeAttributes2)) || void 0;
2468
- wrap = wrap.append(Fragment3.from(type.createAndFill(null, nextType2) || void 0));
2470
+ wrap = wrap.append(Fragment32.from(type.createAndFill(null, nextType2) || void 0));
2469
2471
  const start = $from.before($from.depth - (depthBefore - 1));
2470
2472
  tr.replace(start, $from.after(-depthAfter), new Slice(wrap, 4 - depthBefore, 0));
2471
2473
  let sel = -1;
@@ -4749,6 +4751,7 @@ import {
4749
4751
  } from "react";
4750
4752
  import { Popover, Skeleton } from "@mantine/core";
4751
4753
  import data from "@emoji-mart/data";
4754
+ import { jsx as jsx3, jsxs } from "react/jsx-runtime";
4752
4755
  var EmojiPicker = lazy(() => import("@emoji-mart/react"));
4753
4756
  function EmojiPickerPopover({
4754
4757
  onSelect,
@@ -4758,7 +4761,7 @@ function EmojiPickerPopover({
4758
4761
  position = "bottom-start"
4759
4762
  }) {
4760
4763
  const [opened, setOpened] = useState(false);
4761
- return /* @__PURE__ */ React.createElement(
4764
+ return /* @__PURE__ */ jsxs(
4762
4765
  Popover,
4763
4766
  {
4764
4767
  opened,
@@ -4769,32 +4772,34 @@ function EmojiPickerPopover({
4769
4772
  withArrow: true,
4770
4773
  shadow: "md",
4771
4774
  trapFocus: false,
4772
- closeOnEscape: true
4773
- },
4774
- /* @__PURE__ */ React.createElement(Popover.Target, null, cloneElement(action, {
4775
- onClick: (e) => {
4776
- action.props?.onClick?.(e);
4777
- setOpened((prev) => !prev);
4778
- }
4779
- })),
4780
- /* @__PURE__ */ React.createElement(Popover.Dropdown, { p: 0 }, /* @__PURE__ */ React.createElement(
4781
- Suspense,
4782
- {
4783
- fallback: /* @__PURE__ */ React.createElement("div", { style: { padding: 12, width: 320 } }, /* @__PURE__ */ React.createElement(Skeleton, { height: 280, radius: "md" }))
4784
- },
4785
- /* @__PURE__ */ React.createElement(
4786
- EmojiPicker,
4787
- {
4788
- previewPosition: "none",
4789
- theme: "light",
4790
- data,
4791
- onEmojiSelect: (emoji) => {
4792
- onSelect(emoji.native);
4793
- setOpened(false);
4775
+ closeOnEscape: true,
4776
+ children: [
4777
+ /* @__PURE__ */ jsx3(Popover.Target, { children: cloneElement(action, {
4778
+ onClick: (e) => {
4779
+ action.props?.onClick?.(e);
4780
+ setOpened((prev) => !prev);
4794
4781
  }
4795
- }
4796
- )
4797
- ))
4782
+ }) }),
4783
+ /* @__PURE__ */ jsx3(Popover.Dropdown, { p: 0, children: /* @__PURE__ */ jsx3(
4784
+ Suspense,
4785
+ {
4786
+ fallback: /* @__PURE__ */ jsx3("div", { style: { padding: 12, width: 320 }, children: /* @__PURE__ */ jsx3(Skeleton, { height: 280, radius: "md" }) }),
4787
+ children: /* @__PURE__ */ jsx3(
4788
+ EmojiPicker,
4789
+ {
4790
+ previewPosition: "none",
4791
+ theme: "light",
4792
+ data,
4793
+ onEmojiSelect: (emoji) => {
4794
+ onSelect(emoji.native);
4795
+ setOpened(false);
4796
+ }
4797
+ }
4798
+ )
4799
+ }
4800
+ ) })
4801
+ ]
4802
+ }
4798
4803
  );
4799
4804
  }
4800
4805
 
@@ -4841,6 +4846,7 @@ var EmojiNode = Node3.create({
4841
4846
  });
4842
4847
 
4843
4848
  // src/components/RichTextEditor/RichTextEditor.tsx
4849
+ import { Fragment as Fragment6, jsx as jsx4, jsxs as jsxs2 } from "react/jsx-runtime";
4844
4850
  function CustomRichTextEditor({
4845
4851
  content = "",
4846
4852
  maxLength = 3e3,
@@ -4883,118 +4889,149 @@ function CustomRichTextEditor({
4883
4889
  editor.commands.focus();
4884
4890
  setCharCount(0);
4885
4891
  };
4886
- return /* @__PURE__ */ React.createElement(React.Fragment, null, /* @__PURE__ */ React.createElement(
4892
+ return /* @__PURE__ */ jsx4(Fragment6, { children: /* @__PURE__ */ jsxs2(
4887
4893
  RichTextEditor,
4888
4894
  {
4889
4895
  editor,
4890
4896
  w: "100%",
4891
- className: RichTextEditor_default.richTextEditorContainer
4892
- },
4893
- /* @__PURE__ */ React.createElement(RichTextEditor.Content, null),
4894
- /* @__PURE__ */ React.createElement(RichTextEditor.Toolbar, { sticky: true, stickyOffset: "var(--docs-header-height)" }, /* @__PURE__ */ React.createElement("div", { className: RichTextEditor_default.mainActionContainer }, /* @__PURE__ */ React.createElement(
4895
- EmojiPickerPopover,
4896
- {
4897
- onSelect: (emoji) => {
4898
- editor?.chain().focus().insertContent({
4899
- type: "emoji",
4900
- attrs: {
4901
- emoji
4902
- }
4903
- }).run();
4904
- },
4905
- action: /* @__PURE__ */ React.createElement(
4906
- ActionIcon,
4897
+ className: RichTextEditor_default.richTextEditorContainer,
4898
+ children: [
4899
+ /* @__PURE__ */ jsx4(RichTextEditor.Content, {}),
4900
+ /* @__PURE__ */ jsxs2(RichTextEditor.Toolbar, { sticky: true, stickyOffset: "var(--docs-header-height)", children: [
4901
+ /* @__PURE__ */ jsxs2("div", { className: RichTextEditor_default.mainActionContainer, children: [
4902
+ /* @__PURE__ */ jsx4(
4903
+ EmojiPickerPopover,
4904
+ {
4905
+ onSelect: (emoji) => {
4906
+ editor?.chain().focus().insertContent({
4907
+ type: "emoji",
4908
+ attrs: {
4909
+ emoji
4910
+ }
4911
+ }).run();
4912
+ },
4913
+ action: /* @__PURE__ */ jsx4(
4914
+ ActionIcon,
4915
+ {
4916
+ radius: "lg",
4917
+ variant: "subtle",
4918
+ "aria-label": "add",
4919
+ color: "#333",
4920
+ className: RichTextEditor_default.mainActionEmojiIcon,
4921
+ children: /* @__PURE__ */ jsx4(AddReaction_default, {})
4922
+ }
4923
+ )
4924
+ }
4925
+ ),
4926
+ /* @__PURE__ */ jsx4(
4927
+ ActionIcon,
4928
+ {
4929
+ radius: "lg",
4930
+ variant: "subtle",
4931
+ "aria-label": "text_format",
4932
+ color: "#333",
4933
+ className: RichTextEditor_default.mainTextFormatIcon,
4934
+ onClick: () => setShowToolbar((prev) => !prev),
4935
+ children: /* @__PURE__ */ jsx4(TextFormat_default, {})
4936
+ }
4937
+ ),
4938
+ /* @__PURE__ */ jsx4(
4939
+ ActionIcon,
4940
+ {
4941
+ radius: "lg",
4942
+ variant: "filled",
4943
+ "aria-label": "send",
4944
+ className: RichTextEditor_default.mainSendMsgIcon,
4945
+ onClick: () => handleSubmitMsg(),
4946
+ children: /* @__PURE__ */ jsx4(IconSend, { size: 18 })
4947
+ }
4948
+ )
4949
+ ] }),
4950
+ showToolbar && /* @__PURE__ */ jsxs2(Fragment6, { children: [
4951
+ /* @__PURE__ */ jsxs2(RichTextEditor.ControlsGroup, { children: [
4952
+ /* @__PURE__ */ jsx4(RichTextEditor.Bold, {}),
4953
+ /* @__PURE__ */ jsx4(RichTextEditor.Italic, {}),
4954
+ /* @__PURE__ */ jsx4(RichTextEditor.Underline, {}),
4955
+ /* @__PURE__ */ jsx4(RichTextEditor.Strikethrough, {}),
4956
+ /* @__PURE__ */ jsx4(RichTextEditor.Code, {}),
4957
+ /* @__PURE__ */ jsx4(RichTextEditor.Highlight, {})
4958
+ ] }),
4959
+ /* @__PURE__ */ jsxs2(
4960
+ RichTextEditor.ControlsGroup,
4961
+ {
4962
+ className: RichTextEditor_default.secondRichTextEditorToolBar,
4963
+ children: [
4964
+ /* @__PURE__ */ jsx4(RichTextEditor.BulletList, {}),
4965
+ /* @__PURE__ */ jsx4(RichTextEditor.OrderedList, {}),
4966
+ /* @__PURE__ */ jsxs2(Menu, { trigger: "hover", openDelay: 200, children: [
4967
+ /* @__PURE__ */ jsx4(Menu.Target, { children: /* @__PURE__ */ jsx4(
4968
+ ActionIcon,
4969
+ {
4970
+ variant: "outline",
4971
+ size: "md",
4972
+ color: "#495057",
4973
+ className: RichTextEditor_default.customToolActionItem,
4974
+ children: /* @__PURE__ */ jsx4(IconAlignLeft, { size: 16, stroke: 1.5 })
4975
+ }
4976
+ ) }),
4977
+ /* @__PURE__ */ jsxs2(Menu.Dropdown, { children: [
4978
+ /* @__PURE__ */ jsx4(
4979
+ Menu.Item,
4980
+ {
4981
+ onClick: () => editor?.chain().focus().setTextAlign("left").run(),
4982
+ children: /* @__PURE__ */ jsx4(IconAlignLeft, { size: 14 })
4983
+ }
4984
+ ),
4985
+ /* @__PURE__ */ jsx4(
4986
+ Menu.Item,
4987
+ {
4988
+ onClick: () => editor?.chain().focus().setTextAlign("center").run(),
4989
+ children: /* @__PURE__ */ jsx4(IconAlignCenter, { size: 14 })
4990
+ }
4991
+ ),
4992
+ /* @__PURE__ */ jsx4(
4993
+ Menu.Item,
4994
+ {
4995
+ onClick: () => editor?.chain().focus().setTextAlign("right").run(),
4996
+ children: /* @__PURE__ */ jsx4(IconAlignRight, { size: 14 })
4997
+ }
4998
+ )
4999
+ ] })
5000
+ ] }),
5001
+ /* @__PURE__ */ jsx4(RichTextEditor.Link, {})
5002
+ ]
5003
+ }
5004
+ ),
5005
+ /* @__PURE__ */ jsx4(
5006
+ RichTextEditor.ControlsGroup,
5007
+ {
5008
+ className: RichTextEditor_default.secondRichTextEditorToolBar,
5009
+ children: /* @__PURE__ */ jsx4(RichTextEditor.ClearFormatting, {})
5010
+ }
5011
+ )
5012
+ ] })
5013
+ ] }),
5014
+ showWarning && /* @__PURE__ */ jsxs2(
5015
+ "div",
4907
5016
  {
4908
- radius: "lg",
4909
- variant: "subtle",
4910
- "aria-label": "add",
4911
- color: "#333",
4912
- className: RichTextEditor_default.mainActionEmojiIcon
4913
- },
4914
- /* @__PURE__ */ React.createElement(AddReaction_default, null)
5017
+ style: {
5018
+ textAlign: "right",
5019
+ color: "red",
5020
+ fontSize: 12,
5021
+ marginTop: 4
5022
+ },
5023
+ children: [
5024
+ "Character limit reached (",
5025
+ charCount,
5026
+ "/",
5027
+ maxLength,
5028
+ ")"
5029
+ ]
5030
+ }
4915
5031
  )
4916
- }
4917
- ), /* @__PURE__ */ React.createElement(
4918
- ActionIcon,
4919
- {
4920
- radius: "lg",
4921
- variant: "subtle",
4922
- "aria-label": "text_format",
4923
- color: "#333",
4924
- className: RichTextEditor_default.mainTextFormatIcon,
4925
- onClick: () => setShowToolbar((prev) => !prev)
4926
- },
4927
- /* @__PURE__ */ React.createElement(TextFormat_default, null)
4928
- ), /* @__PURE__ */ React.createElement(
4929
- ActionIcon,
4930
- {
4931
- radius: "lg",
4932
- variant: "filled",
4933
- "aria-label": "send",
4934
- className: RichTextEditor_default.mainSendMsgIcon,
4935
- onClick: () => handleSubmitMsg()
4936
- },
4937
- /* @__PURE__ */ React.createElement(IconSend, { size: 18 })
4938
- )), showToolbar && /* @__PURE__ */ React.createElement(React.Fragment, null, /* @__PURE__ */ React.createElement(RichTextEditor.ControlsGroup, null, /* @__PURE__ */ React.createElement(RichTextEditor.Bold, null), /* @__PURE__ */ React.createElement(RichTextEditor.Italic, null), /* @__PURE__ */ React.createElement(RichTextEditor.Underline, null), /* @__PURE__ */ React.createElement(RichTextEditor.Strikethrough, null), /* @__PURE__ */ React.createElement(RichTextEditor.Code, null), /* @__PURE__ */ React.createElement(RichTextEditor.Highlight, null)), /* @__PURE__ */ React.createElement(
4939
- RichTextEditor.ControlsGroup,
4940
- {
4941
- className: RichTextEditor_default.secondRichTextEditorToolBar
4942
- },
4943
- /* @__PURE__ */ React.createElement(RichTextEditor.BulletList, null),
4944
- /* @__PURE__ */ React.createElement(RichTextEditor.OrderedList, null),
4945
- /* @__PURE__ */ React.createElement(Menu, { trigger: "hover", openDelay: 200 }, /* @__PURE__ */ React.createElement(Menu.Target, null, /* @__PURE__ */ React.createElement(
4946
- ActionIcon,
4947
- {
4948
- variant: "outline",
4949
- size: "md",
4950
- color: "#495057",
4951
- className: RichTextEditor_default.customToolActionItem
4952
- },
4953
- /* @__PURE__ */ React.createElement(IconAlignLeft, { size: 16, stroke: 1.5 })
4954
- )), /* @__PURE__ */ React.createElement(Menu.Dropdown, null, /* @__PURE__ */ React.createElement(
4955
- Menu.Item,
4956
- {
4957
- onClick: () => editor?.chain().focus().setTextAlign("left").run()
4958
- },
4959
- /* @__PURE__ */ React.createElement(IconAlignLeft, { size: 14 })
4960
- ), /* @__PURE__ */ React.createElement(
4961
- Menu.Item,
4962
- {
4963
- onClick: () => editor?.chain().focus().setTextAlign("center").run()
4964
- },
4965
- /* @__PURE__ */ React.createElement(IconAlignCenter, { size: 14 })
4966
- ), /* @__PURE__ */ React.createElement(
4967
- Menu.Item,
4968
- {
4969
- onClick: () => editor?.chain().focus().setTextAlign("right").run()
4970
- },
4971
- /* @__PURE__ */ React.createElement(IconAlignRight, { size: 14 })
4972
- ))),
4973
- /* @__PURE__ */ React.createElement(RichTextEditor.Link, null)
4974
- ), /* @__PURE__ */ React.createElement(
4975
- RichTextEditor.ControlsGroup,
4976
- {
4977
- className: RichTextEditor_default.secondRichTextEditorToolBar
4978
- },
4979
- /* @__PURE__ */ React.createElement(RichTextEditor.ClearFormatting, null)
4980
- ))),
4981
- showWarning && /* @__PURE__ */ React.createElement(
4982
- "div",
4983
- {
4984
- style: {
4985
- textAlign: "right",
4986
- color: "red",
4987
- fontSize: 12,
4988
- marginTop: 4
4989
- }
4990
- },
4991
- "Character limit reached (",
4992
- charCount,
4993
- "/",
4994
- maxLength,
4995
- ")"
4996
- )
4997
- ));
5032
+ ]
5033
+ }
5034
+ ) });
4998
5035
  }
4999
5036
 
5000
5037
  // src/components/ChatUserList/ChatUserMessage.tsx
@@ -5003,7 +5040,8 @@ import { useEffect as useEffect4, useState as useState4 } from "react";
5003
5040
  import DOMPurify from "dompurify";
5004
5041
 
5005
5042
  // src/components/VirtualizedList/ChatScrollContainer.tsx
5006
- import React2, { useRef, useEffect as useEffect2 } from "react";
5043
+ import { useRef, useEffect as useEffect2 } from "react";
5044
+ import { jsx as jsx5 } from "react/jsx-runtime";
5007
5045
  function ChatScrollContainer({
5008
5046
  data: data2,
5009
5047
  renderItem,
@@ -5052,7 +5090,7 @@ function ChatScrollContainer({
5052
5090
  isFetchingRef.current = false;
5053
5091
  }, 0);
5054
5092
  };
5055
- return /* @__PURE__ */ React2.createElement(
5093
+ return /* @__PURE__ */ jsx5(
5056
5094
  "div",
5057
5095
  {
5058
5096
  ref: containerRef,
@@ -5062,9 +5100,9 @@ function ChatScrollContainer({
5062
5100
  height: "100%",
5063
5101
  display: "flex",
5064
5102
  flexDirection: "column"
5065
- }
5066
- },
5067
- data2.map((item, index) => /* @__PURE__ */ React2.createElement("div", { key: item?.id || index }, renderItem(item, index)))
5103
+ },
5104
+ children: data2.map((item, index) => /* @__PURE__ */ jsx5("div", { children: renderItem(item, index) }, item?.id || index))
5105
+ }
5068
5106
  );
5069
5107
  }
5070
5108
 
@@ -5081,6 +5119,7 @@ import {
5081
5119
  var UserProfileDrawer_default = {};
5082
5120
 
5083
5121
  // src/components/UserProfile/UserProfileDrawer.tsx
5122
+ import { Fragment as Fragment7, jsx as jsx6, jsxs as jsxs3 } from "react/jsx-runtime";
5084
5123
  function UserProfileDrawer({
5085
5124
  opened,
5086
5125
  onClose,
@@ -5098,51 +5137,74 @@ function UserProfileDrawer({
5098
5137
  setTimeout(onClose, 250);
5099
5138
  };
5100
5139
  if (!opened && !visible) return null;
5101
- return /* @__PURE__ */ React.createElement(React.Fragment, null, /* @__PURE__ */ React.createElement("div", { className: UserProfileDrawer_default.overlay, onClick: handleClose }, /* @__PURE__ */ React.createElement(
5102
- "div",
5103
- {
5104
- className: `${UserProfileDrawer_default.drawer} ${visible ? UserProfileDrawer_default.open : UserProfileDrawer_default.close}`,
5105
- onClick: (e) => e.stopPropagation()
5106
- },
5107
- /* @__PURE__ */ React.createElement("div", { className: UserProfileDrawer_default.header }, /* @__PURE__ */ React.createElement("div", { className: UserProfileDrawer_default.backBtn, onClick: handleClose }, /* @__PURE__ */ React.createElement(IconArrowLeft, { size: 20 })), /* @__PURE__ */ React.createElement(Text, { fw: 600 }, "Contact info")),
5108
- /* @__PURE__ */ React.createElement("div", { className: UserProfileDrawer_default.profileSection }, /* @__PURE__ */ React.createElement(
5109
- Avatar,
5110
- {
5111
- src: user?.avatar,
5112
- size: 150,
5113
- radius: "xl",
5114
- style: { cursor: "pointer" },
5115
- onClick: () => user?.avatar ? setShowImagePreview(true) : {}
5116
- }
5117
- ), /* @__PURE__ */ React.createElement(Text, { fw: 700, size: "lg", mt: "sm" }, user?.displayName), /* @__PURE__ */ React.createElement(Text, { size: "sm", c: "dimmed" }, "@", user?.username)),
5118
- /* @__PURE__ */ React.createElement("div", { className: UserProfileDrawer_default.actions }, /* @__PURE__ */ React.createElement(
5140
+ return /* @__PURE__ */ jsxs3(Fragment7, { children: [
5141
+ /* @__PURE__ */ jsx6("div", { className: UserProfileDrawer_default.overlay, onClick: handleClose, children: /* @__PURE__ */ jsxs3(
5119
5142
  "div",
5120
5143
  {
5121
- className: `${UserProfileDrawer_default.item} ${UserProfileDrawer_default.itemDanger}`,
5122
- onClick: onDeleteMessages
5123
- },
5124
- /* @__PURE__ */ React.createElement(IconTrash, { size: 18 }),
5125
- /* @__PURE__ */ React.createElement("span", null, "Delete all messages")
5126
- ), /* @__PURE__ */ React.createElement(
5144
+ className: `${UserProfileDrawer_default.drawer} ${visible ? UserProfileDrawer_default.open : UserProfileDrawer_default.close}`,
5145
+ onClick: (e) => e.stopPropagation(),
5146
+ children: [
5147
+ /* @__PURE__ */ jsxs3("div", { className: UserProfileDrawer_default.header, children: [
5148
+ /* @__PURE__ */ jsx6("div", { className: UserProfileDrawer_default.backBtn, onClick: handleClose, children: /* @__PURE__ */ jsx6(IconArrowLeft, { size: 20 }) }),
5149
+ /* @__PURE__ */ jsx6(Text, { fw: 600, children: "Contact info" })
5150
+ ] }),
5151
+ /* @__PURE__ */ jsxs3("div", { className: UserProfileDrawer_default.profileSection, children: [
5152
+ /* @__PURE__ */ jsx6(
5153
+ Avatar,
5154
+ {
5155
+ src: user?.avatar,
5156
+ size: 150,
5157
+ radius: "xl",
5158
+ style: { cursor: "pointer" },
5159
+ onClick: () => user?.avatar ? setShowImagePreview(true) : {}
5160
+ }
5161
+ ),
5162
+ /* @__PURE__ */ jsx6(Text, { fw: 700, size: "lg", mt: "sm", children: user?.displayName }),
5163
+ /* @__PURE__ */ jsxs3(Text, { size: "sm", c: "dimmed", children: [
5164
+ "@",
5165
+ user?.username
5166
+ ] })
5167
+ ] }),
5168
+ /* @__PURE__ */ jsxs3("div", { className: UserProfileDrawer_default.actions, children: [
5169
+ /* @__PURE__ */ jsxs3(
5170
+ "div",
5171
+ {
5172
+ className: `${UserProfileDrawer_default.item} ${UserProfileDrawer_default.itemDanger}`,
5173
+ onClick: onDeleteMessages,
5174
+ children: [
5175
+ /* @__PURE__ */ jsx6(IconTrash, { size: 18 }),
5176
+ /* @__PURE__ */ jsx6("span", { children: "Delete all messages" })
5177
+ ]
5178
+ }
5179
+ ),
5180
+ /* @__PURE__ */ jsxs3(
5181
+ "div",
5182
+ {
5183
+ className: `${UserProfileDrawer_default.item} ${UserProfileDrawer_default.itemDanger}`,
5184
+ onClick: onBlock,
5185
+ children: [
5186
+ /* @__PURE__ */ jsx6(IconBan, { size: 18 }),
5187
+ /* @__PURE__ */ jsx6("span", { children: "Block" })
5188
+ ]
5189
+ }
5190
+ )
5191
+ ] })
5192
+ ]
5193
+ }
5194
+ ) }),
5195
+ showImagePreview && /* @__PURE__ */ jsx6(
5127
5196
  "div",
5128
5197
  {
5129
- className: `${UserProfileDrawer_default.item} ${UserProfileDrawer_default.itemDanger}`,
5130
- onClick: onBlock
5131
- },
5132
- /* @__PURE__ */ React.createElement(IconBan, { size: 18 }),
5133
- /* @__PURE__ */ React.createElement("span", null, "Block")
5134
- ))
5135
- )), showImagePreview && /* @__PURE__ */ React.createElement(
5136
- "div",
5137
- {
5138
- className: UserProfileDrawer_default.imagePreview,
5139
- onClick: () => setShowImagePreview(false)
5140
- },
5141
- /* @__PURE__ */ React.createElement("img", { src: user?.avatar, alt: "profile" })
5142
- ));
5198
+ className: UserProfileDrawer_default.imagePreview,
5199
+ onClick: () => setShowImagePreview(false),
5200
+ children: /* @__PURE__ */ jsx6("img", { src: user?.avatar, alt: "profile" })
5201
+ }
5202
+ )
5203
+ ] });
5143
5204
  }
5144
5205
 
5145
5206
  // src/components/ChatUserList/ChatUserMessage.tsx
5207
+ import { Fragment as Fragment8, jsx as jsx7, jsxs as jsxs4 } from "react/jsx-runtime";
5146
5208
  function ChatUserMessage({
5147
5209
  chatId,
5148
5210
  enableChat,
@@ -5289,102 +5351,126 @@ function ChatUserMessage({
5289
5351
  deleteMessagesByChatId({ chatId, userId: senderDetails?.userId })
5290
5352
  );
5291
5353
  };
5292
- return /* @__PURE__ */ React.createElement("div", { className: ChatUserList_default.mainArea }, /* @__PURE__ */ React.createElement("div", { className: ChatUserList_default.chatHeader }, receiverDetails && /* @__PURE__ */ React.createElement(React.Fragment, null, /* @__PURE__ */ React.createElement(
5293
- "div",
5294
- {
5295
- className: ChatUserList_default.receiverInfo,
5296
- onClick: () => setShowUserInfo(true)
5297
- },
5298
- receiverDetails?.avatar ? /* @__PURE__ */ React.createElement(Avatar2, { src: receiverDetails.avatar, size: 36, radius: "xl" }) : /* @__PURE__ */ React.createElement(
5299
- Avatar2,
5300
- {
5301
- key: receiverDetails?.displayName || receiverDetails?.username,
5302
- name: receiverDetails?.displayName || receiverDetails?.username,
5303
- color: "initials"
5304
- }
5305
- ),
5306
- /* @__PURE__ */ React.createElement(Text2, { fw: 600, size: "md" }, receiverDetails?.displayName || receiverDetails?.username)
5307
- ), /* @__PURE__ */ React.createElement(Menu2, { shadow: "md", width: 200, position: "bottom-end" }, /* @__PURE__ */ React.createElement(Menu2.Target, null, /* @__PURE__ */ React.createElement(IconDotsVertical, { size: 20, style: { cursor: "pointer" } })), /* @__PURE__ */ React.createElement(Menu2.Dropdown, null, /* @__PURE__ */ React.createElement(
5308
- Menu2.Item,
5309
- {
5310
- color: "red",
5311
- leftSection: /* @__PURE__ */ React.createElement(IconTrash2, { size: 16 }),
5312
- onClick: handleDeleteMessages
5313
- },
5314
- "Delete all messages"
5315
- ), /* @__PURE__ */ React.createElement(Menu2.Item, { color: "red", leftSection: /* @__PURE__ */ React.createElement(IconBan2, { size: 16 }) }, "Block"))))), /* @__PURE__ */ React.createElement("div", { className: ChatUserList_default.messageArea }, isEmpty ? /* @__PURE__ */ React.createElement("div", { className: ChatUserList_default.emptyState }, /* @__PURE__ */ React.createElement("div", { className: ChatUserList_default.encryptionMinimal }, /* @__PURE__ */ React.createElement(IconLock, { size: 20, stroke: 1.8 }), /* @__PURE__ */ React.createElement(Text2, { className: ChatUserList_default.encryptionText, size: "md" }, "End-to-end encrypted"))) : /* @__PURE__ */ React.createElement(
5316
- ChatScrollContainer,
5317
- {
5318
- data: messages,
5319
- hasMore: messageList?.hasMore,
5320
- loadMore: handleLoadOlderMessages,
5321
- scrollToBottomTrigger: scrollTrigger,
5322
- renderItem: (item, index) => {
5323
- const isOutgoing = item?.sender === senderDetails?.userId;
5324
- const currentDate = new Date(item?.createdAt);
5325
- const prevItem = messages[index - 1];
5326
- const showDate = index === 0 || new Date(prevItem?.createdAt).toDateString() !== currentDate.toDateString();
5327
- const today = /* @__PURE__ */ new Date();
5328
- const yesterday = /* @__PURE__ */ new Date();
5329
- yesterday.setDate(today.getDate() - 1);
5330
- const isToday = currentDate.toDateString() === today.toDateString();
5331
- const isYesterday = currentDate.toDateString() === yesterday.toDateString();
5332
- let formattedDate = "";
5333
- if (isToday) {
5334
- formattedDate = "Today";
5335
- } else if (isYesterday) {
5336
- formattedDate = "Yesterday";
5337
- } else {
5338
- formattedDate = currentDate.toLocaleDateString(void 0, {
5339
- weekday: "short",
5340
- month: "short",
5341
- day: "numeric"
5342
- });
5354
+ return /* @__PURE__ */ jsxs4("div", { className: ChatUserList_default.mainArea, children: [
5355
+ /* @__PURE__ */ jsx7("div", { className: ChatUserList_default.chatHeader, children: receiverDetails && /* @__PURE__ */ jsxs4(Fragment8, { children: [
5356
+ /* @__PURE__ */ jsxs4(
5357
+ "div",
5358
+ {
5359
+ className: ChatUserList_default.receiverInfo,
5360
+ onClick: () => setShowUserInfo(true),
5361
+ children: [
5362
+ receiverDetails?.avatar ? /* @__PURE__ */ jsx7(Avatar2, { src: receiverDetails.avatar, size: 36, radius: "xl" }) : /* @__PURE__ */ jsx7(
5363
+ Avatar2,
5364
+ {
5365
+ name: receiverDetails?.displayName || receiverDetails?.username,
5366
+ color: "initials"
5367
+ },
5368
+ receiverDetails?.displayName || receiverDetails?.username
5369
+ ),
5370
+ /* @__PURE__ */ jsx7(Text2, { fw: 600, size: "md", children: receiverDetails?.displayName || receiverDetails?.username })
5371
+ ]
5343
5372
  }
5344
- const time = currentDate.toLocaleTimeString([], {
5345
- hour: "2-digit",
5346
- minute: "2-digit",
5347
- hour12: false
5348
- });
5349
- return /* @__PURE__ */ React.createElement("div", { key: item?.id + "_" + index }, showDate && /* @__PURE__ */ React.createElement("div", { className: ChatUserList_default.dateSeparator }, formattedDate), /* @__PURE__ */ React.createElement(
5350
- "div",
5351
- {
5352
- style: {
5353
- borderRadius: item.sender === senderDetails?.userId ? "16px 16px 1px 16px" : "16px 16px 16px 1px"
5354
- },
5355
- className: `${ChatUserList_default.messageBubble} ${isOutgoing ? ChatUserList_default.outgoing : ChatUserList_default.incoming}`
5356
- },
5357
- /* @__PURE__ */ React.createElement(
5358
- "div",
5373
+ ),
5374
+ /* @__PURE__ */ jsxs4(Menu2, { shadow: "md", width: 200, position: "bottom-end", children: [
5375
+ /* @__PURE__ */ jsx7(Menu2.Target, { children: /* @__PURE__ */ jsx7(IconDotsVertical, { size: 20, style: { cursor: "pointer" } }) }),
5376
+ /* @__PURE__ */ jsxs4(Menu2.Dropdown, { children: [
5377
+ /* @__PURE__ */ jsx7(
5378
+ Menu2.Item,
5359
5379
  {
5360
- className: ChatUserList_default.messageContent,
5361
- dangerouslySetInnerHTML: {
5362
- __html: DOMPurify.sanitize(item?.message)
5363
- }
5380
+ color: "red",
5381
+ leftSection: /* @__PURE__ */ jsx7(IconTrash2, { size: 16 }),
5382
+ onClick: handleDeleteMessages,
5383
+ children: "Delete all messages"
5364
5384
  }
5365
5385
  ),
5366
- /* @__PURE__ */ React.createElement("div", { className: ChatUserList_default.messageTime }, time)
5367
- ));
5386
+ /* @__PURE__ */ jsx7(Menu2.Item, { color: "red", leftSection: /* @__PURE__ */ jsx7(IconBan2, { size: 16 }), children: "Block" })
5387
+ ] })
5388
+ ] })
5389
+ ] }) }),
5390
+ /* @__PURE__ */ jsx7("div", { className: ChatUserList_default.messageArea, children: isEmpty ? /* @__PURE__ */ jsx7("div", { className: ChatUserList_default.emptyState, children: /* @__PURE__ */ jsxs4("div", { className: ChatUserList_default.encryptionMinimal, children: [
5391
+ /* @__PURE__ */ jsx7(IconLock, { size: 20, stroke: 1.8 }),
5392
+ /* @__PURE__ */ jsx7(Text2, { className: ChatUserList_default.encryptionText, size: "md", children: "End-to-end encrypted" })
5393
+ ] }) }) : /* @__PURE__ */ jsx7(
5394
+ ChatScrollContainer,
5395
+ {
5396
+ data: messages,
5397
+ hasMore: messageList?.hasMore,
5398
+ loadMore: handleLoadOlderMessages,
5399
+ scrollToBottomTrigger: scrollTrigger,
5400
+ renderItem: (item, index) => {
5401
+ const isOutgoing = item?.sender === senderDetails?.userId;
5402
+ const currentDate = new Date(item?.createdAt);
5403
+ const prevItem = messages[index - 1];
5404
+ const showDate = index === 0 || new Date(prevItem?.createdAt).toDateString() !== currentDate.toDateString();
5405
+ const today = /* @__PURE__ */ new Date();
5406
+ const yesterday = /* @__PURE__ */ new Date();
5407
+ yesterday.setDate(today.getDate() - 1);
5408
+ const isToday = currentDate.toDateString() === today.toDateString();
5409
+ const isYesterday = currentDate.toDateString() === yesterday.toDateString();
5410
+ let formattedDate = "";
5411
+ if (isToday) {
5412
+ formattedDate = "Today";
5413
+ } else if (isYesterday) {
5414
+ formattedDate = "Yesterday";
5415
+ } else {
5416
+ formattedDate = currentDate.toLocaleDateString(void 0, {
5417
+ weekday: "short",
5418
+ month: "short",
5419
+ day: "numeric"
5420
+ });
5421
+ }
5422
+ const time = currentDate.toLocaleTimeString([], {
5423
+ hour: "2-digit",
5424
+ minute: "2-digit",
5425
+ hour12: false
5426
+ });
5427
+ return /* @__PURE__ */ jsxs4("div", { children: [
5428
+ showDate && /* @__PURE__ */ jsx7("div", { className: ChatUserList_default.dateSeparator, children: formattedDate }),
5429
+ /* @__PURE__ */ jsxs4(
5430
+ "div",
5431
+ {
5432
+ style: {
5433
+ borderRadius: item.sender === senderDetails?.userId ? "16px 16px 1px 16px" : "16px 16px 16px 1px"
5434
+ },
5435
+ className: `${ChatUserList_default.messageBubble} ${isOutgoing ? ChatUserList_default.outgoing : ChatUserList_default.incoming}`,
5436
+ children: [
5437
+ /* @__PURE__ */ jsx7(
5438
+ "div",
5439
+ {
5440
+ className: ChatUserList_default.messageContent,
5441
+ dangerouslySetInnerHTML: {
5442
+ __html: DOMPurify.sanitize(item?.message)
5443
+ }
5444
+ }
5445
+ ),
5446
+ /* @__PURE__ */ jsx7("div", { className: ChatUserList_default.messageTime, children: time })
5447
+ ]
5448
+ }
5449
+ )
5450
+ ] }, item?.id + "_" + index);
5451
+ }
5368
5452
  }
5369
- }
5370
- )), (chatId || enableChat) && /* @__PURE__ */ React.createElement("div", { className: ChatUserList_default.inputBar }, /* @__PURE__ */ React.createElement(CustomRichTextEditor, { onSubmit: handleSendMessage })), /* @__PURE__ */ React.createElement(
5371
- UserProfileDrawer,
5372
- {
5373
- opened: showUserInfo,
5374
- onClose: () => setShowUserInfo(false),
5375
- user: {
5376
- avatar: receiverDetails?.avatar,
5377
- username: receiverDetails?.username,
5378
- displayName: receiverDetails?.displayName
5379
- },
5380
- onDeleteMessages: () => {
5381
- handleDeleteMessages();
5382
- },
5383
- onBlock: () => {
5384
- console.log("block user");
5453
+ ) }),
5454
+ (chatId || enableChat) && /* @__PURE__ */ jsx7("div", { className: ChatUserList_default.inputBar, children: /* @__PURE__ */ jsx7(CustomRichTextEditor, { onSubmit: handleSendMessage }) }),
5455
+ /* @__PURE__ */ jsx7(
5456
+ UserProfileDrawer,
5457
+ {
5458
+ opened: showUserInfo,
5459
+ onClose: () => setShowUserInfo(false),
5460
+ user: {
5461
+ avatar: receiverDetails?.avatar,
5462
+ username: receiverDetails?.username,
5463
+ displayName: receiverDetails?.displayName
5464
+ },
5465
+ onDeleteMessages: () => {
5466
+ handleDeleteMessages();
5467
+ },
5468
+ onBlock: () => {
5469
+ console.log("block user");
5470
+ }
5385
5471
  }
5386
- }
5387
- ));
5472
+ )
5473
+ ] });
5388
5474
  }
5389
5475
 
5390
5476
  // src/components/ChatUserList/ChatUserList.tsx
@@ -6043,6 +6129,7 @@ var users_list_default = [
6043
6129
 
6044
6130
  // src/components/VirtualizedList/index.tsx
6045
6131
  import { Virtuoso } from "react-virtuoso";
6132
+ import { jsx as jsx8 } from "react/jsx-runtime";
6046
6133
  function VirtualizedList({
6047
6134
  data: data2,
6048
6135
  itemContent,
@@ -6051,7 +6138,7 @@ function VirtualizedList({
6051
6138
  endReached,
6052
6139
  ...props
6053
6140
  }) {
6054
- return /* @__PURE__ */ React.createElement(
6141
+ return /* @__PURE__ */ jsx8(
6055
6142
  Virtuoso,
6056
6143
  {
6057
6144
  style: { height },
@@ -6094,6 +6181,7 @@ var getChatDisplayTime = (timestamp) => {
6094
6181
  };
6095
6182
 
6096
6183
  // src/components/ChatUserList/ChatUserList.tsx
6184
+ import { jsx as jsx9, jsxs as jsxs5 } from "react/jsx-runtime";
6097
6185
  function ChatUserList() {
6098
6186
  const [opened, { open, close }] = useDisclosure(false);
6099
6187
  const dispatch = useDispatch2();
@@ -6265,155 +6353,201 @@ function ChatUserList() {
6265
6353
  label: user.displayName || user.username,
6266
6354
  user
6267
6355
  }));
6268
- return /* @__PURE__ */ React.createElement("div", { className: ChatUserList_default.chatWrapper }, /* @__PURE__ */ React.createElement(
6269
- Modal,
6270
- {
6271
- opened,
6272
- onClose: () => {
6273
- close();
6274
- setReceiverSearchValue("");
6275
- },
6276
- title: "Find User",
6277
- centered: true,
6278
- withCloseButton: true
6279
- },
6280
- /* @__PURE__ */ React.createElement(
6281
- Autocomplete,
6356
+ return /* @__PURE__ */ jsxs5("div", { className: ChatUserList_default.chatWrapper, children: [
6357
+ /* @__PURE__ */ jsxs5(
6358
+ Modal,
6282
6359
  {
6283
- mb: 12,
6284
- label: "Sender",
6285
- placeholder: "Type username...",
6286
- limit: 20,
6287
- data: userOptions,
6288
- value: senderSearchValue,
6289
- onChange: setSenderSearchValue,
6290
- onOptionSubmit: (val) => {
6291
- const selected = users_list_default.find((u) => u.username === val);
6292
- if (selected) {
6293
- setSenderSearchValue("");
6294
- setSenderUserDetails(selected);
6295
- }
6296
- },
6297
- renderOption: ({ option }) => {
6298
- const user = option.user;
6299
- return /* @__PURE__ */ React.createElement(Group, { gap: "sm" }, /* @__PURE__ */ React.createElement(Avatar3, { src: user.avatar, size: 36, radius: "xl" }), /* @__PURE__ */ React.createElement("div", null, /* @__PURE__ */ React.createElement(Text3, { size: "sm" }, user.displayName || user.username), user.displayName && /* @__PURE__ */ React.createElement(Text3, { size: "xs", opacity: 0.5 }, "@", user.username)));
6300
- }
6301
- }
6302
- ),
6303
- /* @__PURE__ */ React.createElement(
6304
- Autocomplete,
6305
- {
6306
- mb: 12,
6307
- label: "Receiver",
6308
- placeholder: "Type username...",
6309
- limit: 20,
6310
- data: userOptions,
6311
- value: receiverSearchValue,
6312
- onChange: setReceiverSearchValue,
6313
- onOptionSubmit: (val) => {
6314
- const selected = users_list_default.find((u) => u.username === val);
6315
- if (selected) {
6316
- setReceiverSearchValue("");
6317
- setReceiverUserDetails(selected);
6318
- }
6360
+ opened,
6361
+ onClose: () => {
6362
+ close();
6363
+ setReceiverSearchValue("");
6319
6364
  },
6320
- renderOption: ({ option }) => {
6321
- const user = option.user;
6322
- return /* @__PURE__ */ React.createElement(Group, { gap: "sm" }, /* @__PURE__ */ React.createElement(Avatar3, { src: user.avatar, size: 36, radius: "xl" }), /* @__PURE__ */ React.createElement("div", null, /* @__PURE__ */ React.createElement(Text3, { size: "sm" }, user.displayName || user.username), user.displayName && /* @__PURE__ */ React.createElement(Text3, { size: "xs", opacity: 0.5 }, "@", user.username)));
6323
- }
6324
- }
6325
- ),
6326
- /* @__PURE__ */ React.createElement(
6327
- Button,
6328
- {
6329
- fullWidth: true,
6330
- onClick: handleStartChat,
6331
- disabled: !Boolean(receiverUserDetails?.username)
6332
- },
6333
- "Start Chat"
6334
- )
6335
- ), /* @__PURE__ */ React.createElement("div", { className: ChatUserList_default.chatContainer }, /* @__PURE__ */ React.createElement("div", { className: ChatUserList_default.sidebar }, /* @__PURE__ */ React.createElement("div", { className: ChatUserList_default.sidebarTop }, /* @__PURE__ */ React.createElement("div", { className: ChatUserList_default.topBar }, /* @__PURE__ */ React.createElement(Text3, { size: "lg", fw: 600 }, "MrChat"), /* @__PURE__ */ React.createElement("div", { className: ChatUserList_default.topActions }, /* @__PURE__ */ React.createElement(
6336
- ActionIcon2,
6337
- {
6338
- variant: "subtle",
6339
- onClick: () => {
6340
- setReceiverUserDetails(null);
6341
- open();
6342
- },
6343
- radius: "lg"
6344
- },
6345
- /* @__PURE__ */ React.createElement(IconPlus, { size: 20, stroke: 3 })
6346
- )))), /* @__PURE__ */ React.createElement(Text3, { size: "xs", c: "dimmed", mt: "sm", mb: "xs", ml: 12 }, "All Messages"), /* @__PURE__ */ React.createElement("div", { className: ChatUserList_default.scrollWrapper }, /* @__PURE__ */ React.createElement(
6347
- VirtualizedList,
6348
- {
6349
- data: chatList?.rows?.data || [],
6350
- endReached: loadMoreChats,
6351
- itemContent: (_, item) => {
6352
- const isActive = item.chatId === chatId;
6353
- return /* @__PURE__ */ React.createElement(
6354
- "div",
6355
- {
6356
- className: `${ChatUserList_default.chatItem} ${isActive ? ChatUserList_default.activeChatItem : ""}`,
6357
- onClick: () => {
6358
- if (isActive) return;
6359
- handleJoinChat(item);
6360
- }
6361
- },
6362
- item.avatar ? /* @__PURE__ */ React.createElement(Avatar3, { src: item.avatar, size: 36, radius: "xl" }) : /* @__PURE__ */ React.createElement(
6363
- Avatar3,
6365
+ title: "Find User",
6366
+ centered: true,
6367
+ withCloseButton: true,
6368
+ children: [
6369
+ /* @__PURE__ */ jsx9(
6370
+ Autocomplete,
6364
6371
  {
6365
- key: item.displayName || item.username,
6366
- name: item.displayName || item.username,
6367
- color: "initials"
6372
+ mb: 12,
6373
+ label: "Sender",
6374
+ placeholder: "Type username...",
6375
+ limit: 20,
6376
+ data: userOptions,
6377
+ value: senderSearchValue,
6378
+ onChange: setSenderSearchValue,
6379
+ onOptionSubmit: (val) => {
6380
+ const selected = users_list_default.find((u) => u.username === val);
6381
+ if (selected) {
6382
+ setSenderSearchValue("");
6383
+ setSenderUserDetails(selected);
6384
+ }
6385
+ },
6386
+ renderOption: ({ option }) => {
6387
+ const user = option.user;
6388
+ return /* @__PURE__ */ jsxs5(Group, { gap: "sm", children: [
6389
+ /* @__PURE__ */ jsx9(Avatar3, { src: user.avatar, size: 36, radius: "xl" }),
6390
+ /* @__PURE__ */ jsxs5("div", { children: [
6391
+ /* @__PURE__ */ jsx9(Text3, { size: "sm", children: user.displayName || user.username }),
6392
+ user.displayName && /* @__PURE__ */ jsxs5(Text3, { size: "xs", opacity: 0.5, children: [
6393
+ "@",
6394
+ user.username
6395
+ ] })
6396
+ ] })
6397
+ ] });
6398
+ }
6368
6399
  }
6369
6400
  ),
6370
- /* @__PURE__ */ React.createElement("div", { className: ChatUserList_default.chatInfo }, /* @__PURE__ */ React.createElement(Text3, { className: ChatUserList_default.chatLabelItem, truncate: true }, item.displayName || item.username), item.unreadCount > 0 && /* @__PURE__ */ React.createElement("div", { className: ChatUserList_default.unreadBadge }, item.unreadCount || 10), /* @__PURE__ */ React.createElement("div", { className: ChatUserList_default.messagePreview }, /* @__PURE__ */ React.createElement(
6371
- Text3,
6401
+ /* @__PURE__ */ jsx9(
6402
+ Autocomplete,
6372
6403
  {
6373
- truncate: true,
6374
- size: "xs",
6375
- c: "dimmed",
6376
- style: { maxWidth: 150 },
6377
- className: ChatUserList_default.messagePreviewContent
6378
- },
6379
- stripHtml(DOMPurify2.sanitize(item.message))
6380
- ), /* @__PURE__ */ React.createElement(
6381
- Text3,
6404
+ mb: 12,
6405
+ label: "Receiver",
6406
+ placeholder: "Type username...",
6407
+ limit: 20,
6408
+ data: userOptions,
6409
+ value: receiverSearchValue,
6410
+ onChange: setReceiverSearchValue,
6411
+ onOptionSubmit: (val) => {
6412
+ const selected = users_list_default.find((u) => u.username === val);
6413
+ if (selected) {
6414
+ setReceiverSearchValue("");
6415
+ setReceiverUserDetails(selected);
6416
+ }
6417
+ },
6418
+ renderOption: ({ option }) => {
6419
+ const user = option.user;
6420
+ return /* @__PURE__ */ jsxs5(Group, { gap: "sm", children: [
6421
+ /* @__PURE__ */ jsx9(Avatar3, { src: user.avatar, size: 36, radius: "xl" }),
6422
+ /* @__PURE__ */ jsxs5("div", { children: [
6423
+ /* @__PURE__ */ jsx9(Text3, { size: "sm", children: user.displayName || user.username }),
6424
+ user.displayName && /* @__PURE__ */ jsxs5(Text3, { size: "xs", opacity: 0.5, children: [
6425
+ "@",
6426
+ user.username
6427
+ ] })
6428
+ ] })
6429
+ ] });
6430
+ }
6431
+ }
6432
+ ),
6433
+ /* @__PURE__ */ jsx9(
6434
+ Button,
6382
6435
  {
6383
- size: "xs",
6384
- c: "dimmed",
6385
- className: ChatUserList_default.messagePreviewTime
6386
- },
6387
- getChatDisplayTime(item.updatedAt || item.createdAt)
6388
- )))
6389
- );
6390
- }
6391
- }
6392
- ))), /* @__PURE__ */ React.createElement(
6393
- ChatUserMessage,
6394
- {
6395
- chatId,
6396
- enableChat,
6397
- senderDetails,
6398
- receiverDetails,
6399
- onChatInitialized: (data2) => {
6400
- handleJoinChat({
6401
- chatId: data2.chatId,
6402
- userId: receiverDetails?.userId,
6403
- username: receiverDetails?.username,
6404
- displayName: receiverDetails?.displayName,
6405
- avatar: receiverDetails?.avatar
6406
- });
6436
+ fullWidth: true,
6437
+ onClick: handleStartChat,
6438
+ disabled: !Boolean(receiverUserDetails?.username),
6439
+ children: "Start Chat"
6440
+ }
6441
+ )
6442
+ ]
6407
6443
  }
6408
- }
6409
- )));
6444
+ ),
6445
+ /* @__PURE__ */ jsxs5("div", { className: ChatUserList_default.chatContainer, children: [
6446
+ /* @__PURE__ */ jsxs5("div", { className: ChatUserList_default.sidebar, children: [
6447
+ /* @__PURE__ */ jsx9("div", { className: ChatUserList_default.sidebarTop, children: /* @__PURE__ */ jsxs5("div", { className: ChatUserList_default.topBar, children: [
6448
+ /* @__PURE__ */ jsx9(Text3, { size: "lg", fw: 600, children: "MrChat" }),
6449
+ /* @__PURE__ */ jsx9("div", { className: ChatUserList_default.topActions, children: /* @__PURE__ */ jsx9(
6450
+ ActionIcon2,
6451
+ {
6452
+ variant: "subtle",
6453
+ onClick: () => {
6454
+ setReceiverUserDetails(null);
6455
+ open();
6456
+ },
6457
+ radius: "lg",
6458
+ children: /* @__PURE__ */ jsx9(IconPlus, { size: 20, stroke: 3 })
6459
+ }
6460
+ ) })
6461
+ ] }) }),
6462
+ /* @__PURE__ */ jsx9(Text3, { size: "xs", c: "dimmed", mt: "sm", mb: "xs", ml: 12, children: "All Messages" }),
6463
+ /* @__PURE__ */ jsx9("div", { className: ChatUserList_default.scrollWrapper, children: /* @__PURE__ */ jsx9(
6464
+ VirtualizedList,
6465
+ {
6466
+ data: chatList?.rows?.data || [],
6467
+ endReached: loadMoreChats,
6468
+ itemContent: (_, item) => {
6469
+ const isActive = item.chatId === chatId;
6470
+ return /* @__PURE__ */ jsxs5(
6471
+ "div",
6472
+ {
6473
+ className: `${ChatUserList_default.chatItem} ${isActive ? ChatUserList_default.activeChatItem : ""}`,
6474
+ onClick: () => {
6475
+ if (isActive) return;
6476
+ handleJoinChat(item);
6477
+ },
6478
+ children: [
6479
+ item.avatar ? /* @__PURE__ */ jsx9(Avatar3, { src: item.avatar, size: 36, radius: "xl" }) : /* @__PURE__ */ jsx9(
6480
+ Avatar3,
6481
+ {
6482
+ name: item.displayName || item.username,
6483
+ color: "initials"
6484
+ },
6485
+ item.displayName || item.username
6486
+ ),
6487
+ /* @__PURE__ */ jsxs5("div", { className: ChatUserList_default.chatInfo, children: [
6488
+ /* @__PURE__ */ jsx9(Text3, { className: ChatUserList_default.chatLabelItem, truncate: true, children: item.displayName || item.username }),
6489
+ item.unreadCount > 0 && /* @__PURE__ */ jsx9("div", { className: ChatUserList_default.unreadBadge, children: item.unreadCount || 10 }),
6490
+ /* @__PURE__ */ jsxs5("div", { className: ChatUserList_default.messagePreview, children: [
6491
+ /* @__PURE__ */ jsx9(
6492
+ Text3,
6493
+ {
6494
+ truncate: true,
6495
+ size: "xs",
6496
+ c: "dimmed",
6497
+ style: { maxWidth: 150 },
6498
+ className: ChatUserList_default.messagePreviewContent,
6499
+ children: stripHtml(DOMPurify2.sanitize(item.message))
6500
+ }
6501
+ ),
6502
+ /* @__PURE__ */ jsx9(
6503
+ Text3,
6504
+ {
6505
+ size: "xs",
6506
+ c: "dimmed",
6507
+ className: ChatUserList_default.messagePreviewTime,
6508
+ children: getChatDisplayTime(item.updatedAt || item.createdAt)
6509
+ }
6510
+ )
6511
+ ] })
6512
+ ] })
6513
+ ]
6514
+ }
6515
+ );
6516
+ }
6517
+ }
6518
+ ) })
6519
+ ] }),
6520
+ /* @__PURE__ */ jsx9(
6521
+ ChatUserMessage,
6522
+ {
6523
+ chatId,
6524
+ enableChat,
6525
+ senderDetails,
6526
+ receiverDetails,
6527
+ onChatInitialized: (data2) => {
6528
+ handleJoinChat({
6529
+ chatId: data2.chatId,
6530
+ userId: receiverDetails?.userId,
6531
+ username: receiverDetails?.username,
6532
+ displayName: receiverDetails?.displayName,
6533
+ avatar: receiverDetails?.avatar
6534
+ });
6535
+ }
6536
+ }
6537
+ )
6538
+ ] })
6539
+ ] });
6410
6540
  }
6411
6541
 
6412
6542
  // src/components/MrChat/index.tsx
6543
+ import { jsx as jsx10, jsxs as jsxs6 } from "react/jsx-runtime";
6413
6544
  function MrChat(props) {
6414
6545
  const [primaryColor] = useState6("customBrand");
6415
6546
  const theme = createAppTheme(primaryColor);
6416
- return /* @__PURE__ */ React.createElement(ReduxProvider, null, /* @__PURE__ */ React.createElement(SocketProvider, null, /* @__PURE__ */ React.createElement(MantineProvider, { defaultColorScheme: "light", theme }, /* @__PURE__ */ React.createElement(Notifications, null), /* @__PURE__ */ React.createElement(ChatUserList, { ...props }))));
6547
+ return /* @__PURE__ */ jsx10(ReduxProvider, { children: /* @__PURE__ */ jsx10(SocketProvider, { children: /* @__PURE__ */ jsxs6(MantineProvider, { defaultColorScheme: "light", theme, children: [
6548
+ /* @__PURE__ */ jsx10(Notifications, {}),
6549
+ /* @__PURE__ */ jsx10(ChatUserList, { ...props })
6550
+ ] }) }) });
6417
6551
  }
6418
6552
  export {
6419
6553
  MrChat