@axos-web-dev/shared-components 1.0.100-dev.42-chatbot-reset-fix.7 → 1.0.100-dev.43-executive.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.
Files changed (99) hide show
  1. package/dist/ATMLocator/ATMLocator.js +3 -2
  2. package/dist/Auth/ErrorAlert.js +2 -1
  3. package/dist/Auth/SignInPassword.js +2 -2
  4. package/dist/BulletItem/BulletItem.js +0 -1
  5. package/dist/Button/Button.js +2 -1
  6. package/dist/Calculators/AnnualFeeCalculator/index.js +1 -1
  7. package/dist/Calculators/BuyDownCalculator/index.js +1 -1
  8. package/dist/Calculators/Calculator.js +3 -2
  9. package/dist/Calculators/MarineLoanMonthlyPaymentCalculator/index.js +1 -1
  10. package/dist/Calculators/MaxLoanCalculator/index.js +1 -1
  11. package/dist/Calculators/MonthlyPaymentCalculator/index.js +1 -1
  12. package/dist/Carousel/index.js +2 -1
  13. package/dist/Chatbot/Bubble.css.js +1 -0
  14. package/dist/Chatbot/ChatWindow.css.d.ts +0 -1
  15. package/dist/Chatbot/ChatWindow.css.js +11 -13
  16. package/dist/Chatbot/ChatWindow.js +66 -87
  17. package/dist/Chatbot/Chatbot.css.js +0 -1
  18. package/dist/Chatbot/Chatbot.d.ts +1 -1
  19. package/dist/Chatbot/Chatbot.js +10 -46
  20. package/dist/Chatbot/index.js +1 -2
  21. package/dist/Chevron/index.js +2 -1
  22. package/dist/Comparison/Comparison.js +2 -1
  23. package/dist/ExecutiveBio/ExecutiveBio.css.d.ts +136 -0
  24. package/dist/ExecutiveBio/ExecutiveBio.css.js +46 -0
  25. package/dist/ExecutiveBio/ExecutiveBio.d.ts +1 -1
  26. package/dist/ExecutiveBio/ExecutiveBio.interface.d.ts +10 -4
  27. package/dist/ExecutiveBio/ExecutiveBio.js +331 -86
  28. package/dist/ExecutiveBio/index.js +24 -1
  29. package/dist/FaqAccordion/index.js +2 -1
  30. package/dist/FooterSiteMap/AxosBank/FooterSiteMap.js +2 -1
  31. package/dist/Forms/ApplicationStart.js +2 -4
  32. package/dist/Forms/ApplyNow.js +3 -2
  33. package/dist/Forms/ClearingForm.js +2 -4
  34. package/dist/Forms/CommercialDeposits.js +2 -4
  35. package/dist/Forms/CommercialDepositsNoLendingOption.js +2 -4
  36. package/dist/Forms/CommercialLending.js +2 -4
  37. package/dist/Forms/CommercialPremiumFinance.js +2 -4
  38. package/dist/Forms/ContactCompany.js +2 -4
  39. package/dist/Forms/ContactCompanyTitle.js +2 -4
  40. package/dist/Forms/ContactUs.js +2 -4
  41. package/dist/Forms/ContactUsAAS.js +2 -4
  42. package/dist/Forms/ContactUsBusiness.js +4 -5
  43. package/dist/Forms/ContactUsBusinessNameEmail.js +4 -5
  44. package/dist/Forms/ContactUsLVF.js +2 -4
  45. package/dist/Forms/ContactUsNMLSId.js +4 -5
  46. package/dist/Forms/CpraRequest.d.ts +1 -1
  47. package/dist/Forms/CpraRequest.js +2 -5
  48. package/dist/Forms/CraPublicFile.js +4 -5
  49. package/dist/Forms/DealerServices.js +2 -4
  50. package/dist/Forms/EmailOnly.js +4 -5
  51. package/dist/Forms/EmailUs.js +5 -7
  52. package/dist/Forms/HoneyPot/index.js +1 -2
  53. package/dist/Forms/MortgageRate/MortgageRateForm.js +4 -5
  54. package/dist/Forms/MortgageRate/MortgageRateWatch.js +2 -1
  55. package/dist/Forms/MortgageWarehouseLending.js +4 -5
  56. package/dist/Forms/QuickPricer/QuickPricerForm.js +12 -16
  57. package/dist/Forms/ScheduleCall.js +2 -4
  58. package/dist/Forms/ScheduleCallPremier.js +2 -4
  59. package/dist/Forms/SuccesForm.js +3 -2
  60. package/dist/Forms/VendorQuestionnaire.js +2 -6
  61. package/dist/Forms/index.js +0 -1
  62. package/dist/Hyperlink/index.js +2 -1
  63. package/dist/ImageLink/ImageLink.js +3 -2
  64. package/dist/ImageLink/ImageLinkSet.js +2 -1
  65. package/dist/ImageLink/index.js +2 -1
  66. package/dist/Insight/Featured/CategorySelector.js +2 -1
  67. package/dist/Insight/Featured/Featured.js +2 -1
  68. package/dist/Insight/Featured/Header.js +2 -1
  69. package/dist/LoadingIndicator/index.js +0 -1
  70. package/dist/Modal/Modal.js +2 -1
  71. package/dist/Modal/contextApi/store.js +1 -1
  72. package/dist/NavigationMenu/AxosALTS/NavData.js +2 -1
  73. package/dist/NavigationMenu/AxosALTS/index.js +2 -1
  74. package/dist/NavigationMenu/AxosBank/MobileMenu/MobileNavData.js +2 -1
  75. package/dist/NavigationMenu/AxosBank/NavData.js +2 -1
  76. package/dist/NavigationMenu/AxosBank/SubNavBar.js +2 -1
  77. package/dist/NavigationMenu/AxosBank/index.js +2 -1
  78. package/dist/NavigationMenu/LaVictoire/NavData.js +2 -1
  79. package/dist/NavigationMenu/LaVictoire/index.js +2 -1
  80. package/dist/NavigationMenu/NavDataJson.js +2 -1
  81. package/dist/NavigationMenu/Navbar.js +2 -1
  82. package/dist/NavigationMenu/SignInNavButton.js +2 -1
  83. package/dist/SetContainer/SetContainer.js +3 -2
  84. package/dist/SocialMediaBar/iconsRepository.js +2 -1
  85. package/dist/Tab/Tab.js +0 -1
  86. package/dist/VideoTile/VideoTile.js +2 -1
  87. package/dist/VideoWrapper/index.js +2 -1
  88. package/dist/assets/Chatbot/ChatWindow.css +26 -38
  89. package/dist/assets/ExecutiveBio/ExecutiveBio.css +239 -0
  90. package/dist/main.js +26 -11
  91. package/dist/utils/index.d.ts +1 -4
  92. package/dist/utils/index.js +1 -9
  93. package/package.json +136 -136
  94. package/dist/utils/emailValidation.d.ts +0 -1
  95. package/dist/utils/emailValidation.js +0 -31
  96. package/dist/utils/nmlsValidation.d.ts +0 -1
  97. package/dist/utils/nmlsValidation.js +0 -34
  98. package/dist/utils/useCachedValidators.d.ts +0 -2
  99. package/dist/utils/useCachedValidators.js +0 -22
