@axos-web-dev/shared-components 1.0.77-patch.36 → 1.0.77-patch.37
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/ATMLocator/ATMLocator.js +1 -7
- package/dist/Auth/ErrorAlert.js +1 -7
- package/dist/Avatar/Avatar.module.js +7 -7
- package/dist/Blockquote/Blockquote.module.js +3 -3
- package/dist/Button/Button.js +1 -7
- package/dist/Calculators/BuyDownCalculator/index.js +1 -1
- package/dist/Calculators/Calculator.js +2 -8
- package/dist/Carousel/index.js +1 -7
- package/dist/Chevron/index.js +1 -7
- package/dist/Comparison/Comparison.js +1 -7
- package/dist/Comparison/ComparisonSet.js +33 -24
- package/dist/ExecutiveBio/ExecutiveBio.js +1 -7
- package/dist/FaqAccordion/index.js +1 -7
- package/dist/FooterSiteMap/AxosBank/FooterSiteMap.js +1 -7
- package/dist/Forms/ApplyNow.js +1 -7
- package/dist/Forms/ContactUsBusiness.js +1 -7
- package/dist/Forms/ContactUsBusinessNameEmail.js +1 -7
- package/dist/Forms/ContactUsNMLSId.js +1 -7
- package/dist/Forms/CraPublicFile.js +1 -7
- package/dist/Forms/EmailOnly.js +1 -7
- package/dist/Forms/MortgageRate/MortgageRateForm.js +1 -7
- package/dist/Forms/MortgageRate/MortgageRateWatch.js +1 -7
- package/dist/Forms/MortgageWarehouseLending.js +1 -7
- package/dist/Forms/SuccesForm.js +2 -8
- package/dist/Hyperlink/index.js +1 -7
- package/dist/ImageLink/ImageLink.js +1 -7
- package/dist/ImageLink/ImageLinkSet.js +1 -7
- package/dist/ImageLink/index.js +1 -7
- package/dist/Insight/Featured/CategorySelector.js +1 -7
- package/dist/Insight/Featured/Featured.js +1 -7
- package/dist/Insight/Featured/Header.js +1 -7
- package/dist/Modal/Modal.js +1 -7
- package/dist/NavigationMenu/AxosALTS/NavData.js +1 -7
- package/dist/NavigationMenu/AxosALTS/index.js +1 -7
- package/dist/NavigationMenu/AxosAdvisor/NavBar.module.js +52 -52
- package/dist/NavigationMenu/AxosAdvisorServices/NavBar.module.js +53 -53
- package/dist/NavigationMenu/AxosBank/MobileMenu/MobileMenu.module.js +16 -16
- package/dist/NavigationMenu/AxosBank/MobileMenu/MobileNavData.js +1 -7
- package/dist/NavigationMenu/AxosBank/NavBar.module.js +39 -39
- package/dist/NavigationMenu/AxosBank/NavData.js +1 -7
- package/dist/NavigationMenu/AxosBank/SubNavBar.js +1 -7
- package/dist/NavigationMenu/AxosBank/index.js +1 -7
- package/dist/NavigationMenu/AxosClearing/NavBar.module.js +37 -37
- package/dist/NavigationMenu/AxosFiduciary/NavBar.module.js +41 -41
- package/dist/NavigationMenu/LaVictoire/NavData.js +1 -7
- package/dist/NavigationMenu/LaVictoire/index.js +1 -7
- package/dist/SetContainer/SetContainer.js +1 -7
- package/dist/SocialMediaBar/iconsRepository.js +1 -7
- package/dist/VideoTile/VideoTile.js +1 -7
- package/dist/VideoWrapper/index.js +1 -7
- package/dist/assets/Avatar/Avatar.css.css +59 -59
- package/dist/assets/Blockquote/Blockquote.css.css +68 -68
- package/dist/assets/Comparison/Comparison.css +3 -1
- package/dist/assets/NavigationMenu/AxosAdvisor/NavBar.css.css +597 -597
- package/dist/assets/NavigationMenu/AxosAdvisorServices/NavBar.css.css +618 -618
- package/dist/assets/NavigationMenu/AxosBank/MobileMenu/MobileMenu.css.css +191 -191
- package/dist/assets/NavigationMenu/AxosBank/NavBar.css.css +473 -473
- package/dist/assets/NavigationMenu/AxosClearing/NavBar.css.css +458 -458
- package/dist/assets/NavigationMenu/AxosFiduciary/NavBar.css.css +426 -426
- package/dist/main.d.ts +0 -1
- package/dist/main.js +0 -37
- package/package.json +133 -135
- package/dist/Chatbot/Bubble.css.d.ts +0 -2
- package/dist/Chatbot/Bubble.css.js +0 -7
- package/dist/Chatbot/Bubble.d.ts +0 -3
- package/dist/Chatbot/Bubble.js +0 -100
- package/dist/Chatbot/Chat.d.ts +0 -1
- package/dist/Chatbot/Chat.js +0 -165
- package/dist/Chatbot/ChatWindow.css.d.ts +0 -18
- package/dist/Chatbot/ChatWindow.css.js +0 -40
- package/dist/Chatbot/ChatWindow.d.ts +0 -30
- package/dist/Chatbot/ChatWindow.js +0 -397
- package/dist/Chatbot/Chatbot.css.d.ts +0 -2
- package/dist/Chatbot/Chatbot.css.js +0 -6
- package/dist/Chatbot/Chatbot.css.ts.vanilla.css.js +0 -1
- package/dist/Chatbot/Chatbot.d.ts +0 -6
- package/dist/Chatbot/Chatbot.js +0 -43
- package/dist/Chatbot/EllipsisIcon.d.ts +0 -4
- package/dist/Chatbot/EllipsisIcon.js +0 -19
- package/dist/Chatbot/authenticate.d.ts +0 -3
- package/dist/Chatbot/authenticate.js +0 -16
- package/dist/Chatbot/index.d.ts +0 -9
- package/dist/Chatbot/index.js +0 -40
- package/dist/Chatbot/store/chat.d.ts +0 -9
- package/dist/Chatbot/store/chat.js +0 -11
- package/dist/Chatbot/store/messages.d.ts +0 -15
- package/dist/Chatbot/store/messages.js +0 -13
- package/dist/Chatbot/useHeadlessChat.d.ts +0 -28
- package/dist/Chatbot/useHeadlessChat.js +0 -241
- package/dist/assets/Chatbot/Bubble.css +0 -51
- package/dist/assets/Chatbot/ChatWindow.css +0 -213
package/dist/Chatbot/Chat.js
DELETED
|
@@ -1,165 +0,0 @@
|
|
|
1
|
-
"use client";
|
|
2
|
-
import { jsxs, jsx } from "react/jsx-runtime";
|
|
3
|
-
import { useRef, useEffect } from "react";
|
|
4
|
-
import { authenticate } from "./authenticate.js";
|
|
5
|
-
import { useMessages } from "./store/messages.js";
|
|
6
|
-
const companyId = process.env.CCAI_COMPANY_ID || "";
|
|
7
|
-
const tenant = process.env.CCAI_TENANT_NAME || "";
|
|
8
|
-
const host = process.env.CCAI_HOST || "";
|
|
9
|
-
const COBROWSE_CONSENT_TEMPLATE = `
|
|
10
|
-
<script class="cobrowse-template" type="text/template">
|
|
11
|
-
<div class="cobrowse">
|
|
12
|
-
<div class="cobrowse-title">$title</div>
|
|
13
|
-
<div class="cobrowse-content">$content</div>
|
|
14
|
-
<div class="cobrowse-footer">
|
|
15
|
-
<button class="cobrowse-deny js-cobrowse-deny">$deny</button>
|
|
16
|
-
<button class="cobrowse-allow js-cobrowse-allow">$allow</button>
|
|
17
|
-
</div>
|
|
18
|
-
</div>
|
|
19
|
-
<\/script>
|
|
20
|
-
`;
|
|
21
|
-
function Chat() {
|
|
22
|
-
const clientRef = useRef(null);
|
|
23
|
-
const hasLoadedBefore = useRef(true);
|
|
24
|
-
const addMessages = useMessages((state) => state.addMessages);
|
|
25
|
-
const addMessage = useMessages((state) => state.addMessage);
|
|
26
|
-
const chatRef = useRef(null);
|
|
27
|
-
const isMounted = useRef(true);
|
|
28
|
-
useEffect(() => {
|
|
29
|
-
let messageHandler;
|
|
30
|
-
let identityHandler;
|
|
31
|
-
let chatUpdatedHandler;
|
|
32
|
-
let memberJoinedHandler;
|
|
33
|
-
let chatConnectedHandler;
|
|
34
|
-
async function initChat() {
|
|
35
|
-
const { Client, consoleLoggerHandler, Logger } = await import("@ujet/websdk-headless");
|
|
36
|
-
console.log("this", isMounted);
|
|
37
|
-
Logger.addHandler(consoleLoggerHandler);
|
|
38
|
-
clientRef.current = new Client({
|
|
39
|
-
companyId,
|
|
40
|
-
tenant,
|
|
41
|
-
cobrowse: {
|
|
42
|
-
enabled: true,
|
|
43
|
-
template: COBROWSE_CONSENT_TEMPLATE,
|
|
44
|
-
messages: {
|
|
45
|
-
confirmSessionTitle: "...",
|
|
46
|
-
confirmSessionContent: "...",
|
|
47
|
-
endSessionText: "...",
|
|
48
|
-
confirmRemoteControlTitle: "...",
|
|
49
|
-
confirmRemoteControlContent: "...",
|
|
50
|
-
confirmFullDeviceTitle: "...",
|
|
51
|
-
confirmFullDeviceContent: "...",
|
|
52
|
-
allowText: "...",
|
|
53
|
-
denyText: "..."
|
|
54
|
-
}
|
|
55
|
-
},
|
|
56
|
-
host,
|
|
57
|
-
authenticate
|
|
58
|
-
});
|
|
59
|
-
const menus = await clientRef.current?.getMenus();
|
|
60
|
-
try {
|
|
61
|
-
chatRef.current = await clientRef.current?.loadOngoingChat();
|
|
62
|
-
console.log("chat:", chatRef.current);
|
|
63
|
-
if (!chatRef.current) {
|
|
64
|
-
chatRef.current = await clientRef.current?.createChat(
|
|
65
|
-
menus?.menus[5].id
|
|
66
|
-
);
|
|
67
|
-
}
|
|
68
|
-
} catch (error) {
|
|
69
|
-
console.error("Error creating chat:", error);
|
|
70
|
-
chatRef.current = await clientRef.current?.createChat(
|
|
71
|
-
menus?.menus[5].id
|
|
72
|
-
);
|
|
73
|
-
}
|
|
74
|
-
console.log("this");
|
|
75
|
-
identityHandler = (identity) => {
|
|
76
|
-
if (!isMounted.current) return;
|
|
77
|
-
console.log("identity:", identity);
|
|
78
|
-
};
|
|
79
|
-
messageHandler = (msg) => {
|
|
80
|
-
console.log("new message:", msg);
|
|
81
|
-
console.log("addMessage:", msg);
|
|
82
|
-
addMessage(msg);
|
|
83
|
-
};
|
|
84
|
-
chatUpdatedHandler = (chat) => {
|
|
85
|
-
console.log("chat updated:", chat);
|
|
86
|
-
};
|
|
87
|
-
chatConnectedHandler = async () => {
|
|
88
|
-
console.log("connected");
|
|
89
|
-
const messagesFetched = await clientRef.current?.fetchMessages();
|
|
90
|
-
console.log("[messages]:", messagesFetched);
|
|
91
|
-
addMessages(messagesFetched || []);
|
|
92
|
-
};
|
|
93
|
-
memberJoinedHandler = (identity) => {
|
|
94
|
-
console.log("member joined:", identity);
|
|
95
|
-
};
|
|
96
|
-
console.log(isMounted.current);
|
|
97
|
-
clientRef.current?.on("authenticated", () => {
|
|
98
|
-
console.log("authenticated");
|
|
99
|
-
});
|
|
100
|
-
clientRef.current?.on("chat.ongoing", (chat) => {
|
|
101
|
-
if (!isMounted.current) return;
|
|
102
|
-
console.log("chat:", chat);
|
|
103
|
-
});
|
|
104
|
-
clientRef.current?.on("chat.connected", chatConnectedHandler);
|
|
105
|
-
clientRef.current?.on("chat.updated", chatUpdatedHandler);
|
|
106
|
-
clientRef.current?.on("chat.identity", identityHandler);
|
|
107
|
-
clientRef.current?.on("chat.message", messageHandler);
|
|
108
|
-
clientRef.current?.on("cobrowse.request", ({ from }) => {
|
|
109
|
-
console.log("request by", from);
|
|
110
|
-
});
|
|
111
|
-
clientRef.current?.on("chat.memberJoined", memberJoinedHandler);
|
|
112
|
-
}
|
|
113
|
-
if (hasLoadedBefore.current) {
|
|
114
|
-
console.log("Initial setup");
|
|
115
|
-
initChat();
|
|
116
|
-
hasLoadedBefore.current = false;
|
|
117
|
-
}
|
|
118
|
-
return () => {
|
|
119
|
-
isMounted.current = false;
|
|
120
|
-
console.log("Component unmounted. Cancelling pending async operations.");
|
|
121
|
-
if (clientRef.current) {
|
|
122
|
-
if (messageHandler)
|
|
123
|
-
clientRef.current.off("chat.message", messageHandler);
|
|
124
|
-
if (identityHandler)
|
|
125
|
-
clientRef.current.off("chat.identity", identityHandler);
|
|
126
|
-
clientRef.current.off("chat.connected", chatConnectedHandler);
|
|
127
|
-
clientRef.current.off("chat.updated", chatUpdatedHandler);
|
|
128
|
-
clientRef.current.off("chat.memberJoined", memberJoinedHandler);
|
|
129
|
-
if (typeof clientRef.current.destroyChat === "function") {
|
|
130
|
-
console.log("Destroying chat:", chatRef.current);
|
|
131
|
-
clientRef.current.destroyChat();
|
|
132
|
-
}
|
|
133
|
-
}
|
|
134
|
-
};
|
|
135
|
-
}, [addMessage, addMessages]);
|
|
136
|
-
return /* @__PURE__ */ jsxs("div", { children: [
|
|
137
|
-
/* @__PURE__ */ jsx("h2", { children: "Chat" }),
|
|
138
|
-
/* @__PURE__ */ jsxs(
|
|
139
|
-
"form",
|
|
140
|
-
{
|
|
141
|
-
style: { marginTop: "1rem", display: "flex", gap: "0.5rem" },
|
|
142
|
-
onSubmit: async (e) => {
|
|
143
|
-
e.preventDefault();
|
|
144
|
-
const form = e.target;
|
|
145
|
-
const input = form.elements[0];
|
|
146
|
-
const message = input.value;
|
|
147
|
-
console.log("Sending message:", message);
|
|
148
|
-
try {
|
|
149
|
-
await clientRef.current?.sendTextMessage(message);
|
|
150
|
-
input.value = "";
|
|
151
|
-
} catch (error) {
|
|
152
|
-
console.error("Error sending message:", error);
|
|
153
|
-
}
|
|
154
|
-
},
|
|
155
|
-
children: [
|
|
156
|
-
/* @__PURE__ */ jsx("input", { type: "text", name: "message", placeholder: "Type a message..." }),
|
|
157
|
-
/* @__PURE__ */ jsx("button", { type: "submit", children: "Send" })
|
|
158
|
-
]
|
|
159
|
-
}
|
|
160
|
-
)
|
|
161
|
-
] });
|
|
162
|
-
}
|
|
163
|
-
export {
|
|
164
|
-
Chat as default
|
|
165
|
-
};
|
|
@@ -1,18 +0,0 @@
|
|
|
1
|
-
export declare const windowStyle: string;
|
|
2
|
-
export declare const windowOpenStyle: string;
|
|
3
|
-
export declare const windowBarStyle: string;
|
|
4
|
-
export declare const chat_title: string;
|
|
5
|
-
export declare const button_reset: string;
|
|
6
|
-
export declare const arrowFill: string;
|
|
7
|
-
export declare const inputStyle: string;
|
|
8
|
-
export declare const sendButtonStyle: string;
|
|
9
|
-
export declare const messagesContainerStyle: string;
|
|
10
|
-
export declare const notificationStyle: string;
|
|
11
|
-
export declare const messageStyle: string;
|
|
12
|
-
export declare const inline_button_wrapper: string;
|
|
13
|
-
export declare const inline_button: string;
|
|
14
|
-
export declare const endChatButtonStyle: string;
|
|
15
|
-
export declare const chatbotMenu: string;
|
|
16
|
-
export declare const chatbotMenuItem: string;
|
|
17
|
-
export declare const chatNetworkStatus: string;
|
|
18
|
-
export declare const chatFinishDialog: string;
|
|
@@ -1,40 +0,0 @@
|
|
|
1
|
-
import "./Chatbot.css.ts.vanilla.css.js";
|
|
2
|
-
import '../assets/Chatbot/ChatWindow.css';/* empty css */
|
|
3
|
-
var windowStyle = "_13n1jqk0";
|
|
4
|
-
var windowOpenStyle = "_13n1jqk1";
|
|
5
|
-
var windowBarStyle = "_13n1jqk2";
|
|
6
|
-
var chat_title = "_13n1jqk3";
|
|
7
|
-
var button_reset = "_13n1jqk4";
|
|
8
|
-
var arrowFill = "_13n1jqk5";
|
|
9
|
-
var inputStyle = "_13n1jqk6";
|
|
10
|
-
var sendButtonStyle = "_13n1jqk7";
|
|
11
|
-
var messagesContainerStyle = "_13n1jqk8";
|
|
12
|
-
var notificationStyle = "_13n1jqk9";
|
|
13
|
-
var messageStyle = "_13n1jqka";
|
|
14
|
-
var inline_button_wrapper = "_13n1jqkb";
|
|
15
|
-
var inline_button = "_13n1jqkc";
|
|
16
|
-
var endChatButtonStyle = "_13n1jqkd";
|
|
17
|
-
var chatbotMenu = "_13n1jqke";
|
|
18
|
-
var chatbotMenuItem = "_13n1jqkf";
|
|
19
|
-
var chatNetworkStatus = "_13n1jqkg";
|
|
20
|
-
var chatFinishDialog = "_13n1jqkh";
|
|
21
|
-
export {
|
|
22
|
-
arrowFill,
|
|
23
|
-
button_reset,
|
|
24
|
-
chatFinishDialog,
|
|
25
|
-
chatNetworkStatus,
|
|
26
|
-
chat_title,
|
|
27
|
-
chatbotMenu,
|
|
28
|
-
chatbotMenuItem,
|
|
29
|
-
endChatButtonStyle,
|
|
30
|
-
inline_button,
|
|
31
|
-
inline_button_wrapper,
|
|
32
|
-
inputStyle,
|
|
33
|
-
messageStyle,
|
|
34
|
-
messagesContainerStyle,
|
|
35
|
-
notificationStyle,
|
|
36
|
-
sendButtonStyle,
|
|
37
|
-
windowBarStyle,
|
|
38
|
-
windowOpenStyle,
|
|
39
|
-
windowStyle
|
|
40
|
-
};
|
|
@@ -1,30 +0,0 @@
|
|
|
1
|
-
import { MessageResponse as BaseMessageResponse, HumanAgent } from '@ujet/websdk-headless';
|
|
2
|
-
import { default as React } from 'react';
|
|
3
|
-
|
|
4
|
-
interface MessageResponse extends BaseMessageResponse {
|
|
5
|
-
to_agent?: HumanAgent;
|
|
6
|
-
}
|
|
7
|
-
export interface ChatBubble {
|
|
8
|
-
id: string | number;
|
|
9
|
-
body: string;
|
|
10
|
-
sender?: string;
|
|
11
|
-
timestamp?: string;
|
|
12
|
-
isOwn?: boolean;
|
|
13
|
-
}
|
|
14
|
-
interface ChatWindowProps {
|
|
15
|
-
messages: MessageResponse[];
|
|
16
|
-
status?: string;
|
|
17
|
-
onSend: (msg: string) => void;
|
|
18
|
-
inputDisabled?: boolean;
|
|
19
|
-
onClose?: () => void;
|
|
20
|
-
endChat?: () => void;
|
|
21
|
-
showReconnect?: boolean;
|
|
22
|
-
virtualAgent?: {
|
|
23
|
-
avatar_url: string;
|
|
24
|
-
name: string;
|
|
25
|
-
id: string;
|
|
26
|
-
};
|
|
27
|
-
showAvatar?: boolean;
|
|
28
|
-
}
|
|
29
|
-
export declare const ChatWindow: React.FC<ChatWindowProps>;
|
|
30
|
-
export {};
|
|
@@ -1,397 +0,0 @@
|
|
|
1
|
-
"use client";
|
|
2
|
-
import { jsxs, jsx, Fragment } from "react/jsx-runtime";
|
|
3
|
-
import clsx from "clsx";
|
|
4
|
-
import React, { useRef, useEffect, Fragment as Fragment$1 } from "react";
|
|
5
|
-
import ReactMarkdown from "react-markdown";
|
|
6
|
-
import { useNetworkState, useMount } from "react-use";
|
|
7
|
-
import remarkGfm from "remark-gfm";
|
|
8
|
-
import { windowBarStyle, chat_title, chatbotMenuItem, chatbotMenu, chatFinishDialog, endChatButtonStyle, button_reset, arrowFill, chatNetworkStatus, notificationStyle, messageStyle, inline_button_wrapper, inline_button, messagesContainerStyle, inputStyle, sendButtonStyle, windowStyle, windowOpenStyle } from "./ChatWindow.css.js";
|
|
9
|
-
import { EllipsisIcon } from "./EllipsisIcon.js";
|
|
10
|
-
import { useOpenChat } from "./store/chat.js";
|
|
11
|
-
const ChatWindow = ({
|
|
12
|
-
messages,
|
|
13
|
-
status = "connected",
|
|
14
|
-
onSend,
|
|
15
|
-
inputDisabled = false,
|
|
16
|
-
onClose,
|
|
17
|
-
endChat = () => {
|
|
18
|
-
console.log("End chat");
|
|
19
|
-
},
|
|
20
|
-
showReconnect = false,
|
|
21
|
-
virtualAgent,
|
|
22
|
-
showAvatar = false
|
|
23
|
-
}) => {
|
|
24
|
-
const [mounted, setMounted] = React.useState(false);
|
|
25
|
-
const [menuOpen, setMenuOpen] = React.useState(false);
|
|
26
|
-
const [showEndChatDialog, setShowEndChatDialog] = React.useState(false);
|
|
27
|
-
const state = useNetworkState();
|
|
28
|
-
const [input, setInput] = React.useState("");
|
|
29
|
-
const messagesEndRef = useRef(null);
|
|
30
|
-
const isOpen = useOpenChat((state2) => state2.isOpen);
|
|
31
|
-
useEffect(() => {
|
|
32
|
-
messagesEndRef.current?.scrollIntoView({ behavior: "smooth" });
|
|
33
|
-
}, [messages]);
|
|
34
|
-
const handleSend = (e) => {
|
|
35
|
-
e.preventDefault();
|
|
36
|
-
if (input.trim()) {
|
|
37
|
-
onSend(input);
|
|
38
|
-
setInput("");
|
|
39
|
-
}
|
|
40
|
-
};
|
|
41
|
-
useMount(() => {
|
|
42
|
-
setMounted(true);
|
|
43
|
-
});
|
|
44
|
-
const project = process.env.CCAI_PROJECT_ID;
|
|
45
|
-
const isAxos = project === "axos";
|
|
46
|
-
const endUserBg = isAxos ? "#14263d" : "#323339";
|
|
47
|
-
const chatbotBg = isAxos ? "#E9F8FF" : "#EAE8E8";
|
|
48
|
-
return /* @__PURE__ */ jsxs("div", { className: clsx(windowStyle, isOpen && windowOpenStyle), children: [
|
|
49
|
-
/* @__PURE__ */ jsxs("div", { className: windowBarStyle, children: [
|
|
50
|
-
/* @__PURE__ */ jsxs("div", { className: "flex middle", style: { paddingBlock: "6px" }, children: [
|
|
51
|
-
/* @__PURE__ */ jsx(
|
|
52
|
-
"img",
|
|
53
|
-
{
|
|
54
|
-
src: "https://www.axos.com/images/2xmVfQm5l0HWOKjgxQO1Iw/axb-assistant.svg",
|
|
55
|
-
style: { marginRight: 12 },
|
|
56
|
-
height: 18,
|
|
57
|
-
width: 18
|
|
58
|
-
}
|
|
59
|
-
),
|
|
60
|
-
/* @__PURE__ */ jsx("h2", { className: chat_title, children: "Evo Virtual Assistant" })
|
|
61
|
-
] }),
|
|
62
|
-
/* @__PURE__ */ jsx(
|
|
63
|
-
"button",
|
|
64
|
-
{
|
|
65
|
-
onClick: () => {
|
|
66
|
-
setMenuOpen(!menuOpen);
|
|
67
|
-
},
|
|
68
|
-
style: {
|
|
69
|
-
border: "none",
|
|
70
|
-
background: "transparent",
|
|
71
|
-
marginLeft: "auto",
|
|
72
|
-
cursor: "pointer",
|
|
73
|
-
padding: 0,
|
|
74
|
-
display: "flex",
|
|
75
|
-
alignContent: "center"
|
|
76
|
-
},
|
|
77
|
-
children: /* @__PURE__ */ jsx(EllipsisIcon, { color: "#fff" })
|
|
78
|
-
}
|
|
79
|
-
),
|
|
80
|
-
menuOpen && /* @__PURE__ */ jsx("ul", { className: clsx(chatbotMenu), children: /* @__PURE__ */ jsx("li", { className: chatbotMenuItem, children: /* @__PURE__ */ jsx(
|
|
81
|
-
"button",
|
|
82
|
-
{
|
|
83
|
-
type: "button",
|
|
84
|
-
onClick: () => {
|
|
85
|
-
setShowEndChatDialog(true);
|
|
86
|
-
setMenuOpen(false);
|
|
87
|
-
},
|
|
88
|
-
style: { width: "100%" },
|
|
89
|
-
children: "Finish chat"
|
|
90
|
-
}
|
|
91
|
-
) }) }),
|
|
92
|
-
showEndChatDialog && /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
93
|
-
/* @__PURE__ */ jsx(
|
|
94
|
-
"div",
|
|
95
|
-
{
|
|
96
|
-
style: {
|
|
97
|
-
background: "#00000080",
|
|
98
|
-
position: "fixed",
|
|
99
|
-
top: 0,
|
|
100
|
-
left: 0,
|
|
101
|
-
right: 0,
|
|
102
|
-
bottom: 0,
|
|
103
|
-
zIndex: 999,
|
|
104
|
-
opacity: 0.75
|
|
105
|
-
}
|
|
106
|
-
}
|
|
107
|
-
),
|
|
108
|
-
/* @__PURE__ */ jsx(
|
|
109
|
-
"dialog",
|
|
110
|
-
{
|
|
111
|
-
open: showEndChatDialog,
|
|
112
|
-
style: {
|
|
113
|
-
padding: "1rem",
|
|
114
|
-
borderRadius: 8,
|
|
115
|
-
background: "#fff",
|
|
116
|
-
color: "#000",
|
|
117
|
-
border: `1px solid ${endUserBg}`,
|
|
118
|
-
outline: "none",
|
|
119
|
-
maxWidth: "90%",
|
|
120
|
-
top: "25%",
|
|
121
|
-
marginInline: "auto",
|
|
122
|
-
zIndex: 1e3
|
|
123
|
-
},
|
|
124
|
-
children: /* @__PURE__ */ jsxs("form", { method: "dialog", className: chatFinishDialog, children: [
|
|
125
|
-
/* @__PURE__ */ jsx("p", { children: "Are you sure you want to end this chat?" }),
|
|
126
|
-
/* @__PURE__ */ jsxs(
|
|
127
|
-
"div",
|
|
128
|
-
{
|
|
129
|
-
style: { display: "flex", gap: "1rem", marginTop: "1rem" },
|
|
130
|
-
children: [
|
|
131
|
-
/* @__PURE__ */ jsx(
|
|
132
|
-
"button",
|
|
133
|
-
{
|
|
134
|
-
className: endChatButtonStyle,
|
|
135
|
-
type: "submit",
|
|
136
|
-
onClick: () => {
|
|
137
|
-
endChat();
|
|
138
|
-
setShowEndChatDialog(false);
|
|
139
|
-
},
|
|
140
|
-
children: "Yes"
|
|
141
|
-
}
|
|
142
|
-
),
|
|
143
|
-
/* @__PURE__ */ jsx(
|
|
144
|
-
"button",
|
|
145
|
-
{
|
|
146
|
-
className: endChatButtonStyle,
|
|
147
|
-
type: "button",
|
|
148
|
-
onClick: () => {
|
|
149
|
-
setShowEndChatDialog(false);
|
|
150
|
-
},
|
|
151
|
-
children: "No"
|
|
152
|
-
}
|
|
153
|
-
)
|
|
154
|
-
]
|
|
155
|
-
}
|
|
156
|
-
)
|
|
157
|
-
] })
|
|
158
|
-
}
|
|
159
|
-
)
|
|
160
|
-
] }),
|
|
161
|
-
onClose && /* @__PURE__ */ jsx(
|
|
162
|
-
"button",
|
|
163
|
-
{
|
|
164
|
-
onClick: onClose,
|
|
165
|
-
className: button_reset,
|
|
166
|
-
"aria-label": "Close chat",
|
|
167
|
-
title: "Close",
|
|
168
|
-
children: /* @__PURE__ */ jsx(
|
|
169
|
-
"svg",
|
|
170
|
-
{
|
|
171
|
-
xmlns: "http://www.w3.org/2000/svg",
|
|
172
|
-
width: "24",
|
|
173
|
-
height: "24",
|
|
174
|
-
viewBox: "0 0 24 24",
|
|
175
|
-
fill: "none",
|
|
176
|
-
children: /* @__PURE__ */ jsx(
|
|
177
|
-
"path",
|
|
178
|
-
{
|
|
179
|
-
className: arrowFill,
|
|
180
|
-
d: "M2.46875 7.76574L11.9991 17.2961L21.5294 7.76574L20.4687 6.70508L11.9991 15.1749L3.52941 6.70508L2.46875 7.76574Z",
|
|
181
|
-
fill: "#98DDFF"
|
|
182
|
-
}
|
|
183
|
-
)
|
|
184
|
-
}
|
|
185
|
-
)
|
|
186
|
-
}
|
|
187
|
-
)
|
|
188
|
-
] }),
|
|
189
|
-
mounted && !state.online ? /* @__PURE__ */ jsx("div", { className: clsx(chatNetworkStatus), children: /* @__PURE__ */ jsxs(
|
|
190
|
-
"div",
|
|
191
|
-
{
|
|
192
|
-
style: {
|
|
193
|
-
color: "#d32f2f",
|
|
194
|
-
textAlign: "center",
|
|
195
|
-
padding: "8px 0",
|
|
196
|
-
fontWeight: 500
|
|
197
|
-
},
|
|
198
|
-
children: [
|
|
199
|
-
/* @__PURE__ */ jsx(
|
|
200
|
-
"span",
|
|
201
|
-
{
|
|
202
|
-
role: "img",
|
|
203
|
-
"aria-label": "disconnected",
|
|
204
|
-
style: { marginRight: 6 },
|
|
205
|
-
children: "⚠️"
|
|
206
|
-
}
|
|
207
|
-
),
|
|
208
|
-
"You are currently disconnected. Please check your connection."
|
|
209
|
-
]
|
|
210
|
-
}
|
|
211
|
-
) }) : null,
|
|
212
|
-
/* @__PURE__ */ jsxs("div", { className: clsx(messagesContainerStyle), children: [
|
|
213
|
-
messages?.map((msg) => /* @__PURE__ */ jsxs(Fragment$1, { children: [
|
|
214
|
-
msg.type == "noti" && msg.$userType == "system" && msg.event == "escalationStarted" && /* @__PURE__ */ jsx("div", { className: notificationStyle, children: "We are connecting you with a human agent..." }, msg.$index),
|
|
215
|
-
msg.type == "noti" && msg.$userType == "system" && msg.event == "memberLeft" && /* @__PURE__ */ jsxs("div", { className: notificationStyle, children: [
|
|
216
|
-
/* @__PURE__ */ jsx("strong", { children: "Virtual Agent" }),
|
|
217
|
-
" just left the conversation."
|
|
218
|
-
] }, msg.$index),
|
|
219
|
-
msg.type == "noti" && msg.$userType == "system" && msg.event == "escalationAccepted" && /* @__PURE__ */ jsxs("div", { className: notificationStyle, children: [
|
|
220
|
-
"You are now connected with a",
|
|
221
|
-
" ",
|
|
222
|
-
msg.to_agent ? /* @__PURE__ */ jsx("strong", { children: msg?.to_agent?.name }) : "an agent"
|
|
223
|
-
] }, msg.$index),
|
|
224
|
-
["text", "markdown_template", "markdown"].includes(msg.type) && /* @__PURE__ */ jsxs(
|
|
225
|
-
"div",
|
|
226
|
-
{
|
|
227
|
-
className: messageStyle,
|
|
228
|
-
style: {
|
|
229
|
-
textAlign: msg.$userType == "end_user" ? "right" : "left",
|
|
230
|
-
alignSelf: msg.$userType == "end_user" ? "flex-end" : "flex-start",
|
|
231
|
-
background: msg.$userType == "end_user" ? endUserBg : chatbotBg,
|
|
232
|
-
color: msg.$userType == "end_user" ? "#fff" : "#1F1F1F",
|
|
233
|
-
boxShadow: msg.$userType == "end_user" ? "0 1px 4px #b3e0ff55" : void 0
|
|
234
|
-
},
|
|
235
|
-
children: [
|
|
236
|
-
/* @__PURE__ */ jsxs(
|
|
237
|
-
"div",
|
|
238
|
-
{
|
|
239
|
-
style: {
|
|
240
|
-
fontSize: 13,
|
|
241
|
-
display: "flex",
|
|
242
|
-
flexDirection: "column",
|
|
243
|
-
gap: 4
|
|
244
|
-
},
|
|
245
|
-
children: [
|
|
246
|
-
msg.$userType == "virtual_agent" && /* @__PURE__ */ jsxs(
|
|
247
|
-
"div",
|
|
248
|
-
{
|
|
249
|
-
style: {
|
|
250
|
-
display: "flex",
|
|
251
|
-
// justifyContent: "center",
|
|
252
|
-
alignItems: "center",
|
|
253
|
-
gap: "8px"
|
|
254
|
-
},
|
|
255
|
-
children: [
|
|
256
|
-
showAvatar && /* @__PURE__ */ jsx(
|
|
257
|
-
"img",
|
|
258
|
-
{
|
|
259
|
-
width: 24,
|
|
260
|
-
height: 24,
|
|
261
|
-
src: virtualAgent?.avatar_url,
|
|
262
|
-
alt: "agent avatar"
|
|
263
|
-
}
|
|
264
|
-
),
|
|
265
|
-
/* @__PURE__ */ jsx("strong", { children: virtualAgent?.name })
|
|
266
|
-
]
|
|
267
|
-
}
|
|
268
|
-
),
|
|
269
|
-
/* @__PURE__ */ jsx(
|
|
270
|
-
ReactMarkdown,
|
|
271
|
-
{
|
|
272
|
-
remarkPlugins: [[remarkGfm, { singleTilde: false }]],
|
|
273
|
-
components: {
|
|
274
|
-
p: ({ ...props }) => /* @__PURE__ */ jsx(
|
|
275
|
-
"p",
|
|
276
|
-
{
|
|
277
|
-
style: { margin: 0, fontSize: "inherit" },
|
|
278
|
-
title: new Date(msg.$timestamp).toLocaleString(),
|
|
279
|
-
...props
|
|
280
|
-
}
|
|
281
|
-
)
|
|
282
|
-
},
|
|
283
|
-
children: msg.content
|
|
284
|
-
}
|
|
285
|
-
)
|
|
286
|
-
]
|
|
287
|
-
}
|
|
288
|
-
),
|
|
289
|
-
/* @__PURE__ */ jsx("div", { style: { fontSize: 10, color: "#888", marginTop: 2 } })
|
|
290
|
-
]
|
|
291
|
-
},
|
|
292
|
-
msg.$index
|
|
293
|
-
),
|
|
294
|
-
msg.type == "inline_button" && Array.isArray(msg.buttons) && msg.buttons.length > 0 && /* @__PURE__ */ jsx("div", { className: inline_button_wrapper, children: msg.buttons.length !== 0 && Array.isArray(msg.buttons) && msg.buttons.map((button, index) => {
|
|
295
|
-
const lastItem = msg.buttons && msg.buttons?.length - 1;
|
|
296
|
-
return /* @__PURE__ */ jsx(
|
|
297
|
-
"button",
|
|
298
|
-
{
|
|
299
|
-
className: inline_button,
|
|
300
|
-
style: {
|
|
301
|
-
borderRadius: "0px",
|
|
302
|
-
borderTopLeftRadius: [0].includes(index) ? 8 : 0,
|
|
303
|
-
borderTopRightRadius: [0].includes(index) ? 8 : 0,
|
|
304
|
-
borderBottomLeftRadius: [lastItem].includes(index) ? 8 : 0,
|
|
305
|
-
borderBottomRightRadius: [lastItem].includes(index) ? 8 : 0
|
|
306
|
-
},
|
|
307
|
-
onClick: () => {
|
|
308
|
-
onSend(button?.title);
|
|
309
|
-
},
|
|
310
|
-
children: button.title
|
|
311
|
-
},
|
|
312
|
-
index
|
|
313
|
-
);
|
|
314
|
-
}) }),
|
|
315
|
-
msg.event == "chatEnded" && /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
316
|
-
/* @__PURE__ */ jsxs(
|
|
317
|
-
"div",
|
|
318
|
-
{
|
|
319
|
-
title: (/* @__PURE__ */ new Date()).toLocaleString(),
|
|
320
|
-
style: {
|
|
321
|
-
fontSize: 12,
|
|
322
|
-
color: "#888",
|
|
323
|
-
marginBottom: 4,
|
|
324
|
-
textAlign: "center"
|
|
325
|
-
},
|
|
326
|
-
children: [
|
|
327
|
-
"Thank you for chatting!",
|
|
328
|
-
/* @__PURE__ */ jsx("br", {}),
|
|
329
|
-
" This conversation has ended."
|
|
330
|
-
]
|
|
331
|
-
}
|
|
332
|
-
),
|
|
333
|
-
/* @__PURE__ */ jsx("div", { style: { textAlign: "center", marginBottom: 12 }, children: /* @__PURE__ */ jsx("button", { className: endChatButtonStyle, onClick: endChat, children: "End Chat" }) })
|
|
334
|
-
] })
|
|
335
|
-
] }, msg.$index)),
|
|
336
|
-
showReconnect && /* @__PURE__ */ jsx(
|
|
337
|
-
"button",
|
|
338
|
-
{
|
|
339
|
-
style: { margin: "12px auto", display: "block" },
|
|
340
|
-
onClick: () => {
|
|
341
|
-
},
|
|
342
|
-
children: "Reconnect Chat"
|
|
343
|
-
}
|
|
344
|
-
),
|
|
345
|
-
/* @__PURE__ */ jsx("div", { ref: messagesEndRef })
|
|
346
|
-
] }),
|
|
347
|
-
/* @__PURE__ */ jsxs(
|
|
348
|
-
"form",
|
|
349
|
-
{
|
|
350
|
-
onSubmit: handleSend,
|
|
351
|
-
style: {
|
|
352
|
-
borderTop: "1px solid #eee",
|
|
353
|
-
display: "flex",
|
|
354
|
-
gap: 8
|
|
355
|
-
},
|
|
356
|
-
children: [
|
|
357
|
-
/* @__PURE__ */ jsx(
|
|
358
|
-
"input",
|
|
359
|
-
{
|
|
360
|
-
type: "text",
|
|
361
|
-
value: input,
|
|
362
|
-
onChange: (e) => setInput(e.target.value),
|
|
363
|
-
placeholder: "Ask something...",
|
|
364
|
-
className: inputStyle,
|
|
365
|
-
autoFocus: true,
|
|
366
|
-
disabled: inputDisabled || status !== "connected"
|
|
367
|
-
}
|
|
368
|
-
),
|
|
369
|
-
/* @__PURE__ */ jsx(
|
|
370
|
-
"button",
|
|
371
|
-
{
|
|
372
|
-
className: clsx(sendButtonStyle, input.trim().length > 0 && "active"),
|
|
373
|
-
type: "submit",
|
|
374
|
-
disabled: inputDisabled || status !== "connected" || !input.trim(),
|
|
375
|
-
children: /* @__PURE__ */ jsxs(
|
|
376
|
-
"svg",
|
|
377
|
-
{
|
|
378
|
-
xmlns: "http://www.w3.org/2000/svg",
|
|
379
|
-
id: "send-icon",
|
|
380
|
-
width: 24,
|
|
381
|
-
height: 24,
|
|
382
|
-
children: [
|
|
383
|
-
/* @__PURE__ */ jsx("path", { d: "M2.01 21L23 12 2.01 3 2 10l15 2-15 2z" }),
|
|
384
|
-
/* @__PURE__ */ jsx("path", { d: "M0 0h24v24H0z", fill: "none" })
|
|
385
|
-
]
|
|
386
|
-
}
|
|
387
|
-
)
|
|
388
|
-
}
|
|
389
|
-
)
|
|
390
|
-
]
|
|
391
|
-
}
|
|
392
|
-
)
|
|
393
|
-
] });
|
|
394
|
-
};
|
|
395
|
-
export {
|
|
396
|
-
ChatWindow
|
|
397
|
-
};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
|