@droppii-org/chat-sdk 0.0.4 → 0.0.6

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.
Files changed (153) hide show
  1. package/dist/assets/droppiiFontSelection.json +14521 -0
  2. package/dist/components/ChatBubble.d.ts +9 -1
  3. package/dist/components/ChatBubble.d.ts.map +1 -1
  4. package/dist/components/ChatBubble.js +23 -15
  5. package/dist/components/chat-bubble/ChatBubble.d.ts +9 -0
  6. package/dist/components/chat-bubble/ChatBubble.d.ts.map +1 -0
  7. package/dist/components/chat-bubble/ChatBubble.js +27 -0
  8. package/dist/components/conversation/DeskConversationList.d.ts +8 -0
  9. package/dist/components/conversation/DeskConversationList.d.ts.map +1 -0
  10. package/dist/components/conversation/DeskConversationList.js +168 -0
  11. package/dist/components/icon/index.d.ts +11 -0
  12. package/dist/components/icon/index.d.ts.map +1 -0
  13. package/dist/components/icon/index.js +18 -0
  14. package/dist/components/message/MessageList.d.ts +10 -0
  15. package/dist/components/message/MessageList.d.ts.map +1 -0
  16. package/dist/components/message/MessageList.js +91 -0
  17. package/dist/components/session/AssignedSessionFilter.d.ts +7 -0
  18. package/dist/components/session/AssignedSessionFilter.d.ts.map +1 -0
  19. package/dist/components/session/AssignedSessionFilter.js +90 -0
  20. package/dist/context/ChatContext.d.ts +4 -71
  21. package/dist/context/ChatContext.d.ts.map +1 -1
  22. package/dist/context/ChatContext.js +33 -344
  23. package/dist/hooks/conversation/useConversation.d.ts +11 -0
  24. package/dist/hooks/conversation/useConversation.d.ts.map +1 -0
  25. package/dist/hooks/conversation/useConversation.js +51 -0
  26. package/dist/hooks/message/useMessage.d.ts +9 -0
  27. package/dist/hooks/message/useMessage.d.ts.map +1 -0
  28. package/dist/hooks/message/useMessage.js +46 -0
  29. package/dist/hooks/message/useSendMessage.d.ts +10 -0
  30. package/dist/hooks/message/useSendMessage.d.ts.map +1 -0
  31. package/dist/hooks/message/useSendMessage.js +42 -0
  32. package/dist/index.d.ts +9 -26
  33. package/dist/index.d.ts.map +1 -1
  34. package/dist/index.js +10 -27
  35. package/dist/screens/desk-message/index.d.ts +3 -0
  36. package/dist/screens/desk-message/index.d.ts.map +1 -0
  37. package/dist/screens/desk-message/index.js +14 -0
  38. package/dist/types/chat.d.ts +6 -36
  39. package/dist/types/chat.d.ts.map +1 -1
  40. package/dist/types/index.d.ts +0 -85
  41. package/dist/types/index.d.ts.map +1 -1
  42. package/dist/types/index.js +1 -1
  43. package/dist/types/sdk.d.ts +1 -0
  44. package/dist/types/sdk.d.ts.map +1 -0
  45. package/dist/types/sdk.js +1 -0
  46. package/package.json +19 -3
  47. package/dist/components/AutoScrollAnchor.d.ts +0 -2
  48. package/dist/components/AutoScrollAnchor.d.ts.map +0 -1
  49. package/dist/components/AutoScrollAnchor.js +0 -12
  50. package/dist/components/AutoScrollAnchor.jsx +0 -11
  51. package/dist/components/ChatBubble.jsx +0 -80
  52. package/dist/components/ChatHeader.d.ts +0 -8
  53. package/dist/components/ChatHeader.d.ts.map +0 -1
  54. package/dist/components/ChatHeader.js +0 -32
  55. package/dist/components/ChatHeader.jsx +0 -72
  56. package/dist/components/ChatInput.d.ts +0 -3
  57. package/dist/components/ChatInput.d.ts.map +0 -1
  58. package/dist/components/ChatInput.js +0 -379
  59. package/dist/components/ChatInput.jsx +0 -444
  60. package/dist/components/ChatInputDemo.d.ts +0 -2
  61. package/dist/components/ChatInputDemo.d.ts.map +0 -1
  62. package/dist/components/ChatInputDemo.js +0 -38
  63. package/dist/components/ChatInputDemo.jsx +0 -53
  64. package/dist/components/ChatInputWithCustomIcon.d.ts +0 -16
  65. package/dist/components/ChatInputWithCustomIcon.d.ts.map +0 -1
  66. package/dist/components/ChatInputWithCustomIcon.js +0 -85
  67. package/dist/components/ChatInputWithCustomIcon.jsx +0 -167
  68. package/dist/components/ChatLayout.d.ts +0 -6
  69. package/dist/components/ChatLayout.d.ts.map +0 -1
  70. package/dist/components/ChatLayout.js +0 -48
  71. package/dist/components/ChatLayout.jsx +0 -122
  72. package/dist/components/ConversationItem.d.ts +0 -9
  73. package/dist/components/ConversationItem.d.ts.map +0 -1
  74. package/dist/components/ConversationItem.js +0 -27
  75. package/dist/components/ConversationItem.jsx +0 -51
  76. package/dist/components/ConversationList.d.ts +0 -8
  77. package/dist/components/ConversationList.d.ts.map +0 -1
  78. package/dist/components/ConversationList.js +0 -11
  79. package/dist/components/ConversationList.jsx +0 -22
  80. package/dist/components/DateDivider.d.ts +0 -7
  81. package/dist/components/DateDivider.d.ts.map +0 -1
  82. package/dist/components/DateDivider.js +0 -27
  83. package/dist/components/DateDivider.jsx +0 -28
  84. package/dist/components/EmojiPicker.d.ts +0 -4
  85. package/dist/components/EmojiPicker.d.ts.map +0 -1
  86. package/dist/components/EmojiPicker.js +0 -191
  87. package/dist/components/EmojiPicker.jsx +0 -229
  88. package/dist/components/ImageLightbox.d.ts +0 -8
  89. package/dist/components/ImageLightbox.d.ts.map +0 -1
  90. package/dist/components/ImageLightbox.js +0 -8
  91. package/dist/components/ImageLightbox.jsx +0 -16
  92. package/dist/components/ImagePreviewModal.d.ts +0 -12
  93. package/dist/components/ImagePreviewModal.d.ts.map +0 -1
  94. package/dist/components/ImagePreviewModal.js +0 -55
  95. package/dist/components/ImagePreviewModal.jsx +0 -84
  96. package/dist/components/MessageItem.d.ts +0 -3
  97. package/dist/components/MessageItem.d.ts.map +0 -1
  98. package/dist/components/MessageItem.js +0 -38
  99. package/dist/components/MessageItem.jsx +0 -99
  100. package/dist/components/MessageItemDemo.d.ts +0 -2
  101. package/dist/components/MessageItemDemo.d.ts.map +0 -1
  102. package/dist/components/MessageItemDemo.js +0 -166
  103. package/dist/components/MessageItemDemo.jsx +0 -179
  104. package/dist/components/MessageList.d.ts +0 -15
  105. package/dist/components/MessageList.d.ts.map +0 -1
  106. package/dist/components/MessageList.js +0 -243
  107. package/dist/components/MessageList.jsx +0 -306
  108. package/dist/components/MessageListDemo.d.ts +0 -2
  109. package/dist/components/MessageListDemo.d.ts.map +0 -1
  110. package/dist/components/MessageListDemo.js +0 -165
  111. package/dist/components/MessageListDemo.jsx +0 -183
  112. package/dist/components/StickerPicker.d.ts +0 -4
  113. package/dist/components/StickerPicker.d.ts.map +0 -1
  114. package/dist/components/StickerPicker.js +0 -68
  115. package/dist/components/StickerPicker.jsx +0 -106
  116. package/dist/components/SwipeIndicator.d.ts +0 -9
  117. package/dist/components/SwipeIndicator.d.ts.map +0 -1
  118. package/dist/components/SwipeIndicator.js +0 -24
  119. package/dist/components/SwipeIndicator.jsx +0 -28
  120. package/dist/components/TextFormattingToolbar.d.ts +0 -4
  121. package/dist/components/TextFormattingToolbar.d.ts.map +0 -1
  122. package/dist/components/TextFormattingToolbar.js +0 -29
  123. package/dist/components/TextFormattingToolbar.jsx +0 -52
  124. package/dist/components/TypingIndicator.d.ts +0 -6
  125. package/dist/components/TypingIndicator.d.ts.map +0 -1
  126. package/dist/components/TypingIndicator.js +0 -21
  127. package/dist/components/TypingIndicator.jsx +0 -27
  128. package/dist/components/VoiceWaveIcon.d.ts +0 -7
  129. package/dist/components/VoiceWaveIcon.d.ts.map +0 -1
  130. package/dist/components/VoiceWaveIcon.js +0 -5
  131. package/dist/components/VoiceWaveIcon.jsx +0 -11
  132. package/dist/context/ChatContext.jsx +0 -346
  133. package/dist/hooks/useChat.d.ts +0 -5
  134. package/dist/hooks/useChat.d.ts.map +0 -1
  135. package/dist/hooks/useChat.js +0 -73
  136. package/dist/hooks/useConversationList.d.ts +0 -5
  137. package/dist/hooks/useConversationList.d.ts.map +0 -1
  138. package/dist/hooks/useConversationList.js +0 -9
  139. package/dist/hooks/useMessages.d.ts +0 -5
  140. package/dist/hooks/useMessages.d.ts.map +0 -1
  141. package/dist/hooks/useMessages.js +0 -192
  142. package/dist/hooks/useSocket.d.ts +0 -7
  143. package/dist/hooks/useSocket.d.ts.map +0 -1
  144. package/dist/hooks/useSocket.js +0 -120
  145. package/dist/hooks/useSwipeGesture.d.ts +0 -11
  146. package/dist/hooks/useSwipeGesture.d.ts.map +0 -1
  147. package/dist/hooks/useSwipeGesture.js +0 -54
  148. package/dist/hooks/useTextSelection.d.ts +0 -13
  149. package/dist/hooks/useTextSelection.d.ts.map +0 -1
  150. package/dist/hooks/useTextSelection.js +0 -132
  151. package/dist/hooks/useTyping.d.ts +0 -7
  152. package/dist/hooks/useTyping.d.ts.map +0 -1
  153. package/dist/hooks/useTyping.js +0 -64
