shopify-chatbot-widget 0.9.7 → 0.9.8
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/jaweb-chatbot.css +1 -1
- package/dist/jaweb-chatbot.iife.js +380 -133
- package/package.json +1 -1
- package/src/Chatbot/Chatbot.css +82 -171
- package/src/Chatbot/components/ChatInput.css +426 -114
- package/src/Chatbot/components/ChatInput.tsx +313 -219
- package/src/Chatbot/components/Messages/ChatMessages.css +17 -1
- package/src/Chatbot/components/Messages/ChatMessages.tsx +161 -192
- package/src/Chatbot/components/Messages/Typing.css +114 -11
- package/src/Chatbot/components/Messages/Typing.tsx +22 -8
- package/src/Chatbot/components/Messenger/Messenger.tsx +26 -27
- package/src/Chatbot/components/Sessions/RenderList.tsx +445 -141
- package/src/hooks/useChatbotAPI.tsx +2 -16
|
@@ -5,7 +5,7 @@ import '../../Chatbot.css';
|
|
|
5
5
|
import { useChatbotMessage } from '../../../hooks/useSessionMessages';
|
|
6
6
|
import axios from 'axios';
|
|
7
7
|
import ChatInput from '../../components/ChatInput';
|
|
8
|
-
import Suggestions from '../../components/Suggestions';
|
|
8
|
+
// import Suggestions from '../../components/Suggestions';
|
|
9
9
|
import Powered from '../../components/Powered';
|
|
10
10
|
import ChatMessages from '../../components/Messages/ChatMessages';
|
|
11
11
|
import config from '../../../hooks/config';
|
|
@@ -52,8 +52,6 @@ const Messenger: React.FC<MessengerProps> = ({
|
|
|
52
52
|
newSession,
|
|
53
53
|
userType,
|
|
54
54
|
setNewSession,
|
|
55
|
-
messagesSuggestions,
|
|
56
|
-
setMessagesSuggestions,
|
|
57
55
|
disableForm,
|
|
58
56
|
sessionId,
|
|
59
57
|
setOpen,
|
|
@@ -167,34 +165,34 @@ const socket = useChatSocket(sessionId, handleSocketData);
|
|
|
167
165
|
}
|
|
168
166
|
};
|
|
169
167
|
|
|
170
|
-
const sendMessageSuggestion = async (message: string): Promise<void> => {
|
|
171
|
-
|
|
168
|
+
// const sendMessageSuggestion = async (message: string): Promise<void> => {
|
|
169
|
+
// if (!message.trim()) return;
|
|
172
170
|
|
|
173
|
-
|
|
171
|
+
// setIsSending(true);
|
|
174
172
|
|
|
175
|
-
|
|
176
|
-
|
|
173
|
+
// // Remove only the clicked suggestion
|
|
174
|
+
// setMessagesSuggestions(prev => prev.filter(suggestion => suggestion !== message));
|
|
177
175
|
|
|
178
|
-
|
|
179
|
-
|
|
176
|
+
// const userMsg: ChatMessage = { role: 'user', content: message };
|
|
177
|
+
// setMessages(prev => [...prev, userMsg]);
|
|
180
178
|
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
179
|
+
// if (socket && socket.readyState === WebSocket.OPEN) {
|
|
180
|
+
// const additionalData = { isBusiness: true, SessionId: sessionId };
|
|
181
|
+
// const messagePayload = JSON.stringify({
|
|
182
|
+
// message,
|
|
183
|
+
// additionalData,
|
|
184
|
+
// });
|
|
185
|
+
// socket.send(messagePayload);
|
|
186
|
+
// }
|
|
189
187
|
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
};
|
|
188
|
+
// try {
|
|
189
|
+
// await apiCall(message, newSession, sessionId);
|
|
190
|
+
// } catch (error) {
|
|
191
|
+
// console.error("Error sending suggestion:", error);
|
|
192
|
+
// } finally {
|
|
193
|
+
// setIsSending(false);
|
|
194
|
+
// }
|
|
195
|
+
// };
|
|
198
196
|
|
|
199
197
|
|
|
200
198
|
|
|
@@ -555,7 +553,7 @@ const socket = useChatSocket(sessionId, handleSocketData);
|
|
|
555
553
|
|
|
556
554
|
|
|
557
555
|
<div className="chatbot-input-area">
|
|
558
|
-
<Suggestions sendMessageSuggestion={sendMessageSuggestion} colorCode={colorCode} suggestions={messagesSuggestions} />
|
|
556
|
+
{/* <Suggestions sendMessageSuggestion={sendMessageSuggestion} colorCode={colorCode} suggestions={messagesSuggestions} /> */}
|
|
559
557
|
|
|
560
558
|
<ChatInput
|
|
561
559
|
userMessage={input}
|
|
@@ -568,6 +566,7 @@ const socket = useChatSocket(sessionId, handleSocketData);
|
|
|
568
566
|
audioBlob={audioBlob}
|
|
569
567
|
setAudioBlob={setAudioBlob}
|
|
570
568
|
isSending={isSending}
|
|
569
|
+
colorCode={colorCode}
|
|
571
570
|
|
|
572
571
|
/>
|
|
573
572
|
|