shopify-chatbot-widget 0.0.4
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 +69 -0
- package/eslint.config.js +23 -0
- package/index.html +13 -0
- package/package-lock 2.json +4493 -0
- package/package.json +43 -0
- package/public/vite.svg +1 -0
- package/src/App.css +42 -0
- package/src/App.tsx +13 -0
- package/src/Chatbot/Chatbot.css +154 -0
- package/src/Chatbot/Chatbot.tsx +207 -0
- package/src/Chatbot/components/ChatInput.css +127 -0
- package/src/Chatbot/components/ChatInput.tsx +262 -0
- package/src/Chatbot/components/Messages/Addcart.tsx +70 -0
- package/src/Chatbot/components/Messages/AgentStatus.tsx +37 -0
- package/src/Chatbot/components/Messages/AssistantMesage.tsx +316 -0
- package/src/Chatbot/components/Messages/AudioMessage.tsx +123 -0
- package/src/Chatbot/components/Messages/CartWidget.tsx +116 -0
- package/src/Chatbot/components/Messages/ChatImage.tsx +46 -0
- package/src/Chatbot/components/Messages/ChatImageText.tsx +74 -0
- package/src/Chatbot/components/Messages/ChatImageTextAssis.tsx +72 -0
- package/src/Chatbot/components/Messages/ChatMessages.css +5 -0
- package/src/Chatbot/components/Messages/ChatMessages.tsx +284 -0
- package/src/Chatbot/components/Messages/Support.tsx +177 -0
- package/src/Chatbot/components/Messages/Typing.css +27 -0
- package/src/Chatbot/components/Messages/Typing.tsx +14 -0
- package/src/Chatbot/components/Messages/ZidAssistantMesage.tsx +142 -0
- package/src/Chatbot/components/Messenger/Messenger.tsx +521 -0
- package/src/Chatbot/components/Notification.tsx +27 -0
- package/src/Chatbot/components/Powered.css +16 -0
- package/src/Chatbot/components/Powered.tsx +13 -0
- package/src/Chatbot/components/Sessions/CreateSession.tsx +139 -0
- package/src/Chatbot/components/Sessions/RenderList.tsx +202 -0
- package/src/Chatbot/components/Suggestions.css +34 -0
- package/src/Chatbot/components/Suggestions.tsx +28 -0
- package/src/assets/react.svg +1 -0
- package/src/chatbot-widget/index.tsx +14 -0
- package/src/hooks/config.tsx +13 -0
- package/src/hooks/useCart.tsx +99 -0
- package/src/hooks/useChatbotAPI.tsx +160 -0
- package/src/hooks/useChatbotData.tsx +129 -0
- package/src/hooks/useSessionMessages.tsx +51 -0
- package/src/hooks/useWebsocke.tsx +45 -0
- package/src/i18n.tsx +30 -0
- package/src/index.css +1 -0
- package/src/main.tsx +10 -0
- package/src/types/chatbot.ts +38 -0
- package/src/utils/cookies.tsx +14 -0
- package/src/vite-env.d.ts +1 -0
- package/tsconfig.app.json +27 -0
- package/tsconfig.json +7 -0
- package/tsconfig.node.json +25 -0
- package/vite.config.ts +18 -0
package/package.json
ADDED
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "shopify-chatbot-widget",
|
|
3
|
+
"private": false,
|
|
4
|
+
"version": "0.0.4",
|
|
5
|
+
"type": "module",
|
|
6
|
+
"scripts": {
|
|
7
|
+
"dev": "vite",
|
|
8
|
+
"build": "tsc -b && vite build",
|
|
9
|
+
"lint": "eslint .",
|
|
10
|
+
"preview": "vite preview"
|
|
11
|
+
},
|
|
12
|
+
"dependencies": {
|
|
13
|
+
"@fingerprintjs/fingerprintjs": "^4.6.2",
|
|
14
|
+
"@tailwindcss/vite": "^4.1.11",
|
|
15
|
+
"antd": "^5.26.4",
|
|
16
|
+
"axios": "^1.10.0",
|
|
17
|
+
"framer-motion": "^12.23.6",
|
|
18
|
+
"js-cookie": "^3.0.5",
|
|
19
|
+
"lucide-react": "^0.525.0",
|
|
20
|
+
"react": "^19.1.0",
|
|
21
|
+
"react-dom": "^19.1.0",
|
|
22
|
+
"react-i18next": "^15.6.0",
|
|
23
|
+
"wavesurfer.js": "^7.9.9"
|
|
24
|
+
},
|
|
25
|
+
"devDependencies": {
|
|
26
|
+
"@eslint/js": "^9.30.1",
|
|
27
|
+
"@types/axios": "^0.9.36",
|
|
28
|
+
"@types/js-cookie": "^3.0.6",
|
|
29
|
+
"@types/react": "^19.1.8",
|
|
30
|
+
"@types/react-dom": "^19.1.6",
|
|
31
|
+
"@vitejs/plugin-react": "^4.6.0",
|
|
32
|
+
"autoprefixer": "^10.4.21",
|
|
33
|
+
"eslint": "^9.30.1",
|
|
34
|
+
"eslint-plugin-react-hooks": "^5.2.0",
|
|
35
|
+
"eslint-plugin-react-refresh": "^0.4.20",
|
|
36
|
+
"globals": "^16.3.0",
|
|
37
|
+
"postcss": "^8.5.6",
|
|
38
|
+
"tailwindcss": "^4.1.11",
|
|
39
|
+
"typescript": "~5.8.3",
|
|
40
|
+
"typescript-eslint": "^8.35.1",
|
|
41
|
+
"vite": "^7.0.4"
|
|
42
|
+
}
|
|
43
|
+
}
|
package/public/vite.svg
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
<svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" aria-hidden="true" role="img" class="iconify iconify--logos" width="31.88" height="32" preserveAspectRatio="xMidYMid meet" viewBox="0 0 256 257"><defs><linearGradient id="IconifyId1813088fe1fbc01fb466" x1="-.828%" x2="57.636%" y1="7.652%" y2="78.411%"><stop offset="0%" stop-color="#41D1FF"></stop><stop offset="100%" stop-color="#BD34FE"></stop></linearGradient><linearGradient id="IconifyId1813088fe1fbc01fb467" x1="43.376%" x2="50.316%" y1="2.242%" y2="89.03%"><stop offset="0%" stop-color="#FFEA83"></stop><stop offset="8.333%" stop-color="#FFDD35"></stop><stop offset="100%" stop-color="#FFA800"></stop></linearGradient></defs><path fill="url(#IconifyId1813088fe1fbc01fb466)" d="M255.153 37.938L134.897 252.976c-2.483 4.44-8.862 4.466-11.382.048L.875 37.958c-2.746-4.814 1.371-10.646 6.827-9.67l120.385 21.517a6.537 6.537 0 0 0 2.322-.004l117.867-21.483c5.438-.991 9.574 4.796 6.877 9.62Z"></path><path fill="url(#IconifyId1813088fe1fbc01fb467)" d="M185.432.063L96.44 17.501a3.268 3.268 0 0 0-2.634 3.014l-5.474 92.456a3.268 3.268 0 0 0 3.997 3.378l24.777-5.718c2.318-.535 4.413 1.507 3.936 3.838l-7.361 36.047c-.495 2.426 1.782 4.5 4.151 3.78l15.304-4.649c2.372-.72 4.652 1.36 4.15 3.788l-11.698 56.621c-.732 3.542 3.979 5.473 5.943 2.437l1.313-2.028l72.516-144.72c1.215-2.423-.88-5.186-3.54-4.672l-25.505 4.922c-2.396.462-4.435-1.77-3.759-4.114l16.646-57.705c.677-2.35-1.37-4.583-3.769-4.113Z"></path></svg>
|
package/src/App.css
ADDED
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
#root {
|
|
2
|
+
max-width: 1280px;
|
|
3
|
+
margin: 0 auto;
|
|
4
|
+
padding: 2rem;
|
|
5
|
+
text-align: center;
|
|
6
|
+
}
|
|
7
|
+
|
|
8
|
+
.logo {
|
|
9
|
+
height: 6em;
|
|
10
|
+
padding: 1.5em;
|
|
11
|
+
will-change: filter;
|
|
12
|
+
transition: filter 300ms;
|
|
13
|
+
}
|
|
14
|
+
.logo:hover {
|
|
15
|
+
filter: drop-shadow(0 0 2em #646cffaa);
|
|
16
|
+
}
|
|
17
|
+
.logo.react:hover {
|
|
18
|
+
filter: drop-shadow(0 0 2em #61dafbaa);
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
@keyframes logo-spin {
|
|
22
|
+
from {
|
|
23
|
+
transform: rotate(0deg);
|
|
24
|
+
}
|
|
25
|
+
to {
|
|
26
|
+
transform: rotate(360deg);
|
|
27
|
+
}
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
@media (prefers-reduced-motion: no-preference) {
|
|
31
|
+
a:nth-of-type(2) .logo {
|
|
32
|
+
animation: logo-spin infinite 20s linear;
|
|
33
|
+
}
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
.card {
|
|
37
|
+
padding: 2em;
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
.read-the-docs {
|
|
41
|
+
color: #888;
|
|
42
|
+
}
|
package/src/App.tsx
ADDED
|
@@ -0,0 +1,154 @@
|
|
|
1
|
+
.jaweb-chatbot-container {
|
|
2
|
+
position: fixed;
|
|
3
|
+
bottom: 20px;
|
|
4
|
+
right: 20px;
|
|
5
|
+
z-index: 9999;
|
|
6
|
+
|
|
7
|
+
}
|
|
8
|
+
|
|
9
|
+
/* Tailwind global CSS file */
|
|
10
|
+
.scrollbar-hide::-webkit-scrollbar {
|
|
11
|
+
display: none;
|
|
12
|
+
}
|
|
13
|
+
.scrollbar-hide {
|
|
14
|
+
-ms-overflow-style: none;
|
|
15
|
+
scrollbar-width: none;
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
|
|
19
|
+
.chatbot-box {
|
|
20
|
+
position: fixed;
|
|
21
|
+
bottom: 5%;
|
|
22
|
+
right: 10px;
|
|
23
|
+
width: 28%;
|
|
24
|
+
top: 2%;
|
|
25
|
+
z-index: 9999;
|
|
26
|
+
height: 86%;
|
|
27
|
+
background: #ffffff;
|
|
28
|
+
color: #000000;
|
|
29
|
+
border-radius: 12px;
|
|
30
|
+
overflow: hidden;
|
|
31
|
+
display: flex;
|
|
32
|
+
flex-direction: column;
|
|
33
|
+
box-shadow: 0 8px 24px rgba(0, 0, 0, 0.2);
|
|
34
|
+
font-family: 'Inter', sans-serif;
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
|
|
38
|
+
|
|
39
|
+
|
|
40
|
+
/* Mobile responsiveness */
|
|
41
|
+
|
|
42
|
+
.chatbot-header {
|
|
43
|
+
background: #f7f7f7;
|
|
44
|
+
padding: 16px;
|
|
45
|
+
display: flex;
|
|
46
|
+
align-items: center;
|
|
47
|
+
height: 8%;
|
|
48
|
+
gap: 12px;
|
|
49
|
+
font-size: 16px;
|
|
50
|
+
font-weight: bold;
|
|
51
|
+
border-bottom: 1px solid #e0e0e0;
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
.chatbot-title {
|
|
55
|
+
flex-grow: 1;
|
|
56
|
+
}
|
|
57
|
+
|
|
58
|
+
.chatbot-close {
|
|
59
|
+
cursor: pointer;
|
|
60
|
+
font-size: 16px;
|
|
61
|
+
color: #888;
|
|
62
|
+
}
|
|
63
|
+
|
|
64
|
+
.chatbot-messages {
|
|
65
|
+
flex: 1;
|
|
66
|
+
padding: 16px;
|
|
67
|
+
overflow-y: auto;
|
|
68
|
+
display: flex;
|
|
69
|
+
flex-direction: column;
|
|
70
|
+
height: 70%;
|
|
71
|
+
gap: 12px;
|
|
72
|
+
background-color: #fafafa;
|
|
73
|
+
|
|
74
|
+
/* Hide scrollbar for all browsers */
|
|
75
|
+
scrollbar-width: none; /* Firefox */
|
|
76
|
+
-ms-overflow-style: none; /* Internet Explorer 10+ */
|
|
77
|
+
}
|
|
78
|
+
|
|
79
|
+
/* Hide scrollbar for WebKit-based browsers (Chrome, Safari) */
|
|
80
|
+
.chatbot-messages::-webkit-scrollbar {
|
|
81
|
+
display: none;
|
|
82
|
+
}
|
|
83
|
+
|
|
84
|
+
|
|
85
|
+
.chat-msg {
|
|
86
|
+
max-width: 85%;
|
|
87
|
+
padding: 10px 14px;
|
|
88
|
+
border-radius: 16px;
|
|
89
|
+
font-size: 14px;
|
|
90
|
+
line-height: 1.4;
|
|
91
|
+
word-break: break-word;
|
|
92
|
+
}
|
|
93
|
+
|
|
94
|
+
.chat-msg.assistant {
|
|
95
|
+
background: #f0f0f0;
|
|
96
|
+
align-self: flex-start;
|
|
97
|
+
color: #000;
|
|
98
|
+
}
|
|
99
|
+
|
|
100
|
+
.chat-msg.user {
|
|
101
|
+
background: #7f28f8;
|
|
102
|
+
align-self: flex-end;
|
|
103
|
+
color: white;
|
|
104
|
+
}
|
|
105
|
+
|
|
106
|
+
.chatbot-input-area {
|
|
107
|
+
width: 100%;
|
|
108
|
+
display: flex;
|
|
109
|
+
flex-direction: column;
|
|
110
|
+
height:22%;
|
|
111
|
+
align-items: center;
|
|
112
|
+
background: #ffffff;
|
|
113
|
+
border-top: 1px solid #e0e0e0;
|
|
114
|
+
|
|
115
|
+
}
|
|
116
|
+
|
|
117
|
+
.typing-animation span {
|
|
118
|
+
display: inline-block;
|
|
119
|
+
animation: blink 1.2s infinite;
|
|
120
|
+
font-size: 18px;
|
|
121
|
+
margin: 0 2px;
|
|
122
|
+
}
|
|
123
|
+
|
|
124
|
+
.typing-animation span:nth-child(2) {
|
|
125
|
+
animation-delay: 0.2s;
|
|
126
|
+
}
|
|
127
|
+
.typing-animation span:nth-child(3) {
|
|
128
|
+
animation-delay: 0.4s;
|
|
129
|
+
}
|
|
130
|
+
|
|
131
|
+
@keyframes blink {
|
|
132
|
+
0% { opacity: 0.2; }
|
|
133
|
+
20% { opacity: 1; }
|
|
134
|
+
100% { opacity: 0.2; }
|
|
135
|
+
}
|
|
136
|
+
|
|
137
|
+
|
|
138
|
+
|
|
139
|
+
|
|
140
|
+
@media (max-width: 600px) {
|
|
141
|
+
.chatbot-box {
|
|
142
|
+
position: fixed;
|
|
143
|
+
width: 100%;
|
|
144
|
+
height: 100%;
|
|
145
|
+
right: 0;
|
|
146
|
+
bottom: 0;
|
|
147
|
+
top: 0;
|
|
148
|
+
|
|
149
|
+
|
|
150
|
+
}
|
|
151
|
+
.chat-launcher.chatbot-open {
|
|
152
|
+
display: none;
|
|
153
|
+
}
|
|
154
|
+
}
|
|
@@ -0,0 +1,207 @@
|
|
|
1
|
+
import React, { useState,useEffect } from 'react';
|
|
2
|
+
import { Button } from 'antd';
|
|
3
|
+
|
|
4
|
+
import { useChatbotData } from '../hooks/useChatbotData';
|
|
5
|
+
import ChatSessions from './components/Sessions/RenderList';
|
|
6
|
+
import CreateSession from './components/Sessions/CreateSession';
|
|
7
|
+
import Messenger from './components/Messenger/Messenger';
|
|
8
|
+
import './Chatbot.css'
|
|
9
|
+
import config from '../hooks/config';
|
|
10
|
+
import FingerprintJS from '@fingerprintjs/fingerprintjs';
|
|
11
|
+
|
|
12
|
+
const Chatbot: React.FC = () => {
|
|
13
|
+
const [open, setOpen] = useState(false);
|
|
14
|
+
const [viewMode, setViewMode] = useState<'sessions' | 'create' | 'messenger'>('sessions');
|
|
15
|
+
const [activeSessionId, setActiveSessionId] = useState<string | null>(null);
|
|
16
|
+
const [HasInfo,setHasInfo]=useState(false)
|
|
17
|
+
const [activeAgentName,setActiveAgentName]=useState('')
|
|
18
|
+
const [activeAgentImage,setActiveAgentImage]=useState('')
|
|
19
|
+
const [newSession,setNewSession]=useState(false)
|
|
20
|
+
|
|
21
|
+
|
|
22
|
+
const windowWidth = window.innerWidth;
|
|
23
|
+
|
|
24
|
+
const {
|
|
25
|
+
chatbotLogo,
|
|
26
|
+
colorCode,
|
|
27
|
+
subscription,
|
|
28
|
+
messagesSuggestions,
|
|
29
|
+
isFetchingDetails,
|
|
30
|
+
disableForm,
|
|
31
|
+
merchantPhone,
|
|
32
|
+
userType
|
|
33
|
+
} = useChatbotData();
|
|
34
|
+
|
|
35
|
+
const [visitorData, setVisitorData] = useState<{ visitorId: string; country: string } | null>(null);
|
|
36
|
+
|
|
37
|
+
|
|
38
|
+
|
|
39
|
+
const handleNewSessionClick = () => {
|
|
40
|
+
if (HasInfo) {
|
|
41
|
+
const newSessionId = crypto.randomUUID();
|
|
42
|
+
setActiveSessionId(newSessionId);
|
|
43
|
+
setActiveAgentImage(chatbotLogo)
|
|
44
|
+
setActiveAgentName('Ai Agent')
|
|
45
|
+
console.log(activeSessionId)
|
|
46
|
+
setNewSession(true)
|
|
47
|
+
setViewMode('messenger');
|
|
48
|
+
} else {
|
|
49
|
+
setViewMode('create');
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
};
|
|
53
|
+
|
|
54
|
+
useEffect(() => {
|
|
55
|
+
const fetchVisitorInfo = async () => {
|
|
56
|
+
try {
|
|
57
|
+
// 1. Check if we already have a visitorId cached
|
|
58
|
+
let visitorId = localStorage.getItem('visitor_id');
|
|
59
|
+
|
|
60
|
+
if (!visitorId) {
|
|
61
|
+
// 2. Load FingerprintJS and get the visitorId
|
|
62
|
+
const fp = await FingerprintJS.load();
|
|
63
|
+
const result = await fp.get();
|
|
64
|
+
visitorId = result.visitorId;
|
|
65
|
+
|
|
66
|
+
// 3. Cache it for future use
|
|
67
|
+
localStorage.setItem('visitor_id', visitorId);
|
|
68
|
+
}
|
|
69
|
+
|
|
70
|
+
const res = await fetch('https://ipapi.co/json');
|
|
71
|
+
const data = await res.json();
|
|
72
|
+
const ip = data.ip;
|
|
73
|
+
const country = data.country_name;
|
|
74
|
+
|
|
75
|
+
|
|
76
|
+
|
|
77
|
+
// 5. Store locally
|
|
78
|
+
setVisitorData({ visitorId, country });
|
|
79
|
+
|
|
80
|
+
// 6. Send to Django
|
|
81
|
+
const backendRes = await fetch(`${config.apiUrl}register-ip/`, {
|
|
82
|
+
method: 'POST',
|
|
83
|
+
headers: {
|
|
84
|
+
'Content-Type': 'application/json',
|
|
85
|
+
},
|
|
86
|
+
body: JSON.stringify({
|
|
87
|
+
ip_address: ip,
|
|
88
|
+
country,
|
|
89
|
+
visitor_id: visitorId,
|
|
90
|
+
}),
|
|
91
|
+
});
|
|
92
|
+
|
|
93
|
+
const result = await backendRes.json();
|
|
94
|
+
setHasInfo(result.has_user_info || false);
|
|
95
|
+
|
|
96
|
+
} catch (err) {
|
|
97
|
+
console.error('Failed to fetch or send visitor info', err);
|
|
98
|
+
}
|
|
99
|
+
};
|
|
100
|
+
|
|
101
|
+
fetchVisitorInfo();
|
|
102
|
+
}, []);
|
|
103
|
+
|
|
104
|
+
|
|
105
|
+
const handleSessionSelect = (sessionId: string,agentName:string,agentImage:string) => {
|
|
106
|
+
setActiveSessionId(sessionId);
|
|
107
|
+
setActiveAgentName(agentName)
|
|
108
|
+
setActiveAgentImage(agentImage)
|
|
109
|
+
setNewSession(false)
|
|
110
|
+
setViewMode('messenger');
|
|
111
|
+
};
|
|
112
|
+
|
|
113
|
+
|
|
114
|
+
|
|
115
|
+
|
|
116
|
+
return (
|
|
117
|
+
<div>
|
|
118
|
+
{!isFetchingDetails && subscription ? (
|
|
119
|
+
<div
|
|
120
|
+
style={{
|
|
121
|
+
bottom: windowWidth < 768 ? '20%' : 0,
|
|
122
|
+
top: windowWidth < 768 ? '0' : '5%' ,
|
|
123
|
+
height: windowWidth < 768 ? '100%' : '85%',
|
|
124
|
+
borderRadius: 10,
|
|
125
|
+
width: windowWidth < 768 ? '100%' : '100%',
|
|
126
|
+
zIndex: 9999,
|
|
127
|
+
}}
|
|
128
|
+
>
|
|
129
|
+
{open && (
|
|
130
|
+
<div className="chatbot-box">
|
|
131
|
+
{viewMode === 'sessions' && (
|
|
132
|
+
<ChatSessions
|
|
133
|
+
chatbotLogo={chatbotLogo}
|
|
134
|
+
Phone={merchantPhone||''}
|
|
135
|
+
colorCode={colorCode}
|
|
136
|
+
visitorId={visitorData?.visitorId || ''}
|
|
137
|
+
Opened={open}
|
|
138
|
+
setOpen={setOpen}
|
|
139
|
+
onNewSession={handleNewSessionClick}
|
|
140
|
+
onSessionSelect={handleSessionSelect} // ✅ Pass handler
|
|
141
|
+
/>
|
|
142
|
+
)}
|
|
143
|
+
|
|
144
|
+
{viewMode === 'create' && (
|
|
145
|
+
<CreateSession
|
|
146
|
+
colorCode={colorCode}
|
|
147
|
+
visitorId={visitorData?.visitorId || ''}
|
|
148
|
+
country={visitorData?.country || ''}
|
|
149
|
+
onBack={() => setViewMode('sessions')}
|
|
150
|
+
onCreate={(userData) => {
|
|
151
|
+
setActiveSessionId(userData.session_id)
|
|
152
|
+
setHasInfo(userData.hasInfo)
|
|
153
|
+
setViewMode('messenger');
|
|
154
|
+
}}
|
|
155
|
+
/>
|
|
156
|
+
)}
|
|
157
|
+
|
|
158
|
+
{viewMode === 'messenger' && activeSessionId && (
|
|
159
|
+
<Messenger
|
|
160
|
+
sessionId={activeSessionId}
|
|
161
|
+
chatbotLogo={activeAgentImage||chatbotLogo}
|
|
162
|
+
agentName={activeAgentName||'Ai Assistant'}
|
|
163
|
+
colorCode={colorCode}
|
|
164
|
+
messagesSuggestions={messagesSuggestions}
|
|
165
|
+
newSession={newSession}
|
|
166
|
+
disableForm={disableForm}
|
|
167
|
+
setOpen={setOpen}
|
|
168
|
+
setNewSession={setNewSession}
|
|
169
|
+
Opened={open}
|
|
170
|
+
setView={() => setViewMode('sessions')}
|
|
171
|
+
userType={userType}
|
|
172
|
+
/>
|
|
173
|
+
)}
|
|
174
|
+
</div>
|
|
175
|
+
)}
|
|
176
|
+
|
|
177
|
+
|
|
178
|
+
</div>
|
|
179
|
+
) : null}
|
|
180
|
+
|
|
181
|
+
<div
|
|
182
|
+
className="jaweb-chatbot-container">
|
|
183
|
+
|
|
184
|
+
{!isFetchingDetails && subscription ? (
|
|
185
|
+
<Button
|
|
186
|
+
type="primary"
|
|
187
|
+
shape="circle"
|
|
188
|
+
icon={
|
|
189
|
+
<img
|
|
190
|
+
src="https://jaweb.me/wp-content/uploads/2025/03/download__2_-removebg-preview.png"
|
|
191
|
+
alt="Chat Icon"
|
|
192
|
+
style={{ width: 30, height: 30 }}
|
|
193
|
+
/>
|
|
194
|
+
}
|
|
195
|
+
size="large"
|
|
196
|
+
style={{ backgroundColor: colorCode, width: 60, height: 60 }}
|
|
197
|
+
className={`chat-launcher ${open ? 'chatbot-open' : ''}`}
|
|
198
|
+
onClick={() => setOpen(!open)}
|
|
199
|
+
/>
|
|
200
|
+
):null}
|
|
201
|
+
</div>
|
|
202
|
+
</div>
|
|
203
|
+
|
|
204
|
+
);
|
|
205
|
+
};
|
|
206
|
+
|
|
207
|
+
export default Chatbot;
|
|
@@ -0,0 +1,127 @@
|
|
|
1
|
+
.chat-input-container {
|
|
2
|
+
display: flex;
|
|
3
|
+
align-items: center;
|
|
4
|
+
background-color: white;
|
|
5
|
+
border: 1px solid #d1d5db;
|
|
6
|
+
border-radius: 9999px;
|
|
7
|
+
padding: 0.5rem 0.75rem;
|
|
8
|
+
box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
|
|
9
|
+
width: 95%;
|
|
10
|
+
height: 56px;
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
.chat-icon-button {
|
|
14
|
+
color: #6b7280;
|
|
15
|
+
background: none;
|
|
16
|
+
border: none;
|
|
17
|
+
margin: 0 0.5rem;
|
|
18
|
+
cursor: pointer;
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
.chat-icon-button:hover {
|
|
22
|
+
color: #374151;
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
.chat-icon-button.recording {
|
|
26
|
+
color: #ef4444;
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
.hidden-input {
|
|
30
|
+
display: none;
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
.image-preview-wrapper {
|
|
34
|
+
position: relative;
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
.image-preview {
|
|
38
|
+
width: 2rem;
|
|
39
|
+
height: 2rem;
|
|
40
|
+
border-radius: 9999px;
|
|
41
|
+
object-fit: cover;
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
.remove-image-icon {
|
|
45
|
+
position: absolute;
|
|
46
|
+
top: -0.5rem;
|
|
47
|
+
right: -0.5rem;
|
|
48
|
+
font-size: 14px;
|
|
49
|
+
color: #ef4444;
|
|
50
|
+
background: white;
|
|
51
|
+
border-radius: 9999px;
|
|
52
|
+
cursor: pointer;
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
.chat-input-wrapper {
|
|
56
|
+
flex: 1;
|
|
57
|
+
margin: 0 0.5rem;
|
|
58
|
+
min-width: 0;
|
|
59
|
+
max-width: 100%;
|
|
60
|
+
display: flex;
|
|
61
|
+
align-items: center;
|
|
62
|
+
}
|
|
63
|
+
|
|
64
|
+
.text-input {
|
|
65
|
+
width: 100%;
|
|
66
|
+
border: none;
|
|
67
|
+
font-size: 16px;
|
|
68
|
+
line-height: 1.5;
|
|
69
|
+
color: #374151;
|
|
70
|
+
}
|
|
71
|
+
|
|
72
|
+
.text-input:focus {
|
|
73
|
+
outline: none;
|
|
74
|
+
box-shadow: none;
|
|
75
|
+
}
|
|
76
|
+
|
|
77
|
+
|
|
78
|
+
|
|
79
|
+
|
|
80
|
+
.audio-preview {
|
|
81
|
+
display: flex;
|
|
82
|
+
align-items: center;
|
|
83
|
+
width: 100%;
|
|
84
|
+
background-color: #f3f4f6;
|
|
85
|
+
padding: 0.5rem 1rem;
|
|
86
|
+
border-radius: 0.5rem;
|
|
87
|
+
}
|
|
88
|
+
|
|
89
|
+
.audio-play-button {
|
|
90
|
+
background: none;
|
|
91
|
+
border: none;
|
|
92
|
+
margin-right: 0.75rem;
|
|
93
|
+
color: #7f28f8;
|
|
94
|
+
cursor: pointer;
|
|
95
|
+
}
|
|
96
|
+
|
|
97
|
+
.remove-audio-icon {
|
|
98
|
+
font-size: 18px;
|
|
99
|
+
color: #ef4444;
|
|
100
|
+
margin-left: 0.75rem;
|
|
101
|
+
cursor: pointer;
|
|
102
|
+
}
|
|
103
|
+
|
|
104
|
+
.waveform {
|
|
105
|
+
width: 100%;
|
|
106
|
+
height: 2rem;
|
|
107
|
+
}
|
|
108
|
+
|
|
109
|
+
.recording-indicator {
|
|
110
|
+
display: flex;
|
|
111
|
+
align-items: center;
|
|
112
|
+
justify-content: center;
|
|
113
|
+
background-color: #f3f4f6;
|
|
114
|
+
padding: 0.5rem 1rem;
|
|
115
|
+
border-radius: 0.5rem;
|
|
116
|
+
animation: pulse 2s infinite;
|
|
117
|
+
}
|
|
118
|
+
|
|
119
|
+
@keyframes pulse {
|
|
120
|
+
0%, 100% {
|
|
121
|
+
opacity: 1;
|
|
122
|
+
}
|
|
123
|
+
50% {
|
|
124
|
+
opacity: 0.5;
|
|
125
|
+
}
|
|
126
|
+
}
|
|
127
|
+
|