@@ -0,0 +1,14 @@
1
+ "use client";
2
+ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
3
+ import { SessionType } from "@openim/wasm-client-sdk";
4
+ import MessageList from "../../components/message/MessageList";
5
+ import DeskConversationList from "../../components/conversation/DeskConversationList";
6
+ import { useConversationDetail } from "src/hooks/conversation/useConversation";
7
+ const DChatDeskMessage = () => {
8
+ const { conversationDetail } = useConversationDetail({
9
+ sourceID: "3408237279",
10
+ sessionType: SessionType.Group,
11
+ });
12
+ return (_jsxs("div", { className: "flex flex-1 flex-row h-screen bg-gray-50", children: [_jsx(DeskConversationList, {}), _jsx(MessageList, { conversationId: "sg_3408237279", conversationData: conversationDetail })] }));
13
+ };
14
+ export default DChatDeskMessage;
@@ -1,39 +1,9 @@
1
- import type React from "react";
2
- export interface ChatInputProps {
3
- onSendMessage?: (message: string) => void;
4
- onEmojiClick?: (emoji: string) => void;
5
- onFileUpload?: (file: File) => void;
6
- onImageUpload?: (file: File) => void;
7
- onContactShare?: () => void;
8
- onVoiceRecord?: () => void;
9
- onVoiceMessage?: () => void;
10
- onQuickReact?: () => void;
11
- placeholder?: string;
12
- disabled?: boolean;
13
- className?: string;
14
- onStickerClick?: (sticker: string) => void;
15
- conversationId?: string;
1
+ import { InitAndLoginConfig, SelfUserInfo } from "@openim/wasm-client-sdk";
2
+ export interface ChatContextType {
3
+ user: SelfUserInfo | null;
16
4
  }
17
- export interface EmojiPickerProps {
18
- onEmojiSelect?: (emoji: string) => void;
19
- onClose?: () => void;
20
- isOpen?: boolean;
21
- ref?: React.Ref<HTMLDivElement>;
22
- style?: React.CSSProperties;
23
- }
24
- export interface StickerPickerProps {
25
- onStickerSelect?: (sticker: string) => void;
26
- onClose?: () => void;
27
- isOpen?: boolean;
28
- ref?: React.Ref<HTMLDivElement>;
29
- style?: React.CSSProperties;
30
- }
31
- export interface TextFormattingToolbarProps {
32
- isOpen: boolean;
33
- onClose: () => void;
34
- onFormatSelect: (format: string) => void;
35
- selectedFormats?: string[];
36
- ref?: React.Ref<HTMLDivElement>;
37
- style?: React.CSSProperties;
5
+ export interface ChatProviderProps {
6
+ children: React.ReactNode;
7
+ config: InitAndLoginConfig;
38
8
  }
39
9
  //# sourceMappingURL=chat.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"chat.d.ts","sourceRoot":"","sources":["../../src/types/chat.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAA;AAE9B,MAAM,WAAW,cAAc;IAC7B,aAAa,CAAC,EAAE,CAAC,OAAO,EAAE,MAAM,KAAK,IAAI,CAAA;IACzC,YAAY,CAAC,EAAE,CAAC,KAAK,EAAE,MAAM,KAAK,IAAI,CAAA;IACtC,YAAY,CAAC,EAAE,CAAC,IAAI,EAAE,IAAI,KAAK,IAAI,CAAA;IACnC,aAAa,CAAC,EAAE,CAAC,IAAI,EAAE,IAAI,KAAK,IAAI,CAAA;IACpC,cAAc,CAAC,EAAE,MAAM,IAAI,CAAA;IAC3B,aAAa,CAAC,EAAE,MAAM,IAAI,CAAA;IAC1B,cAAc,CAAC,EAAE,MAAM,IAAI,CAAA;IAC3B,YAAY,CAAC,EAAE,MAAM,IAAI,CAAA;IACzB,WAAW,CAAC,EAAE,MAAM,CAAA;IACpB,QAAQ,CAAC,EAAE,OAAO,CAAA;IAClB,SAAS,CAAC,EAAE,MAAM,CAAA;IAClB,cAAc,CAAC,EAAE,CAAC,OAAO,EAAE,MAAM,KAAK,IAAI,CAAA;IAC1C,cAAc,CAAC,EAAE,MAAM,CAAA;CACxB;AAED,MAA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1 @@
1
- export type MessageStatus = "sending" | "sent" | "delivered" | "read";
2
- export interface User {
3
- id: string;
4
- name: string;
5
- avatar?: string;
6
- status: "online" | "offline" | "away";
7
- lastSeen?: Date;
8
- }
9
- export interface Message {
10
- id: string;
11
- conversationId: string;
12
- senderId: string;
13
- content: string;
14
- type: "text" | "image" | "file" | "promo";
15
- timestamp: Date;
16
- status: MessageStatus;
17
- attachments?: Attachment[];
18
- promoData?: PromotionalMessageData;
19
- }
20
- export interface Attachment {
21
- id: string;
22
- name: string;
23
- url: string;
24
- type: string;
25
- size: number;
26
- }
27
- export interface Conversation {
28
- id: string;
29
- participants: User[];
30
- lastMessage?: Message;
31
- unreadCount: number;
32
- updatedAt: Date;
33
- type: "direct" | "group";
34
- name?: string;
35
- avatar?: string;
36
- }
37
- export interface TypingStatus {
38
- userId: string;
39
- conversationId: string;
40
- isTyping: boolean;
41
- }
42
- export interface ChatConfig {
43
- userId: string;
44
- token: string;
45
- apiUrl?: string;
46
- wsUrl?: string;
47
- onTokenRefresh?: () => Promise<string>;
48
- }
49
- export interface SocketMessage {
50
- type: "message" | "typing" | "read" | "user_status";
51
- data: any;
52
- }
53
- export type MessageAttachment = {
54
- id: string;
55
- type: "image" | "file";
56
- url: string;
57
- name?: string;
58
- size?: number;
59
- };
60
- export type PromotionalMessageData = {
61
- imageUrl: string;
62
- title: string;
63
- description: string;
64
- buttonText: string;
65
- buttonUrl: string;
66
- };
67
- export type DisplayMessage = {
68
- id: string;
69
- senderId: string;
70
- type: "text" | "media" | "promo";
71
- text?: string;
72
- attachments?: MessageAttachment[];
73
- promoData?: PromotionalMessageData;
74
- createdAt: string;
75
- isMine: boolean;
76
- };
77
- export type MessageItemProps = {
78
- message: DisplayMessage;
79
- isGrouped?: boolean;
80
- onImageClick?: (imageId: string, images: {
81
- id: string;
82
- url: string;
83
- name?: string;
84
- }[]) => void;
85
- };
86
1
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts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AAE,OAAO,CAAA;IACnB,YAAY,CAAC,EAAE,CAAC,OAAO,EAAE,MAAM,EAAE,MAAM,EAAE;QAAE,EAAE,EAAE,MAAM,CAAC;QAAC,GAAG,EAAE,MAAM,CAAC;QAAC,IAAI,CAAC,EAAE,MAAM,CAAA;KAAE,EAAE,KAAK,IAAI,CAAA;CAC/F,CAAA"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/types/index.ts"],"names":[],"mappings":""}
@@ -1 +1 @@
1
- export {};
1
+ "use strict";
@@ -0,0 +1 @@
1
+ //# sourceMappingURL=sdk.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"sdk.d.ts","sourceRoot":"","sources":["../../src/types/sdk.ts"],"names":[],"mappings":""}
@@ -0,0 +1 @@
1
+ "use strict";
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@droppii-org/chat-sdk",
3
- "version": "0.0.4",
3
+ "version": "0.0.6",
4
4
  "description": "Droppii React Chat SDK",
