@aslaluroba/help-center-react 3.2.14 → 3.2.16

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/package.json CHANGED
@@ -3,7 +3,7 @@
3
3
  "main": "dist/index.js",
4
4
  "module": "dist/index.esm.js",
5
5
  "types": "dist/index.d.ts",
6
- "version": "3.2.14",
6
+ "version": "3.2.16",
7
7
  "description": "BabylAI Help Center Widget for React and Next.js",
8
8
  "private": false,
9
9
  "exports": {
@@ -1,6 +1,6 @@
1
- import { useTypewriter } from '@/lib/custom-hooks/useTypewriter';
2
- import Markdown from 'react-markdown';
3
- import type { Element } from 'hast';
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 = ({ senderType, messageContent, messageId, onType }: AgentResponseProps) => {
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 = (senderType === 2 || senderType === 3) && !seenMessagesRef.has(messageId);
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
 
@@ -25,17 +31,18 @@ const AgentResponse = ({ senderType, messageContent, messageId, onType }: AgentR
25
31
 
26
32
  return (
27
33
  <div
28
- className={`babylai:rounded-2xl babylai:p-4 ${
34
+ dir="auto"
35
+ className={`babylai:rounded-2xl babylai:p-4 ${
29
36
  senderType === 1
30
- ? 'babylai:bg-primary-500 babylai:text-black-white-50 babylai:max-w-[220px]'
31
- : 'babylai:bg-card'
37
+ ? "babylai:bg-primary-500 babylai:text-black-white-50 babylai:max-w-[220px]"
38
+ : "babylai:bg-card"
32
39
  }`}
33
40
  >
34
41
  <Markdown
35
42
  components={{
36
43
  p: ({ node, ...props }: { node?: Element; [key: string]: any }) => (
37
44
  <p
38
- className='babylai:m-0 babylai:leading-snug babylai:text-sm babylai:font-sans babylai:wrap-break-word babylai:text-start'
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 */
@@ -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
- // Keep showChat and selectedOption so chat screen stays open with in-chat review
179
- }, [onEndChat]);
183
+ }, [onEndChat, sessionId, setSelectedOption]);
180
184
 
181
185
  const handleMinimize = useCallback(() => {
182
186
  onClose();