@@ -11,11 +11,11 @@ import '../assets/VideoWrapper/VideoWrapper.css';import '../assets/TopicalNavSet
11
11
  /* empty css */
12
12
  import "../utils/allowedAxosDomains.js";
13
13
  import { getVariant } from "../utils/getVariant.js";
14
- import "react";
15
14
  import clsx from "clsx";
16
15
  /* empty css */
17
16
  /* empty css */
18
17
  import "../Button/Button.css.js";
18
+ import "react";
19
19
  import "react-use";
20
20
  import "../Accordion/Accordion.js";
21
21
  import "../Accordion/Accordion.css.js";
@@ -67,12 +67,13 @@ import "../Calculators/MonthlyPaymentCalculator/MonthlyPaymentCalculator.css.js"
67
67
  /* empty css */
68
68
  /* empty css */
69
69
  import "../Carousel/index.js";
70
+ import "../Chatbot/Chatbot.css.ts.vanilla.css.js";
70
71
  /* empty css */
71
72
  import "../Chatbot/store/chat.js";
72
73
  import "../Chatbot/authenticate.js";
73
- import "../Chatbot/Chatbot.css.ts.vanilla.css.js";
74
74
  /* empty css */
75
75
  import "../Chatbot/store/messages.js";
76
+ import "@ujet/websdk-headless";
76
77
  /* empty css */
77
78
  import "../Comparison/Comparison.css.js";
78
79
  import "next/image.js";
@@ -59,12 +59,13 @@ import "./SignInPassword.js";
59
59
  /* empty css */
60
60
  /* empty css */
61
61
  import "../Carousel/index.js";
62
+ import "../Chatbot/Chatbot.css.ts.vanilla.css.js";
62
63
  /* empty css */
63
64
  import "../Chatbot/store/chat.js";
64
65
  import "../Chatbot/authenticate.js";
65
- import "../Chatbot/Chatbot.css.ts.vanilla.css.js";
66
66
  /* empty css */
67
67
  import "../Chatbot/store/messages.js";
68
+ import "@ujet/websdk-headless";
68
69
  import { Hyperlink } from "../Hyperlink/index.js";
69
70
  /* empty css */
70
71
  import "../Comparison/Comparison.css.js";
