ajaxter-chat 3.0.9 → 3.0.10
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/components/ChatScreen/index.js +256 -34
- package/dist/components/ChatWidget.js +1 -1
- package/dist/components/TicketFormScreen/index.js +19 -13
- package/dist/components/UserListScreen/index.d.ts +2 -0
- package/dist/components/UserListScreen/index.js +8 -3
- package/dist/types/index.d.ts +2 -0
- package/package.json +1 -1
- package/src/components/ChatScreen/index.tsx +365 -62
- package/src/components/ChatWidget.tsx +1 -0
- package/src/components/TicketFormScreen/index.tsx +15 -4
- package/src/components/UserListScreen/index.tsx +19 -2
- package/src/types/index.ts +2 -0
|
@@ -12,10 +12,13 @@ interface UserListScreenProps {
|
|
|
12
12
|
onSelectUser: (user: ChatUser) => void;
|
|
13
13
|
/** Shown on “New Conversation” list — opens block list */
|
|
14
14
|
onBlockList?: () => void;
|
|
15
|
+
/** “Need Support” (user → agents): show home icon instead of back arrow */
|
|
16
|
+
useHomeHeader?: boolean;
|
|
15
17
|
}
|
|
16
18
|
|
|
17
19
|
export const UserListScreen: React.FC<UserListScreenProps> = ({
|
|
18
20
|
context, users, primaryColor, viewerType = 'user', onBack, onSelectUser, onBlockList,
|
|
21
|
+
useHomeHeader = false,
|
|
19
22
|
}) => {
|
|
20
23
|
const isStaff = viewerType === 'developer';
|
|
21
24
|
const title = context === 'support'
|
|
@@ -29,7 +32,7 @@ export const UserListScreen: React.FC<UserListScreenProps> = ({
|
|
|
29
32
|
<div style={{ display:'flex', flexDirection:'column', height:'100%', animation:'cw-slideIn 0.22s ease' }}>
|
|
30
33
|
{/* Header */}
|
|
31
34
|
<div style={{ background:`linear-gradient(135deg,${primaryColor},${primaryColor}cc)`, padding:'14px 18px', display:'flex', alignItems:'center', gap:12, flexShrink:0, position:'relative' }}>
|
|
32
|
-
<BackBtn onClick={onBack} />
|
|
35
|
+
{useHomeHeader ? <HomeBtn onClick={onBack} /> : <BackBtn onClick={onBack} />}
|
|
33
36
|
<div style={{ flex: 1, minWidth: 0 }}>
|
|
34
37
|
<div style={{ fontWeight:700, fontSize:16, color:'#fff' }}>{title}</div>
|
|
35
38
|
<div style={{ fontSize:12, color:'rgba(255,255,255,0.8)' }}>{subtitle}</div>
|
|
@@ -119,7 +122,7 @@ export const UserListScreen: React.FC<UserListScreenProps> = ({
|
|
|
119
122
|
};
|
|
120
123
|
|
|
121
124
|
const BackBtn: React.FC<{ onClick: () => void }> = ({ onClick }) => (
|
|
122
|
-
<button onClick={onClick} style={{
|
|
125
|
+
<button type="button" onClick={onClick} style={{
|
|
123
126
|
background:'rgba(255,255,255,0.22)', border:'none', borderRadius:'50%',
|
|
124
127
|
width:32, height:32, display:'flex', alignItems:'center', justifyContent:'center',
|
|
125
128
|
cursor:'pointer', flexShrink:0,
|
|
@@ -130,6 +133,20 @@ const BackBtn: React.FC<{ onClick: () => void }> = ({ onClick }) => (
|
|
|
130
133
|
</button>
|
|
131
134
|
);
|
|
132
135
|
|
|
136
|
+
const HomeBtn: React.FC<{ onClick: () => void }> = ({ onClick }) => (
|
|
137
|
+
<button type="button" onClick={onClick} title="Home" aria-label="Home" style={{
|
|
138
|
+
background:'rgba(255,255,255,0.22)', border:'none', borderRadius:'50%',
|
|
139
|
+
width:32, height:32, display:'flex', alignItems:'center', justifyContent:'center',
|
|
140
|
+
cursor:'pointer', flexShrink:0,
|
|
141
|
+
}}>
|
|
142
|
+
<svg width="18" height="18" viewBox="0 0 24 24" fill="none">
|
|
143
|
+
<path d="M3 9.5L12 3l9 6.5V20a1 1 0 01-1 1H4a1 1 0 01-1-1V9.5z"
|
|
144
|
+
stroke="#fff" strokeWidth="2.2" fill="none" strokeLinecap="round" strokeLinejoin="round" />
|
|
145
|
+
<path d="M9 21V12h6v9" stroke="#fff" strokeWidth="2.2" strokeLinecap="round" strokeLinejoin="round" />
|
|
146
|
+
</svg>
|
|
147
|
+
</button>
|
|
148
|
+
);
|
|
149
|
+
|
|
133
150
|
const Empty: React.FC = () => (
|
|
134
151
|
<div style={{ padding:'50px 24px', textAlign:'center' }}>
|
|
135
152
|
<div style={{ fontSize:36, marginBottom:10 }}>👥</div>
|
package/src/types/index.ts
CHANGED
|
@@ -98,6 +98,8 @@ export interface ChatMessage {
|
|
|
98
98
|
attachmentSize?: string;
|
|
99
99
|
/** Blob URL for attachment download (local send) */
|
|
100
100
|
attachmentUrl?: string;
|
|
101
|
+
/** e.g. image/png — used for inline image preview in bubbles */
|
|
102
|
+
attachmentMime?: string;
|
|
101
103
|
voiceDuration?: number; // seconds
|
|
102
104
|
/** Blob URL for in-bubble audio playback (local recording) */
|
|
103
105
|
voiceUrl?: string;
|