@pubuduth-aplicy/chat-ui 2.1.87 → 2.1.89

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@pubuduth-aplicy/chat-ui",
3
- "version": "2.1.87",
3
+ "version": "2.1.89",
4
4
  "description": "This template provides a minimal setup to get React working in Vite with HMR and some ESLint rules.",
5
5
  "license": "ISC",
6
6
  "author": "",
Binary file
@@ -26,6 +26,10 @@ export const Chat = () => {
26
26
  data: {
27
27
  messageIds: [message._id],
28
28
  chatId: message.conversationId, // make sure this is sent from backend
29
+ senderRole: message.senderRole,
30
+ receiverRole: message.receiverRole,
31
+ senderId: message.senderId,
32
+ receiverId: message.receiverId,
29
33
  },
30
34
  });
31
35
 
@@ -1,12 +1,12 @@
1
1
  /* eslint-disable @typescript-eslint/no-explicit-any */
2
- import { ChevronLeft, MessageSquare } from "lucide-react";
3
- import { FiArrowLeft } from "react-icons/fi";
2
+ import { ChevronLeft, MessageCircle } from "lucide-react";
4
3
  import { useEffect } from "react";
5
4
  import MessageInput from "./MessageInput";
6
5
  import Messages from "./Messages";
7
6
  import useChatUIStore from "../../stores/Zustant";
8
7
  import { useChatContext } from "../../providers/ChatProvider";
9
8
  import { getChatConfig } from "../../Chat.config";
9
+ import defaultProfilePicture from "../../assets/pngegg.png";
10
10
 
11
11
  const MessageContainer = () => {
12
12
  const { userId } = useChatContext();
@@ -90,13 +90,13 @@ const MessageContainer = () => {
90
90
  </button>
91
91
  {selectedConversation.type === "service" ? (
92
92
  <div className="w-10 h-10 rounded-full bg-gray-200 flex items-center justify-center">
93
- <MessageSquare size={24} className="text-gray-600" />
93
+ <MessageCircle size={24} className="text-gray-600" />
94
94
  </div>
95
95
  ) : (
96
96
  <img
97
97
  className="chatMessageContainerInnerImg"
98
98
  alt="Profile"
99
- src={participant?.profilePicture}
99
+ src={participant?.profilePicture || defaultProfilePicture}
100
100
  />
101
101
  )}
102
102
  <div className="chatMessageContainerOutter">
@@ -106,7 +106,8 @@ const MessageInput = () => {
106
106
  data: {
107
107
  chatId: selectedConversation._id,
108
108
  userId,
109
- reciverId: otherParticipant?._id,
109
+ receiverId: otherParticipant?._id,
110
+ receiverRole: role === "customer" ? "provider" : "customer",
110
111
  },
111
112
  });
112
113
  }
@@ -119,7 +120,8 @@ const MessageInput = () => {
119
120
  data: {
120
121
  chatId: selectedConversation._id,
121
122
  userId,
122
- reciverId: otherParticipant?._id,
123
+ receiverId: otherParticipant?._id,
124
+ receiverRole: role === "customer" ? "provider" : "customer",
123
125
  },
124
126
  });
125
127
  }
@@ -383,6 +385,8 @@ const MessageInput = () => {
383
385
  attachments: successfulUploads,
384
386
  senderId: userId,
385
387
  receiverId: otherParticipant._id,
388
+ receiverRole: role === "customer" ? "provider" : "customer",
389
+ senderRole: role,
386
390
  },
387
391
  });
388
392
  },
@@ -5,6 +5,7 @@ import { useChatContext } from "../../providers/ChatProvider";
5
5
  import useChatUIStore from "../../stores/Zustant";
6
6
  import { ConversationProps } from "../../types/type";
7
7
  import { getChatConfig } from "../../Chat.config";
8
+ import defaultProfilePicture from "../../assets/pngegg.png";
8
9
 
9
10
  const Conversation = ({ conversation }: ConversationProps) => {
10
11
  const {
@@ -39,6 +40,7 @@ const Conversation = ({ conversation }: ConversationProps) => {
39
40
  senderId: participant?._id,
40
41
  receiverId: userId,
41
42
  receiverRole: role,
43
+ senderRole: role === "customer" ? "provider" : "customer",
42
44
  chatId: conversation._id,
43
45
  },
44
46
  };
@@ -102,7 +104,7 @@ const Conversation = ({ conversation }: ConversationProps) => {
102
104
  <>
103
105
  <img
104
106
  className="w-10 h-10 rounded-full"
105
- src={participant?.profilePicture}
107
+ src={participant?.profilePicture || defaultProfilePicture}
106
108
  alt="User Avatar"
107
109
  />
108
110
  <span