vpschatbotwidget 1.2.4 → 1.2.5
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-lib/vps-chatbot.cjs +31 -31
- package/dist-lib/vps-chatbot.js +1748 -1750
- package/package.json +1 -1
- package/src/chatbot/core/ChatHeader.tsx +5 -2
- package/src/chatbot/core/ChatMessage.tsx +3 -1
- package/src/chatbot/embedded/EmbeddedChatbot.tsx +18 -1
- package/src/chatbot/embedded/EmbeddedChatbotTrigger.tsx +2 -2
- package/src/index.css +9 -2
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "vpschatbotwidget",
|
|
3
|
-
"version": "1.2.
|
|
3
|
+
"version": "1.2.5",
|
|
4
4
|
"private": false,
|
|
5
5
|
"description": "This is an Package for the chatbot widget ui for our customer portel . ",
|
|
6
6
|
"homepage": "https://github.com/dhineshkumar-natobotics/VPS-Chatbot-Widget#readme",
|
|
@@ -1,6 +1,8 @@
|
|
|
1
1
|
import React, { useEffect, useRef } from "react";
|
|
2
2
|
import { ArrowLeft, Minus, RefreshCw, Volume2, VolumeX } from "lucide-react";
|
|
3
3
|
import { EnvBadge, type EnvStage } from "../../components/EnvBadge";
|
|
4
|
+
import vpsIconUrl from '../../vps-v.svg';
|
|
5
|
+
|
|
4
6
|
|
|
5
7
|
interface ChatHeaderProps {
|
|
6
8
|
title?: string;
|
|
@@ -17,7 +19,7 @@ interface ChatHeaderProps {
|
|
|
17
19
|
envPulse?: boolean;
|
|
18
20
|
}
|
|
19
21
|
|
|
20
|
-
const SVGComponent = (props: React.SVGProps<SVGSVGElement> & { width?: string; height?: string
|
|
22
|
+
const SVGComponent = (props: React.SVGProps<SVGSVGElement> & { width?: string; height?: string, Color?: string }) => (
|
|
21
23
|
<svg
|
|
22
24
|
width={props.width || "24px"}
|
|
23
25
|
height={props.height || "24px"}
|
|
@@ -61,7 +63,8 @@ export const ChatHeader: React.FC<ChatHeaderProps> = ({
|
|
|
61
63
|
className="avatar-circle"
|
|
62
64
|
aria-hidden="true"
|
|
63
65
|
>
|
|
64
|
-
<SVGComponent width="16px" height="16px" color="white" />
|
|
66
|
+
{/* <SVGComponent width="16px" height="16px" color="white" /> */}
|
|
67
|
+
<img src={vpsIconUrl} alt="VPS Logo" style={{ width: '16px', height: '16px' }} />
|
|
65
68
|
</div>
|
|
66
69
|
<div>
|
|
67
70
|
<div className="chat-header-title-row">
|
|
@@ -15,6 +15,7 @@ import { AgentReasoning } from "./AgentReasoning";
|
|
|
15
15
|
import { GroundedSources } from "./GroundedSources";
|
|
16
16
|
|
|
17
17
|
import { useOptionalChatContext } from "./ChatContext";
|
|
18
|
+
import VPSIcon from '../../vps-v.svg'
|
|
18
19
|
|
|
19
20
|
interface ChatMessageProps {
|
|
20
21
|
message: ChatMessage;
|
|
@@ -42,7 +43,8 @@ export const ChatMessageBubble: React.FC<ChatMessageProps> = ({ message, onEdit
|
|
|
42
43
|
<Message align={isUser ? "end" : "start"}>
|
|
43
44
|
{message.role === "assistant" && (
|
|
44
45
|
<MessageAvatar className="avatar-circle" aria-hidden="true">
|
|
45
|
-
<BotMessageSquare size={15} />
|
|
46
|
+
{/* <BotMessageSquare size={15} /> */}
|
|
47
|
+
<img src={VPSIcon} alt="VPS Logo" style={{ width: '16px', height: '16px' }} />
|
|
46
48
|
</MessageAvatar>
|
|
47
49
|
)}
|
|
48
50
|
<MessageContent>
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import React, { useState } from "react";
|
|
1
|
+
import React, { useEffect, useState } from "react";
|
|
2
2
|
import { EmbeddedChatbotPanel } from "./EmbeddedChatbotPanel";
|
|
3
3
|
import { EmbeddedChatbotTrigger } from "./EmbeddedChatbotTrigger";
|
|
4
4
|
import { type EnvStage } from "../../components/EnvBadge";
|
|
@@ -65,6 +65,23 @@ const EmbeddedChatbotView: React.FC<Omit<
|
|
|
65
65
|
}
|
|
66
66
|
};
|
|
67
67
|
|
|
68
|
+
// Push a history entry when the panel opens so the back button closes it.
|
|
69
|
+
useEffect(() => {
|
|
70
|
+
if (isOpen) {
|
|
71
|
+
window.history.pushState({ vpsChatOpen: true }, "");
|
|
72
|
+
|
|
73
|
+
const handlePopState = () => {
|
|
74
|
+
setOpen(false);
|
|
75
|
+
};
|
|
76
|
+
|
|
77
|
+
window.addEventListener("popstate", handlePopState);
|
|
78
|
+
return () => {
|
|
79
|
+
window.removeEventListener("popstate", handlePopState);
|
|
80
|
+
};
|
|
81
|
+
}
|
|
82
|
+
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
83
|
+
}, [isOpen]);
|
|
84
|
+
|
|
68
85
|
return (
|
|
69
86
|
<>
|
|
70
87
|
{showTrigger && !isOpen && (
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import React, { useEffect, useRef, useState } from "react";
|
|
2
|
-
import
|
|
2
|
+
import vpsIconUrl from "../../vps-v.svg";
|
|
3
3
|
|
|
4
4
|
const DRAG_THRESHOLD_PX = 5;
|
|
5
5
|
const EDGE_PADDING_PX = 8;
|
|
@@ -161,7 +161,7 @@ export const EmbeddedChatbotTrigger: React.FC<EmbeddedChatbotTriggerProps> = ({
|
|
|
161
161
|
transform: undefined,
|
|
162
162
|
}}
|
|
163
163
|
>
|
|
164
|
-
<
|
|
164
|
+
<img src={vpsIconUrl} alt="" className="embedded-trigger-icon" aria-hidden="true" />
|
|
165
165
|
<span className="embedded-trigger-label">Assistant</span>
|
|
166
166
|
</button>
|
|
167
167
|
);
|
package/src/index.css
CHANGED
|
@@ -784,7 +784,7 @@ button {
|
|
|
784
784
|
align-items: center;
|
|
785
785
|
justify-content: center;
|
|
786
786
|
border-radius: 50%;
|
|
787
|
-
background-color: var(--
|
|
787
|
+
background-color: var(--action);
|
|
788
788
|
color: var(--text-on-action);
|
|
789
789
|
flex-shrink: 0;
|
|
790
790
|
}
|
|
@@ -1959,9 +1959,10 @@ button {
|
|
|
1959
1959
|
pointer-events: none;
|
|
1960
1960
|
}
|
|
1961
1961
|
|
|
1962
|
+
/* On desktop: keep overlay for outside-click detection but hide the dim */
|
|
1962
1963
|
@media (min-width: 640px) {
|
|
1963
1964
|
.embedded-overlay {
|
|
1964
|
-
|
|
1965
|
+
background-color: transparent;
|
|
1965
1966
|
}
|
|
1966
1967
|
}
|
|
1967
1968
|
|
|
@@ -2060,6 +2061,12 @@ button {
|
|
|
2060
2061
|
cursor: grabbing;
|
|
2061
2062
|
}
|
|
2062
2063
|
|
|
2064
|
+
.embedded-trigger-icon {
|
|
2065
|
+
width: 22px;
|
|
2066
|
+
height: 24px;
|
|
2067
|
+
flex-shrink: 0;
|
|
2068
|
+
}
|
|
2069
|
+
|
|
2063
2070
|
/* ── MessageScroller ─────────────────────────────────────────── */
|
|
2064
2071
|
.msg-scroller-root {
|
|
2065
2072
|
position: relative;
|