5
5
  "main": "./dist/index.js",
6
6
  "types": "./dist/index.d.ts",
@@ -24,6 +24,14 @@
24
24
  "./types/*": {
25
25
  "import": "./dist/types/*.js",
26
26
  "types": "./dist/types/*.d.ts"
27
+ },
28
+ "./screens/*": {
29
+ "import": "./dist/screens/*.js",
30
+ "types": "./dist/screens/*.d.ts"
31
+ },
32
+ "./assets/*": {
33
+ "import": "./dist/assets/*.js",
34
+ "types": "./dist/assets/*.d.ts"
27
35
  }
28
36
  },
29
37
  "files": [
@@ -34,17 +42,25 @@
34
42
  "dev": "tsc --noEmit --watch",
35
43
  "lint": "eslint src/",
36
44
  "type-check": "tsc --noEmit",
37
- "prepare": "pnpm build"
45
+ "prepublishOnly": "pnpm build"
38
46
  },
39
- "keywords": ["chat", "sdk", "react", "messenger-style"],
47
+ "keywords": [
48
+ "chat",
49
+ "sdk",
50
+ "react",
51
+ "messenger-style"
52
+ ],
40
53
  "author": "Garru",
41
54
  "license": "MIT",
42
55
  "publishConfig": {
43
56
  "access": "public"
44
57
  },
