@pubuduth-aplicy/chat-ui 2.1.59 → 2.1.60

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.59",
3
+ "version": "2.1.60",
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": "",
@@ -0,0 +1,17 @@
1
+ const SystemNotice = () => (
2
+ <div style={{
3
+ padding: "1rem",
4
+ border: "1px solid #ddd",
5
+ borderRadius: "8px",
6
+ margin: "1rem",
7
+ backgroundColor: "#f9f9f9",
8
+ fontSize: "14px",
9
+ }}>
10
+ <strong style={{ display: "block", marginBottom: "0.5rem", textAlign:"center", fontSize:"smaller" }}>🛡 WE HAVE YOUR BACK</strong>
11
+ <p style={{fontSize:"x-small"}}>For added safety and your protection, keep payments and communications within Gigmosaic.
12
+ {/* <a href="#">Learn more</a> */}
13
+ </p>
14
+ </div>
15
+ );
16
+ export default SystemNotice;
17
+
@@ -83,13 +83,13 @@ const MessageInput = () => {
83
83
  // Check for email
84
84
  const emailRegex = /\b[A-Z0-9._%+-]+@[A-Z0-9.-]+\.[A-Z]{2,}\b/i;
85
85
  if (emailRegex.test(text)) {
86
- return "Email addresses are not allowed.";
86
+ return "To protect your account, make sure not to share any personal or sensitive information.";
87
87
  }
88
88
 
89
89
  // Check for phone number (very basic)
90
90
  const phoneRegex = /(\+?\d{1,4}[\s-]?)?(\(?\d{3}\)?[\s-]?)?\d{3}[\s-]?\d{4}/;
91
91
  if (phoneRegex.test(text)) {
92
- return "Phone numbers are not allowed.";
92
+ return "To protect your account, make sure not to share any personal or sensitive information.";
93
93
  }
94
94
 
95
95
  // // Check for bad words
@@ -108,6 +108,8 @@ const MessageInput = () => {
108
108
 
109
109
  if (validationError) {
110
110
  setInputError(validationError);
111
+ setMessage(newValue);
112
+ setMessage1(newValue);
111
113
  } else {
112
114
  setInputError(null);
113
115
  setMessage(newValue);
@@ -7,6 +7,7 @@ import { useInfiniteQuery } from "@tanstack/react-query";
7
7
  import { fetchMessages } from "../../service/messageService";
8
8
  import { useInView } from "react-intersection-observer";
9
9
  import Loader from "../Loader";
10
+ import SystemNotice from "../common/SystemNotice";
10
11
 
11
12
  const Messages = () => {
12
13
  const { selectedConversation, setMessages, messages } = useChatUIStore();
@@ -164,6 +165,7 @@ const Messages = () => {
164
165
  className="chatMessages"
165
166
  style={{ overflowY: "auto", height: "100%", position: "relative" }}
166
167
  >
168
+ <SystemNotice/>
167
169
  <div ref={ref} className="my-8">
168
170
  {isFetchingNextPage ? <Loader /> : null}
169
171
  </div>
@@ -83,9 +83,17 @@ const Conversation = ({ conversation, lastIdx }: ConversationProps) => {
83
83
  </span>
84
84
  </div>
85
85
  <p className="conversation-message">
86
- {conversation.lastMessage.message.length > 50
86
+ {conversation.lastMessage.message.length > 50
87
87
  ? conversation.lastMessage.message.slice(0, 50) + "..."
88
- : conversation.lastMessage.message}
88
+ :conversation.lastMessage.media.length > 0 ?
89
+ <div style={{display:"flex",alignItems:"center", gap:"5px"}}>
90
+ <svg xmlns="http://www.w3.org/2000/svg" width="18" height="18" viewBox="0 0 24 24" fill="none" stroke="currentColor" strokeWidth="2" strokeLinecap="round" strokeLinejoin="round">
91
+ <path d="M21.44 11.05l-9.19 9.19a6 6 0 0 1-8.49-8.49l9.19-9.19a4 4 0 0 1 5.66 5.66l-9.2 9.19a2 2 0 0 1-2.83-2.83l8.49-8.48"></path>
92
+ </svg>
93
+ attachment
94
+ </div>
95
+
96
+ :conversation.lastMessage.message}
89
97
  </p>
90
98
  </div>
91
99
  </div>
package/src/types/type.ts CHANGED
@@ -51,6 +51,7 @@ export interface ConversationProps {
51
51
  _id: string;
52
52
  senderId: string;
53
53
  message: string;
54
+ media:string[];
54
55
  chatId: string;
55
56
  createdAt: string;
56
57
  updatedAt: string;