@@ -3,12 +3,12 @@ import { jsx, jsxs } from "react/jsx-runtime";
3
3
  import { zodResolver } from "@hookform/resolvers/zod";
4
4
  import { Input } from "../Input/Input.js";
5
5
  import "../utils/allowedAxosDomains.js";
6
- import { z } from "zod";
7
6
  import { getVariant } from "../utils/getVariant.js";
8
- import { useState } from "react";
9
7
  import clsx from "clsx";
10
8
  import { useAction } from "next-safe-action/hooks";
9
+ import { useState } from "react";
11
10
  import { useForm } from "react-hook-form";
11
+ import { z } from "zod";
12
12
  import { ErrorAlert } from "./ErrorAlert.js";
13
13
  import { body_sign_in, form_input_wrapper, sign_in_button, sign_in_form } from "./SignIn.css.js";
14
14
  const schema = z.object({
@@ -10,7 +10,6 @@ import '../assets/icons/FollowIcon/FollowIcon.css';import '../assets/icons/Downl
10
10
  /* empty css */
11
11
  import "../utils/allowedAxosDomains.js";
12
12
  import { getVariant } from "../utils/getVariant.js";
13
- import "react";
14
13
  import clsx from "clsx";
15
14
  import { bulletIcon } from "./BulletItem.css.js";
16
15
  const BulletItem = (props) => {
@@ -70,12 +70,13 @@ import "../Auth/SignInPassword.js";
70
70
  /* empty css */
71
71
  /* empty css */
72
72
  import "../Carousel/index.js";
73
+ import "../Chatbot/Chatbot.css.ts.vanilla.css.js";
73
74
  /* empty css */
74
75
  import "../Chatbot/store/chat.js";
75
76
  import "../Chatbot/authenticate.js";
76
- import "../Chatbot/Chatbot.css.ts.vanilla.css.js";
77
77
  /* empty css */
78
78
  import "../Chatbot/store/messages.js";
79
+ import "@ujet/websdk-headless";
79
80
  /* empty css */
80
81
  import "../Comparison/Comparison.css.js";
81
82
  import "next/image.js";
@@ -5,8 +5,8 @@ import { Chevron } from "../../Chevron/index.js";
5
5
  import { title } from "../../IconBillboard/IconBillboard.css.js";
6
6
  import "../../utils/allowedAxosDomains.js";
7
7
  import { getVariant } from "../../utils/getVariant.js";
8
- import { useRef, useState, useEffect } from "react";
9
8
  import clsx from "clsx";
9
+ import { useRef, useState, useEffect } from "react";
10
10
  import { calculator } from "../calculator.css.js";
11
11
  import { container, calc_container, calc_block, pb0_1023, slider_block_wrapper, w100, stat_row, balance_wrapper, fb50, stat, slider_wrapper, slider, pt0_1023, text_block } from "./AnnualFeeCalculator.css.js";
12
12
  const AnnualFeeCalculator = ({
@@ -19,10 +19,10 @@ import "../../Input/DownPaymentInput.js";
19
19
  import "../../Input/RadioButton.js";
20
20
  import { PercentageInput } from "../../Input/PercentageInput.js";
21
21
  import "../../utils/allowedAxosDomains.js";
22
- import { z } from "zod";
23
22
  import { getVariant } from "../../utils/getVariant.js";
24
23
  import clsx from "clsx";
25
24
  import { useForm, FormProvider } from "react-hook-form";
25
+ import { z } from "zod";
26
26
  import { calc_container, calculator_section, section_header, theme_header, mt_8, buydown_calculator_form, row_form, calculate_row, form_wrapper, form_disclosure } from "./BuyDownCalculator.css.js";
27
27
  const BuyDownCalculator = ({
28
28
  header,
@@ -14,13 +14,13 @@ import '../assets/Forms/QuickPricer/UserInformation.css';import '../assets/Forms
14
14
  /* empty css */
15
15
  import "../utils/allowedAxosDomains.js";
16
16
  import { getVariant } from "../utils/getVariant.js";
17
- import { useRef, useEffect } from "react";
18
17
  import clsx from "clsx";
19
18
  /* empty css */
20
19
  /* empty css */
21
20
  import "../Accordion/Accordion.js";
22
21
  import "../Accordion/Accordion.css.js";
23
22
  import "../AlertBanner/AlertBanner.css.js";
23
+ import { useRef, useEffect } from "react";
24
24
  import "../Article/Article.css.js";
25
25
  import "../ArticlesSet/ArticlesSet.css.js";
26
26
  import "../Chevron/Chevron.css.js";
@@ -49,13 +49,14 @@ import { SummitApyCalculator } from "./SummitApyCalculator/index.js";
49
49
  /* empty css */
50
50
  /* empty css */
51
51
  import "../Carousel/index.js";
52
+ import "../Chatbot/Chatbot.css.ts.vanilla.css.js";
52
53
  /* empty css */
53
54
  import "../Chatbot/store/chat.js";
54
55
  import "../Chatbot/authenticate.js";
55
- import "../Chatbot/Chatbot.css.ts.vanilla.css.js";
56
56
  import "react-use";
57
57
  /* empty css */
58
58
  import "../Chatbot/store/messages.js";
59
+ import "@ujet/websdk-headless";
59
60
  /* empty css */
60
61
  import "../Comparison/Comparison.css.js";
61
62
  import "next/image.js";
@@ -4,8 +4,8 @@ import { button } from "../../Button/Button.css.js";
4
4
  import { title } from "../../IconBillboard/IconBillboard.css.js";
5
5
  import "../../utils/allowedAxosDomains.js";
6
6
  import { getVariant } from "../../utils/getVariant.js";
7
- import { useState } from "react";
8
7
  import clsx from "clsx";
8
+ import { useState } from "react";
9
9
  import { calc_text, description_text, calc_disclosure } from "../BalanceAPYCalculator/BalanceAPYCalculator.css.js";
10
10
  import { calculator } from "../calculator.css.js";
11
11
  import { calc_container, container, h2i, inputs_container, input_container, input_box, error_message, hide_select_arrow, calculation_header, payment_results } from "../MonthlyPaymentCalculator/MonthlyPaymentCalculator.css.js";
@@ -5,8 +5,8 @@ import { calc_container, container, h2i, inputs_container, input_container, inpu
5
5
  import { title } from "../../IconBillboard/IconBillboard.css.js";
6
6
  import "../../utils/allowedAxosDomains.js";
7
7
  import { getVariant } from "../../utils/getVariant.js";
8
- import { useState } from "react";
9
8
  import clsx from "clsx";
9
+ import { useState } from "react";
10
10
  import { calculator } from "../calculator.css.js";
11
11
  const MaxLoanCalculator = ({
12
12
  variant,
@@ -4,8 +4,8 @@ import { button } from "../../Button/Button.css.js";
4
4
  import { title } from "../../IconBillboard/IconBillboard.css.js";
5
5
  import "../../utils/allowedAxosDomains.js";
6
6
  import { getVariant } from "../../utils/getVariant.js";
7
- import { useState } from "react";
8
7
  import clsx from "clsx";
8
+ import { useState } from "react";
9
9
  import { calc_text, description_text, calc_disclosure } from "../BalanceAPYCalculator/BalanceAPYCalculator.css.js";
10
10
  import { calculator } from "../calculator.css.js";
11
11
  import { calc_container, container, h2i, inputs_container, input_container, input_box, error_message, calculation_header, payment_results } from "./MonthlyPaymentCalculator.css.js";
@@ -72,12 +72,13 @@ import "../Auth/SignInPassword.js";
72
72
  /* empty css */
73
73
  /* empty css */
74
74
  /* empty css */
75
+ import "../Chatbot/Chatbot.css.ts.vanilla.css.js";
75
76
  /* empty css */
76
77
  import "../Chatbot/store/chat.js";
77
78
  import "../Chatbot/authenticate.js";
78
- import "../Chatbot/Chatbot.css.ts.vanilla.css.js";
79
79
  /* empty css */
80
80
  import "../Chatbot/store/messages.js";
81
+ import "@ujet/websdk-headless";
81
82
  /* empty css */
82
83
  import "../Comparison/Comparison.css.js";
83
84
  import "next/image.js";
@@ -1,3 +1,4 @@
1
+ import "./Chatbot.css.ts.vanilla.css.js";
1
2
  import '../assets/Chatbot/Bubble.css';/* empty css */
2
3
  var bubbleWrapper = "_7u9pv30";
3
4
  var svgFill = "_7u9pv31";
@@ -5,7 +5,6 @@ export declare const chat_title: string;
5
5
  export declare const button_reset: string;
6
6
  export declare const arrowFill: string;
7
7
  export declare const inputStyle: string;
8
- export declare const autoResize: string;
9
8
  export declare const sendButtonStyle: string;
10
9
  export declare const messagesContainerStyle: string;
11
10
  export declare const notificationStyle: string;
@@ -6,21 +6,19 @@ var chat_title = "_13n1jqk3";
6
6
  var button_reset = "_13n1jqk4";
7
7
  var arrowFill = "_13n1jqk5";
8
8
  var inputStyle = "_13n1jqk6";
9
- var autoResize = "_13n1jqk7";
10
- var sendButtonStyle = "_13n1jqk8";
11
- var messagesContainerStyle = "_13n1jqk9";
12
- var notificationStyle = "_13n1jqka";
13
- var messageStyle = "_13n1jqkb";
14
- var inline_button_wrapper = "_13n1jqkc";
15
- var inline_button = "_13n1jqkd";
16
- var endChatButtonStyle = "_13n1jqke";
17
- var chatbotMenu = "_13n1jqkf";
18
- var chatbotMenuItem = "_13n1jqkg";
19
- var chatNetworkStatus = "_13n1jqkh";
20
- var chatFinishDialog = "_13n1jqki";
9
+ var sendButtonStyle = "_13n1jqk7";
10
+ var messagesContainerStyle = "_13n1jqk8";
11
+ var notificationStyle = "_13n1jqk9";
12
+ var messageStyle = "_13n1jqka";
13
+ var inline_button_wrapper = "_13n1jqkb";
14
+ var inline_button = "_13n1jqkc";
15
+ var endChatButtonStyle = "_13n1jqkd";
16
+ var chatbotMenu = "_13n1jqke";
17
+ var chatbotMenuItem = "_13n1jqkf";
18
+ var chatNetworkStatus = "_13n1jqkg";
19
+ var chatFinishDialog = "_13n1jqkh";
21
20
  export {
22
21
  arrowFill,
23
- autoResize,
24
22
  button_reset,
25
23
  chatFinishDialog,
26
24
  chatNetworkStatus,
@@ -5,7 +5,7 @@ import React, { useRef, useEffect, Fragment as Fragment$1 } from "react";
5
5
  import ReactMarkdown from "react-markdown";
6
6
  import { useNetworkState, useMount } from "react-use";
7
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, autoResize, sendButtonStyle, windowStyle, windowOpenStyle } from "./ChatWindow.css.js";
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
9
  import EllipsisLoader from "./EllipsisAnimation.js";
10
10
  import { EllipsisIcon } from "./EllipsisIcon.js";
11
11
  import { useOpenChat } from "./store/chat.js";
@@ -28,16 +28,14 @@ const ChatWindow = ({
28
28
  const state = useNetworkState();
29
29
  const [input, setInput] = React.useState("");
30
30
  const messagesEndRef = useRef(null);
31
- const inputRef = useRef(null);
32
31
  const isOpen = useOpenChat((state2) => state2.isOpen);
33
32
  useEffect(() => {
34
33
  messagesEndRef.current?.scrollIntoView({ behavior: "smooth" });
35
34
  }, [messages]);
36
35
  const handleSend = (e) => {
37
36
  e.preventDefault();
38
- const cleaned = cleanInput(input);
39
- if (cleaned) {
40
- onSend(cleaned);
37
+ if (input.trim()) {
38
+ onSend(input);
41
39
  setInput("");
42
40
  }
43
41
  };
@@ -51,18 +49,6 @@ const ChatWindow = ({
51
49
  const escalationDeflected = messages?.filter(
52
50
  (item) => item.type == "noti" && item.event == "escalationDeflected"
53
51
  ).length > 0;
54
- const cleanInput = (text) => text.replace(/[\r\n]+/g, " ").trim();
55
- const autoResizeTextarea = () => {
56
- if (inputRef.current) {
57
- inputRef.current.style.height = "auto";
58
- inputRef.current.style.maxHeight = "80px";
59
- inputRef.current.style.height = inputRef.current.scrollHeight + "px";
60
- inputRef.current.style.overflowY = inputRef.current.scrollHeight > 80 ? "auto" : "hidden";
61
- }
62
- };
63
- useEffect(() => {
64
- autoResizeTextarea();
65
- }, [input]);
66
52
  return /* @__PURE__ */ jsxs("div", { className: clsx(windowStyle, isOpen && windowOpenStyle), children: [
67
53
  /* @__PURE__ */ jsxs("div", { className: windowBarStyle, children: [
68
54
  /* @__PURE__ */ jsxs("div", { className: "flex middle", style: { paddingBlock: "6px" }, children: [
@@ -283,7 +269,7 @@ const ChatWindow = ({
283
269
  ),
284
270
  /* @__PURE__ */ jsx("div", { style: { textAlign: "center", marginBottom: 12 }, children: /* @__PURE__ */ jsx("button", { className: endChatButtonStyle, onClick: endChat, children: "End Chat" }) })
285
271
  ] }),
286
- ["text", "markdown_template", "markdown"].includes(msg.type) && /* @__PURE__ */ jsx(
272
+ ["text", "markdown_template", "markdown"].includes(msg.type) && /* @__PURE__ */ jsxs(
287
273
  "div",
288
274
  {
289
275
  className: messageStyle,
@@ -294,58 +280,62 @@ const ChatWindow = ({
294
280
  color: msg.$userType == "end_user" ? "#fff" : "#1F1F1F",
295
281
  boxShadow: msg.$userType == "end_user" ? "0 1px 4px #b3e0ff55" : void 0
296
282
  },
297
- children: /* @__PURE__ */ jsxs(
298
- "div",
299
- {
300
- style: {
301
- fontSize: 13,
302
- display: "flex",
303
- flexDirection: "column",
304
- gap: 4
305
- },
306
- children: [
307
- msg.$userType == "virtual_agent" && /* @__PURE__ */ jsxs(
308
- "div",
309
- {
310
- style: {
311
- display: "flex",
312
- alignItems: "center",
313
- gap: "8px"
314
- },
315
- children: [
316
- showAvatar && /* @__PURE__ */ jsx(
317
- "img",
318
- {
319
- width: 24,
320
- height: 24,
321
- src: virtualAgent?.avatar_url,
322
- alt: "agent avatar"
323
- }
324
- ),
325
- /* @__PURE__ */ jsx("strong", { children: virtualAgent?.name })
326
- ]
327
- }
328
- ),
329
- msg.$userType != "end_user" ? /* @__PURE__ */ jsx(
330
- ReactMarkdown,
331
- {
332
- remarkPlugins: [[remarkGfm, { singleTilde: false }]],
333
- components: {
334
- p: ({ ...props }) => /* @__PURE__ */ jsx(
335
- "p",
336
- {
337
- style: { margin: 0, fontSize: "inherit" },
338
- title: new Date(msg.$timestamp).toLocaleString(),
339
- ...props
340
- }
341
- )
342
- },
343
- children: msg.content
344
- }
345
- ) : /* @__PURE__ */ jsx("div", { title: new Date(msg.$timestamp).toLocaleString(), children: msg.content })
346
- ]
347
- }
348
- )
283
+ children: [
284
+ /* @__PURE__ */ jsxs(
285
+ "div",
286
+ {
287
+ style: {
288
+ fontSize: 13,
289
+ display: "flex",
290
+ flexDirection: "column",
291
+ gap: 4
292
+ },
293
+ children: [
294
+ msg.$userType == "virtual_agent" && /* @__PURE__ */ jsxs(
295
+ "div",
296
+ {
297
+ style: {
298
+ display: "flex",
299
+ // justifyContent: "center",
300
+ alignItems: "center",
301
+ gap: "8px"
302
+ },
303
+ children: [
304
+ showAvatar && /* @__PURE__ */ jsx(
305
+ "img",
306
+ {
307
+ width: 24,
308
+ height: 24,
309
+ src: virtualAgent?.avatar_url,
310
+ alt: "agent avatar"
311
+ }
312
+ ),
313
+ /* @__PURE__ */ jsx("strong", { children: virtualAgent?.name })
314
+ ]
315
+ }
316
+ ),
317
+ /* @__PURE__ */ jsx(
318
+ ReactMarkdown,
319
+ {
320
+ remarkPlugins: [[remarkGfm, { singleTilde: false }]],
321
+ components: {
322
+ p: ({ ...props }) => /* @__PURE__ */ jsx(
323
+ "p",
324
+ {
325
+ style: { margin: 0, fontSize: "inherit" },
326
+ title: new Date(msg.$timestamp).toLocaleString(),
327
+ ...props
328
+ }
329
+ )
330
+ },
331
+ children: msg.content
332
+ }
333
+ )
334
+ ]
335
+ }
336
+ ),
337
+ /* @__PURE__ */ jsx("div", { style: { fontSize: 10, color: "#888", marginTop: 2 } })
338
+ ]
349
339
  },
350
340
  msg.$index
351
341
  ),
@@ -408,31 +398,20 @@ const ChatWindow = ({
408
398
  onSubmit: handleSend,
409
399
  style: {
410
400
  borderTop: "1px solid #eee",
411
- display: "flex"
412
- // gap: 8,
401
+ display: "flex",
402
+ gap: 8
413
403
  },
414
404
  children: [
415
405
  /* @__PURE__ */ jsx(
416
- "textarea",
406
+ "input",
417
407
  {
418
- ref: inputRef,
408
+ type: "text",
419
409
  value: input,
420
410
  onChange: (e) => setInput(e.target.value),
421
- onKeyDown: (e) => {
422
- if (e.key === "Enter" && !e.shiftKey) {
423
- e.preventDefault();
424
- const cleaned = cleanInput(input);
425
- if (cleaned) {
426
- onSend(cleaned);
427
- setInput("");
428
- }
429
- }
430
- },
431
411
  placeholder: "Ask something...",
432
- className: clsx(inputStyle, autoResize),
412
+ className: inputStyle,
433
413
  autoFocus: true,
434
- disabled: inputDisabled || status !== "connected" || messages.length == 0 || escalationDeflected,
435
- rows: 1
414
+ disabled: inputDisabled || status !== "connected" || messages.length == 0 || escalationDeflected
436
415
  }
437
416
  ),
438
417
  /* @__PURE__ */ jsx(
@@ -1,4 +1,3 @@
1
- import "./Chatbot.css.ts.vanilla.css.js";
2
1
  var chatbotAXB = "_1hpv6vm0";
3
2
  var chatbotUFB = "_1hpv6vm1";
4
3
  export {
@@ -2,7 +2,7 @@ export type ChatbotProps = {
2
2
  project?: "axos" | "ufb";
3
3
  debug?: boolean;
4
4
  };
5
- export declare const Chatbot: ({ project, projectEnv, menuOption, debug, }: {
5
+ export declare const Chatbot: ({ project, projectEnv, menuOption, }: {
6
6
  project?: "axos" | "ufb";
7
7
  projectEnv?: "dev" | "qa" | "uat" | "stg" | "prod";
8
8
  menuOption?: "Support Virtual Agent" | string;
@@ -6,13 +6,13 @@ import { chatbotUFB, chatbotAXB } from "./Chatbot.css.js";
6
6
  import { ChatWindow } from "./ChatWindow.js";
7
7
  import { useOpenChat } from "./store/chat.js";
8
8
  import { useMessages } from "./store/messages.js";
9
- import { useRef, useState, useEffect } from "react";
9
+ import { Logger, consoleLoggerHandler, Client } from "@ujet/websdk-headless";
10
+ import { useRef, useState } from "react";
10
11
  import { useMount, useUnmount } from "react-use";
11
12
  const Chatbot = ({
12
13
  project = "axos",
13
14
  projectEnv = "dev",
14
- menuOption = "Support Virtual Agent",
15
- debug = false
15
+ menuOption = "Support Virtual Agent"
16
16
  }) => {
17
17
  const { hasOpenedOnce, toggle, reset } = useOpenChat();
18
18
  const { addMessage, addMessages, clearMessages, messages } = useMessages();
@@ -24,8 +24,6 @@ const Chatbot = ({
24
24
  const agent_virtual = useRef(null);
25
25
  const [status, setStatus] = useState("idle");
26
26
  const [hasStarted, setHasStarted] = useState(false);
27
- const [menusLoaded, setMenusLoaded] = useState(false);
28
- const [pendingStart, setPendingStart] = useState(false);
29
27
  const brandMap = /* @__PURE__ */ new Map([
30
28
  ["axos", 1],
31
29
  ["ufb", 3]
@@ -50,13 +48,11 @@ const Chatbot = ({
50
48
  }
51
49
  }
52
50
  };
51
+ if (projectEnv !== "prod") {
52
+ Logger.addHandler(consoleLoggerHandler);
53
+ }
53
54
  const onReadyHandler = async () => {
54
55
  console.log("Chat client is ready");
55
- if (clientRef.current) {
56
- menuRef.current = await clientRef.current.getMenus();
57
- setMenusLoaded(true);
58
- console.log("menus:", menuRef.current);
59
- }
60
56
  };
61
57
  const onAuthenticatedHandler = async () => {
62
58
  console.log("Chat client is authenticated");
@@ -100,6 +96,8 @@ const Chatbot = ({
100
96
  }
101
97
  };
102
98
  const registerEventHandlers = () => {
99
+ clientRef.current?.on("ready", onReadyHandler);
100
+ clientRef.current?.on("authenticated", onAuthenticatedHandler);
103
101
  clientRef.current?.on("chat.ongoing", onChatOngoingHandler);
104
102
  clientRef.current?.on("chat.message", onChatMessageHandler);
105
103
  clientRef.current?.on("chat.typingStarted", onChatTypingStartedHandler);
@@ -126,10 +124,6 @@ const Chatbot = ({
126
124
  clientRef.current?.off("chat.connected", onChatConnectedHandler);
127
125
  };
128
126
  const createClient = async () => {
129
- const { Client, Logger, consoleLoggerHandler } = await import("@ujet/websdk-headless");
130
- if (projectEnv !== "prod" || debug) {
131
- Logger.addHandler(consoleLoggerHandler);
132
- }
133
127
  if (clientRef.current) return;
134
128
  const client = new Client({
135
129
  companyId: process.env.CCAI_COMPANY_ID || "",
@@ -138,10 +132,10 @@ const Chatbot = ({
138
132
  // or your region
139
133
  authenticate
140
134
  });
141
- client?.on("ready", onReadyHandler);
142
- client?.on("authenticated", onAuthenticatedHandler);
143
135
  isMountedRef.current = true;
144
136
  clientRef.current = client;
137
+ menuRef.current = await client.getMenus();
138
+ console.log("menus:", menuRef.current);
145
139
  registerEventHandlers();
146
140
  return;
147
141
  };
@@ -149,17 +143,6 @@ const Chatbot = ({
149
143
  console.log("Starting chat");
150
144
  const client = clientRef.current;
151
145
  if (!client) return;
152
- if (!menuRef.current || !menuRef.current.menus) {
153
- let waited = 0;
154
- while ((!menuRef.current || !menuRef.current.menus) && waited < 5e3) {
155
- await new Promise((res) => setTimeout(res, 100));
156
- waited += 100;
157
- }
158
- if (!menuRef.current || !menuRef.current.menus) {
159
- console.error("Menu not loaded, cannot start chat");
160
- return;
161
- }
162
- }
163
146
  try {
164
147
  const ongoingChat = await client.loadOngoingChat();
165
148
  if (ongoingChat) {
@@ -177,7 +160,6 @@ const Chatbot = ({
177
160
  const newChat = await client.createChat(menuId, { custom_data });
178
161
  if (newChat !== null) {
179
162
  chatRef.current = newChat;
180
- agent_virtual.current = newChat.agent;
181
163
  console.log("Chat created id:", newChat.id);
182
164
  }
183
165
  } catch (err) {
@@ -187,10 +169,6 @@ const Chatbot = ({
187
169
  const handleClick = async () => {
188
170
  toggle();
189
171
  if (hasStarted) return;
190
- if (!menusLoaded) {
191
- setPendingStart(true);
192
- return;
193
- }
194
172
  if (!hasOpenedOnce) {
195
173
  await startChat();
196
174
  setHasStarted(true);
@@ -218,25 +196,11 @@ const Chatbot = ({
218
196
  isMountedRef.current = true;
219
197
  await createClient();
220
198
  });
221
- useEffect(() => {
222
- if (menusLoaded && pendingStart && !hasStarted) {
223
- startChat();
224
- setHasStarted(true);
225
- setPendingStart(false);
226
- }
227
- }, [menusLoaded, pendingStart, hasStarted]);
228
199
  useUnmount(() => {
229
200
  console.log("Chatbot unmounted");
230
201
  deregisterEventHandlers();
231
202
  isMountedRef.current = false;
232
203
  hasLoadedBefore.current = true;
233
- reset();
234
- setHasStarted(false);
235
- setStatus("idle");
236
- clearMessages();
237
- clientRef.current?.destroy();
238
- clientRef.current?.destroyChat();
239
- clientRef.current = null;
240
204
  });
241
205
  return /* @__PURE__ */ jsxs("div", { className: project === "ufb" ? chatbotUFB : chatbotAXB, children: [
242
206
  /* @__PURE__ */ jsx(Bubble, { onClick: handleClick }),
@@ -4,7 +4,7 @@ import { bubbleWrapper, svgFill } from "./Bubble.css.js";
4
4
  import { Chatbot } from "./Chatbot.js";
5
5
  import { chatbotAXB, chatbotUFB } from "./Chatbot.css.js";
6
6
  import { ChatWindow } from "./ChatWindow.js";
7
- import { arrowFill, autoResize, button_reset, chatFinishDialog, chatNetworkStatus, chat_title, chatbotMenu, chatbotMenuItem, endChatButtonStyle, inline_button, inline_button_wrapper, inputStyle, messageStyle, messagesContainerStyle, notificationStyle, sendButtonStyle, windowBarStyle, windowOpenStyle, windowStyle } from "./ChatWindow.css.js";
7
+ import { arrowFill, button_reset, chatFinishDialog, chatNetworkStatus, chat_title, chatbotMenu, chatbotMenuItem, endChatButtonStyle, inline_button, inline_button_wrapper, inputStyle, messageStyle, messagesContainerStyle, notificationStyle, sendButtonStyle, windowBarStyle, windowOpenStyle, windowStyle } from "./ChatWindow.css.js";
8
8
  import { useOpenChat } from "./store/chat.js";
9
9
  import { useMessages } from "./store/messages.js";
10
10
  export {
@@ -12,7 +12,6 @@ export {
12
12
  ChatWindow,
13
13
  Chatbot,
14
14
  arrowFill,
15
- autoResize,
16
15
  bubbleWrapper,
17
16
  button_reset,
18
17
  chatFinishDialog,
@@ -72,12 +72,13 @@ import "../Auth/SignInPassword.js";
72
72
  /* empty css */
73
73
  /* empty css */
74
74
  import "../Carousel/index.js";
75
+ import "../Chatbot/Chatbot.css.ts.vanilla.css.js";
75
76
  /* empty css */
76
77
  import "../Chatbot/store/chat.js";
77
78
  import "../Chatbot/authenticate.js";
78
- import "../Chatbot/Chatbot.css.ts.vanilla.css.js";
79
79
  /* empty css */
80
80
  import "../Chatbot/store/messages.js";
81
+ import "@ujet/websdk-headless";
81
82
  /* empty css */
82
83
  import "../Comparison/Comparison.css.js";
83
84
  import "next/image.js";