ajaxter-chat 1.0.3 → 2.0.1
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/README.md +96 -204
- package/dist/components/ChatScreen/index.d.ts +12 -0
- package/dist/components/ChatScreen/index.js +83 -0
- package/dist/components/ChatWidget.d.ts +0 -24
- package/dist/components/ChatWidget.js +129 -38
- package/dist/components/HomeScreen/index.d.ts +9 -0
- package/dist/components/HomeScreen/index.js +71 -0
- package/dist/components/MaintenanceView/index.d.ts +1 -1
- package/dist/components/MaintenanceView/index.js +15 -52
- package/dist/components/RecentChatsScreen/index.d.ts +16 -0
- package/dist/components/RecentChatsScreen/index.js +38 -0
- package/dist/components/Tabs/BottomTabs.d.ts +10 -0
- package/dist/components/Tabs/BottomTabs.js +29 -0
- package/dist/components/TicketScreen/index.d.ts +9 -0
- package/dist/components/TicketScreen/index.js +71 -0
- package/dist/components/UserListScreen/index.d.ts +13 -0
- package/dist/components/UserListScreen/index.js +64 -0
- package/dist/config/index.d.ts +0 -13
- package/dist/config/index.js +20 -95
- package/dist/hooks/useChat.d.ts +3 -7
- package/dist/hooks/useChat.js +8 -30
- package/dist/hooks/useUsers.d.ts +3 -10
- package/dist/hooks/useUsers.js +5 -11
- package/dist/index.d.ts +8 -7
- package/dist/index.js +7 -12
- package/dist/services/userService.d.ts +0 -5
- package/dist/services/userService.js +6 -15
- package/dist/src/components/ChatScreen/index.d.ts +12 -0
- package/dist/src/components/ChatScreen/index.js +83 -0
- package/dist/src/components/ChatWidget.d.ts +4 -0
- package/dist/src/components/ChatWidget.js +141 -0
- package/dist/src/components/HomeScreen/index.d.ts +9 -0
- package/dist/src/components/HomeScreen/index.js +71 -0
- package/dist/src/components/MaintenanceView/index.d.ts +7 -0
- package/dist/src/components/MaintenanceView/index.js +16 -0
- package/dist/src/components/RecentChatsScreen/index.d.ts +16 -0
- package/dist/src/components/RecentChatsScreen/index.js +38 -0
- package/dist/src/components/Tabs/BottomTabs.d.ts +10 -0
- package/dist/src/components/Tabs/BottomTabs.js +29 -0
- package/dist/src/components/TicketScreen/index.d.ts +9 -0
- package/dist/src/components/TicketScreen/index.js +71 -0
- package/dist/src/components/UserListScreen/index.d.ts +13 -0
- package/dist/src/components/UserListScreen/index.js +64 -0
- package/dist/src/config/index.d.ts +3 -0
- package/dist/src/config/index.js +38 -0
- package/dist/src/hooks/useChat.d.ts +8 -0
- package/dist/src/hooks/useChat.js +26 -0
- package/dist/src/hooks/useUsers.d.ts +7 -0
- package/dist/src/hooks/useUsers.js +26 -0
- package/dist/src/index.d.ts +14 -0
- package/dist/src/index.js +13 -0
- package/dist/src/services/userService.d.ts +2 -0
- package/dist/src/services/userService.js +9 -0
- package/dist/src/types/index.d.ts +59 -0
- package/dist/src/types/index.js +1 -0
- package/dist/src/utils/theme.d.ts +3 -0
- package/dist/src/utils/theme.js +13 -0
- package/dist/types/index.d.ts +23 -36
- package/dist/utils/theme.d.ts +0 -1
- package/dist/utils/theme.js +3 -18
- package/package.json +10 -20
- package/src/components/ChatScreen/index.tsx +205 -0
- package/src/components/ChatWidget.tsx +327 -0
- package/src/components/HomeScreen/index.tsx +130 -0
- package/src/components/MaintenanceView/index.tsx +41 -0
- package/src/components/RecentChatsScreen/index.tsx +108 -0
- package/src/components/Tabs/BottomTabs.tsx +82 -0
- package/src/components/TicketScreen/index.tsx +170 -0
- package/src/components/UserListScreen/index.tsx +181 -0
- package/src/config/index.ts +46 -0
- package/src/hooks/useChat.ts +31 -0
- package/src/hooks/useUsers.ts +27 -0
- package/src/index.ts +18 -0
- package/src/services/userService.ts +9 -0
- package/src/types/index.ts +82 -0
- package/src/utils/theme.ts +16 -0
- package/dist/components/BottomNav/index.d.ts +0 -10
- package/dist/components/BottomNav/index.js +0 -32
- package/dist/components/ChatBox/index.d.ts +0 -15
- package/dist/components/ChatBox/index.js +0 -228
- package/dist/components/ChatButton/index.d.ts +0 -9
- package/dist/components/ChatButton/index.js +0 -17
- package/dist/components/ChatWindow/index.d.ts +0 -10
- package/dist/components/ChatWindow/index.js +0 -286
- package/dist/components/HomeView/index.d.ts +0 -12
- package/dist/components/HomeView/index.js +0 -51
- package/dist/components/UserList/index.d.ts +0 -13
- package/dist/components/UserList/index.js +0 -136
|
@@ -1,10 +0,0 @@
|
|
|
1
|
-
import React from 'react';
|
|
2
|
-
import { BottomNavTab } from '../../types';
|
|
3
|
-
interface BottomNavProps {
|
|
4
|
-
active: BottomNavTab;
|
|
5
|
-
onChange: (tab: BottomNavTab) => void;
|
|
6
|
-
primaryColor: string;
|
|
7
|
-
fontFamily: string;
|
|
8
|
-
}
|
|
9
|
-
export declare const BottomNav: React.FC<BottomNavProps>;
|
|
10
|
-
export {};
|
|
@@ -1,32 +0,0 @@
|
|
|
1
|
-
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
-
export const BottomNav = ({ active, onChange, primaryColor, fontFamily, }) => {
|
|
3
|
-
const item = (tab, label, icon) => {
|
|
4
|
-
const isOn = active === tab;
|
|
5
|
-
return (_jsxs("button", { type: "button", onClick: () => onChange(tab), style: {
|
|
6
|
-
flex: 1,
|
|
7
|
-
display: 'flex',
|
|
8
|
-
flexDirection: 'column',
|
|
9
|
-
alignItems: 'center',
|
|
10
|
-
justifyContent: 'center',
|
|
11
|
-
gap: '4px',
|
|
12
|
-
padding: '10px 8px',
|
|
13
|
-
border: 'none',
|
|
14
|
-
background: 'transparent',
|
|
15
|
-
cursor: 'pointer',
|
|
16
|
-
fontFamily,
|
|
17
|
-
color: isOn ? primaryColor : '#b0b0b0',
|
|
18
|
-
transition: 'color 0.2s',
|
|
19
|
-
}, children: [_jsx("span", { style: { display: 'flex', alignItems: 'center', justifyContent: 'center' }, children: icon }), _jsx("span", { style: { fontSize: '11px', fontWeight: isOn ? 600 : 500 }, children: label })] }));
|
|
20
|
-
};
|
|
21
|
-
return (_jsxs("nav", { style: {
|
|
22
|
-
flexShrink: 0,
|
|
23
|
-
display: 'flex',
|
|
24
|
-
alignItems: 'stretch',
|
|
25
|
-
backgroundColor: '#fff',
|
|
26
|
-
borderTop: '1px solid #eee',
|
|
27
|
-
paddingBottom: 'env(safe-area-inset-bottom, 0)',
|
|
28
|
-
}, "aria-label": "Widget sections", children: [item('home', 'Home', _jsx(HomeIcon, { active: active === 'home', color: primaryColor, muted: "#b0b0b0" })), item('chats', 'Chat', _jsx(ChatBubbleIcon, { active: active === 'chats', color: primaryColor, muted: "#b0b0b0" })), item('tickets', 'Tickets', _jsx(TicketIcon, { active: active === 'tickets', color: primaryColor, muted: "#b0b0b0" }))] }));
|
|
29
|
-
};
|
|
30
|
-
const HomeIcon = ({ active, color, muted, }) => (_jsx("svg", { width: "24", height: "24", viewBox: "0 0 24 24", fill: "none", "aria-hidden": true, children: _jsx("path", { d: "M3 9.5L12 3l9 6.5V20a1 1 0 0 1-1 1h-5v-7H9v7H4a1 1 0 0 1-1-1V9.5z", stroke: active ? color : muted, strokeWidth: "2", strokeLinejoin: "round" }) }));
|
|
31
|
-
const ChatBubbleIcon = ({ active, color, muted, }) => (_jsx("svg", { width: "24", height: "24", viewBox: "0 0 24 24", fill: "none", "aria-hidden": true, children: _jsx("path", { d: "M21 15a2 2 0 0 1-2 2H7l-4 4V5a2 2 0 0 1 2-2h14a2 2 0 0 1 2 2z", stroke: active ? color : muted, strokeWidth: "2", strokeLinecap: "round", strokeLinejoin: "round" }) }));
|
|
32
|
-
const TicketIcon = ({ active, color, muted, }) => (_jsx("svg", { width: "24", height: "24", viewBox: "0 0 24 24", fill: "none", "aria-hidden": true, children: _jsx("path", { d: "M4 4h16v4H4V4zm0 6h10v10H4V10zm12 0h4v10h-4V10z", stroke: active ? color : muted, strokeWidth: "2", strokeLinejoin: "round" }) }));
|
|
@@ -1,15 +0,0 @@
|
|
|
1
|
-
import React from 'react';
|
|
2
|
-
import { ChatMessage, ChatUser } from '../../types';
|
|
3
|
-
export interface ChatBoxProps {
|
|
4
|
-
activeUser: ChatUser | null;
|
|
5
|
-
messages: ChatMessage[];
|
|
6
|
-
onSendMessage: (text: string) => void;
|
|
7
|
-
primaryColor: string;
|
|
8
|
-
fontFamily: string;
|
|
9
|
-
/** Minimal: teal bar with back/close, footer with extra actions (reference UI). */
|
|
10
|
-
variant?: 'default' | 'minimal';
|
|
11
|
-
onBack?: () => void;
|
|
12
|
-
onClose?: () => void;
|
|
13
|
-
headerTitle?: string;
|
|
14
|
-
}
|
|
15
|
-
export declare const ChatBox: React.FC<ChatBoxProps>;
|
|
@@ -1,228 +0,0 @@
|
|
|
1
|
-
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
-
import { useState, useRef, useEffect } from 'react';
|
|
3
|
-
export const ChatBox = ({ activeUser, messages, onSendMessage, primaryColor, fontFamily, variant = 'default', onBack, onClose, headerTitle, }) => {
|
|
4
|
-
const [inputText, setInputText] = useState('');
|
|
5
|
-
const messagesEndRef = useRef(null);
|
|
6
|
-
const inputRef = useRef(null);
|
|
7
|
-
useEffect(() => {
|
|
8
|
-
var _a;
|
|
9
|
-
(_a = messagesEndRef.current) === null || _a === void 0 ? void 0 : _a.scrollIntoView({ behavior: 'smooth' });
|
|
10
|
-
}, [messages]);
|
|
11
|
-
const handleSend = () => {
|
|
12
|
-
var _a;
|
|
13
|
-
if (!inputText.trim())
|
|
14
|
-
return;
|
|
15
|
-
onSendMessage(inputText);
|
|
16
|
-
setInputText('');
|
|
17
|
-
(_a = inputRef.current) === null || _a === void 0 ? void 0 : _a.focus();
|
|
18
|
-
};
|
|
19
|
-
const handleKeyDown = (e) => {
|
|
20
|
-
if (e.key === 'Enter' && !e.shiftKey) {
|
|
21
|
-
e.preventDefault();
|
|
22
|
-
handleSend();
|
|
23
|
-
}
|
|
24
|
-
};
|
|
25
|
-
if (variant === 'minimal') {
|
|
26
|
-
return (_jsxs("div", { style: {
|
|
27
|
-
flex: 1,
|
|
28
|
-
display: 'flex',
|
|
29
|
-
flexDirection: 'column',
|
|
30
|
-
fontFamily,
|
|
31
|
-
overflow: 'hidden',
|
|
32
|
-
backgroundColor: '#fff',
|
|
33
|
-
}, children: [_jsxs("div", { style: {
|
|
34
|
-
flexShrink: 0,
|
|
35
|
-
padding: '14px 16px',
|
|
36
|
-
backgroundColor: primaryColor,
|
|
37
|
-
color: '#fff',
|
|
38
|
-
display: 'flex',
|
|
39
|
-
alignItems: 'center',
|
|
40
|
-
justifyContent: 'space-between',
|
|
41
|
-
}, children: [_jsx("button", { type: "button", onClick: onBack, "aria-label": "Back", style: {
|
|
42
|
-
background: 'transparent',
|
|
43
|
-
border: 'none',
|
|
44
|
-
color: '#fff',
|
|
45
|
-
cursor: 'pointer',
|
|
46
|
-
padding: '4px',
|
|
47
|
-
display: 'flex',
|
|
48
|
-
alignItems: 'center',
|
|
49
|
-
}, children: _jsx("svg", { width: "22", height: "22", viewBox: "0 0 24 24", fill: "none", children: _jsx("path", { d: "M15 18L9 12L15 6", stroke: "currentColor", strokeWidth: "2", strokeLinecap: "round", strokeLinejoin: "round" }) }) }), _jsx("div", { style: { fontWeight: 600, fontSize: '15px', flex: 1, textAlign: 'center' }, children: headerTitle !== null && headerTitle !== void 0 ? headerTitle : (activeUser ? activeUser.name : 'Chat') }), _jsx("button", { type: "button", onClick: onClose, "aria-label": "Close", style: {
|
|
50
|
-
background: 'transparent',
|
|
51
|
-
border: 'none',
|
|
52
|
-
color: '#fff',
|
|
53
|
-
cursor: 'pointer',
|
|
54
|
-
padding: '4px',
|
|
55
|
-
display: 'flex',
|
|
56
|
-
}, children: _jsxs("svg", { width: "20", height: "20", viewBox: "0 0 24 24", fill: "none", children: [_jsx("line", { x1: "18", y1: "6", x2: "6", y2: "18", stroke: "currentColor", strokeWidth: "2", strokeLinecap: "round" }), _jsx("line", { x1: "6", y1: "6", x2: "18", y2: "18", stroke: "currentColor", strokeWidth: "2", strokeLinecap: "round" })] }) })] }), _jsxs("div", { style: {
|
|
57
|
-
flex: 1,
|
|
58
|
-
overflowY: 'auto',
|
|
59
|
-
padding: '16px',
|
|
60
|
-
backgroundColor: '#fff',
|
|
61
|
-
}, children: [!activeUser ? (_jsx("div", { style: { textAlign: 'center', color: '#bbb', fontSize: '14px', marginTop: '32px' }, children: "Select someone to chat" })) : messages.length === 0 ? (_jsxs("div", { style: { textAlign: 'center', color: '#ccc', fontSize: '13px', marginTop: '32px' }, children: ["Say hello to ", activeUser.name, "! \uD83D\uDC4B"] })) : (messages.map((msg) => (_jsx(MessageBubble, { message: msg, primaryColor: primaryColor }, msg.id)))), _jsx("div", { ref: messagesEndRef })] }), _jsxs("div", { style: {
|
|
62
|
-
borderTop: '1px solid #eee',
|
|
63
|
-
backgroundColor: '#fff',
|
|
64
|
-
padding: '10px 12px',
|
|
65
|
-
display: 'flex',
|
|
66
|
-
alignItems: 'center',
|
|
67
|
-
gap: '8px',
|
|
68
|
-
}, children: [_jsx("textarea", { ref: inputRef, value: inputText, onChange: (e) => setInputText(e.target.value), onKeyDown: handleKeyDown, placeholder: "Type and press [enter]..", rows: 1, disabled: !activeUser, style: {
|
|
69
|
-
flex: 1,
|
|
70
|
-
resize: 'none',
|
|
71
|
-
border: 'none',
|
|
72
|
-
outline: 'none',
|
|
73
|
-
fontFamily,
|
|
74
|
-
fontSize: '14px',
|
|
75
|
-
color: '#1a1a2e',
|
|
76
|
-
maxHeight: '80px',
|
|
77
|
-
lineHeight: 1.45,
|
|
78
|
-
} }), _jsx(IconButton, { label: "Like", disabled: !activeUser, children: _jsx("svg", { width: "20", height: "20", viewBox: "0 0 24 24", fill: "none", stroke: "#888", strokeWidth: "1.8", children: _jsx("path", { d: "M14 9V5a3 3 0 0 0-3-3l-4 9v11h11.28a2 2 0 0 0 2-1.7l1.38-9a2 2 0 0 0-2-2.3zM7 22H4a2 2 0 0 1-2-2v-7a2 2 0 0 1 2-2h3" }) }) }), _jsx(IconButton, { label: "Attach", disabled: !activeUser, children: _jsx("svg", { width: "20", height: "20", viewBox: "0 0 24 24", fill: "none", stroke: "#888", strokeWidth: "1.8", children: _jsx("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" }) }) }), _jsx(IconButton, { label: "Emoji", disabled: !activeUser, children: _jsxs("svg", { width: "20", height: "20", viewBox: "0 0 24 24", fill: "none", stroke: "#888", strokeWidth: "1.8", children: [_jsx("circle", { cx: "12", cy: "12", r: "10" }), _jsx("path", { d: "M8 14s1.5 2 4 2 4-2 4-2M9 9h.01M15 9h.01" })] }) })] })] }));
|
|
79
|
-
}
|
|
80
|
-
if (!activeUser) {
|
|
81
|
-
return (_jsxs("div", { style: {
|
|
82
|
-
flex: 1,
|
|
83
|
-
display: 'flex',
|
|
84
|
-
flexDirection: 'column',
|
|
85
|
-
alignItems: 'center',
|
|
86
|
-
justifyContent: 'center',
|
|
87
|
-
fontFamily,
|
|
88
|
-
gap: '16px',
|
|
89
|
-
padding: '24px',
|
|
90
|
-
textAlign: 'center',
|
|
91
|
-
}, children: [_jsx("div", { style: {
|
|
92
|
-
width: '80px',
|
|
93
|
-
height: '80px',
|
|
94
|
-
borderRadius: '50%',
|
|
95
|
-
backgroundColor: `${primaryColor}12`,
|
|
96
|
-
display: 'flex',
|
|
97
|
-
alignItems: 'center',
|
|
98
|
-
justifyContent: 'center',
|
|
99
|
-
}, children: _jsx("svg", { width: "36", height: "36", viewBox: "0 0 24 24", fill: "none", children: _jsx("path", { d: "M21 15a2 2 0 0 1-2 2H7l-4 4V5a2 2 0 0 1 2-2h14a2 2 0 0 1 2 2z", stroke: primaryColor, strokeWidth: "1.5", strokeLinecap: "round", strokeLinejoin: "round", fill: `${primaryColor}15` }) }) }), _jsxs("div", { children: [_jsx("p", { style: {
|
|
100
|
-
margin: '0 0 6px',
|
|
101
|
-
fontWeight: 700,
|
|
102
|
-
fontSize: '16px',
|
|
103
|
-
color: '#1a1a2e',
|
|
104
|
-
letterSpacing: '-0.02em',
|
|
105
|
-
}, children: "Select a conversation" }), _jsx("p", { style: { margin: 0, fontSize: '13px', color: '#aaa', lineHeight: 1.6 }, children: "Choose someone from the list to start chatting" })] })] }));
|
|
106
|
-
}
|
|
107
|
-
const initials = activeUser.name
|
|
108
|
-
.split(' ')
|
|
109
|
-
.map((n) => n[0])
|
|
110
|
-
.join('')
|
|
111
|
-
.toUpperCase()
|
|
112
|
-
.slice(0, 2);
|
|
113
|
-
return (_jsxs("div", { style: {
|
|
114
|
-
flex: 1,
|
|
115
|
-
display: 'flex',
|
|
116
|
-
flexDirection: 'column',
|
|
117
|
-
fontFamily,
|
|
118
|
-
overflow: 'hidden',
|
|
119
|
-
}, children: [_jsxs("div", { style: {
|
|
120
|
-
padding: '14px 20px',
|
|
121
|
-
borderBottom: '1px solid #f0f0f5',
|
|
122
|
-
display: 'flex',
|
|
123
|
-
alignItems: 'center',
|
|
124
|
-
gap: '12px',
|
|
125
|
-
background: '#fafafa',
|
|
126
|
-
}, children: [_jsx("div", { style: {
|
|
127
|
-
width: '38px',
|
|
128
|
-
height: '38px',
|
|
129
|
-
borderRadius: '50%',
|
|
130
|
-
backgroundColor: primaryColor,
|
|
131
|
-
display: 'flex',
|
|
132
|
-
alignItems: 'center',
|
|
133
|
-
justifyContent: 'center',
|
|
134
|
-
color: '#fff',
|
|
135
|
-
fontSize: '13px',
|
|
136
|
-
fontWeight: 700,
|
|
137
|
-
}, children: initials }), _jsxs("div", { children: [_jsx("div", { style: { fontWeight: 700, fontSize: '14px', color: '#1a1a2e' }, children: activeUser.name }), _jsxs("div", { style: { fontSize: '12px', color: '#aaa', display: 'flex', alignItems: 'center', gap: '5px' }, children: [_jsx("span", { style: {
|
|
138
|
-
width: '6px',
|
|
139
|
-
height: '6px',
|
|
140
|
-
borderRadius: '50%',
|
|
141
|
-
backgroundColor: '#4caf50',
|
|
142
|
-
display: 'inline-block',
|
|
143
|
-
} }), "Online"] })] })] }), _jsxs("div", { style: {
|
|
144
|
-
flex: 1,
|
|
145
|
-
overflowY: 'auto',
|
|
146
|
-
padding: '20px 16px',
|
|
147
|
-
display: 'flex',
|
|
148
|
-
flexDirection: 'column',
|
|
149
|
-
gap: '10px',
|
|
150
|
-
backgroundColor: '#f8f8fc',
|
|
151
|
-
}, children: [messages.length === 0 ? (_jsxs("div", { style: {
|
|
152
|
-
textAlign: 'center',
|
|
153
|
-
color: '#ccc',
|
|
154
|
-
fontSize: '13px',
|
|
155
|
-
marginTop: 'auto',
|
|
156
|
-
marginBottom: 'auto',
|
|
157
|
-
}, children: ["Say hello to ", activeUser.name, "! \uD83D\uDC4B"] })) : (messages.map((msg) => (_jsx(MessageBubble, { message: msg, primaryColor: primaryColor }, msg.id)))), _jsx("div", { ref: messagesEndRef })] }), _jsxs("div", { style: {
|
|
158
|
-
padding: '12px 16px',
|
|
159
|
-
borderTop: '1px solid #f0f0f5',
|
|
160
|
-
backgroundColor: '#fff',
|
|
161
|
-
display: 'flex',
|
|
162
|
-
alignItems: 'flex-end',
|
|
163
|
-
gap: '10px',
|
|
164
|
-
}, children: [_jsx("textarea", { ref: inputRef, value: inputText, onChange: (e) => setInputText(e.target.value), onKeyDown: handleKeyDown, placeholder: "Type a message... (Enter to send)", rows: 1, style: {
|
|
165
|
-
flex: 1,
|
|
166
|
-
resize: 'none',
|
|
167
|
-
border: '1.5px solid #eee',
|
|
168
|
-
borderRadius: '12px',
|
|
169
|
-
padding: '10px 14px',
|
|
170
|
-
fontFamily,
|
|
171
|
-
fontSize: '14px',
|
|
172
|
-
outline: 'none',
|
|
173
|
-
lineHeight: '1.5',
|
|
174
|
-
maxHeight: '90px',
|
|
175
|
-
overflowY: 'auto',
|
|
176
|
-
transition: 'border-color 0.2s',
|
|
177
|
-
color: '#1a1a2e',
|
|
178
|
-
}, onFocus: (e) => {
|
|
179
|
-
e.target.style.borderColor = primaryColor;
|
|
180
|
-
}, onBlur: (e) => {
|
|
181
|
-
e.target.style.borderColor = '#eee';
|
|
182
|
-
} }), _jsx("button", { onClick: handleSend, disabled: !inputText.trim(), "aria-label": "Send message", style: {
|
|
183
|
-
width: '42px',
|
|
184
|
-
height: '42px',
|
|
185
|
-
borderRadius: '50%',
|
|
186
|
-
backgroundColor: inputText.trim() ? primaryColor : '#eee',
|
|
187
|
-
border: 'none',
|
|
188
|
-
cursor: inputText.trim() ? 'pointer' : 'not-allowed',
|
|
189
|
-
display: 'flex',
|
|
190
|
-
alignItems: 'center',
|
|
191
|
-
justifyContent: 'center',
|
|
192
|
-
flexShrink: 0,
|
|
193
|
-
transition: 'all 0.2s ease',
|
|
194
|
-
}, children: _jsx("svg", { width: "18", height: "18", viewBox: "0 0 24 24", fill: "none", children: _jsx("path", { d: "M22 2L11 13M22 2L15 22L11 13L2 9L22 2Z", stroke: inputText.trim() ? '#fff' : '#bbb', strokeWidth: "2", strokeLinecap: "round", strokeLinejoin: "round" }) }) })] })] }));
|
|
195
|
-
};
|
|
196
|
-
const IconButton = ({ label, disabled, children }) => (_jsx("button", { type: "button", "aria-label": label, disabled: disabled, style: {
|
|
197
|
-
background: 'transparent',
|
|
198
|
-
border: 'none',
|
|
199
|
-
padding: '6px',
|
|
200
|
-
cursor: disabled ? 'not-allowed' : 'pointer',
|
|
201
|
-
opacity: disabled ? 0.45 : 1,
|
|
202
|
-
display: 'flex',
|
|
203
|
-
alignItems: 'center',
|
|
204
|
-
justifyContent: 'center',
|
|
205
|
-
}, children: children }));
|
|
206
|
-
const MessageBubble = ({ message, primaryColor }) => {
|
|
207
|
-
const isMe = message.senderId === 'me';
|
|
208
|
-
const time = new Date(message.timestamp).toLocaleTimeString([], {
|
|
209
|
-
hour: '2-digit',
|
|
210
|
-
minute: '2-digit',
|
|
211
|
-
});
|
|
212
|
-
return (_jsxs("div", { style: {
|
|
213
|
-
display: 'flex',
|
|
214
|
-
flexDirection: 'column',
|
|
215
|
-
alignItems: isMe ? 'flex-end' : 'flex-start',
|
|
216
|
-
gap: '3px',
|
|
217
|
-
}, children: [_jsx("div", { style: {
|
|
218
|
-
maxWidth: '78%',
|
|
219
|
-
padding: '10px 14px',
|
|
220
|
-
borderRadius: isMe ? '18px 18px 4px 18px' : '18px 18px 18px 4px',
|
|
221
|
-
backgroundColor: isMe ? primaryColor : '#fff',
|
|
222
|
-
color: isMe ? '#fff' : '#1a1a2e',
|
|
223
|
-
fontSize: '14px',
|
|
224
|
-
lineHeight: '1.5',
|
|
225
|
-
boxShadow: '0 1px 3px rgba(0,0,0,0.08)',
|
|
226
|
-
wordBreak: 'break-word',
|
|
227
|
-
}, children: message.text }), _jsx("span", { style: { fontSize: '11px', color: '#bbb', paddingLeft: '4px', paddingRight: '4px' }, children: time })] }));
|
|
228
|
-
};
|
|
@@ -1,17 +0,0 @@
|
|
|
1
|
-
import { jsx as _jsx, Fragment as _Fragment, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
-
import { mergeTheme } from '../../utils/theme';
|
|
3
|
-
export const ChatButton = ({ isOpen, onClick, theme, }) => {
|
|
4
|
-
const t = mergeTheme(theme);
|
|
5
|
-
const positionStyle = t.buttonPosition === 'bottom-left'
|
|
6
|
-
? { left: '24px', right: 'auto' }
|
|
7
|
-
: { right: '24px', left: 'auto' };
|
|
8
|
-
return (_jsx("button", { onClick: onClick, "aria-label": isOpen ? 'Close chat' : t.buttonLabel, style: Object.assign(Object.assign({ position: 'fixed', bottom: '24px' }, positionStyle), { zIndex: 9999, display: 'flex', alignItems: 'center', gap: '10px', padding: isOpen ? '14px' : '14px 22px', backgroundColor: t.buttonColor, color: t.buttonTextColor, border: 'none', borderRadius: '50px', cursor: 'pointer', fontFamily: t.fontFamily, fontSize: '15px', fontWeight: 600, boxShadow: `0 8px 32px ${t.buttonColor}55`, transition: 'all 0.3s cubic-bezier(0.34, 1.56, 0.64, 1)', transform: isOpen ? 'scale(0.95)' : 'scale(1)', letterSpacing: '0.01em', minWidth: isOpen ? '52px' : 'auto', justifyContent: 'center' }), onMouseEnter: (e) => {
|
|
9
|
-
e.currentTarget.style.transform = 'scale(1.06) translateY(-2px)';
|
|
10
|
-
e.currentTarget.style.boxShadow = `0 12px 40px ${t.buttonColor}77`;
|
|
11
|
-
}, onMouseLeave: (e) => {
|
|
12
|
-
e.currentTarget.style.transform = isOpen ? 'scale(0.95)' : 'scale(1)';
|
|
13
|
-
e.currentTarget.style.boxShadow = `0 8px 32px ${t.buttonColor}55`;
|
|
14
|
-
}, children: isOpen ? (_jsx(CloseIcon, { color: t.buttonTextColor })) : (_jsxs(_Fragment, { children: [_jsx(ChatIcon, { color: t.buttonTextColor }), _jsx("span", { children: t.buttonLabel })] })) }));
|
|
15
|
-
};
|
|
16
|
-
const ChatIcon = ({ color }) => (_jsx("svg", { width: "20", height: "20", viewBox: "0 0 24 24", fill: "none", children: _jsx("path", { d: "M21 15a2 2 0 0 1-2 2H7l-4 4V5a2 2 0 0 1 2-2h14a2 2 0 0 1 2 2z", stroke: color, strokeWidth: "2", strokeLinecap: "round", strokeLinejoin: "round", fill: "none" }) }));
|
|
17
|
-
const CloseIcon = ({ color }) => (_jsxs("svg", { width: "20", height: "20", viewBox: "0 0 24 24", fill: "none", children: [_jsx("line", { x1: "18", y1: "6", x2: "6", y2: "18", stroke: color, strokeWidth: "2.5", strokeLinecap: "round" }), _jsx("line", { x1: "6", y1: "6", x2: "18", y2: "18", stroke: color, strokeWidth: "2.5", strokeLinecap: "round" })] }));
|
|
@@ -1,10 +0,0 @@
|
|
|
1
|
-
import React from 'react';
|
|
2
|
-
import { ChatConfig, ChatWidgetTheme } from '../../types';
|
|
3
|
-
interface ChatWindowProps {
|
|
4
|
-
config: ChatConfig;
|
|
5
|
-
theme?: ChatWidgetTheme;
|
|
6
|
-
buttonPosition: 'bottom-right' | 'bottom-left';
|
|
7
|
-
onClose: () => void;
|
|
8
|
-
}
|
|
9
|
-
export declare const ChatWindow: React.FC<ChatWindowProps>;
|
|
10
|
-
export {};
|
|
@@ -1,286 +0,0 @@
|
|
|
1
|
-
import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-runtime";
|
|
2
|
-
import { useState, useMemo, useCallback } from 'react';
|
|
3
|
-
import { UserList } from '../UserList';
|
|
4
|
-
import { ChatBox } from '../ChatBox';
|
|
5
|
-
import { MaintenanceView } from '../MaintenanceView';
|
|
6
|
-
import { HomeView } from '../HomeView';
|
|
7
|
-
import { BottomNav } from '../BottomNav';
|
|
8
|
-
import { useUsers } from '../../hooks/useUsers';
|
|
9
|
-
import { useChat } from '../../hooks/useChat';
|
|
10
|
-
import { buildUserListUrl } from '../../config';
|
|
11
|
-
import { mergeTheme } from '../../utils/theme';
|
|
12
|
-
export const ChatWindow = ({ config, theme, buttonPosition, onClose, }) => {
|
|
13
|
-
var _a, _b, _c, _d, _e, _f;
|
|
14
|
-
const t = mergeTheme(Object.assign(Object.assign({}, theme), { widgetMinWidth: (_a = theme === null || theme === void 0 ? void 0 : theme.widgetMinWidth) !== null && _a !== void 0 ? _a : config.widgetMinWidth, widgetMaxWidth: (_b = theme === null || theme === void 0 ? void 0 : theme.widgetMaxWidth) !== null && _b !== void 0 ? _b : config.widgetMaxWidth, widgetMinHeight: (_c = theme === null || theme === void 0 ? void 0 : theme.widgetMinHeight) !== null && _c !== void 0 ? _c : config.widgetMinHeight, widgetMaxHeight: (_d = theme === null || theme === void 0 ? void 0 : theme.widgetMaxHeight) !== null && _d !== void 0 ? _d : config.widgetMaxHeight, widgetDefaultSize: (_e = theme === null || theme === void 0 ? void 0 : theme.widgetDefaultSize) !== null && _e !== void 0 ? _e : config.widgetDefaultSize }));
|
|
15
|
-
const minW = Math.min(t.widgetMinWidth, t.widgetMaxWidth);
|
|
16
|
-
const maxW = Math.max(t.widgetMinWidth, t.widgetMaxWidth);
|
|
17
|
-
const minH = Math.min(t.widgetMinHeight, t.widgetMaxHeight);
|
|
18
|
-
const maxH = Math.max(t.widgetMinHeight, t.widgetMaxHeight);
|
|
19
|
-
const [sizeRatio, setSizeRatio] = useState(t.widgetDefaultSize);
|
|
20
|
-
const widthPx = minW + (maxW - minW) * sizeRatio;
|
|
21
|
-
const heightPx = minH + (maxH - minH) * sizeRatio;
|
|
22
|
-
const [bottomTab, setBottomTab] = useState('home');
|
|
23
|
-
const [homeFlow, setHomeFlow] = useState('home');
|
|
24
|
-
const [pickUserMode, setPickUserMode] = useState(null);
|
|
25
|
-
const [tickets, setTickets] = useState([]);
|
|
26
|
-
const [ticketSubject, setTicketSubject] = useState('');
|
|
27
|
-
const [ticketBody, setTicketBody] = useState('');
|
|
28
|
-
const userListUrl = buildUserListUrl(config);
|
|
29
|
-
const filterType = pickUserMode === 'support'
|
|
30
|
-
? 'developer'
|
|
31
|
-
: pickUserMode === 'conversation'
|
|
32
|
-
? 'user'
|
|
33
|
-
: config.chatType === 'SUPPORT'
|
|
34
|
-
? 'developer'
|
|
35
|
-
: config.chatType === 'CHAT'
|
|
36
|
-
? 'user'
|
|
37
|
-
: 'developer';
|
|
38
|
-
const { users, loading, error } = useUsers({
|
|
39
|
-
url: userListUrl,
|
|
40
|
-
filterType,
|
|
41
|
-
enabled: config.status === 'ACTIVE' && homeFlow === 'pickUser',
|
|
42
|
-
});
|
|
43
|
-
const { messages, activeUser, recentChats, selectUser, sendMessage, openRecent, } = useChat();
|
|
44
|
-
const positionStyle = buttonPosition === 'bottom-left'
|
|
45
|
-
? { left: '24px', right: 'auto' }
|
|
46
|
-
: { right: '24px', left: 'auto' };
|
|
47
|
-
const goHomeCards = useCallback(() => {
|
|
48
|
-
setHomeFlow('home');
|
|
49
|
-
setPickUserMode(null);
|
|
50
|
-
}, []);
|
|
51
|
-
const handleBackFromChat = useCallback(() => {
|
|
52
|
-
if (pickUserMode) {
|
|
53
|
-
setHomeFlow('pickUser');
|
|
54
|
-
return;
|
|
55
|
-
}
|
|
56
|
-
setBottomTab('chats');
|
|
57
|
-
setHomeFlow('home');
|
|
58
|
-
}, [pickUserMode]);
|
|
59
|
-
const handleBottomTab = useCallback((tab) => {
|
|
60
|
-
setBottomTab(tab);
|
|
61
|
-
goHomeCards();
|
|
62
|
-
}, [goHomeCards]);
|
|
63
|
-
const startSupport = useCallback(() => {
|
|
64
|
-
setPickUserMode('support');
|
|
65
|
-
setHomeFlow('pickUser');
|
|
66
|
-
}, []);
|
|
67
|
-
const startConversation = useCallback(() => {
|
|
68
|
-
setPickUserMode('conversation');
|
|
69
|
-
setHomeFlow('pickUser');
|
|
70
|
-
}, []);
|
|
71
|
-
const startRaiseTicket = useCallback(() => {
|
|
72
|
-
setHomeFlow('raiseTicket');
|
|
73
|
-
setTicketSubject('');
|
|
74
|
-
setTicketBody('');
|
|
75
|
-
}, []);
|
|
76
|
-
const submitTicket = useCallback(() => {
|
|
77
|
-
if (!ticketSubject.trim())
|
|
78
|
-
return;
|
|
79
|
-
const id = `tkt_${Date.now()}`;
|
|
80
|
-
setTickets((prev) => [
|
|
81
|
-
{
|
|
82
|
-
id,
|
|
83
|
-
subject: ticketSubject.trim(),
|
|
84
|
-
body: ticketBody.trim(),
|
|
85
|
-
createdAt: new Date(),
|
|
86
|
-
status: 'open',
|
|
87
|
-
},
|
|
88
|
-
...prev,
|
|
89
|
-
]);
|
|
90
|
-
setHomeFlow('home');
|
|
91
|
-
setBottomTab('tickets');
|
|
92
|
-
}, [ticketSubject, ticketBody]);
|
|
93
|
-
const pickUserHeader = useMemo(() => {
|
|
94
|
-
if (pickUserMode === 'support')
|
|
95
|
-
return 'Support';
|
|
96
|
-
if (pickUserMode === 'conversation')
|
|
97
|
-
return 'New conversation';
|
|
98
|
-
return 'People';
|
|
99
|
-
}, [pickUserMode]);
|
|
100
|
-
return (_jsxs("div", { style: Object.assign(Object.assign({ position: 'fixed', bottom: '90px' }, positionStyle), { zIndex: 9998, width: `${widthPx}px`, maxWidth: 'calc(100vw - 32px)', height: `${heightPx}px`, maxHeight: 'calc(100vh - 120px)', backgroundColor: t.backgroundColor, borderRadius: t.borderRadius, boxShadow: '0 24px 80px rgba(0,0,0,0.18), 0 8px 24px rgba(0,0,0,0.08)', display: 'flex', flexDirection: 'column', overflow: 'hidden', fontFamily: t.fontFamily, animation: 'cw-slideUp 0.3s cubic-bezier(0.34, 1.56, 0.64, 1)' }), children: [_jsx("style", { children: `
|
|
101
|
-
@import url('https://fonts.googleapis.com/css2?family=DM+Sans:wght@400;500;600;700&display=swap');
|
|
102
|
-
@keyframes cw-slideUp {
|
|
103
|
-
from { opacity: 0; transform: translateY(20px) scale(0.97); }
|
|
104
|
-
to { opacity: 1; transform: translateY(0) scale(1); }
|
|
105
|
-
}
|
|
106
|
-
@keyframes cw-slideFromRight {
|
|
107
|
-
from { opacity: 0; transform: translateX(24px); }
|
|
108
|
-
to { opacity: 1; transform: translateX(0); }
|
|
109
|
-
}
|
|
110
|
-
@keyframes shimmer {
|
|
111
|
-
0% { background-position: 200% 0; }
|
|
112
|
-
100% { background-position: -200% 0; }
|
|
113
|
-
}
|
|
114
|
-
::-webkit-scrollbar { width: 4px; }
|
|
115
|
-
::-webkit-scrollbar-track { background: transparent; }
|
|
116
|
-
::-webkit-scrollbar-thumb { background: #e0e0e0; border-radius: 4px; }
|
|
117
|
-
` }), config.status === 'MAINTENANCE' ? (_jsx(MaintenanceView, { fontFamily: t.fontFamily, primaryColor: t.primaryColor })) : (_jsxs(_Fragment, { children: [_jsxs("div", { style: { flex: 1, display: 'flex', flexDirection: 'column', minHeight: 0, overflow: 'hidden' }, children: [bottomTab === 'home' && homeFlow === 'home' && (_jsx(HomeView, { primaryColor: t.primaryColor, fontFamily: t.fontFamily, showNeedSupport: config.showNeedSupport, showNewConversation: config.showNewConversation, onNeedSupport: startSupport, onNewConversation: startConversation, onRaiseTicket: startRaiseTicket, onClose: onClose })), bottomTab === 'home' && homeFlow === 'pickUser' && (_jsxs("div", { style: {
|
|
118
|
-
flex: 1,
|
|
119
|
-
display: 'flex',
|
|
120
|
-
flexDirection: 'column',
|
|
121
|
-
minHeight: 0,
|
|
122
|
-
backgroundColor: '#fff',
|
|
123
|
-
animation: 'cw-slideFromRight 0.28s ease-out',
|
|
124
|
-
}, children: [_jsxs("div", { style: {
|
|
125
|
-
flexShrink: 0,
|
|
126
|
-
padding: '14px 16px',
|
|
127
|
-
backgroundColor: t.primaryColor,
|
|
128
|
-
color: '#fff',
|
|
129
|
-
display: 'flex',
|
|
130
|
-
alignItems: 'center',
|
|
131
|
-
gap: '12px',
|
|
132
|
-
}, children: [_jsx("button", { type: "button", onClick: goHomeCards, "aria-label": "Back", style: {
|
|
133
|
-
background: 'transparent',
|
|
134
|
-
border: 'none',
|
|
135
|
-
color: '#fff',
|
|
136
|
-
cursor: 'pointer',
|
|
137
|
-
padding: '4px',
|
|
138
|
-
}, children: _jsx("svg", { width: "22", height: "22", viewBox: "0 0 24 24", fill: "none", children: _jsx("path", { d: "M15 18L9 12L15 6", stroke: "currentColor", strokeWidth: "2", strokeLinecap: "round", strokeLinejoin: "round" }) }) }), _jsx("div", { style: { fontWeight: 700, fontSize: '16px' }, children: pickUserHeader })] }), _jsxs("div", { style: { flex: 1, overflow: 'hidden', display: 'flex', flexDirection: 'column' }, children: [_jsx("div", { style: {
|
|
139
|
-
padding: '10px 16px',
|
|
140
|
-
fontSize: '11px',
|
|
141
|
-
fontWeight: 700,
|
|
142
|
-
color: '#bbb',
|
|
143
|
-
textTransform: 'uppercase',
|
|
144
|
-
letterSpacing: '0.08em',
|
|
145
|
-
borderBottom: '1px solid #f0f0f0',
|
|
146
|
-
}, children: "Select a contact" }), _jsx(UserList, { users: users, loading: loading, error: error, activeUserId: (_f = activeUser === null || activeUser === void 0 ? void 0 : activeUser.uid) !== null && _f !== void 0 ? _f : null, onSelectUser: (u) => {
|
|
147
|
-
selectUser(u);
|
|
148
|
-
setHomeFlow('chat');
|
|
149
|
-
}, primaryColor: t.primaryColor, fontFamily: t.fontFamily })] })] })), bottomTab === 'home' && homeFlow === 'chat' && (_jsx("div", { style: {
|
|
150
|
-
flex: 1,
|
|
151
|
-
display: 'flex',
|
|
152
|
-
flexDirection: 'column',
|
|
153
|
-
minHeight: 0,
|
|
154
|
-
animation: 'cw-slideFromRight 0.28s ease-out',
|
|
155
|
-
}, children: _jsx(ChatBox, { activeUser: activeUser, messages: messages, onSendMessage: sendMessage, primaryColor: t.primaryColor, fontFamily: t.fontFamily, variant: "minimal", onBack: handleBackFromChat, onClose: onClose, headerTitle: activeUser === null || activeUser === void 0 ? void 0 : activeUser.name }) })), bottomTab === 'home' && homeFlow === 'raiseTicket' && (_jsxs("div", { style: {
|
|
156
|
-
flex: 1,
|
|
157
|
-
display: 'flex',
|
|
158
|
-
flexDirection: 'column',
|
|
159
|
-
minHeight: 0,
|
|
160
|
-
backgroundColor: '#fff',
|
|
161
|
-
animation: 'cw-slideFromRight 0.28s ease-out',
|
|
162
|
-
}, children: [_jsxs("div", { style: {
|
|
163
|
-
flexShrink: 0,
|
|
164
|
-
padding: '14px 16px',
|
|
165
|
-
backgroundColor: t.primaryColor,
|
|
166
|
-
color: '#fff',
|
|
167
|
-
display: 'flex',
|
|
168
|
-
alignItems: 'center',
|
|
169
|
-
justifyContent: 'space-between',
|
|
170
|
-
}, children: [_jsx("button", { type: "button", onClick: goHomeCards, "aria-label": "Back", style: {
|
|
171
|
-
background: 'transparent',
|
|
172
|
-
border: 'none',
|
|
173
|
-
color: '#fff',
|
|
174
|
-
cursor: 'pointer',
|
|
175
|
-
padding: '4px',
|
|
176
|
-
}, children: _jsx("svg", { width: "22", height: "22", viewBox: "0 0 24 24", fill: "none", children: _jsx("path", { d: "M15 18L9 12L15 6", stroke: "currentColor", strokeWidth: "2", strokeLinecap: "round", strokeLinejoin: "round" }) }) }), _jsx("span", { style: { fontWeight: 700, fontSize: '16px' }, children: "Raise ticket" }), _jsx("button", { type: "button", onClick: onClose, "aria-label": "Close", style: {
|
|
177
|
-
background: 'transparent',
|
|
178
|
-
border: 'none',
|
|
179
|
-
color: '#fff',
|
|
180
|
-
cursor: 'pointer',
|
|
181
|
-
padding: '4px',
|
|
182
|
-
}, children: _jsxs("svg", { width: "20", height: "20", viewBox: "0 0 24 24", fill: "none", children: [_jsx("line", { x1: "18", y1: "6", x2: "6", y2: "18", stroke: "currentColor", strokeWidth: "2", strokeLinecap: "round" }), _jsx("line", { x1: "6", y1: "6", x2: "18", y2: "18", stroke: "currentColor", strokeWidth: "2", strokeLinecap: "round" })] }) })] }), _jsxs("div", { style: { padding: '20px', flex: 1, overflowY: 'auto' }, children: [_jsx("label", { style: { display: 'block', fontSize: '12px', fontWeight: 600, color: '#666', marginBottom: '6px' }, children: "Subject" }), _jsx("input", { value: ticketSubject, onChange: (e) => setTicketSubject(e.target.value), placeholder: "Brief summary", style: {
|
|
183
|
-
width: '100%',
|
|
184
|
-
boxSizing: 'border-box',
|
|
185
|
-
padding: '10px 12px',
|
|
186
|
-
borderRadius: '10px',
|
|
187
|
-
border: '1px solid #e5e5e5',
|
|
188
|
-
fontFamily: t.fontFamily,
|
|
189
|
-
fontSize: '14px',
|
|
190
|
-
marginBottom: '16px',
|
|
191
|
-
} }), _jsx("label", { style: { display: 'block', fontSize: '12px', fontWeight: 600, color: '#666', marginBottom: '6px' }, children: "Description" }), _jsx("textarea", { value: ticketBody, onChange: (e) => setTicketBody(e.target.value), placeholder: "Describe the issue or change\u2026", rows: 5, style: {
|
|
192
|
-
width: '100%',
|
|
193
|
-
boxSizing: 'border-box',
|
|
194
|
-
padding: '10px 12px',
|
|
195
|
-
borderRadius: '10px',
|
|
196
|
-
border: '1px solid #e5e5e5',
|
|
197
|
-
fontFamily: t.fontFamily,
|
|
198
|
-
fontSize: '14px',
|
|
199
|
-
resize: 'vertical',
|
|
200
|
-
} }), _jsx("button", { type: "button", onClick: submitTicket, style: {
|
|
201
|
-
marginTop: '18px',
|
|
202
|
-
width: '100%',
|
|
203
|
-
padding: '12px',
|
|
204
|
-
borderRadius: '10px',
|
|
205
|
-
border: 'none',
|
|
206
|
-
backgroundColor: t.primaryColor,
|
|
207
|
-
color: '#fff',
|
|
208
|
-
fontWeight: 700,
|
|
209
|
-
fontFamily: t.fontFamily,
|
|
210
|
-
cursor: 'pointer',
|
|
211
|
-
fontSize: '15px',
|
|
212
|
-
}, children: "Submit ticket" })] })] })), bottomTab === 'chats' && (_jsxs("div", { style: {
|
|
213
|
-
flex: 1,
|
|
214
|
-
display: 'flex',
|
|
215
|
-
flexDirection: 'column',
|
|
216
|
-
minHeight: 0,
|
|
217
|
-
backgroundColor: '#fff',
|
|
218
|
-
}, children: [_jsxs("div", { style: {
|
|
219
|
-
padding: '16px 20px',
|
|
220
|
-
backgroundColor: t.primaryColor,
|
|
221
|
-
color: '#fff',
|
|
222
|
-
fontWeight: 700,
|
|
223
|
-
fontSize: '17px',
|
|
224
|
-
display: 'flex',
|
|
225
|
-
alignItems: 'center',
|
|
226
|
-
justifyContent: 'space-between',
|
|
227
|
-
}, children: ["Recent chats", _jsx("button", { type: "button", onClick: onClose, "aria-label": "Close", style: {
|
|
228
|
-
background: 'transparent',
|
|
229
|
-
border: 'none',
|
|
230
|
-
color: '#fff',
|
|
231
|
-
cursor: 'pointer',
|
|
232
|
-
}, children: _jsxs("svg", { width: "20", height: "20", viewBox: "0 0 24 24", fill: "none", children: [_jsx("line", { x1: "18", y1: "6", x2: "6", y2: "18", stroke: "currentColor", strokeWidth: "2", strokeLinecap: "round" }), _jsx("line", { x1: "6", y1: "6", x2: "18", y2: "18", stroke: "currentColor", strokeWidth: "2", strokeLinecap: "round" })] }) })] }), _jsx("div", { style: { flex: 1, overflowY: 'auto' }, children: recentChats.length === 0 ? (_jsx("p", { style: { padding: '24px', textAlign: 'center', color: '#aaa', fontSize: '14px', margin: 0 }, children: "No recent chats yet" })) : (recentChats.map((r) => (_jsxs("button", { type: "button", onClick: () => {
|
|
233
|
-
openRecent(r.user);
|
|
234
|
-
setBottomTab('home');
|
|
235
|
-
setHomeFlow('chat');
|
|
236
|
-
setPickUserMode(null);
|
|
237
|
-
}, style: {
|
|
238
|
-
width: '100%',
|
|
239
|
-
padding: '14px 18px',
|
|
240
|
-
border: 'none',
|
|
241
|
-
borderBottom: '1px solid #f0f0f0',
|
|
242
|
-
background: '#fff',
|
|
243
|
-
textAlign: 'left',
|
|
244
|
-
cursor: 'pointer',
|
|
245
|
-
fontFamily: t.fontFamily,
|
|
246
|
-
}, children: [_jsx("div", { style: { fontWeight: 600, color: '#1a1a2e' }, children: r.user.name }), _jsx("div", { style: { fontSize: '13px', color: '#888', marginTop: '4px' }, children: r.lastMessage }), _jsx("div", { style: { fontSize: '11px', color: '#bbb', marginTop: '6px' }, children: r.updatedAt.toLocaleString() })] }, r.user.uid)))) })] })), bottomTab === 'tickets' && (_jsxs("div", { style: {
|
|
247
|
-
flex: 1,
|
|
248
|
-
display: 'flex',
|
|
249
|
-
flexDirection: 'column',
|
|
250
|
-
minHeight: 0,
|
|
251
|
-
backgroundColor: '#fff',
|
|
252
|
-
}, children: [_jsxs("div", { style: {
|
|
253
|
-
padding: '16px 20px',
|
|
254
|
-
backgroundColor: t.primaryColor,
|
|
255
|
-
color: '#fff',
|
|
256
|
-
fontWeight: 700,
|
|
257
|
-
fontSize: '17px',
|
|
258
|
-
display: 'flex',
|
|
259
|
-
alignItems: 'center',
|
|
260
|
-
justifyContent: 'space-between',
|
|
261
|
-
}, children: ["Tickets", _jsx("button", { type: "button", onClick: onClose, "aria-label": "Close", style: {
|
|
262
|
-
background: 'transparent',
|
|
263
|
-
border: 'none',
|
|
264
|
-
color: '#fff',
|
|
265
|
-
cursor: 'pointer',
|
|
266
|
-
}, children: _jsxs("svg", { width: "20", height: "20", viewBox: "0 0 24 24", fill: "none", children: [_jsx("line", { x1: "18", y1: "6", x2: "6", y2: "18", stroke: "currentColor", strokeWidth: "2", strokeLinecap: "round" }), _jsx("line", { x1: "6", y1: "6", x2: "18", y2: "18", stroke: "currentColor", strokeWidth: "2", strokeLinecap: "round" })] }) })] }), _jsx("div", { style: { flex: 1, overflowY: 'auto' }, children: tickets.length === 0 ? (_jsx("p", { style: { padding: '24px', textAlign: 'center', color: '#aaa', fontSize: '14px', margin: 0 }, children: "No tickets yet. Use Home \u2192 Raise Ticket." })) : (tickets.map((tk) => (_jsxs("div", { style: {
|
|
267
|
-
padding: '14px 18px',
|
|
268
|
-
borderBottom: '1px solid #f0f0f0',
|
|
269
|
-
fontFamily: t.fontFamily,
|
|
270
|
-
}, children: [_jsx("div", { style: { fontWeight: 600, color: '#1a1a2e' }, children: tk.subject }), tk.body ? (_jsx("div", { style: { fontSize: '13px', color: '#666', marginTop: '6px', lineHeight: 1.45 }, children: tk.body })) : null, _jsxs("div", { style: { fontSize: '11px', color: '#bbb', marginTop: '8px' }, children: [tk.createdAt.toLocaleString(), " \u00B7 ", tk.status] })] }, tk.id)))) })] }))] }), _jsx("div", { style: {
|
|
271
|
-
padding: '8px 14px 6px',
|
|
272
|
-
borderTop: '1px solid #eee',
|
|
273
|
-
backgroundColor: '#fafafa',
|
|
274
|
-
flexShrink: 0,
|
|
275
|
-
}, children: _jsxs("div", { style: {
|
|
276
|
-
display: 'flex',
|
|
277
|
-
alignItems: 'center',
|
|
278
|
-
gap: '10px',
|
|
279
|
-
fontSize: '11px',
|
|
280
|
-
color: '#888',
|
|
281
|
-
fontFamily: t.fontFamily,
|
|
282
|
-
}, children: [_jsx("span", { style: { flexShrink: 0 }, children: "Size" }), _jsx("input", { type: "range", min: 0, max: 1, step: 0.02, value: sizeRatio, onChange: (e) => setSizeRatio(parseFloat(e.target.value)), "aria-label": "Widget size", style: {
|
|
283
|
-
flex: 1,
|
|
284
|
-
accentColor: t.primaryColor,
|
|
285
|
-
} })] }) }), _jsx(BottomNav, { active: bottomTab, onChange: handleBottomTab, primaryColor: t.primaryColor, fontFamily: t.fontFamily })] }))] }));
|
|
286
|
-
};
|