@axos-web-dev/shared-components 1.0.77-patch.69 → 1.0.77-patch.69-rev.1
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.
|
@@ -43,7 +43,8 @@ const ChatWindow = ({
|
|
|
43
43
|
toggleThankyouMessage,
|
|
44
44
|
hasEscalated,
|
|
45
45
|
isBlockedInput,
|
|
46
|
-
isOpen
|
|
46
|
+
isOpen,
|
|
47
|
+
hasOpenedOnce
|
|
47
48
|
} = useOpenChat();
|
|
48
49
|
const [mounted, setMounted] = React.useState(false);
|
|
49
50
|
const [menuOpen, setMenuOpen] = React.useState(false);
|
|
@@ -398,7 +399,7 @@ const ChatWindow = ({
|
|
|
398
399
|
}
|
|
399
400
|
) }) : null,
|
|
400
401
|
/* @__PURE__ */ jsxs("div", { className: clsx(messagesContainerStyle), children: [
|
|
401
|
-
(status === "idle" || messages.length == 0) && /* @__PURE__ */ jsx(
|
|
402
|
+
(status === "idle" && messages.length == 0 || messages.length == 0) && /* @__PURE__ */ jsx(
|
|
402
403
|
"div",
|
|
403
404
|
{
|
|
404
405
|
className: clsx(),
|
|
@@ -425,22 +426,28 @@ const ChatWindow = ({
|
|
|
425
426
|
)
|
|
426
427
|
}
|
|
427
428
|
),
|
|
428
|
-
messages?.map((msg) =>
|
|
429
|
-
|
|
430
|
-
|
|
431
|
-
|
|
432
|
-
|
|
433
|
-
|
|
434
|
-
|
|
435
|
-
|
|
436
|
-
|
|
437
|
-
|
|
438
|
-
|
|
439
|
-
|
|
440
|
-
|
|
441
|
-
|
|
442
|
-
|
|
443
|
-
|
|
429
|
+
messages?.map((msg) => {
|
|
430
|
+
if (!hasOpenedOnce) {
|
|
431
|
+
return null;
|
|
432
|
+
}
|
|
433
|
+
return /* @__PURE__ */ jsx(
|
|
434
|
+
ChatbotMessage,
|
|
435
|
+
{
|
|
436
|
+
msg,
|
|
437
|
+
onSend,
|
|
438
|
+
showAvatar,
|
|
439
|
+
showName,
|
|
440
|
+
virtualAgent,
|
|
441
|
+
onCancelEndChat,
|
|
442
|
+
onEndChat: () => {
|
|
443
|
+
endChat();
|
|
444
|
+
onCloseAfterThankYou();
|
|
445
|
+
},
|
|
446
|
+
inputRef
|
|
447
|
+
},
|
|
448
|
+
msg?.$index
|
|
449
|
+
);
|
|
450
|
+
}),
|
|
444
451
|
showReconnect && /* @__PURE__ */ jsx(
|
|
445
452
|
"button",
|
|
446
453
|
{
|
|
@@ -12,6 +12,7 @@ interface ChatbotMessageProps {
|
|
|
12
12
|
onCancelEndChat?: () => void;
|
|
13
13
|
onSend?: (content: string) => void;
|
|
14
14
|
onEndChat?: () => void;
|
|
15
|
+
inputRef: React.RefObject<HTMLTextAreaElement | null>;
|
|
15
16
|
}
|
|
16
17
|
export declare const ChatbotMessage: FC<ChatbotMessageProps>;
|
|
17
18
|
export {};
|
|
@@ -25,7 +25,8 @@ const ChatbotMessage = ({
|
|
|
25
25
|
showName,
|
|
26
26
|
virtualAgent,
|
|
27
27
|
onEndChat,
|
|
28
|
-
onSend
|
|
28
|
+
onSend,
|
|
29
|
+
inputRef
|
|
29
30
|
}) => {
|
|
30
31
|
const { hasEscalated } = useOpenChat();
|
|
31
32
|
const [timeText, setTimeText] = useState(timeAgo(msg.$timestamp));
|
|
@@ -36,6 +37,9 @@ const ChatbotMessage = ({
|
|
|
36
37
|
return () => clearInterval(interval);
|
|
37
38
|
}, [msg.$timestamp]);
|
|
38
39
|
if (msg.$sid === "typing-1" && !hasEscalated) {
|
|
40
|
+
if (inputRef?.current) {
|
|
41
|
+
inputRef?.current.focus();
|
|
42
|
+
}
|
|
39
43
|
return /* @__PURE__ */ jsx(
|
|
40
44
|
"div",
|
|
41
45
|
{
|
package/package.json
CHANGED