@aslaluroba/help-center-react 3.2.13 → 3.2.15
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/ui/agent-response/agent-response.d.ts +1 -1
- package/dist/index.css +1 -1
- package/dist/index.esm.js +24 -15
- package/dist/index.esm.js.map +1 -1
- package/dist/index.js +24 -15
- package/dist/index.js.map +1 -1
- package/dist/ui/chatbot-popup/options-list-screen/helpscreen-list.d.ts +1 -0
- package/package.json +1 -1
- package/src/components/ui/agent-response/agent-response.tsx +16 -9
- package/src/globals.css +13 -0
- package/src/ui/chatbot-popup/options-list-screen/helpscreen-list.tsx +3 -1
- package/src/ui/chatbot-popup/options-list-screen/helpscreen-option.tsx +19 -11
- package/src/ui/chatbot-popup/options-list-screen/index.tsx +1 -0
- package/src/ui/help-popup.tsx +6 -2
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { useTypewriter } from
|
|
2
|
-
import Markdown from
|
|
3
|
-
import type { Element } from
|
|
1
|
+
import { useTypewriter } from "@/lib/custom-hooks/useTypewriter";
|
|
2
|
+
import Markdown from "react-markdown";
|
|
3
|
+
import type { Element } from "hast";
|
|
4
4
|
|
|
5
5
|
interface AgentResponseProps {
|
|
6
6
|
messageContent: string;
|
|
@@ -11,10 +11,16 @@ interface AgentResponseProps {
|
|
|
11
11
|
|
|
12
12
|
const seenMessagesRef = new Set<number>();
|
|
13
13
|
|
|
14
|
-
const AgentResponse = ({
|
|
14
|
+
const AgentResponse = ({
|
|
15
|
+
senderType,
|
|
16
|
+
messageContent,
|
|
17
|
+
messageId,
|
|
18
|
+
onType,
|
|
19
|
+
}: AgentResponseProps) => {
|
|
15
20
|
// Ensure messageContent is always a string to prevent errors
|
|
16
|
-
const safeMessageContent = messageContent ??
|
|
17
|
-
const shouldAnimate =
|
|
21
|
+
const safeMessageContent = messageContent ?? "";
|
|
22
|
+
const shouldAnimate =
|
|
23
|
+
(senderType === 2 || senderType === 3) && !seenMessagesRef.has(messageId);
|
|
18
24
|
const animatedText = useTypewriter(safeMessageContent, 20, onType);
|
|
19
25
|
const finalMessage = shouldAnimate ? animatedText : safeMessageContent;
|
|
20
26
|
|
|
@@ -27,15 +33,16 @@ const AgentResponse = ({ senderType, messageContent, messageId, onType }: AgentR
|
|
|
27
33
|
<div
|
|
28
34
|
className={`babylai:rounded-2xl babylai:p-4 ${
|
|
29
35
|
senderType === 1
|
|
30
|
-
?
|
|
31
|
-
:
|
|
36
|
+
? "babylai:bg-primary-500 babylai:text-black-white-50 babylai:max-w-[220px]"
|
|
37
|
+
: "babylai:bg-card"
|
|
32
38
|
}`}
|
|
33
39
|
>
|
|
34
40
|
<Markdown
|
|
35
41
|
components={{
|
|
36
42
|
p: ({ node, ...props }: { node?: Element; [key: string]: any }) => (
|
|
37
43
|
<p
|
|
38
|
-
|
|
44
|
+
dir="auto"
|
|
45
|
+
className="babylai:m-0 babylai:leading-snug babylai:text-sm babylai:font-sans babylai:wrap-break-word"
|
|
39
46
|
{...props}
|
|
40
47
|
/>
|
|
41
48
|
),
|
package/src/globals.css
CHANGED
|
@@ -138,12 +138,14 @@
|
|
|
138
138
|
}
|
|
139
139
|
|
|
140
140
|
@keyframes typing-dot {
|
|
141
|
+
|
|
141
142
|
0%,
|
|
142
143
|
60%,
|
|
143
144
|
100% {
|
|
144
145
|
opacity: 0.35;
|
|
145
146
|
transform: scale(0.85);
|
|
146
147
|
}
|
|
148
|
+
|
|
147
149
|
30% {
|
|
148
150
|
opacity: 1;
|
|
149
151
|
transform: scale(1);
|
|
@@ -155,12 +157,15 @@
|
|
|
155
157
|
.babylai-typing-dot {
|
|
156
158
|
animation: typing-dot 1.4s ease-in-out infinite;
|
|
157
159
|
}
|
|
160
|
+
|
|
158
161
|
.babylai-typing-dot:nth-child(1) {
|
|
159
162
|
animation-delay: 0ms;
|
|
160
163
|
}
|
|
164
|
+
|
|
161
165
|
.babylai-typing-dot:nth-child(2) {
|
|
162
166
|
animation-delay: 0.2s;
|
|
163
167
|
}
|
|
168
|
+
|
|
164
169
|
.babylai-typing-dot:nth-child(3) {
|
|
165
170
|
animation-delay: 0.4s;
|
|
166
171
|
}
|
|
@@ -216,6 +221,14 @@
|
|
|
216
221
|
p {
|
|
217
222
|
margin: 0;
|
|
218
223
|
}
|
|
224
|
+
|
|
225
|
+
ul,
|
|
226
|
+
ol {
|
|
227
|
+
list-style: auto;
|
|
228
|
+
padding-inline-start: 40px;
|
|
229
|
+
margin-block-start: 1rem;
|
|
230
|
+
margin-block-end: 1rem;
|
|
231
|
+
}
|
|
219
232
|
}
|
|
220
233
|
|
|
221
234
|
/* Dark theme colors */
|
|
@@ -11,6 +11,7 @@ interface HelpscreenListProps {
|
|
|
11
11
|
onToggleOption: (option: Option) => void;
|
|
12
12
|
onStartChat: () => void;
|
|
13
13
|
showChatNowButton?: boolean;
|
|
14
|
+
chatWithUs?: boolean;
|
|
14
15
|
}
|
|
15
16
|
|
|
16
17
|
const HelpscreenList: React.FC<HelpscreenListProps> = ({
|
|
@@ -19,6 +20,7 @@ const HelpscreenList: React.FC<HelpscreenListProps> = ({
|
|
|
19
20
|
onToggleOption,
|
|
20
21
|
onStartChat,
|
|
21
22
|
showChatNowButton = true,
|
|
23
|
+
chatWithUs = true,
|
|
22
24
|
}) => {
|
|
23
25
|
const { t } = useLocalTranslation();
|
|
24
26
|
|
|
@@ -39,7 +41,7 @@ const HelpscreenList: React.FC<HelpscreenListProps> = ({
|
|
|
39
41
|
<Button
|
|
40
42
|
variant='default'
|
|
41
43
|
onClick={onStartChat}
|
|
42
|
-
disabled={!selectedOption}
|
|
44
|
+
disabled={!selectedOption || !chatWithUs}
|
|
43
45
|
>
|
|
44
46
|
{t('homeSdk.chatNow')}
|
|
45
47
|
<SolarPlain2BoldDuotone className="babylai:w-6 babylai:h-6" />
|
|
@@ -13,23 +13,31 @@ const HelpscreenOption: React.FC<HelpscreenOptionProps> = ({
|
|
|
13
13
|
isSelected,
|
|
14
14
|
onClick,
|
|
15
15
|
}) => {
|
|
16
|
+
const chatWithUs = option.chatWithUs ?? true;
|
|
17
|
+
|
|
16
18
|
return (
|
|
17
19
|
<div
|
|
18
|
-
role=
|
|
19
|
-
tabIndex={0}
|
|
20
|
+
role={chatWithUs ? 'button' : undefined}
|
|
21
|
+
tabIndex={chatWithUs ? 0 : undefined}
|
|
20
22
|
className={cn(
|
|
21
|
-
'babylai:flex babylai:flex-col babylai:gap-2 babylai:p-6 babylai:rounded-3xl babylai:text-start babylai:border babylai:border-black-white-200 babylai:bg-card
|
|
23
|
+
'babylai:flex babylai:flex-col babylai:gap-2 babylai:p-6 babylai:rounded-3xl babylai:text-start babylai:border babylai:border-black-white-200 babylai:bg-card',
|
|
22
24
|
'babylai:transition-all babylai:duration-200 babylai:ease-out',
|
|
23
|
-
|
|
25
|
+
chatWithUs
|
|
26
|
+
? 'babylai:cursor-pointer babylai:active:scale-[0.98] babylai:active:opacity-95'
|
|
27
|
+
: 'babylai:cursor-default',
|
|
24
28
|
isSelected && 'babylai:ring babylai:ring-primary-500 babylai:shadow-md'
|
|
25
29
|
)}
|
|
26
|
-
onClick={onClick}
|
|
27
|
-
onKeyDown={
|
|
28
|
-
|
|
29
|
-
e
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
30
|
+
onClick={chatWithUs ? onClick : undefined}
|
|
31
|
+
onKeyDown={
|
|
32
|
+
chatWithUs
|
|
33
|
+
? (e) => {
|
|
34
|
+
if (e.key === 'Enter' || e.key === ' ') {
|
|
35
|
+
e.preventDefault();
|
|
36
|
+
onClick();
|
|
37
|
+
}
|
|
38
|
+
}
|
|
39
|
+
: undefined
|
|
40
|
+
}
|
|
33
41
|
>
|
|
34
42
|
<h2 className="babylai:text-base! babylai:font-semibold! babylai:text-card-foreground" dir="auto">
|
|
35
43
|
{option.title}
|
|
@@ -59,6 +59,7 @@ const OptionsListScreen: React.FC<OptionsListScreenProps> = ({
|
|
|
59
59
|
onToggleOption={handleToggleExpandOption}
|
|
60
60
|
onStartChat={handleStartChatWithSelected}
|
|
61
61
|
showChatNowButton={!hasActiveSession}
|
|
62
|
+
chatWithUs={helpScreen?.chatWithUs ?? true}
|
|
62
63
|
/>
|
|
63
64
|
</div >
|
|
64
65
|
<PoweredBy />
|
package/src/ui/help-popup.tsx
CHANGED
|
@@ -174,9 +174,13 @@ const HelpPopup = ({
|
|
|
174
174
|
|
|
175
175
|
const handleEndChatFromChatScreen = useCallback(async () => {
|
|
176
176
|
setEndChatConfirmation(false);
|
|
177
|
+
if (!sessionId) {
|
|
178
|
+
setShowChat(false);
|
|
179
|
+
setSelectedOption(null);
|
|
180
|
+
return;
|
|
181
|
+
}
|
|
177
182
|
await onEndChat({ fromChatScreen: true });
|
|
178
|
-
|
|
179
|
-
}, [onEndChat]);
|
|
183
|
+
}, [onEndChat, sessionId, setSelectedOption]);
|
|
180
184
|
|
|
181
185
|
const handleMinimize = useCallback(() => {
|
|
182
186
|
onClose();
|