@axos-web-dev/shared-components 1.0.100-dev.57 → 1.0.100-dev.59
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 +4 -2
- package/dist/Accordion/Accordion.css.js +2 -1
- package/dist/Accordion/Accordion.js +2 -1
- package/dist/AlertBanner/index.js +2 -1
- package/dist/Article/Article.css.js +2 -1
- package/dist/ArticlesSet/ArticlesSet.css.js +2 -1
- package/dist/Auth/ErrorAlert.js +4 -2
- package/dist/Auth/SignIn.css.js +2 -1
- package/dist/AwardsBanner/AwardsBanner.css.js +2 -1
- package/dist/Blockquote/Blockquote.module.js +3 -3
- package/dist/BulletItem/BulletItem.js +2 -1
- package/dist/Button/Button.css.js +2 -1
- package/dist/Button/Button.js +4 -2
- package/dist/Calculators/AnnualFeeCalculator/AnnualFeeCalculator.css.js +2 -1
- package/dist/Calculators/ApyCalculator/ApyCalculator.css.js +2 -1
- package/dist/Calculators/AxosOneCalculator/BalanceAPYCalculator.css.js +2 -1
- package/dist/Calculators/AxosOneCalculator/index.js +4 -3
- package/dist/Calculators/BalanceAPYCalculator/BalanceAPYCalculator.css.js +2 -1
- package/dist/Calculators/BalanceAPYCalculator/index.js +2 -1
- package/dist/Calculators/BuyDownCalculator/BuyDownCalculator.css.js +2 -1
- package/dist/Calculators/Calculator.js +4 -2
- package/dist/Calculators/MonthlyPaymentCalculator/MonthlyPaymentCalculator.css.js +2 -1
- package/dist/Calculators/MonthlyPaymentLVFCalculator/MonthlyPaymentCalculator.css.js +2 -1
- package/dist/Calculators/SummitApyCalculator/BalanceAPYCalculator.css.js +2 -1
- package/dist/Calculators/SummitApyCalculator/index.js +2 -1
- package/dist/Calculators/calculator.css.js +2 -1
- package/dist/CallToActionBar/CallToActionBar.css.js +2 -1
- package/dist/Carousel/Carousel.css.js +2 -1
- package/dist/Carousel/index.js +4 -2
- package/dist/Chatbot/AnimatedGradientBorder.css.d.ts +3 -0
- package/dist/Chatbot/AnimatedGradientBorder.css.js +13 -0
- package/dist/Chatbot/Bubble.css.d.ts +4 -0
- package/dist/Chatbot/Bubble.css.js +15 -3
- package/dist/Chatbot/Bubble.js +26 -19
- package/dist/Chatbot/ChatWindow.css.d.ts +17 -0
- package/dist/Chatbot/ChatWindow.css.js +46 -17
- package/dist/Chatbot/ChatWindow.d.ts +4 -1
- package/dist/Chatbot/ChatWindow.js +322 -283
- package/dist/Chatbot/Chatbot.css.js +1 -1
- package/dist/Chatbot/Chatbot.js +32 -5
- package/dist/Chatbot/ChatbotMessage.d.ts +16 -0
- package/dist/Chatbot/ChatbotMessage.js +215 -0
- package/dist/Chatbot/ThankYouMessage.d.ts +9 -0
- package/dist/Chatbot/ThankYouMessage.js +510 -0
- package/dist/Chatbot/index.js +18 -2
- package/dist/Chatbot/store/chat.d.ts +3 -0
- package/dist/Chatbot/store/chat.js +4 -1
- package/dist/Chatbot/store/messages.d.ts +1 -1
- package/dist/Chatbot/store/messages.js +7 -2
- package/dist/Chevron/Chevron.css.js +2 -1
- package/dist/Chevron/index.js +4 -2
- package/dist/CollectInformationAlert/CollectInformationAlert.css.js +2 -1
- package/dist/CollectInformationAlert/index.js +2 -1
- package/dist/Comparison/Comparison.css.js +2 -1
- package/dist/Comparison/Comparison.js +4 -2
- package/dist/ContentBanner/ContentBanner.css.js +2 -1
- package/dist/DownloadTile/DownloadTile.css.js +2 -1
- package/dist/ExecutiveBio/ExecutiveBio.css.js +2 -1
- package/dist/ExecutiveBio/ExecutiveBio.js +4 -2
- package/dist/FaqAccordion/FaqAccordion.css.js +2 -1
- package/dist/FaqAccordion/index.js +4 -2
- package/dist/FooterDisclosure/LVF/LaVictorieFooter.css.js +2 -1
- package/dist/FooterDisclosure/LVF/LaVictorieFooter.js +2 -1
- package/dist/FooterSiteMap/AxosBank/FooterSiteMap.css.js +2 -1
- package/dist/FooterSiteMap/AxosBank/FooterSiteMap.js +5 -21
- package/dist/Forms/ApplicationStart.js +2 -1
- package/dist/Forms/ApplyNow.js +4 -2
- package/dist/Forms/ClearingForm.js +2 -1
- package/dist/Forms/CommercialDeposits.js +2 -1
- package/dist/Forms/CommercialDepositsNoLendingOption.js +2 -1
- package/dist/Forms/CommercialLending.js +2 -1
- package/dist/Forms/CommercialPremiumFinance.js +2 -1
- package/dist/Forms/ContactCompany.js +2 -1
- package/dist/Forms/ContactCompanyTitle.js +2 -1
- package/dist/Forms/ContactUs.js +2 -1
- package/dist/Forms/ContactUsAAS.js +2 -1
- package/dist/Forms/ContactUsBusiness.js +4 -2
- package/dist/Forms/ContactUsBusinessNameEmail.js +4 -2
- package/dist/Forms/ContactUsLVF.js +2 -1
- package/dist/Forms/ContactUsNMLSId.js +4 -2
- package/dist/Forms/CpraRequest.js +2 -1
- package/dist/Forms/CraPublicFile.js +4 -2
- package/dist/Forms/DealerServices.js +2 -1
- package/dist/Forms/EmailOnly.js +4 -2
- package/dist/Forms/EmailUs.js +2 -1
- package/dist/Forms/Forms.css.js +2 -1
- package/dist/Forms/MortgageRate/MortgageRateForm.js +4 -2
- package/dist/Forms/MortgageRate/MortgageRateWatch.js +4 -2
- package/dist/Forms/MortgageWarehouseLending.js +4 -2
- package/dist/Forms/QuickPricer/QuickPricerForm.js +2 -1
- package/dist/Forms/QuickPricer/UserInformation.css.js +2 -1
- package/dist/Forms/ScheduleCall.js +2 -1
- package/dist/Forms/ScheduleCallPremier.js +2 -1
- package/dist/Forms/SuccesForm.js +4 -2
- package/dist/Forms/WcplSurvey.js +2 -1
- package/dist/HeroBanner/HeroBanner.css.js +2 -1
- package/dist/HeroBanner/HeroBanner.js +2 -1
- package/dist/HeroBanner/LargeBanner.css.js +2 -1
- package/dist/HeroBanner/SelectionBanner.css.js +2 -1
- package/dist/Hyperlink/Hyperlink.css.js +2 -1
- package/dist/Hyperlink/index.js +4 -2
- package/dist/IconBillboard/IconBillboard.css.js +2 -1
- package/dist/ImageBillboard/ImageBillboard.css.js +2 -1
- package/dist/ImageBillboard/ImageBillboard.js +2 -1
- package/dist/ImageBillboard/ImageBillboardSet.js +2 -1
- package/dist/ImageLink/ImageLink.js +4 -2
- package/dist/ImageLink/ImageLinkSet.js +4 -2
- package/dist/ImageLink/index.js +4 -2
- package/dist/Input/Input.css.js +2 -1
- package/dist/Inputs/Input.css.js +2 -1
- package/dist/Insight/Featured/CategorySelector.css.js +2 -1
- package/dist/Insight/Featured/CategorySelector.js +4 -2
- package/dist/Insight/Featured/Featured.js +4 -2
- package/dist/Insight/Featured/Header.js +4 -2
- package/dist/Interstitial/Interstitial-variants.css.js +2 -1
- package/dist/LandingPageHeader/LandingPageHeader.css.js +2 -1
- package/dist/LandingPageHeader/LandingPageHeader.js +2 -1
- package/dist/MainHTML/index.d.ts +1 -1
- package/dist/MainHTML/index.js +3 -1
- package/dist/Modal/Modal.css.js +2 -1
- package/dist/Modal/Modal.js +4 -2
- package/dist/Modal/contextApi/store.js +1 -1
- package/dist/NavigationMenu/AxosALTS/NavBar.css.js +2 -1
- package/dist/NavigationMenu/AxosALTS/NavData.js +4 -2
- package/dist/NavigationMenu/AxosALTS/index.js +4 -2
- package/dist/NavigationMenu/AxosAdvisor/NavBar.css.js +2 -1
- package/dist/NavigationMenu/AxosAdvisor/SubNavbar.css.js +2 -1
- package/dist/NavigationMenu/AxosAdvisorServices/NavBar.css.js +2 -1
- package/dist/NavigationMenu/AxosAdvisorServices/SubNavbar.css.js +2 -1
- package/dist/NavigationMenu/AxosBank/MobileMenu/MobileNavData.js +4 -2
- package/dist/NavigationMenu/AxosBank/NavBar.css.js +2 -1
- package/dist/NavigationMenu/AxosBank/NavData.js +4 -2
- package/dist/NavigationMenu/AxosBank/SubNavBar.js +4 -2
- package/dist/NavigationMenu/AxosBank/SubNavbar.css.js +2 -1
- package/dist/NavigationMenu/AxosBank/index.js +4 -2
- package/dist/NavigationMenu/LaVictoire/NavData.js +4 -2
- package/dist/NavigationMenu/LaVictoire/index.js +4 -2
- package/dist/NavigationMenu/NavDataJson.js +4 -2
- package/dist/NavigationMenu/Navbar.js +4 -2
- package/dist/NavigationMenu/SignInNavButton.js +4 -2
- package/dist/PageNavItem/PageNavItem.css.js +2 -1
- package/dist/Pagination/Pagination.js +2 -1
- package/dist/SecondaryFooter/SecondaryFooter.css.js +2 -1
- package/dist/SetContainer/SetContainer.css.js +2 -1
- package/dist/SetContainer/SetContainer.js +4 -2
- package/dist/SocialMediaBar/iconsRepository.js +4 -2
- package/dist/StepItem/StepItem.css.js +2 -1
- package/dist/StepItemSet/StepItemSet.css.js +2 -1
- package/dist/StepItemSet/StepItemSet.js +2 -1
- package/dist/Tab/Tab.css.js +2 -1
- package/dist/Table/Table.css.js +2 -1
- package/dist/Table/Table.js +2 -1
- package/dist/TextBlock/TextBlock.css.js +2 -1
- package/dist/VideoTile/VideoTile.css.js +2 -1
- package/dist/VideoTile/VideoTile.js +4 -2
- package/dist/VideoWrapper/index.js +4 -2
- package/dist/assets/Blockquote/Blockquote.css.css +72 -72
- package/dist/assets/Chatbot/AnimatedGradientBorder.css +37 -0
- package/dist/assets/Chatbot/Bubble.css +58 -21
- package/dist/assets/Chatbot/ChatWindow.css +208 -83
- package/dist/assets/Chatbot/Chatbot.css +3 -0
- package/dist/assets/DownloadTile/DownloadTile.css +1 -1
- package/dist/assets/Insight/Insight.css +2 -2
- package/dist/assets/themes/axos.css +11 -0
- package/dist/assets/themes/premier.css +11 -0
- package/dist/assets/themes/ufb.css +51 -0
- package/dist/assets/themes/victorie.css +11 -0
- package/dist/icons/ArrowIcon/ArrowIcon.css.js +2 -1
- package/dist/icons/CheckIcon/CheckIcon.css.js +2 -1
- package/dist/icons/DownloadIcon/DownloadIcon.css.js +2 -1
- package/dist/icons/FollowIcon/FollowIcon.css.js +2 -1
- package/dist/main.js +20 -2
- package/dist/themes/axos.css.d.ts +17 -0
- package/dist/themes/axos.css.js +1 -1
- package/dist/themes/index.d.ts +1 -0
- package/dist/themes/index.js +2 -0
- package/dist/themes/ufb.css.d.ts +1 -0
- package/dist/themes/ufb.css.js +6 -0
- package/package.json +136 -136
- package/dist/Chatbot/Chatbot.css.ts.vanilla.css.js +0 -1
package/dist/Chatbot/Chatbot.js
CHANGED
|
@@ -30,6 +30,17 @@ const Chatbot = ({
|
|
|
30
30
|
["axos", 1],
|
|
31
31
|
["ufb", 3]
|
|
32
32
|
]);
|
|
33
|
+
const typingMessage = {
|
|
34
|
+
$sid: "typing-1",
|
|
35
|
+
type: "system",
|
|
36
|
+
// or a custom type like "typing"
|
|
37
|
+
text: "AI is typing...",
|
|
38
|
+
sender: { id: "system", type: "system" },
|
|
39
|
+
$timestamp: /* @__PURE__ */ new Date(),
|
|
40
|
+
$userType: "system",
|
|
41
|
+
$index: -10,
|
|
42
|
+
$userId: 0
|
|
43
|
+
};
|
|
33
44
|
const custom_data = {
|
|
34
45
|
unsigned: {
|
|
35
46
|
facingBrandId: {
|
|
@@ -46,7 +57,7 @@ const Chatbot = ({
|
|
|
46
57
|
},
|
|
47
58
|
env: {
|
|
48
59
|
label: "env",
|
|
49
|
-
value: projectEnv === "
|
|
60
|
+
value: projectEnv === "uat" ? "dev" : projectEnv
|
|
50
61
|
}
|
|
51
62
|
}
|
|
52
63
|
};
|
|
@@ -67,6 +78,9 @@ const Chatbot = ({
|
|
|
67
78
|
const onChatMessageHandler = async (message) => {
|
|
68
79
|
console.log("Received message:", message);
|
|
69
80
|
addMessage(message);
|
|
81
|
+
if (!["virtual_agent", "system"].includes(message.$userType)) {
|
|
82
|
+
addMessage(typingMessage);
|
|
83
|
+
}
|
|
70
84
|
};
|
|
71
85
|
const onChatTypingStartedHandler = async (identity) => {
|
|
72
86
|
console.log("Typing started by:", identity);
|
|
@@ -204,14 +218,18 @@ const Chatbot = ({
|
|
|
204
218
|
console.log("Ending chat");
|
|
205
219
|
if (chatRef.current) {
|
|
206
220
|
await clientRef.current?.finishChat();
|
|
207
|
-
await chatRef.current
|
|
221
|
+
await chatRef.current?.destroy();
|
|
208
222
|
clearMessages();
|
|
209
223
|
chatRef.current = null;
|
|
210
224
|
console.log("Chat ended");
|
|
211
225
|
setHasStarted(false);
|
|
212
|
-
reset();
|
|
213
226
|
}
|
|
214
227
|
};
|
|
228
|
+
const onEndAndStartNewChat = async () => {
|
|
229
|
+
console.log("Ending current chat and starting a new one");
|
|
230
|
+
await onEndChat();
|
|
231
|
+
await startChat();
|
|
232
|
+
};
|
|
215
233
|
useMount(async () => {
|
|
216
234
|
console.log("Chatbot mounted");
|
|
217
235
|
if (isMountedRef.current) return;
|
|
@@ -221,7 +239,6 @@ const Chatbot = ({
|
|
|
221
239
|
useEffect(() => {
|
|
222
240
|
if (menusLoaded && pendingStart && !hasStarted) {
|
|
223
241
|
startChat();
|
|
224
|
-
setHasStarted(true);
|
|
225
242
|
setPendingStart(false);
|
|
226
243
|
}
|
|
227
244
|
}, [menusLoaded, pendingStart, hasStarted]);
|
|
@@ -238,6 +255,13 @@ const Chatbot = ({
|
|
|
238
255
|
clientRef.current?.destroyChat();
|
|
239
256
|
clientRef.current = null;
|
|
240
257
|
});
|
|
258
|
+
const onClose = () => {
|
|
259
|
+
toggle();
|
|
260
|
+
};
|
|
261
|
+
const onCloseAfterThankYou = () => {
|
|
262
|
+
reset();
|
|
263
|
+
setHasStarted(false);
|
|
264
|
+
};
|
|
241
265
|
return /* @__PURE__ */ jsxs("div", { className: project === "ufb" ? chatbotUFB : chatbotAXB, children: [
|
|
242
266
|
/* @__PURE__ */ jsx(Bubble, { onClick: handleClick }),
|
|
243
267
|
/* @__PURE__ */ jsx(
|
|
@@ -247,7 +271,10 @@ const Chatbot = ({
|
|
|
247
271
|
virtualAgent: agent_virtual.current,
|
|
248
272
|
messages,
|
|
249
273
|
onSend: onSendMessage,
|
|
250
|
-
endChat: onEndChat
|
|
274
|
+
endChat: onEndChat,
|
|
275
|
+
onClose,
|
|
276
|
+
onNewChat: onEndAndStartNewChat,
|
|
277
|
+
onCloseAfterThankYou
|
|
251
278
|
}
|
|
252
279
|
)
|
|
253
280
|
] });
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import { FC } from 'react';
|
|
2
|
+
import { MessageResponse as BaseMessageResponse, HumanAgent, VirtualAgent } from '@ujet/websdk-headless';
|
|
3
|
+
|
|
4
|
+
interface MessageResponse extends BaseMessageResponse {
|
|
5
|
+
to_agent?: HumanAgent;
|
|
6
|
+
}
|
|
7
|
+
interface ChatbotMessageProps {
|
|
8
|
+
msg: MessageResponse;
|
|
9
|
+
showAvatar?: boolean;
|
|
10
|
+
showName?: boolean;
|
|
11
|
+
virtualAgent?: VirtualAgent | null;
|
|
12
|
+
onCancelEndChat?: () => void;
|
|
13
|
+
onSend?: (content: string) => void;
|
|
14
|
+
}
|
|
15
|
+
export declare const ChatbotMessage: FC<ChatbotMessageProps>;
|
|
16
|
+
export {};
|
|
@@ -0,0 +1,215 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { jsx, jsxs, Fragment } from "react/jsx-runtime";
|
|
3
|
+
import { useState, useEffect } from "react";
|
|
4
|
+
import ReactMarkdown from "react-markdown";
|
|
5
|
+
import remarkGfm from "remark-gfm";
|
|
6
|
+
import { vars } from "../themes/axos.css.js";
|
|
7
|
+
import '../assets/themes/victorie.css';import '../assets/themes/ufb.css';import '../assets/themes/premier.css';import '../assets/themes/axos.css';/* empty css */
|
|
8
|
+
/* empty css */
|
|
9
|
+
/* empty css */
|
|
10
|
+
/* empty css */
|
|
11
|
+
import clsx from "clsx";
|
|
12
|
+
import { shimmerText, notificationStyle, endChatButtonStyle, messageStyle, user_msg, agent_msg, inline_button_wrapper, inline_button } from "./ChatWindow.css.js";
|
|
13
|
+
function timeAgo(date) {
|
|
14
|
+
const seconds = Math.floor(((/* @__PURE__ */ new Date()).getTime() - date.getTime()) / 1e3);
|
|
15
|
+
if (seconds < 60) return "Just now";
|
|
16
|
+
return new Date(date).toLocaleTimeString([], {
|
|
17
|
+
hour: "2-digit",
|
|
18
|
+
minute: "2-digit"
|
|
19
|
+
});
|
|
20
|
+
}
|
|
21
|
+
const ChatbotMessage = ({
|
|
22
|
+
msg,
|
|
23
|
+
showAvatar,
|
|
24
|
+
showName,
|
|
25
|
+
virtualAgent,
|
|
26
|
+
onCancelEndChat,
|
|
27
|
+
onSend
|
|
28
|
+
}) => {
|
|
29
|
+
const [timeText, setTimeText] = useState(timeAgo(msg.$timestamp));
|
|
30
|
+
useEffect(() => {
|
|
31
|
+
const interval = setInterval(() => {
|
|
32
|
+
setTimeText(timeAgo(msg.$timestamp));
|
|
33
|
+
}, 3e4);
|
|
34
|
+
return () => clearInterval(interval);
|
|
35
|
+
}, [msg.$timestamp]);
|
|
36
|
+
if (msg.$sid === "typing-1") {
|
|
37
|
+
return /* @__PURE__ */ jsx(
|
|
38
|
+
"div",
|
|
39
|
+
{
|
|
40
|
+
className: clsx(),
|
|
41
|
+
style: {
|
|
42
|
+
textAlign: "left",
|
|
43
|
+
alignSelf: "flex-start",
|
|
44
|
+
color: "#1e3860",
|
|
45
|
+
borderRadius: 16,
|
|
46
|
+
padding: "8px 8px",
|
|
47
|
+
maxWidth: "80%",
|
|
48
|
+
marginBottom: 2
|
|
49
|
+
},
|
|
50
|
+
children: /* @__PURE__ */ jsx(
|
|
51
|
+
"div",
|
|
52
|
+
{
|
|
53
|
+
style: {
|
|
54
|
+
fontSize: 14,
|
|
55
|
+
display: "flex",
|
|
56
|
+
flexDirection: "column",
|
|
57
|
+
gap: 4
|
|
58
|
+
},
|
|
59
|
+
children: /* @__PURE__ */ jsx("p", { className: shimmerText, children: "AI thinking..." })
|
|
60
|
+
}
|
|
61
|
+
)
|
|
62
|
+
}
|
|
63
|
+
);
|
|
64
|
+
}
|
|
65
|
+
return /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
66
|
+
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),
|
|
67
|
+
msg.type == "noti" && msg.$userType == "system" && msg.event == "memberLeft" && /* @__PURE__ */ jsxs("div", { className: notificationStyle, children: [
|
|
68
|
+
/* @__PURE__ */ jsx("strong", { children: "Virtual Agent" }),
|
|
69
|
+
" just left the conversation."
|
|
70
|
+
] }, msg.$index),
|
|
71
|
+
msg.type == "noti" && msg.$userType == "system" && msg.event == "escalationAccepted" && /* @__PURE__ */ jsxs("div", { className: notificationStyle, children: [
|
|
72
|
+
"You are now connected with a",
|
|
73
|
+
" ",
|
|
74
|
+
msg.to_agent ? /* @__PURE__ */ jsx("strong", { children: msg?.to_agent?.name }) : "an agent"
|
|
75
|
+
] }, msg.$index),
|
|
76
|
+
msg.type == "noti" && msg.$userType == "virtual_agent" && msg.event == "escalationDeflected" && /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
77
|
+
/* @__PURE__ */ jsxs(
|
|
78
|
+
"div",
|
|
79
|
+
{
|
|
80
|
+
className: notificationStyle,
|
|
81
|
+
style: { fontSize: 12 },
|
|
82
|
+
children: [
|
|
83
|
+
"Our chat team is available weekdays, 8am-5pm, except federal bank holidays. For immediate assistance you can reach out to us at",
|
|
84
|
+
" ",
|
|
85
|
+
/* @__PURE__ */ jsx("a", { href: "tel:1-888-502-2967", children: "1-888-502-2967" }),
|
|
86
|
+
"."
|
|
87
|
+
]
|
|
88
|
+
},
|
|
89
|
+
msg.$index
|
|
90
|
+
),
|
|
91
|
+
/* @__PURE__ */ jsx("div", { style: { textAlign: "center", marginBottom: 12 }, children: /* @__PURE__ */ jsx("button", { className: endChatButtonStyle, onClick: onCancelEndChat, children: "End Chat" }) })
|
|
92
|
+
] }),
|
|
93
|
+
["text", "markdown_template", "markdown"].includes(msg.type) && /* @__PURE__ */ jsx(
|
|
94
|
+
"div",
|
|
95
|
+
{
|
|
96
|
+
className: clsx(
|
|
97
|
+
messageStyle,
|
|
98
|
+
msg.$userType == "end_user" ? user_msg : agent_msg
|
|
99
|
+
),
|
|
100
|
+
children: /* @__PURE__ */ jsxs(
|
|
101
|
+
"div",
|
|
102
|
+
{
|
|
103
|
+
style: {
|
|
104
|
+
fontSize: 14,
|
|
105
|
+
display: "flex",
|
|
106
|
+
flexDirection: "column",
|
|
107
|
+
gap: 4
|
|
108
|
+
},
|
|
109
|
+
children: [
|
|
110
|
+
msg.$userType == "virtual_agent" && /* @__PURE__ */ jsxs(
|
|
111
|
+
"div",
|
|
112
|
+
{
|
|
113
|
+
style: {
|
|
114
|
+
display: "flex",
|
|
115
|
+
alignItems: "center",
|
|
116
|
+
gap: "8px"
|
|
117
|
+
},
|
|
118
|
+
children: [
|
|
119
|
+
showAvatar && /* @__PURE__ */ jsx(
|
|
120
|
+
"img",
|
|
121
|
+
{
|
|
122
|
+
width: 24,
|
|
123
|
+
height: 24,
|
|
124
|
+
src: virtualAgent?.avatar_url,
|
|
125
|
+
alt: "agent avatar"
|
|
126
|
+
}
|
|
127
|
+
),
|
|
128
|
+
showName && /* @__PURE__ */ jsx("strong", { children: virtualAgent?.name })
|
|
129
|
+
]
|
|
130
|
+
}
|
|
131
|
+
),
|
|
132
|
+
msg.$userType != "end_user" ? /* @__PURE__ */ jsx(Fragment, { children: /* @__PURE__ */ jsx(
|
|
133
|
+
ReactMarkdown,
|
|
134
|
+
{
|
|
135
|
+
remarkPlugins: [[remarkGfm, { singleTilde: false }]],
|
|
136
|
+
components: {
|
|
137
|
+
p: ({ ...props }) => /* @__PURE__ */ jsx(
|
|
138
|
+
"p",
|
|
139
|
+
{
|
|
140
|
+
style: { margin: 0, fontSize: "inherit" },
|
|
141
|
+
title: new Date(msg.$timestamp).toLocaleTimeString([], {
|
|
142
|
+
hour: "2-digit",
|
|
143
|
+
minute: "2-digit"
|
|
144
|
+
}),
|
|
145
|
+
...props
|
|
146
|
+
}
|
|
147
|
+
)
|
|
148
|
+
},
|
|
149
|
+
children: msg.content
|
|
150
|
+
}
|
|
151
|
+
) }) : /* @__PURE__ */ jsx(
|
|
152
|
+
"div",
|
|
153
|
+
{
|
|
154
|
+
title: new Date(msg.$timestamp).toLocaleTimeString([], {
|
|
155
|
+
hour: "2-digit",
|
|
156
|
+
minute: "2-digit"
|
|
157
|
+
}),
|
|
158
|
+
children: msg.content
|
|
159
|
+
}
|
|
160
|
+
)
|
|
161
|
+
]
|
|
162
|
+
}
|
|
163
|
+
)
|
|
164
|
+
},
|
|
165
|
+
msg.$index
|
|
166
|
+
),
|
|
167
|
+
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) => {
|
|
168
|
+
return /* @__PURE__ */ jsx(
|
|
169
|
+
"button",
|
|
170
|
+
{
|
|
171
|
+
className: inline_button,
|
|
172
|
+
onClick: () => {
|
|
173
|
+
onSend?.(button?.title);
|
|
174
|
+
},
|
|
175
|
+
children: button.title
|
|
176
|
+
},
|
|
177
|
+
index
|
|
178
|
+
);
|
|
179
|
+
}) }),
|
|
180
|
+
msg.event == "chatEnded" && /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
181
|
+
/* @__PURE__ */ jsxs(
|
|
182
|
+
"div",
|
|
183
|
+
{
|
|
184
|
+
title: (/* @__PURE__ */ new Date()).toLocaleString(),
|
|
185
|
+
style: {
|
|
186
|
+
fontSize: 12,
|
|
187
|
+
color: "#888",
|
|
188
|
+
marginBottom: 4,
|
|
189
|
+
textAlign: "center"
|
|
190
|
+
},
|
|
191
|
+
children: [
|
|
192
|
+
"Thank you for chatting!",
|
|
193
|
+
/* @__PURE__ */ jsx("br", {}),
|
|
194
|
+
" This conversation has ended."
|
|
195
|
+
]
|
|
196
|
+
}
|
|
197
|
+
),
|
|
198
|
+
/* @__PURE__ */ jsx("div", { style: { textAlign: "center", marginBottom: 12 }, children: /* @__PURE__ */ jsx("button", { className: endChatButtonStyle, onClick: onCancelEndChat, children: "End Chat" }) })
|
|
199
|
+
] }),
|
|
200
|
+
msg.type == "text" && /* @__PURE__ */ jsx(
|
|
201
|
+
"div",
|
|
202
|
+
{
|
|
203
|
+
style: {
|
|
204
|
+
textAlign: msg.$userType === "end_user" ? "right" : "left",
|
|
205
|
+
fontSize: 12,
|
|
206
|
+
color: vars.chatbot.window.timestampColor
|
|
207
|
+
},
|
|
208
|
+
children: timeText
|
|
209
|
+
}
|
|
210
|
+
)
|
|
211
|
+
] });
|
|
212
|
+
};
|
|
213
|
+
export {
|
|
214
|
+
ChatbotMessage
|
|
215
|
+
};
|