@axos-web-dev/shared-components 1.0.101-dev.1 → 2.0.0-dev.2
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 +3 -8
- package/dist/Article/Article.d.ts +2 -2
- package/dist/Article/Article.js +13 -2
- package/dist/Auth/ErrorAlert.js +4 -9
- package/dist/Auth/SignInPassword.js +0 -1
- package/dist/Blockquote/Blockquote.module.js +3 -3
- package/dist/BulletItem/BulletItem.js +0 -1
- package/dist/Button/Button.js +3 -9
- package/dist/Calculators/AnnualFeeCalculator/index.js +0 -1
- package/dist/Calculators/ApyCalculator/index.js +3 -1
- package/dist/Calculators/AxosOneCalculator/index.js +16 -9
- package/dist/Calculators/BalanceAPYCalculator/index.js +0 -1
- package/dist/Calculators/BuyDownCalculator/index.js +0 -1
- package/dist/Calculators/Calculator.js +0 -5
- package/dist/Calculators/MarginTradingCalculator/index.js +119 -2
- package/dist/Calculators/MarineLoanMonthlyPaymentCalculator/index.js +0 -1
- package/dist/Calculators/MaxLoanCalculator/index.js +0 -1
- package/dist/Calculators/MonthlyPaymentCalculator/index.js +0 -1
- package/dist/Calculators/MonthlyPaymentLVFCalculator/index.js +0 -1
- package/dist/Calculators/SummitApyCalculator/index.js +3 -2
- package/dist/Carousel/index.js +10 -12
- package/dist/Chatbot/Bubble.js +1 -1
- package/dist/Chatbot/Chat.js +0 -7
- package/dist/Chatbot/ChatWindow.d.ts +2 -0
- package/dist/Chatbot/ChatWindow.js +27 -14
- package/dist/Chatbot/Chatbot.d.ts +1 -1
- package/dist/Chatbot/Chatbot.js +118 -13
- package/dist/Chatbot/ChatbotMessage.d.ts +1 -0
- package/dist/Chatbot/ChatbotMessage.js +42 -22
- package/dist/Chatbot/store/chat.d.ts +6 -0
- package/dist/Chatbot/store/chat.js +14 -2
- package/dist/Chatbot/store/messages.d.ts +1 -0
- package/dist/Chatbot/store/messages.js +5 -2
- package/dist/Chevron/index.js +2 -8
- package/dist/Comparison/Comparison.js +3 -8
- package/dist/ExecutiveBio/ExecutiveBio.css.d.ts +51 -1
- package/dist/ExecutiveBio/ExecutiveBio.css.js +48 -46
- package/dist/ExecutiveBio/ExecutiveBio.d.ts +1 -1
- package/dist/ExecutiveBio/ExecutiveBio.interface.d.ts +3 -1
- package/dist/ExecutiveBio/ExecutiveBio.js +142 -151
- package/dist/ExecutiveBio/ExecutiveBioSet.d.ts +1 -2
- package/dist/ExecutiveBio/ExecutiveBioSet.js +29 -16
- package/dist/ExecutiveBio/index.js +2 -1
- package/dist/FaqAccordion/index.js +3 -8
- package/dist/FooterSiteMap/AxosBank/FooterSiteMap.js +83 -184
- package/dist/Forms/ApplicationStart.js +0 -1
- package/dist/Forms/ApplyNow.js +1 -6
- package/dist/Forms/BoatMooringLocation.js +0 -1
- package/dist/Forms/ClearingForm.js +0 -1
- package/dist/Forms/CommercialDeposits.js +0 -1
- package/dist/Forms/CommercialDepositsNoLendingOption.js +0 -1
- package/dist/Forms/CommercialLending.js +3 -2
- package/dist/Forms/CommercialPremiumFinance.js +0 -1
- package/dist/Forms/ConstructionLendingDynamic.d.ts +12 -0
- package/dist/Forms/ConstructionLendingDynamic.js +324 -0
- package/dist/Forms/ContactCompany.js +0 -1
- package/dist/Forms/ContactCompanyTitle.js +0 -1
- package/dist/Forms/ContactUs.js +0 -1
- package/dist/Forms/ContactUsAAS.js +0 -1
- package/dist/Forms/ContactUsBusiness.js +3 -8
- package/dist/Forms/ContactUsBusinessNameEmail.js +3 -8
- package/dist/Forms/ContactUsLVF.js +0 -1
- package/dist/Forms/ContactUsNMLSId.js +3 -8
- package/dist/Forms/CpraRequest.js +100 -3
- package/dist/Forms/CraPublicFile.js +3 -8
- package/dist/Forms/DealerServices.js +0 -1
- package/dist/Forms/EmailOnly.js +10 -10
- package/dist/Forms/EmailUs.js +0 -1
- package/dist/Forms/FormEnums.js +1 -3
- package/dist/Forms/Forms.css.d.ts +1 -1
- package/dist/Forms/Forms.css.js +3 -3
- package/dist/Forms/HoneyPot/index.js +0 -1
- package/dist/Forms/MortgageRate/MortgageRateForm.js +4 -9
- package/dist/Forms/MortgageRate/MortgageRateWatch.js +3 -8
- package/dist/Forms/MortgageWarehouseLending.js +3 -8
- package/dist/Forms/QuickPricer/QuickPricerForm.js +0 -1
- package/dist/Forms/ScheduleCall.js +0 -1
- package/dist/Forms/ScheduleCallPremier.js +0 -1
- package/dist/Forms/SuccesForm.js +3 -8
- package/dist/Forms/VendorQuestionnaire.js +0 -1
- package/dist/Forms/index.d.ts +1 -0
- package/dist/Forms/index.js +2 -1
- package/dist/Hyperlink/index.js +6 -10
- package/dist/IconBillboard/IconBillboard.css.d.ts +1 -0
- package/dist/IconBillboard/IconBillboard.css.js +11 -9
- package/dist/IconBillboard/index.js +2 -1
- package/dist/ImageBillboard/ImageBillboardSet.js +14 -8
- package/dist/ImageLink/ImageLink.js +3 -8
- package/dist/ImageLink/ImageLinkSet.js +3 -8
- package/dist/ImageLink/index.js +1 -6
- package/dist/Insight/Featured/CategorySelector.js +1 -6
- package/dist/Insight/Featured/Featured.js +3 -8
- package/dist/Insight/Featured/Header.js +3 -8
- package/dist/LandingPageHeader/LandingPageHeader.css.d.ts +19 -1
- package/dist/LandingPageHeader/LandingPageHeader.css.js +6 -6
- package/dist/LandingPageHeader/LandingPageHeader.d.ts +3 -1
- package/dist/LandingPageHeader/LandingPageHeader.js +42 -16
- package/dist/LoadingIndicator/index.js +0 -1
- package/dist/Modal/Modal.js +1 -6
- package/dist/Modal/contextApi/store.d.ts +16 -2
- package/dist/Modal/contextApi/store.js +37 -6
- package/dist/NavigationMenu/AxosALTS/NavData.d.ts +7 -1
- package/dist/NavigationMenu/AxosALTS/NavData.js +6 -137
- package/dist/NavigationMenu/AxosALTS/index.js +10 -12
- package/dist/NavigationMenu/AxosAdvisor/SubNavBar.js +0 -1
- package/dist/NavigationMenu/AxosAdvisor/index.js +0 -1
- package/dist/NavigationMenu/AxosAdvisorServices/SubNavBar.js +0 -1
- package/dist/NavigationMenu/AxosAdvisorServices/index.js +0 -1
- package/dist/NavigationMenu/AxosBank/MobileMenu/MobileMenu.js +341 -73
- package/dist/NavigationMenu/AxosBank/MobileMenu/MobileMenu.module.js +50 -17
- package/dist/NavigationMenu/AxosBank/MobileMenu/MobileNavData.d.ts +20 -6
- package/dist/NavigationMenu/AxosBank/MobileMenu/MobileNavData.js +211 -355
- package/dist/NavigationMenu/AxosBank/NavData.d.ts +39 -2
- package/dist/NavigationMenu/AxosBank/NavData.js +34 -166
- package/dist/NavigationMenu/AxosBank/SubNavBar.js +199 -220
- package/dist/NavigationMenu/AxosBank/index.js +16 -43
- package/dist/NavigationMenu/AxosClearing/index.js +0 -1
- package/dist/NavigationMenu/LaVictoire/NavData.d.ts +13 -2
- package/dist/NavigationMenu/LaVictoire/NavData.js +14 -146
- package/dist/NavigationMenu/LaVictoire/SubNavBar.js +4 -1
- package/dist/NavigationMenu/LaVictoire/index.js +16 -41
- package/dist/NavigationMenu/Navbar.js +4 -5
- package/dist/NavigationMenu/SignInNavButton.js +16 -24
- package/dist/SetContainer/SetContainer.js +4 -9
- package/dist/SocialMediaBar/iconsRepository.d.ts +44 -14
- package/dist/SocialMediaBar/iconsRepository.js +28 -37
- package/dist/SocialMediaBar/index.js +3 -1
- package/dist/Tab/Tab.js +0 -1
- package/dist/Table/Table.js +0 -1
- package/dist/VideoTile/VideoTile.js +0 -5
- package/dist/VideoWrapper/index.js +0 -5
- package/dist/assets/Blockquote/Blockquote.css +72 -72
- package/dist/assets/Calculators/ApyCalculator/ApyCalculator.css +1 -1
- package/dist/assets/Calculators/MarginTradingCalculator/MarginTradingCalculator.css +2 -2
- package/dist/assets/Calculators/SummitApyCalculator/BalanceAPYCalculator.css +1 -1
- package/dist/assets/Carousel/Carousel.css +1 -1
- package/dist/assets/Chatbot/AnimatedGradientBorder.css +2 -1
- package/dist/assets/Chatbot/ChatWindow.css +16 -8
- package/dist/assets/DownloadTile/DownloadTile.css +2 -2
- package/dist/assets/ExecutiveBio/ExecutiveBio.css +281 -171
- package/dist/assets/Forms/Forms.css +29 -25
- package/dist/assets/HelpArticle/HelpArticle.css +2 -2
- package/dist/assets/IconBillboard/IconBillboard.css +35 -28
- package/dist/assets/Inputs/Input.css +1 -1
- package/dist/assets/Insight/Featured/CategorySelector.css +1 -1
- package/dist/assets/Insight/Insight.css +4 -4
- package/dist/assets/LandingPageHeader/LandingPageHeader.css +28 -15
- package/dist/assets/NavigationMenu/AxosBank/MobileMenu/MobileMenu.css +353 -192
- package/dist/assets/Topic/Topic.css +1 -1
- package/dist/assets/Typography/Typography.css +1 -1
- package/dist/assets/VideoTile/VideoTile.css +1 -1
- package/dist/assets/globals.css +24 -14
- package/dist/main.js +8 -3
- package/dist/utils/allowedAxosDomains.d.ts +5 -2
- package/dist/utils/allowedAxosDomains.js +50 -47
- package/dist/utils/appendQueryParams.js +36 -5
- package/dist/utils/index.js +2 -1
- package/dist/utils/validateExternalLinks.d.ts +1 -1
- package/dist/utils/validateExternalLinks.js +4 -6
- package/package.json +148 -145
- package/dist/NavigationMenu/NavDataJson.d.ts +0 -2
- package/dist/NavigationMenu/NavDataJson.js +0 -317
package/dist/Carousel/index.js
CHANGED
|
@@ -6,7 +6,7 @@ import { getVariant } from "../utils/getVariant.js";
|
|
|
6
6
|
import { section_text } from "../IconBillboard/IconBillboard.css.js";
|
|
7
7
|
import "../icons/ArrowIcon/ArrowIcon.css.js";
|
|
8
8
|
import "../icons/CheckIcon/CheckIcon.css.js";
|
|
9
|
-
import '../assets/VideoWrapper/VideoWrapper.css';import '../assets/TopicalNavSet/TopicalNavSet.css';import '../assets/TopicalNavItem/TopicalNavItem.css';import '../assets/Topic/Topic.css';import '../assets/TextBlock/TextBlock.css';import '../assets/SocialMediaBar/SocialMediaBar.css';import '../assets/SecondaryFooter/SecondaryFooter.css';import '../assets/Pagination/Pagination.css';import '../assets/PageNavSet/PageNavigationSet.css';import '../assets/NavigationMenu/LaVictoire/NavBar2.css';import '../assets/NavigationMenu/AxosALTS/NavBar2.css';import '../assets/NavigationMenu/AxosClearing/NavBar2.css';import '../assets/NavigationMenu/AxosBank/SubNavbar.css';import '../assets/NavigationMenu/AxosBank/NavBar2.css';import '../assets/NavigationMenu/AxosAdvisorServices/SubNavbar.css';import '../assets/NavigationMenu/AxosAdvisorServices/NavBar2.css';import '../assets/NavigationMenu/AxosAdvisor/SubNavbar.css';import '../assets/NavigationMenu/AxosAdvisor/NavBar2.css';import '../assets/Insight/Featured/Header.css';import '../assets/Insight/Featured/CategorySelector.css';import '../assets/Insight/Featured/Featured.css';import '../assets/ImageLink/ImageLink.css';import '../assets/VideoTile/VideoTile.css';import '../assets/HelpArticle/HelpArticle.css';import '../assets/FooterSiteMap/AxosBank/FooterSiteMap.css';import '../assets/FooterDisclosure/LVF/LaVictorieFooter.css';import '../assets/DownloadTile/DownloadTile.css';import '../assets/CollectInformationAlert/CollectInformationAlert.css';import '../assets/Chatbot/ChatWindow.css';import '../assets/Chatbot/Chatbot.css';import '../assets/Chatbot/Bubble.css';import '../assets/Chatbot/AnimatedGradientBorder.css';import '../assets/CallToActionBar/CallToActionBar.css';import '../assets/Insight/Insight.css';import '../assets/AwardsItem/AwardsItem.css';import '../assets/AwardsBanner/AwardsBanner.css';import '../assets/Auth/SignIn.css';import '../assets/Auth/ErrorAlert.css';import '../assets/Calculators/MarginTradingCalculator/MarginTradingCalculator.css';import '../assets/Forms/QuickPricer/UserInformation.css';import '../assets/
|
|
9
|
+
import '../assets/VideoWrapper/VideoWrapper.css';import '../assets/TopicalNavSet/TopicalNavSet.css';import '../assets/TopicalNavItem/TopicalNavItem.css';import '../assets/Topic/Topic.css';import '../assets/TextBlock/TextBlock.css';import '../assets/SocialMediaBar/SocialMediaBar.css';import '../assets/SecondaryFooter/SecondaryFooter.css';import '../assets/Pagination/Pagination.css';import '../assets/PageNavSet/PageNavigationSet.css';import '../assets/NavigationMenu/LaVictoire/NavBar2.css';import '../assets/NavigationMenu/AxosALTS/NavBar2.css';import '../assets/NavigationMenu/AxosClearing/NavBar2.css';import '../assets/NavigationMenu/AxosBank/SubNavbar.css';import '../assets/NavigationMenu/AxosBank/NavBar2.css';import '../assets/NavigationMenu/AxosAdvisorServices/SubNavbar.css';import '../assets/NavigationMenu/AxosAdvisorServices/NavBar2.css';import '../assets/NavigationMenu/AxosAdvisor/SubNavbar.css';import '../assets/NavigationMenu/AxosAdvisor/NavBar2.css';import '../assets/Insight/Featured/Header.css';import '../assets/Insight/Featured/CategorySelector.css';import '../assets/Insight/Featured/Featured.css';import '../assets/ImageLink/ImageLink.css';import '../assets/VideoTile/VideoTile.css';import '../assets/HelpArticle/HelpArticle.css';import '../assets/FooterSiteMap/AxosBank/FooterSiteMap.css';import '../assets/FooterDisclosure/LVF/LaVictorieFooter.css';import '../assets/DownloadTile/DownloadTile.css';import '../assets/CollectInformationAlert/CollectInformationAlert.css';import '../assets/Chatbot/ChatWindow.css';import '../assets/Chatbot/Chatbot.css';import '../assets/Chatbot/Bubble.css';import '../assets/Chatbot/AnimatedGradientBorder.css';import '../assets/CallToActionBar/CallToActionBar.css';import '../assets/Insight/Insight.css';import '../assets/AwardsItem/AwardsItem.css';import '../assets/AwardsBanner/AwardsBanner.css';import '../assets/Auth/SignIn.css';import '../assets/Auth/ErrorAlert.css';import '../assets/Calculators/MarginTradingCalculator/MarginTradingCalculator.css';import '../assets/Forms/QuickPricer/UserInformation.css';import '../assets/Forms/QuickPricer/QuickPricerResults.css';import '../assets/Modal/Modal.css';import '../assets/BulletItem/BulletItem.css';import '../assets/Typography/Typography.css';import '../assets/icons/FollowIcon/FollowIcon.css';import '../assets/icons/DownloadIcon/DownloadIcon.css';import '../assets/themes/victorie.css';import '../assets/themes/ufb.css';import '../assets/themes/premier.css';import '../assets/themes/axos.css';/* empty css */
|
|
10
10
|
/* empty css */
|
|
11
11
|
/* empty css */
|
|
12
12
|
/* empty css */
|
|
@@ -15,7 +15,6 @@ import '../assets/VideoWrapper/VideoWrapper.css';import '../assets/TopicalNavSet
|
|
|
15
15
|
import SvgQuoteIconGrey from "../icons/QuoteIconGrey.js";
|
|
16
16
|
import SvgQuoteIconWhite from "../icons/QuoteIconWhite.js";
|
|
17
17
|
import SvgQuoteIconYellow from "../icons/QuoteIconYellow.js";
|
|
18
|
-
import "../utils/allowedAxosDomains.js";
|
|
19
18
|
/* empty css */
|
|
20
19
|
/* empty css */
|
|
21
20
|
import "../Accordion/Accordion.js";
|
|
@@ -26,6 +25,7 @@ import "../ArticlesSet/ArticlesSet.css.js";
|
|
|
26
25
|
import "../Calculators/calculator.css.js";
|
|
27
26
|
import "../Calculators/AnnualFeeCalculator/AnnualFeeCalculator.css.js";
|
|
28
27
|
import "../Button/Button.css.js";
|
|
28
|
+
import "../Modal/contextApi/store.js";
|
|
29
29
|
import "../Calculators/ApyCalculator/ApyCalculator.css.js";
|
|
30
30
|
import "../Table/Table.css.js";
|
|
31
31
|
import "../Calculators/AxosOneCalculator/BalanceAPYCalculator.css.js";
|
|
@@ -53,11 +53,10 @@ import "../Input/Checkbox.css.js";
|
|
|
53
53
|
import "../LoadingIndicator/LoadingIndicator.css.js";
|
|
54
54
|
import "react-use";
|
|
55
55
|
import "../Chevron/Chevron.css.js";
|
|
56
|
+
/* empty css */
|
|
56
57
|
import "../Interstitial/Interstitial-variants.css.js";
|
|
57
58
|
import "../Inputs/Input.css.js";
|
|
58
59
|
/* empty css */
|
|
59
|
-
/* empty css */
|
|
60
|
-
import "../Modal/contextApi/store.js";
|
|
61
60
|
import "../Hyperlink/Hyperlink.css.js";
|
|
62
61
|
/* empty css */
|
|
63
62
|
import "iframe-resizer";
|
|
@@ -111,15 +110,11 @@ import "next/navigation.js";
|
|
|
111
110
|
/* empty css */
|
|
112
111
|
/* empty css */
|
|
113
112
|
import "next/link.js";
|
|
114
|
-
import "../NavigationMenu/AxosBank/MobileMenu/MobileNavData.js";
|
|
115
113
|
/* empty css */
|
|
116
|
-
import "../NavigationMenu/AxosBank/NavData.js";
|
|
117
114
|
/* empty css */
|
|
118
115
|
/* empty css */
|
|
119
|
-
import "../NavigationMenu/AxosALTS/NavData.js";
|
|
120
116
|
/* empty css */
|
|
121
117
|
/* empty css */
|
|
122
|
-
import "../NavigationMenu/LaVictoire/NavData.js";
|
|
123
118
|
import "../PageNavItem/PageNavItem.css.js";
|
|
124
119
|
import "react-slick";
|
|
125
120
|
/* empty css */
|
|
@@ -230,10 +225,13 @@ const Carousel = (props) => {
|
|
|
230
225
|
/* @__PURE__ */ jsx("div", { children: iconVarints.get(variant) }),
|
|
231
226
|
/* @__PURE__ */ jsx("div", { className: slides, children: children ? Children.map(children, (child2, idx) => {
|
|
232
227
|
if (!React.isValidElement(child2)) return child2;
|
|
233
|
-
return cloneElement(
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
228
|
+
return cloneElement(
|
|
229
|
+
child2,
|
|
230
|
+
{
|
|
231
|
+
selected: idx === itemSelected,
|
|
232
|
+
variant
|
|
233
|
+
}
|
|
234
|
+
);
|
|
237
235
|
}) : items?.map((item, idx) => /* @__PURE__ */ jsx(
|
|
238
236
|
CarouselSlide,
|
|
239
237
|
{
|
package/dist/Chatbot/Bubble.js
CHANGED
package/dist/Chatbot/Chat.js
CHANGED
|
@@ -33,7 +33,6 @@ function Chat() {
|
|
|
33
33
|
let chatConnectedHandler;
|
|
34
34
|
async function initChat() {
|
|
35
35
|
const { Client, consoleLoggerHandler, Logger } = await import("@ujet/websdk-headless");
|
|
36
|
-
console.log("this", isMounted);
|
|
37
36
|
Logger.addHandler(consoleLoggerHandler);
|
|
38
37
|
clientRef.current = new Client({
|
|
39
38
|
companyId,
|
|
@@ -71,14 +70,11 @@ function Chat() {
|
|
|
71
70
|
menus?.menus[5].id
|
|
72
71
|
);
|
|
73
72
|
}
|
|
74
|
-
console.log("this");
|
|
75
73
|
identityHandler = (identity) => {
|
|
76
74
|
if (!isMounted.current) return;
|
|
77
75
|
console.log("identity:", identity);
|
|
78
76
|
};
|
|
79
77
|
messageHandler = (msg) => {
|
|
80
|
-
console.log("new message:", msg);
|
|
81
|
-
console.log("addMessage:", msg);
|
|
82
78
|
addMessage(msg);
|
|
83
79
|
};
|
|
84
80
|
chatUpdatedHandler = (chat) => {
|
|
@@ -87,13 +83,11 @@ function Chat() {
|
|
|
87
83
|
chatConnectedHandler = async () => {
|
|
88
84
|
console.log("connected");
|
|
89
85
|
const messagesFetched = await clientRef.current?.fetchMessages();
|
|
90
|
-
console.log("[messages]:", messagesFetched);
|
|
91
86
|
addMessages(messagesFetched || []);
|
|
92
87
|
};
|
|
93
88
|
memberJoinedHandler = (identity) => {
|
|
94
89
|
console.log("member joined:", identity);
|
|
95
90
|
};
|
|
96
|
-
console.log(isMounted.current);
|
|
97
91
|
clientRef.current?.on("authenticated", () => {
|
|
98
92
|
console.log("authenticated");
|
|
99
93
|
});
|
|
@@ -144,7 +138,6 @@ function Chat() {
|
|
|
144
138
|
const form = e.target;
|
|
145
139
|
const input = form.elements[0];
|
|
146
140
|
const message = input.value;
|
|
147
|
-
console.log("Sending message:", message);
|
|
148
141
|
try {
|
|
149
142
|
await clientRef.current?.sendTextMessage(message);
|
|
150
143
|
input.value = "";
|
|
@@ -24,6 +24,8 @@ interface ChatWindowProps {
|
|
|
24
24
|
showName?: boolean;
|
|
25
25
|
onNewChat?: () => void;
|
|
26
26
|
onCloseAfterThankYou?: () => void;
|
|
27
|
+
isTyping?: boolean;
|
|
28
|
+
previewTyping?: (msg: string) => void;
|
|
27
29
|
}
|
|
28
30
|
export declare const ChatWindow: React.FC<ChatWindowProps>;
|
|
29
31
|
export {};
|
|
@@ -32,9 +32,19 @@ const ChatWindow = ({
|
|
|
32
32
|
showName = false,
|
|
33
33
|
onCloseAfterThankYou = () => {
|
|
34
34
|
console.log("Close after thank you");
|
|
35
|
+
},
|
|
36
|
+
previewTyping = (msg) => {
|
|
37
|
+
console.log("Preview typing: ", msg);
|
|
35
38
|
}
|
|
36
39
|
}) => {
|
|
37
|
-
const {
|
|
40
|
+
const {
|
|
41
|
+
showThankyouMessage,
|
|
42
|
+
displayThankyouMessage,
|
|
43
|
+
toggleThankyouMessage,
|
|
44
|
+
hasEscalated,
|
|
45
|
+
isBlockedInput,
|
|
46
|
+
isOpen
|
|
47
|
+
} = useOpenChat();
|
|
38
48
|
const [mounted, setMounted] = React.useState(false);
|
|
39
49
|
const [menuOpen, setMenuOpen] = React.useState(false);
|
|
40
50
|
const [showEndChatDialog, setShowEndChatDialog] = React.useState(false);
|
|
@@ -42,14 +52,14 @@ const ChatWindow = ({
|
|
|
42
52
|
const [input, setInput] = React.useState("");
|
|
43
53
|
const messagesEndRef = useRef(null);
|
|
44
54
|
const inputRef = useRef(null);
|
|
45
|
-
const isOpen = useOpenChat((state2) => state2.isOpen);
|
|
46
55
|
useEffect(() => {
|
|
47
56
|
messagesEndRef.current?.scrollIntoView({ behavior: "smooth" });
|
|
48
57
|
}, [messages]);
|
|
49
58
|
const handleSend = (e) => {
|
|
50
59
|
e.preventDefault();
|
|
51
60
|
const cleaned = cleanInput(input);
|
|
52
|
-
if (
|
|
61
|
+
if (isBlockedInput) return;
|
|
62
|
+
if (cleaned != "") {
|
|
53
63
|
onSend(cleaned);
|
|
54
64
|
setInput("");
|
|
55
65
|
}
|
|
@@ -128,7 +138,7 @@ const ChatWindow = ({
|
|
|
128
138
|
]
|
|
129
139
|
}
|
|
130
140
|
),
|
|
131
|
-
/* @__PURE__ */ jsx("h2", { className: chat_title, children: "Ask
|
|
141
|
+
/* @__PURE__ */ jsx("h2", { className: chat_title, children: "Ask Evo AI" })
|
|
132
142
|
]
|
|
133
143
|
}
|
|
134
144
|
),
|
|
@@ -136,6 +146,7 @@ const ChatWindow = ({
|
|
|
136
146
|
/* @__PURE__ */ jsx(
|
|
137
147
|
"button",
|
|
138
148
|
{
|
|
149
|
+
disabled: messages.length === 0,
|
|
139
150
|
onClick: () => {
|
|
140
151
|
setMenuOpen(!menuOpen);
|
|
141
152
|
},
|
|
@@ -417,7 +428,11 @@ const ChatWindow = ({
|
|
|
417
428
|
showAvatar,
|
|
418
429
|
showName,
|
|
419
430
|
virtualAgent,
|
|
420
|
-
onCancelEndChat
|
|
431
|
+
onCancelEndChat,
|
|
432
|
+
onEndChat: () => {
|
|
433
|
+
endChat();
|
|
434
|
+
onCloseAfterThankYou();
|
|
435
|
+
}
|
|
421
436
|
},
|
|
422
437
|
msg?.$index
|
|
423
438
|
)),
|
|
@@ -438,7 +453,7 @@ const ChatWindow = ({
|
|
|
438
453
|
style: {
|
|
439
454
|
display: "flex",
|
|
440
455
|
padding: "12px 16px",
|
|
441
|
-
background: "#ffffff",
|
|
456
|
+
background: isBlockedInput || inputDisabled || status !== "connected" || messages.length == 0 || escalationDeflected ? "light-dark(rgba(239, 239, 239, 0.3), rgba(59, 59, 59, 0.3))" : "#ffffff",
|
|
442
457
|
borderRadius: 12
|
|
443
458
|
},
|
|
444
459
|
children: [
|
|
@@ -449,19 +464,17 @@ const ChatWindow = ({
|
|
|
449
464
|
value: input,
|
|
450
465
|
onChange: (e) => setInput(e.target.value),
|
|
451
466
|
onKeyDown: (e) => {
|
|
467
|
+
if (hasEscalated) {
|
|
468
|
+
previewTyping(e.target?.value);
|
|
469
|
+
}
|
|
452
470
|
if (e.key === "Enter" && !e.shiftKey) {
|
|
453
|
-
e
|
|
454
|
-
const cleaned = cleanInput(input);
|
|
455
|
-
if (cleaned) {
|
|
456
|
-
onSend(cleaned);
|
|
457
|
-
setInput("");
|
|
458
|
-
}
|
|
471
|
+
handleSend(e);
|
|
459
472
|
}
|
|
460
473
|
},
|
|
461
474
|
placeholder: "Ask anything...",
|
|
462
475
|
className: clsx(inputStyle, autoResize),
|
|
463
476
|
autoFocus: true,
|
|
464
|
-
disabled: inputDisabled || status !== "connected" || messages.length == 0 || escalationDeflected,
|
|
477
|
+
disabled: isBlockedInput || inputDisabled || status !== "connected" || messages.length == 0 || escalationDeflected,
|
|
465
478
|
rows: 1
|
|
466
479
|
}
|
|
467
480
|
),
|
|
@@ -474,7 +487,7 @@ const ChatWindow = ({
|
|
|
474
487
|
),
|
|
475
488
|
type: "submit",
|
|
476
489
|
title: "Send message",
|
|
477
|
-
disabled: inputDisabled || status !== "connected" || !input.trim() || messages.length == 0 || escalationDeflected,
|
|
490
|
+
disabled: isBlockedInput || inputDisabled || status !== "connected" || !input.trim() || messages.length == 0 || escalationDeflected,
|
|
478
491
|
children: /* @__PURE__ */ jsx(
|
|
479
492
|
"svg",
|
|
480
493
|
{
|
|
@@ -7,4 +7,4 @@ export declare const Chatbot: ({ project, projectEnv, menuOption, debug, }: {
|
|
|
7
7
|
projectEnv?: "dev" | "qa" | "uat" | "stg" | "prod";
|
|
8
8
|
menuOption?: "Support Virtual Agent" | string;
|
|
9
9
|
debug?: boolean;
|
|
10
|
-
}) => import("react/jsx-runtime").JSX.Element;
|
|
10
|
+
}) => false | import("react/jsx-runtime").JSX.Element;
|
package/dist/Chatbot/Chatbot.js
CHANGED
|
@@ -14,7 +14,16 @@ const Chatbot = ({
|
|
|
14
14
|
menuOption = "Support Virtual Agent",
|
|
15
15
|
debug = false
|
|
16
16
|
}) => {
|
|
17
|
-
const {
|
|
17
|
+
const {
|
|
18
|
+
hasOpenedOnce,
|
|
19
|
+
toggle,
|
|
20
|
+
reset,
|
|
21
|
+
startEscalation,
|
|
22
|
+
hasEscalated,
|
|
23
|
+
endEscalation,
|
|
24
|
+
unblockInput,
|
|
25
|
+
blockInput
|
|
26
|
+
} = useOpenChat();
|
|
18
27
|
const { addMessage, addMessages, clearMessages, messages } = useMessages();
|
|
19
28
|
const clientRef = useRef(null);
|
|
20
29
|
const menuRef = useRef(null);
|
|
@@ -26,6 +35,20 @@ const Chatbot = ({
|
|
|
26
35
|
const [hasStarted, setHasStarted] = useState(false);
|
|
27
36
|
const [menusLoaded, setMenusLoaded] = useState(false);
|
|
28
37
|
const [pendingStart, setPendingStart] = useState(false);
|
|
38
|
+
const [isTyping, setIsTyping] = useState(false);
|
|
39
|
+
const [scalationStarted, setScalationStarted] = useState(false);
|
|
40
|
+
useEffect(() => {
|
|
41
|
+
if (messages.length === 0) return;
|
|
42
|
+
const hasScalation = messages.some(
|
|
43
|
+
(msg) => msg.$userType === "user" || ["escalationAccepted", "escalationStarted"].includes(
|
|
44
|
+
msg.event
|
|
45
|
+
)
|
|
46
|
+
);
|
|
47
|
+
setScalationStarted(hasScalation);
|
|
48
|
+
return () => {
|
|
49
|
+
setScalationStarted(false);
|
|
50
|
+
};
|
|
51
|
+
}, [messages]);
|
|
29
52
|
const brandMap = /* @__PURE__ */ new Map([
|
|
30
53
|
["axos", 1],
|
|
31
54
|
["ufb", 3]
|
|
@@ -33,8 +56,7 @@ const Chatbot = ({
|
|
|
33
56
|
const typingMessage = {
|
|
34
57
|
$sid: "typing-1",
|
|
35
58
|
type: "system",
|
|
36
|
-
|
|
37
|
-
text: "AI is typing...",
|
|
59
|
+
text: scalationStarted ? "Typing" : "AI is typing...",
|
|
38
60
|
sender: { id: "system", type: "system" },
|
|
39
61
|
$timestamp: /* @__PURE__ */ new Date(),
|
|
40
62
|
$userType: "system",
|
|
@@ -77,13 +99,44 @@ const Chatbot = ({
|
|
|
77
99
|
};
|
|
78
100
|
const onChatMessageHandler = async (message) => {
|
|
79
101
|
console.log("Received message:", message);
|
|
80
|
-
|
|
81
|
-
if (
|
|
82
|
-
addMessage(
|
|
102
|
+
const { event, $userType } = message;
|
|
103
|
+
if (["system", "virtual_agent", "user"].includes($userType) && event === void 0) {
|
|
104
|
+
addMessage(message);
|
|
105
|
+
if (!hasEscalated) {
|
|
106
|
+
unblockInput?.();
|
|
107
|
+
}
|
|
108
|
+
return;
|
|
109
|
+
}
|
|
110
|
+
switch (event) {
|
|
111
|
+
case "escalationAccepted":
|
|
112
|
+
case "escalationStarted":
|
|
113
|
+
setScalationStarted(true);
|
|
114
|
+
startEscalation?.();
|
|
115
|
+
addMessage(message);
|
|
116
|
+
return;
|
|
117
|
+
case "escalationEnded":
|
|
118
|
+
case "escalationFailed": {
|
|
119
|
+
endEscalation?.();
|
|
120
|
+
addMessage(message);
|
|
121
|
+
return;
|
|
122
|
+
}
|
|
123
|
+
default:
|
|
124
|
+
addMessage(message);
|
|
125
|
+
if (["end_user"].includes(message.$userType)) {
|
|
126
|
+
if (!hasEscalated) {
|
|
127
|
+
addMessage(typingMessage);
|
|
128
|
+
}
|
|
129
|
+
}
|
|
130
|
+
return;
|
|
83
131
|
}
|
|
84
132
|
};
|
|
85
133
|
const onChatTypingStartedHandler = async (identity) => {
|
|
86
134
|
console.log("Typing started by:", identity);
|
|
135
|
+
setIsTyping(true);
|
|
136
|
+
};
|
|
137
|
+
const onChatTypingEndedHandler = async (identity) => {
|
|
138
|
+
console.log("Typing ended by:", identity);
|
|
139
|
+
setIsTyping(false);
|
|
87
140
|
};
|
|
88
141
|
const onChatDisconnectedHandler = async () => {
|
|
89
142
|
console.log("Chat disconnected");
|
|
@@ -105,23 +158,47 @@ const Chatbot = ({
|
|
|
105
158
|
const onChatMemberLeftHandler = async (identity) => {
|
|
106
159
|
console.log("Chat member left:", identity);
|
|
107
160
|
};
|
|
161
|
+
const onChatMemberJoinedHandler = async (identity) => {
|
|
162
|
+
console.log("Chat member joined:", identity);
|
|
163
|
+
};
|
|
108
164
|
const onChatConnectedHandler = async () => {
|
|
109
165
|
setStatus("connected");
|
|
110
166
|
console.log("connected");
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
167
|
+
try {
|
|
168
|
+
if (!clientRef.current) {
|
|
169
|
+
console.error("Client not initialized on chat connected");
|
|
170
|
+
return;
|
|
171
|
+
}
|
|
172
|
+
const messages2 = await clientRef.current?.fetchMessages();
|
|
173
|
+
console.log("Fetched messages on chat connected:", messages2);
|
|
174
|
+
if (messages2) {
|
|
175
|
+
addMessages(messages2);
|
|
176
|
+
const hasEscalation = messages2.some(
|
|
177
|
+
(msg) => msg.$userType === "user" || ["escalationAccepted", "escalationStarted"].includes(
|
|
178
|
+
msg.event
|
|
179
|
+
)
|
|
180
|
+
);
|
|
181
|
+
console.log(hasEscalation);
|
|
182
|
+
if (hasEscalation) {
|
|
183
|
+
setScalationStarted(true);
|
|
184
|
+
startEscalation?.();
|
|
185
|
+
}
|
|
186
|
+
}
|
|
187
|
+
} catch (error) {
|
|
188
|
+
console.error("Error fetching messages on chat connected:", error);
|
|
114
189
|
}
|
|
115
190
|
};
|
|
116
191
|
const registerEventHandlers = () => {
|
|
117
192
|
clientRef.current?.on("chat.ongoing", onChatOngoingHandler);
|
|
118
193
|
clientRef.current?.on("chat.message", onChatMessageHandler);
|
|
119
194
|
clientRef.current?.on("chat.typingStarted", onChatTypingStartedHandler);
|
|
195
|
+
clientRef.current?.on("chat.typingEnded", onChatTypingEndedHandler);
|
|
120
196
|
clientRef.current?.on("chat.disconnected", onChatDisconnectedHandler);
|
|
121
197
|
clientRef.current?.on("chat.dismissed", onDismissedHandler);
|
|
122
198
|
clientRef.current?.on("chat.timeout", onTimeoutHandler);
|
|
123
199
|
clientRef.current?.on("chat.ended", onEndedHandler);
|
|
124
200
|
clientRef.current?.on("chat.destroyed", onDestroyedHandler);
|
|
201
|
+
clientRef.current?.on("chat.memberJoined", onChatMemberJoinedHandler);
|
|
125
202
|
clientRef.current?.on("chat.memberLeft", onChatMemberLeftHandler);
|
|
126
203
|
clientRef?.current?.on("chat.connected", onChatConnectedHandler);
|
|
127
204
|
};
|
|
@@ -131,12 +208,14 @@ const Chatbot = ({
|
|
|
131
208
|
clientRef.current?.off("chat.ongoing", onDismissedHandler);
|
|
132
209
|
clientRef.current?.off("chat.message", onChatMessageHandler);
|
|
133
210
|
clientRef.current?.off("chat.typingStarted", onChatTypingStartedHandler);
|
|
211
|
+
clientRef.current?.off("chat.typingEnded", onChatTypingEndedHandler);
|
|
134
212
|
clientRef.current?.off("chat.disconnected", onChatDisconnectedHandler);
|
|
135
213
|
clientRef.current?.off("chat.dismissed", onDismissedHandler);
|
|
136
214
|
clientRef.current?.off("chat.timeout", onTimeoutHandler);
|
|
137
215
|
clientRef.current?.off("chat.ended", onEndedHandler);
|
|
138
216
|
clientRef.current?.off("chat.destroyed", onDestroyedHandler);
|
|
139
217
|
clientRef.current?.off("chat.memberLeft", onChatMemberLeftHandler);
|
|
218
|
+
clientRef.current?.off("chat.memberJoined", onChatMemberJoinedHandler);
|
|
140
219
|
clientRef.current?.off("chat.connected", onChatConnectedHandler);
|
|
141
220
|
};
|
|
142
221
|
const createClient = async () => {
|
|
@@ -150,6 +229,9 @@ const Chatbot = ({
|
|
|
150
229
|
tenant: process.env.CCAI_TENANT_NAME || "",
|
|
151
230
|
host: process.env.CCAI_HOST || "",
|
|
152
231
|
// or your region
|
|
232
|
+
// companyId: import.meta.env.VITE_COMPANY_ID || "",
|
|
233
|
+
// tenant: import.meta.env.VITE_TENANT_NAME || "",
|
|
234
|
+
// host: import.meta.env.VITE_HOST || "", // or your region
|
|
153
235
|
authenticate
|
|
154
236
|
});
|
|
155
237
|
client?.on("ready", onReadyHandler);
|
|
@@ -210,9 +292,17 @@ const Chatbot = ({
|
|
|
210
292
|
setHasStarted(true);
|
|
211
293
|
}
|
|
212
294
|
};
|
|
213
|
-
const onSendMessage = (msg) => {
|
|
295
|
+
const onSendMessage = async (msg) => {
|
|
214
296
|
console.log("Sending message:", msg);
|
|
215
|
-
|
|
297
|
+
try {
|
|
298
|
+
await clientRef.current?.sendTextMessage(msg);
|
|
299
|
+
} catch (error) {
|
|
300
|
+
console.log(error);
|
|
301
|
+
} finally {
|
|
302
|
+
if (!hasEscalated) {
|
|
303
|
+
blockInput?.();
|
|
304
|
+
}
|
|
305
|
+
}
|
|
216
306
|
};
|
|
217
307
|
const onEndChat = async () => {
|
|
218
308
|
console.log("Ending chat");
|
|
@@ -223,6 +313,7 @@ const Chatbot = ({
|
|
|
223
313
|
chatRef.current = null;
|
|
224
314
|
console.log("Chat ended");
|
|
225
315
|
setHasStarted(false);
|
|
316
|
+
endEscalation?.();
|
|
226
317
|
}
|
|
227
318
|
};
|
|
228
319
|
const onEndAndStartNewChat = async () => {
|
|
@@ -251,6 +342,7 @@ const Chatbot = ({
|
|
|
251
342
|
setHasStarted(false);
|
|
252
343
|
setStatus("idle");
|
|
253
344
|
clearMessages();
|
|
345
|
+
endEscalation?.();
|
|
254
346
|
clientRef.current?.destroy();
|
|
255
347
|
clientRef.current?.destroyChat();
|
|
256
348
|
clientRef.current = null;
|
|
@@ -262,7 +354,18 @@ const Chatbot = ({
|
|
|
262
354
|
reset();
|
|
263
355
|
setHasStarted(false);
|
|
264
356
|
};
|
|
265
|
-
|
|
357
|
+
const onPreviewTyping = async (msg) => {
|
|
358
|
+
console.log("Preview typing message:", msg);
|
|
359
|
+
try {
|
|
360
|
+
if (clientRef.current) {
|
|
361
|
+
chatRef.current?.startTyping();
|
|
362
|
+
await clientRef.current?.sendPreviewMessage(msg);
|
|
363
|
+
}
|
|
364
|
+
} catch (error) {
|
|
365
|
+
console.error("Error sending preview message:", error);
|
|
366
|
+
}
|
|
367
|
+
};
|
|
368
|
+
return menusLoaded && /* @__PURE__ */ jsxs("div", { className: project === "ufb" ? chatbotUFB : chatbotAXB, children: [
|
|
266
369
|
/* @__PURE__ */ jsx(Bubble, { onClick: handleClick }),
|
|
267
370
|
/* @__PURE__ */ jsx(
|
|
268
371
|
ChatWindow,
|
|
@@ -274,7 +377,9 @@ const Chatbot = ({
|
|
|
274
377
|
endChat: onEndChat,
|
|
275
378
|
onClose,
|
|
276
379
|
onNewChat: onEndAndStartNewChat,
|
|
277
|
-
onCloseAfterThankYou
|
|
380
|
+
onCloseAfterThankYou,
|
|
381
|
+
previewTyping: onPreviewTyping,
|
|
382
|
+
isTyping
|
|
278
383
|
}
|
|
279
384
|
)
|
|
280
385
|
] });
|
|
@@ -9,7 +9,8 @@ import '../assets/themes/victorie.css';import '../assets/themes/ufb.css';import
|
|
|
9
9
|
/* empty css */
|
|
10
10
|
/* empty css */
|
|
11
11
|
import clsx from "clsx";
|
|
12
|
-
import { shimmerText, notificationStyle,
|
|
12
|
+
import { shimmerText, notificationStyle, messageStyle, user_msg, agent_msg, inline_button_wrapper, inline_button, endChatButtonStyle } from "./ChatWindow.css.js";
|
|
13
|
+
import { useOpenChat } from "./store/chat.js";
|
|
13
14
|
function timeAgo(date) {
|
|
14
15
|
const seconds = Math.floor(((/* @__PURE__ */ new Date()).getTime() - date.getTime()) / 1e3);
|
|
15
16
|
if (seconds < 60) return "Just now";
|
|
@@ -23,9 +24,10 @@ const ChatbotMessage = ({
|
|
|
23
24
|
showAvatar,
|
|
24
25
|
showName,
|
|
25
26
|
virtualAgent,
|
|
26
|
-
|
|
27
|
+
onEndChat,
|
|
27
28
|
onSend
|
|
28
29
|
}) => {
|
|
30
|
+
const { hasEscalated } = useOpenChat();
|
|
29
31
|
const [timeText, setTimeText] = useState(timeAgo(msg.$timestamp));
|
|
30
32
|
useEffect(() => {
|
|
31
33
|
const interval = setInterval(() => {
|
|
@@ -33,7 +35,7 @@ const ChatbotMessage = ({
|
|
|
33
35
|
}, 3e4);
|
|
34
36
|
return () => clearInterval(interval);
|
|
35
37
|
}, [msg.$timestamp]);
|
|
36
|
-
if (msg.$sid === "typing-1") {
|
|
38
|
+
if (msg.$sid === "typing-1" && !hasEscalated) {
|
|
37
39
|
return /* @__PURE__ */ jsx(
|
|
38
40
|
"div",
|
|
39
41
|
{
|
|
@@ -73,23 +75,20 @@ const ChatbotMessage = ({
|
|
|
73
75
|
" ",
|
|
74
76
|
msg.to_agent ? /* @__PURE__ */ jsx("strong", { children: msg?.to_agent?.name }) : "an agent"
|
|
75
77
|
] }, msg.$index),
|
|
76
|
-
msg.type == "noti" && msg.$userType == "virtual_agent" && msg.event == "escalationDeflected" && /* @__PURE__ */
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
),
|
|
91
|
-
/* @__PURE__ */ jsx("div", { style: { textAlign: "center", marginBottom: 12 }, children: /* @__PURE__ */ jsx("button", { className: endChatButtonStyle, onClick: onCancelEndChat, children: "End Chat" }) })
|
|
92
|
-
] }),
|
|
78
|
+
msg.type == "noti" && msg.$userType == "virtual_agent" && msg.event == "escalationDeflected" && /* @__PURE__ */ jsx(Fragment, { children: /* @__PURE__ */ jsxs(
|
|
79
|
+
"div",
|
|
80
|
+
{
|
|
81
|
+
className: notificationStyle,
|
|
82
|
+
style: { fontSize: 12 },
|
|
83
|
+
children: [
|
|
84
|
+
"Our chat team is available weekdays, 8am-5pm, except federal bank holidays. For immediate assistance you can reach out to us at",
|
|
85
|
+
" ",
|
|
86
|
+
/* @__PURE__ */ jsx("a", { href: "tel:1-888-502-2967", children: "1-888-502-2967" }),
|
|
87
|
+
"."
|
|
88
|
+
]
|
|
89
|
+
},
|
|
90
|
+
msg.$index
|
|
91
|
+
) }),
|
|
93
92
|
["text", "markdown_template", "markdown"].includes(msg.type) && /* @__PURE__ */ jsx(
|
|
94
93
|
"div",
|
|
95
94
|
{
|
|
@@ -178,7 +177,28 @@ const ChatbotMessage = ({
|
|
|
178
177
|
index
|
|
179
178
|
);
|
|
180
179
|
}) }),
|
|
181
|
-
|
|
180
|
+
" ",
|
|
181
|
+
msg.event == "chatEnded" && msg.status == "failed" && /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
182
|
+
/* @__PURE__ */ jsxs(
|
|
183
|
+
"div",
|
|
184
|
+
{
|
|
185
|
+
title: (/* @__PURE__ */ new Date()).toLocaleString(),
|
|
186
|
+
style: {
|
|
187
|
+
fontSize: 12,
|
|
188
|
+
color: "#888",
|
|
189
|
+
marginBottom: 4,
|
|
190
|
+
textAlign: "center"
|
|
191
|
+
},
|
|
192
|
+
children: [
|
|
193
|
+
"No team members are online at the moment.",
|
|
194
|
+
/* @__PURE__ */ jsx("br", {}),
|
|
195
|
+
" Please try again later."
|
|
196
|
+
]
|
|
197
|
+
}
|
|
198
|
+
),
|
|
199
|
+
/* @__PURE__ */ jsx("div", { style: { textAlign: "center", marginBottom: 12 }, children: /* @__PURE__ */ jsx("button", { className: endChatButtonStyle, onClick: onEndChat, children: "End Chat" }) })
|
|
200
|
+
] }),
|
|
201
|
+
msg.event == "chatEnded" && msg.status != "failed" && /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
182
202
|
/* @__PURE__ */ jsxs(
|
|
183
203
|
"div",
|
|
184
204
|
{
|
|
@@ -196,7 +216,7 @@ const ChatbotMessage = ({
|
|
|
196
216
|
]
|
|
197
217
|
}
|
|
198
218
|
),
|
|
199
|
-
/* @__PURE__ */ jsx("div", { style: { textAlign: "center", marginBottom: 12 }, children: /* @__PURE__ */ jsx("button", { className: endChatButtonStyle, onClick:
|
|
219
|
+
/* @__PURE__ */ jsx("div", { style: { textAlign: "center", marginBottom: 12 }, children: /* @__PURE__ */ jsx("button", { className: endChatButtonStyle, onClick: onEndChat, children: "End Chat" }) })
|
|
200
220
|
] }),
|
|
201
221
|
msg.type == "text" && /* @__PURE__ */ jsx(
|
|
202
222
|
"div",
|
|
@@ -8,6 +8,12 @@ interface OpenChatState {
|
|
|
8
8
|
showThankyouMessage: boolean;
|
|
9
9
|
displayThankyouMessage: () => void;
|
|
10
10
|
toggleThankyouMessage?: () => void;
|
|
11
|
+
hasEscalated?: boolean;
|
|
12
|
+
startEscalation?: () => void;
|
|
13
|
+
endEscalation?: () => void;
|
|
14
|
+
isBlockedInput?: boolean;
|
|
15
|
+
blockInput?: () => void;
|
|
16
|
+
unblockInput?: () => void;
|
|
11
17
|
}
|
|
12
18
|
export declare const useOpenChat: import('zustand').UseBoundStore<import('zustand').StoreApi<OpenChatState>>;
|
|
13
19
|
export {};
|
|
@@ -3,6 +3,7 @@ const useOpenChat = create((set, get) => ({
|
|
|
3
3
|
isOpen: false,
|
|
4
4
|
hasOpenedOnce: false,
|
|
5
5
|
showThankyouMessage: false,
|
|
6
|
+
hasEscalated: false,
|
|
6
7
|
toggle: () => set((state) => ({ isOpen: !state.isOpen, hasOpenedOnce: true })),
|
|
7
8
|
open: () => {
|
|
8
9
|
const alreadyOpened = get().hasOpenedOnce;
|
|
@@ -12,9 +13,20 @@ const useOpenChat = create((set, get) => ({
|
|
|
12
13
|
});
|
|
13
14
|
},
|
|
14
15
|
close: () => set({ isOpen: false }),
|
|
15
|
-
reset: () => set({
|
|
16
|
+
reset: () => set({
|
|
17
|
+
hasOpenedOnce: false,
|
|
18
|
+
isOpen: false,
|
|
19
|
+
showThankyouMessage: false,
|
|
20
|
+
hasEscalated: false,
|
|
21
|
+
isBlockedInput: false
|
|
22
|
+
}),
|
|
16
23
|
displayThankyouMessage: () => set({ showThankyouMessage: true }),
|
|
17
|
-
toggleThankyouMessage: () => set((state) => ({ showThankyouMessage: !state.showThankyouMessage }))
|
|
24
|
+
toggleThankyouMessage: () => set((state) => ({ showThankyouMessage: !state.showThankyouMessage })),
|
|
25
|
+
startEscalation: () => set({ hasEscalated: true }),
|
|
26
|
+
endEscalation: () => set({ hasEscalated: false }),
|
|
27
|
+
isBlockedInput: false,
|
|
28
|
+
blockInput: () => set({ isBlockedInput: true }),
|
|
29
|
+
unblockInput: () => set({ isBlockedInput: false })
|
|
18
30
|
}));
|
|
19
31
|
export {
|
|
20
32
|
useOpenChat
|