45
58
  "dependencies": {
59
+ "@openim/wasm-client-sdk": "3.8.3-patch.10",
60
+ "antd": "^5.27.0",
46
61
  "clsx": "^2.0.0",
47
62
  "lucide-react": "^0.263.1",
63
+ "react-icomoon": "^2.6.1",
48
64
  "tailwind-merge": "^2.0.0"
49
65
  },
50
66
  "peerDependencies": {
@@ -1,2 +0,0 @@
1
- export declare function AutoScrollAnchor(): import("react/jsx-runtime").JSX.Element;
2
- //# sourceMappingURL=AutoScrollAnchor.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"AutoScrollAnchor.d.ts","sourceRoot":"","sources":["../../src/components/AutoScrollAnchor.tsx"],"names":[],"mappings":"AAIA,wBAAgB,gBAAgB,4CAU/B"}
@@ -1,12 +0,0 @@
1
- "use client";
2
- import { jsx as _jsx } from "react/jsx-runtime";
3
- import { useEffect, useRef } from "react";
4
- export function AutoScrollAnchor() {
5
- const anchorRef = useRef(null);
6
- useEffect(() => {
7
- if (anchorRef.current) {
8
- anchorRef.current.scrollIntoView({ behavior: "smooth" });
9
- }
10
- });
11
- return _jsx("div", { ref: anchorRef });
12
- }
@@ -1,11 +0,0 @@
1
- "use client";
2
- import { useEffect, useRef } from "react";
3
- export function AutoScrollAnchor() {
4
- const anchorRef = useRef(null);
5
- useEffect(() => {
6
- if (anchorRef.current) {
7
- anchorRef.current.scrollIntoView({ behavior: "smooth" });
8
- }
9
- });
10
- return <div ref={anchorRef}/>;
11
- }
@@ -1,80 +0,0 @@
1
- "use client";
2
- import { useState } from "react";
3
- import { MessageCircle, X } from "lucide-react";
4
- import { ChatHeader } from "./ChatHeader";
5
- import { MessageList } from "./MessageList";
6
- import { ChatInput } from "./ChatInput";
7
- import { useMessages } from "../hooks/useMessages";
8
- export function ChatBubble() {
9
- const [isOpen, setIsOpen] = useState(false);
10
- const [selectedConversationId, setSelectedConversationId] = useState('conv-1');
11
- console.log("🚀 ~ ChatBubble ~ isOpen:", isOpen);
12
- const messagesHook = useMessages(selectedConversationId || "");
13
- return (<>
14
- {/* Chat Bubble Button */}
15
- <button onClick={() => setIsOpen(true)} className={`fixed bottom-6 right-6 w-14 h-14 bg-blue-600 hover:bg-blue-700 text-white rounded-full shadow-lg transition-all duration-200 flex items-center justify-center z-40 ${isOpen ? "scale-0" : "scale-100"}`} aria-label="Open chat">
16
- <MessageCircle className="w-6 h-6"/>
17
- </button>
18
-
19
- {/* Chat Window */}
20
- {isOpen && (<div className="fixed bottom-6 right-6 w-96 h-[700px] max-h-[80%] bg-white rounded-lg shadow-2xl border z-50 flex flex-col overflow-hidden">
21
- {/* Header */}
22
- <div className="flex items-center justify-between p-4 border-b bg-blue-600 text-white">
23
- <h3 className="font-semibold">Chat Support</h3>
24
- <button onClick={() => setIsOpen(false)} className="p-1 hover:bg-blue-700 rounded" aria-label="Close chat">
25
- <X className="w-4 h-4"/>
26
- </button>
27
- </div>
28
-
29
- {/* Chat Content */}
30
- <div className={`
31
- flex-1 flex flex-col relative h-[calc(100%-50px)]
32
- ${selectedConversationId ? "flex" : "hidden md:flex"}
33
- `}>
34
- {selectedConversationId ? (<>
35
- {/* Swipe indicator for mobile */}
36
- <div className="md:hidden absolute top-2 left-2 z-10 pointer-events-none">
37
- <div className="bg-black bg-opacity-20 text-white text-xs px-2 py-1 rounded-full opacity-0 transition-opacity duration-200 swipe-hint">
38
- ← Swipe to go back
39
- </div>
40
- </div>
41
-
42
- {/* Chat Header - Fixed */}
43
- <div className="flex-shrink-0">
44
- <ChatHeader conversationId={selectedConversationId} onBackClick={() => setIsOpen(false)} onMenuClick={() => setIsOpen(false)}/>
45
- </div>
46
-
47
- {/* Message List - Scrollable */}
48
- <div className="flex-1 min-h-0">
49
- {" "}
50
- {/* Added min-h-0 here */}
51
- <MessageList messages={messagesHook.messages} currentUserId={"current-user"} conversationId={selectedConversationId} className="h-full"/>
52
- </div>
53
-
54
- {/* Chat Input - Fixed */}
55
- <div className="flex-shrink-0">
56
- <ChatInput />
57
- </div>
58
- </>) : (<div className="flex-1 flex items-center justify-center text-gray-500 p-4">
59
- <div className="text-center max-w-sm">
60
- <div className="w-16 h-16 mx-auto mb-4 bg-gray-100 rounded-full flex items-center justify-center">
61
- <svg className="w-8 h-8 text-gray-400" fill="none" stroke="currentColor" viewBox="0 0 24 24">
62
- <path strokeLinecap="round" strokeLinejoin="round" strokeWidth={2} d="M8 12h.01M12 12h.01M16 12h.01M21 12c0 4.418-4.03 8-9 8a9.863 9.863 0 01-4.255-.949L3 20l1.395-3.72C3.512 15.042 3 13.574 3 12c0-4.418 4.03-8 9-8s9 3.582 9 8z"/>
63
- </svg>
64
- </div>
65
- <h3 className="text-lg font-medium text-gray-900 mb-2">Select a conversation</h3>
66
- <p className="text-gray-500 text-sm sm:text-base">
67
- Choose a conversation from the sidebar to start messaging
68
- </p>
69
- <button onClick={() => setIsOpen(false)} className="mt-4 md:hidden px-4 py-2 bg-blue-500 text-white rounded-lg hover:bg-blue-600 transition-colors">
70
- View Conversations
71
- </button>
72
- </div>
73
- </div>)}
74
- </div>
75
- </div>)}
76
-
77
- {/* Backdrop */}
78
- {isOpen && <div className="fixed inset-0 bg-black bg-opacity-20 z-30" onClick={() => setIsOpen(false)}/>}
79
- </>);
80
- }
@@ -1,8 +0,0 @@
1
- interface ChatHeaderProps {
2
- conversationId: string;
3
- onBackClick?: () => void;
4
- onMenuClick?: () => void;
5
- }
6
- export declare function ChatHeader({ conversationId, onBackClick, onMenuClick }: ChatHeaderProps): import("react/jsx-runtime").JSX.Element | null;
7
- export {};
8
- //# sourceMappingURL=ChatHeader.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"ChatHeader.d.ts","sourceRoot":"","sources":["../../src/components/ChatHeader.tsx"],"names":[],"mappings":"AAGA,UAAU,eAAe;IACvB,cAAc,EAAE,MAAM,CAAA;IACtB,WAAW,CAAC,EAAE,MAAM,IAAI,CAAA;IACxB,WAAW,CAAC,EAAE,MAAM,IAAI,CAAA;CACzB;AAED,wBAAgB,UAAU,CAAC,EAAE,cAAc,EAAE,WAAW,EAAE,WAAW,EAAE,EAAE,eAAe,kDAgGvF"}
@@ -1,32 +0,0 @@
1
- "use client";
2
- import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
3
- import { useChatContext } from "../context/ChatContext";
4
- export function ChatHeader({ conversationId, onBackClick, onMenuClick }) {
5
- const { state } = useChatContext();
6
- const conversation = state.conversations.find((c) => c.id === conversationId);
7
- const otherParticipant = conversation === null || conversation === void 0 ? void 0 : conversation.participants.find((p) => { var _a; return p.id !== ((_a = state.config) === null || _a === void 0 ? void 0 : _a.userId); });
8
- if (!conversation || !otherParticipant) {
9
- return null;
10
- }
11
- const getStatusText = () => {
12
- if (otherParticipant.status === "online") {
13
- return "Online";
14
- }
15
- else if (otherParticipant.lastSeen) {
16
- const now = new Date();
17
- const diff = now.getTime() - otherParticipant.lastSeen.getTime();
18
- const minutes = Math.floor(diff / (1000 * 60));
19
- const hours = Math.floor(minutes / 60);
20
- const days = Math.floor(hours / 24);
21
- if (minutes < 1)
22
- return "Last seen just now";
23
- if (minutes < 60)
24
- return `Last seen ${minutes}m ago`;
25
- if (hours < 24)
26
- return `Last seen ${hours}h ago`;
27
- return `Last seen ${days}d ago`;
28
- }
29
- return "Offline";
30
- };
31
- return (_jsxs("div", { className: "flex items-center p-3 sm:p-4 border-b border-gray-200 bg-white relative", children: [_jsx("button", { onClick: onBackClick, className: "md:hidden p-3 mr-1 text-gray-400 hover:text-gray-600 rounded-full hover:bg-gray-100 -ml-3 transition-colors", "aria-label": "Go back to conversations", children: _jsx("svg", { className: "w-5 h-5", fill: "none", stroke: "currentColor", viewBox: "0 0 24 24", children: _jsx("path", { strokeLinecap: "round", strokeLinejoin: "round", strokeWidth: 2, d: "M15 19l-7-7 7-7" }) }) }), _jsxs("div", { className: "relative", children: [_jsx("img", { src: otherParticipant.avatar || "/placeholder.svg?height=40&width=40&query=user", alt: otherParticipant.name, className: "w-8 h-8 sm:w-10 sm:h-10 rounded-full object-cover" }), otherParticipant.status === "online" && (_jsx("div", { className: "absolute bottom-0 right-0 w-2.5 h-2.5 sm:w-3 sm:h-3 bg-green-500 rounded-full border-2 border-white" }))] }), _jsxs("div", { className: "ml-3 flex-1 min-w-0", children: [_jsx("h2", { className: "text-base sm:text-lg font-semibold text-gray-900 truncate", children: otherParticipant.name }), _jsx("p", { className: "text-xs sm:text-sm text-gray-500 truncate", children: getStatusText() })] }), _jsx("div", { className: "md:hidden absolute top-full left-0 right-0 bg-blue-50 border-b border-blue-100 px-4 py-2 text-xs text-blue-600 text-center animate-pulse swipe-tutorial", children: "\uD83D\uDCA1 Tip: Swipe right anywhere to go back" }), _jsxs("div", { className: "flex items-center space-x-1 sm:space-x-2", children: [_jsx("button", { className: "p-2 text-gray-400 hover:text-gray-600 rounded-full hover:bg-gray-100 transition-colors", children: _jsx("svg", { className: "w-4 h-4 sm:w-5 sm:h-5", fill: "none", stroke: "currentColor", viewBox: "0 0 24 24", children: _jsx("path", { strokeLinecap: "round", strokeLinejoin: "round", strokeWidth: 2, d: "M3 5a2 2 0 012-2h3.28a1 1 0 01.948.684l1.498 4.493a1 1 0 01-.502 1.21l-2.257 1.13a11.042 11.042 0 005.516 5.516l1.13-2.257a1 1 0 011.21-.502l4.493 1.498a1 1 0 01.684.949V19a2 2 0 01-2 2h-1C9.716 21 3 14.284 3 6V5z" }) }) }), _jsx("button", { className: "p-2 text-gray-400 hover:text-gray-600 rounded-full hover:bg-gray-100 transition-colors", children: _jsx("svg", { className: "w-4 h-4 sm:w-5 sm:h-5", fill: "none", stroke: "currentColor", viewBox: "0 0 24 24", children: _jsx("path", { strokeLinecap: "round", strokeLinejoin: "round", strokeWidth: 2, d: "M15 10l4.553-2.276A1 1 0 0121 8.618v6.764a1 1 0 01-1.447.894L15 14M5 18h8a2 2 0 002-2V8a2 2 0 00-2-2H5a2 2 0 00-2 2v8a2 2 0 002 2z" }) }) }), _jsx("button", { onClick: onMenuClick, className: "md:hidden p-2 text-gray-400 hover:text-gray-600 rounded-full hover:bg-gray-100 transition-colors", "aria-label": "Open menu", children: _jsx("svg", { className: "w-4 h-4", fill: "none", stroke: "currentColor", viewBox: "0 0 24 24", children: _jsx("path", { strokeLinecap: "round", strokeLinejoin: "round", strokeWidth: 2, d: "M4 6h16M4 12h16M4 18h16" }) }) })] })] }));
32
- }
@@ -1,72 +0,0 @@
1
- "use client";
2
- import { useChatContext } from "../context/ChatContext";
3
- export function ChatHeader({ conversationId, onBackClick, onMenuClick }) {
4
- const { state } = useChatContext();
5
- const conversation = state.conversations.find((c) => c.id === conversationId);
6
- const otherParticipant = conversation === null || conversation === void 0 ? void 0 : conversation.participants.find((p) => { var _a; return p.id !== ((_a = state.config) === null || _a === void 0 ? void 0 : _a.userId); });
7
- if (!conversation || !otherParticipant) {
8
- return null;
9
- }
10
- const getStatusText = () => {
11
- if (otherParticipant.status === "online") {
12
- return "Online";
13
- }
14
- else if (otherParticipant.lastSeen) {
15
- const now = new Date();
16
- const diff = now.getTime() - otherParticipant.lastSeen.getTime();
17
- const minutes = Math.floor(diff / (1000 * 60));
18
- const hours = Math.floor(minutes / 60);
19
- const days = Math.floor(hours / 24);
20
- if (minutes < 1)
21
- return "Last seen just now";
22
- if (minutes < 60)
23
- return `Last seen ${minutes}m ago`;
24
- if (hours < 24)
25
- return `Last seen ${hours}h ago`;
26
- return `Last seen ${days}d ago`;
27
- }
28
- return "Offline";
29
- };
30
- return (<div className="flex items-center p-3 sm:p-4 border-b border-gray-200 bg-white relative">
31
- {/* Mobile back button with enhanced touch area */}
32
- <button onClick={onBackClick} className="md:hidden p-3 mr-1 text-gray-400 hover:text-gray-600 rounded-full hover:bg-gray-100 -ml-3 transition-colors" aria-label="Go back to conversations">
33
- <svg className="w-5 h-5" fill="none" stroke="currentColor" viewBox="0 0 24 24">
34
- <path strokeLinecap="round" strokeLinejoin="round" strokeWidth={2} d="M15 19l-7-7 7-7"/>
35
- </svg>
36
- </button>
37
-
38
- <div className="relative">
39
- <img src={otherParticipant.avatar || "/placeholder.svg?height=40&width=40&query=user"} alt={otherParticipant.name} className="w-8 h-8 sm:w-10 sm:h-10 rounded-full object-cover"/>
40
- {otherParticipant.status === "online" && (<div className="absolute bottom-0 right-0 w-2.5 h-2.5 sm:w-3 sm:h-3 bg-green-500 rounded-full border-2 border-white"></div>)}
41
- </div>
42
-
43
- <div className="ml-3 flex-1 min-w-0">
44
- <h2 className="text-base sm:text-lg font-semibold text-gray-900 truncate">{otherParticipant.name}</h2>
45
- <p className="text-xs sm:text-sm text-gray-500 truncate">{getStatusText()}</p>
46
- </div>
47
-
48
- {/* Swipe hint for first-time users */}
49
- <div className="md:hidden absolute top-full left-0 right-0 bg-blue-50 border-b border-blue-100 px-4 py-2 text-xs text-blue-600 text-center animate-pulse swipe-tutorial">
50
- 💡 Tip: Swipe right anywhere to go back
51
- </div>
52
-
53
- <div className="flex items-center space-x-1 sm:space-x-2">
54
- <button className="p-2 text-gray-400 hover:text-gray-600 rounded-full hover:bg-gray-100 transition-colors">
55
- <svg className="w-4 h-4 sm:w-5 sm:h-5" fill="none" stroke="currentColor" viewBox="0 0 24 24">
56
- <path strokeLinecap="round" strokeLinejoin="round" strokeWidth={2} d="M3 5a2 2 0 012-2h3.28a1 1 0 01.948.684l1.498 4.493a1 1 0 01-.502 1.21l-2.257 1.13a11.042 11.042 0 005.516 5.516l1.13-2.257a1 1 0 011.21-.502l4.493 1.498a1 1 0 01.684.949V19a2 2 0 01-2 2h-1C9.716 21 3 14.284 3 6V5z"/>
57
- </svg>
58
- </button>
59
- <button className="p-2 text-gray-400 hover:text-gray-600 rounded-full hover:bg-gray-100 transition-colors">
60
- <svg className="w-4 h-4 sm:w-5 sm:h-5" fill="none" stroke="currentColor" viewBox="0 0 24 24">
61
- <path strokeLinecap="round" strokeLinejoin="round" strokeWidth={2} d="M15 10l4.553-2.276A1 1 0 0121 8.618v6.764a1 1 0 01-1.447.894L15 14M5 18h8a2 2 0 002-2V8a2 2 0 00-2-2H5a2 2 0 00-2 2v8a2 2 0 002 2z"/>
62
- </svg>
63
- </button>
64
- {/* Mobile menu button */}
65
- <button onClick={onMenuClick} className="md:hidden p-2 text-gray-400 hover:text-gray-600 rounded-full hover:bg-gray-100 transition-colors" aria-label="Open menu">
66
- <svg className="w-4 h-4" fill="none" stroke="currentColor" viewBox="0 0 24 24">
67
- <path strokeLinecap="round" strokeLinejoin="round" strokeWidth={2} d="M4 6h16M4 12h16M4 18h16"/>
68
- </svg>
69
- </button>
70
- </div>
71
- </div>);
72
- }
@@ -1,3 +0,0 @@
1
- import type { ChatInputProps } from "../types/chat";
2
- export declare function ChatInput({ conversationId, onSendMessage, onEmojiClick, onStickerClick, onFileUpload, onImageUpload, onContactShare, onVoiceRecord, onVoiceMessage, onQuickReact, placeholder, disabled, className, }: ChatInputProps): import("react/jsx-runtime").JSX.Element;
3
- //# sourceMappingURL=ChatInput.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"ChatInput.d.ts","sourceRoot":"","sources":["../../src/components/ChatInput.tsx"],"names":[],"mappings":"AAWA,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,eAAe,CAAA;AAEnD,wBAAgB,SAAS,CAAC,EACxB,cAAc,EACd,aAAa,EACb,YAAY,EACZ,cAAc,EACd,YAAY,EACZ,aAAa,EACb,cAAc,EACd,aAAa,EACb,cAAc,EACd,YAAY,EACZ,WAA6B,EAC7B,QAAgB,EAChB,SAAc,GACf,EAAE,cAAc,2CA4lBhB"}