shopify-chatbot-widget 0.9.7 → 1.0.0
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 +393 -146
- 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 +264 -216
- 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 +17 -16
- package/src/Chatbot/components/Sessions/RenderList.tsx +445 -141
- package/src/hooks/config.tsx +4 -4
- package/src/hooks/useChatbotAPI.tsx +2 -16
- package/src/Chatbot/components/Suggestions.css +0 -35
- package/src/Chatbot/components/Suggestions.tsx +0 -57
|
@@ -81,6 +81,7 @@ export const useChatbotAPI = (params: Params) => {
|
|
|
81
81
|
|
|
82
82
|
if (res.ok) {
|
|
83
83
|
const data = await res.json();
|
|
84
|
+
console.log(data)
|
|
84
85
|
|
|
85
86
|
if (data.message_history) {
|
|
86
87
|
|
|
@@ -131,22 +132,7 @@ export const useChatbotAPI = (params: Params) => {
|
|
|
131
132
|
const filtered = prev.filter((msg) => !msg.typing);
|
|
132
133
|
const updated = [...filtered, assistantMessage];
|
|
133
134
|
|
|
134
|
-
|
|
135
|
-
if (
|
|
136
|
-
data.message &&
|
|
137
|
-
calendlyLink &&
|
|
138
|
-
/book\s?(a\s?)?meeting|schedule\s?(a\s?)?(call|meeting)|let\s?('s)?\s?meet|set\s?up\s?(a\s?)?meeting|book\s?(an\s?)?appointment/i.test(
|
|
139
|
-
data.message
|
|
140
|
-
)
|
|
141
|
-
) {
|
|
142
|
-
console.log("meeting please")
|
|
143
|
-
updated.push({
|
|
144
|
-
role: 'assistant',
|
|
145
|
-
content: 'Scheduling a meeting...',
|
|
146
|
-
isBusiness: false,
|
|
147
|
-
calendly: true,
|
|
148
|
-
});
|
|
149
|
-
}
|
|
135
|
+
|
|
150
136
|
|
|
151
137
|
return updated;
|
|
152
138
|
});
|
|
@@ -1,35 +0,0 @@
|
|
|
1
|
-
/* Suggestions.css */
|
|
2
|
-
.suggestions-wrapper {
|
|
3
|
-
overflow-x: auto;
|
|
4
|
-
overflow-y: hidden;
|
|
5
|
-
white-space: nowrap;
|
|
6
|
-
padding-top: 4px;
|
|
7
|
-
padding-bottom: 8px;
|
|
8
|
-
width: 100%; /* ensures it respects screen boundaries */
|
|
9
|
-
box-sizing: border-box;
|
|
10
|
-
margin-left: 4%;
|
|
11
|
-
margin-top: 4px;
|
|
12
|
-
margin-bottom: 4px;
|
|
13
|
-
|
|
14
|
-
}
|
|
15
|
-
|
|
16
|
-
.suggestions-scroll {
|
|
17
|
-
display: inline-flex; /* horizontal scroll with inline behavior */
|
|
18
|
-
gap: 0.5rem;
|
|
19
|
-
}
|
|
20
|
-
|
|
21
|
-
.suggestion-button {
|
|
22
|
-
white-space: nowrap;
|
|
23
|
-
padding: 0.5rem 1rem;
|
|
24
|
-
border: 1px solid #ccc;
|
|
25
|
-
border-radius: 9999px;
|
|
26
|
-
background-color: white;
|
|
27
|
-
cursor: pointer;
|
|
28
|
-
font-size: 0.9rem;
|
|
29
|
-
flex-shrink: 0; /* prevents shrinking inside flex */
|
|
30
|
-
}
|
|
31
|
-
|
|
32
|
-
.suggestion-button:hover {
|
|
33
|
-
background-color: #f3f3f3;
|
|
34
|
-
}
|
|
35
|
-
|
|
@@ -1,57 +0,0 @@
|
|
|
1
|
-
interface SuggestionsProps {
|
|
2
|
-
suggestions: string[];
|
|
3
|
-
colorCode: string;
|
|
4
|
-
sendMessageSuggestion: (message: string) => Promise<void>;
|
|
5
|
-
}
|
|
6
|
-
|
|
7
|
-
export default function Suggestions({ suggestions, colorCode, sendMessageSuggestion }: SuggestionsProps) {
|
|
8
|
-
return (
|
|
9
|
-
<div
|
|
10
|
-
style={{
|
|
11
|
-
overflowX: "auto",
|
|
12
|
-
overflowY: "hidden",
|
|
13
|
-
whiteSpace: "nowrap",
|
|
14
|
-
paddingTop: "4px",
|
|
15
|
-
paddingBottom: "8px",
|
|
16
|
-
width: "100%",
|
|
17
|
-
boxSizing: "border-box",
|
|
18
|
-
marginLeft: "4%",
|
|
19
|
-
marginTop: "4px",
|
|
20
|
-
marginBottom: "4px",
|
|
21
|
-
}}
|
|
22
|
-
>
|
|
23
|
-
<div
|
|
24
|
-
style={{
|
|
25
|
-
display: "inline-flex",
|
|
26
|
-
gap: "0.5rem",
|
|
27
|
-
}}
|
|
28
|
-
>
|
|
29
|
-
{suggestions?.map((text, index) => (
|
|
30
|
-
<button
|
|
31
|
-
key={index}
|
|
32
|
-
onClick={() => sendMessageSuggestion(text)}
|
|
33
|
-
style={{
|
|
34
|
-
whiteSpace: "nowrap",
|
|
35
|
-
padding: "0.5rem 1rem",
|
|
36
|
-
border: `1px solid ${colorCode}`,
|
|
37
|
-
borderRadius: "9999px",
|
|
38
|
-
backgroundColor: "white",
|
|
39
|
-
cursor: "pointer",
|
|
40
|
-
fontSize: "14px",
|
|
41
|
-
color: colorCode,
|
|
42
|
-
flexShrink: 0,
|
|
43
|
-
}}
|
|
44
|
-
onMouseEnter={(e) => {
|
|
45
|
-
(e.currentTarget.style.backgroundColor = "#f3f3f3");
|
|
46
|
-
}}
|
|
47
|
-
onMouseLeave={(e) => {
|
|
48
|
-
(e.currentTarget.style.backgroundColor = "white");
|
|
49
|
-
}}
|
|
50
|
-
>
|
|
51
|
-
{text}
|
|
52
|
-
</button>
|
|
53
|
-
))}
|
|
54
|
-
</div>
|
|
55
|
-
</div>
|
|
56
|
-
);
|
|
57
|
-
}
|