@axos-web-dev/shared-components 1.0.100-dev.1 → 1.0.100-dev.10

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 (234) hide show
  1. package/dist/ATMLocator/ATMLocator.js +2 -2
  2. package/dist/Accordion/Accordion.css.js +1 -1
  3. package/dist/Accordion/Accordion.js +2 -2
  4. package/dist/AlertBanner/AlertBanner.css.js +1 -1
  5. package/dist/AlertBanner/index.js +1 -1
  6. package/dist/Article/Article.css.js +1 -1
  7. package/dist/ArticlesSet/ArticlesSet.css.js +1 -1
  8. package/dist/Auth/ErrorAlert.css.js +1 -1
  9. package/dist/Auth/ErrorAlert.js +3 -3
  10. package/dist/Auth/Logout.js +1 -1
  11. package/dist/Auth/SignIn.css.js +1 -1
  12. package/dist/Auth/SignInPassword.js +1 -1
  13. package/dist/Avatar/Avatar.module.js +1 -1
  14. package/dist/AwardsBanner/AwardsBanner.css.js +1 -1
  15. package/dist/AwardsItem/AwardsItem.css.js +1 -1
  16. package/dist/Blockquote/Blockquote.module.js +1 -1
  17. package/dist/BulletItem/BulletItem.css.js +1 -1
  18. package/dist/BulletItem/BulletItem.js +1 -1
  19. package/dist/Button/Button.css.js +1 -1
  20. package/dist/Button/Button.js +2 -2
  21. package/dist/Calculators/AnnualFeeCalculator/AnnualFeeCalculator.css.js +1 -1
  22. package/dist/Calculators/ApyCalculator/ApyCalculator.css.js +1 -1
  23. package/dist/Calculators/AxosOneCalculator/BalanceAPYCalculator.css.js +1 -1
  24. package/dist/Calculators/AxosOneCalculator/index.js +2 -2
  25. package/dist/Calculators/BalanceAPYCalculator/BalanceAPYCalculator.css.js +1 -1
  26. package/dist/Calculators/BalanceAPYCalculator/index.js +2 -2
  27. package/dist/Calculators/BuyDownCalculator/BuyDownCalculator.css.js +1 -1
  28. package/dist/Calculators/BuyDownCalculator/index.d.ts +1 -0
  29. package/dist/Calculators/BuyDownCalculator/index.js +164 -78
  30. package/dist/Calculators/Calculator.js +3 -3
  31. package/dist/Calculators/MarginTradingCalculator/MarginTradingCalculator.css.js +1 -1
  32. package/dist/Calculators/MarginTradingCalculator/index.js +2 -2
  33. package/dist/Calculators/MonthlyPaymentCalculator/MonthlyPaymentCalculator.css.js +1 -1
  34. package/dist/Calculators/MonthlyPaymentLVFCalculator/MonthlyPaymentCalculator.css.js +1 -1
  35. package/dist/Calculators/SummitApyCalculator/BalanceAPYCalculator.css.js +1 -1
  36. package/dist/Calculators/SummitApyCalculator/index.js +2 -2
  37. package/dist/Calculators/calculator.css.js +1 -1
  38. package/dist/CallToActionBar/CallToActionBar.css.js +1 -1
  39. package/dist/CallToActionBar/index.js +1 -1
  40. package/dist/Carousel/Carousel.css.js +1 -1
  41. package/dist/Carousel/index.js +3 -3
  42. package/dist/Chatbot/Bubble.css.d.ts +1 -2
  43. package/dist/Chatbot/Bubble.css.js +4 -5
  44. package/dist/Chatbot/Bubble.js +78 -12
  45. package/dist/Chatbot/ChatWindow.css.d.ts +11 -0
  46. package/dist/Chatbot/ChatWindow.css.js +27 -5
  47. package/dist/Chatbot/ChatWindow.d.ts +6 -0
  48. package/dist/Chatbot/ChatWindow.js +277 -142
  49. package/dist/Chatbot/Chatbot.css.d.ts +2 -1
  50. package/dist/Chatbot/Chatbot.css.js +4 -3
  51. package/dist/Chatbot/Chatbot.d.ts +5 -1
  52. package/dist/Chatbot/Chatbot.js +10 -7
  53. package/dist/Chatbot/EllipsisIcon.d.ts +4 -0
  54. package/dist/Chatbot/EllipsisIcon.js +19 -0
  55. package/dist/Chatbot/index.js +17 -6
  56. package/dist/Chatbot/store/messages.d.ts +1 -0
  57. package/dist/Chatbot/store/messages.js +2 -1
  58. package/dist/Chatbot/useHeadlessChat.d.ts +6 -1
  59. package/dist/Chatbot/useHeadlessChat.js +74 -20
  60. package/dist/Chevron/Chevron.css.js +1 -1
  61. package/dist/Chevron/index.js +3 -3
  62. package/dist/CollectInformationAlert/CollectInformationAlert.css.js +1 -1
  63. package/dist/CollectInformationAlert/index.js +1 -1
  64. package/dist/Comparison/Comparison.css.js +1 -1
  65. package/dist/Comparison/Comparison.js +3 -3
  66. package/dist/Comparison/ComparisonSet.js +34 -25
  67. package/dist/ContentBanner/ContentBanner.css.js +1 -1
  68. package/dist/DownloadTile/DownloadTile.css.js +1 -1
  69. package/dist/ExecutiveBio/ExecutiveBio.css.js +1 -1
  70. package/dist/ExecutiveBio/ExecutiveBio.js +2 -2
  71. package/dist/FaqAccordion/FaqAccordion.css.js +1 -1
  72. package/dist/FaqAccordion/index.js +3 -3
  73. package/dist/FdicCallout/FdicCallout.module.js +1 -1
  74. package/dist/FooterDisclosure/FooterDisclosure.css.js +1 -1
  75. package/dist/FooterDisclosure/LVF/LaVictorieFooter.css.js +1 -1
  76. package/dist/FooterDisclosure/LVF/LaVictorieFooter.js +2 -2
  77. package/dist/FooterSiteMap/AxosBank/FooterSiteMap.css.js +1 -1
  78. package/dist/FooterSiteMap/AxosBank/FooterSiteMap.js +2 -2
  79. package/dist/Forms/ApplicationStart.js +2 -2
  80. package/dist/Forms/ApplyNow.js +3 -3
  81. package/dist/Forms/ClearingForm.js +2 -2
  82. package/dist/Forms/CommercialDeposits.js +2 -2
  83. package/dist/Forms/CommercialDepositsNoLendingOption.d.ts +16 -0
  84. package/dist/Forms/CommercialDepositsNoLendingOption.js +330 -0
  85. package/dist/Forms/CommercialLending.js +2 -2
  86. package/dist/Forms/CommercialPremiumFinance.js +2 -2
  87. package/dist/Forms/ContactCompany.js +2 -2
  88. package/dist/Forms/ContactCompanyTitle.js +2 -2
  89. package/dist/Forms/ContactUs.js +2 -2
  90. package/dist/Forms/ContactUsAAS.js +2 -2
  91. package/dist/Forms/ContactUsBusiness.js +3 -3
  92. package/dist/Forms/ContactUsBusinessNameEmail.js +3 -3
  93. package/dist/Forms/ContactUsLVF.d.ts +5 -1
  94. package/dist/Forms/ContactUsLVF.js +10 -8
  95. package/dist/Forms/ContactUsNMLSId.js +3 -3
  96. package/dist/Forms/CpraRequest.js +2 -2
  97. package/dist/Forms/CraPublicFile.js +3 -3
  98. package/dist/Forms/DealerServices.js +2 -2
  99. package/dist/Forms/EmailOnly.js +3 -3
  100. package/dist/Forms/EmailUs.js +2 -2
  101. package/dist/Forms/FormEnums.js +6 -15
  102. package/dist/Forms/Forms.css.js +1 -1
  103. package/dist/Forms/HoneyPot/HoneyPot.css.js +1 -1
  104. package/dist/Forms/MortgageRate/MortgageRateForm.js +3 -3
  105. package/dist/Forms/MortgageRate/MortgageRateQuoteFilters.js +1 -1
  106. package/dist/Forms/MortgageRate/MortgageRateWatch.js +2 -2
  107. package/dist/Forms/MortgageWarehouseLending.js +3 -3
  108. package/dist/Forms/QuickPricer/QuickPricerForm.js +4 -4
  109. package/dist/Forms/QuickPricer/QuickPricerResults.css.js +1 -1
  110. package/dist/Forms/QuickPricer/UserInformation.css.js +1 -1
  111. package/dist/Forms/SalesforceFieldsForm.d.ts +5 -0
  112. package/dist/Forms/SalesforceFieldsForm.js +11 -1
  113. package/dist/Forms/ScheduleCall.js +2 -2
  114. package/dist/Forms/ScheduleCallPremier.js +2 -2
  115. package/dist/Forms/SuccesForm.js +4 -4
  116. package/dist/Forms/VendorQuestionnaire.js +1 -1
  117. package/dist/Forms/WcplSurvey.js +2 -2
  118. package/dist/Forms/index.d.ts +1 -0
  119. package/dist/Forms/index.js +2 -0
  120. package/dist/HelpArticle/HelpArticle.css.js +1 -1
  121. package/dist/HeroBanner/HeroBanner.css.js +1 -1
  122. package/dist/HeroBanner/HeroBanner.js +2 -2
  123. package/dist/HeroBanner/LargeBanner.css.js +1 -1
  124. package/dist/HeroBanner/SelectionBanner.css.js +1 -1
  125. package/dist/Hyperlink/Hyperlink.css.js +1 -1
  126. package/dist/Hyperlink/index.js +2 -2
  127. package/dist/IconBillboard/IconBillboard.css.js +1 -1
  128. package/dist/IconBillboard/IconBillboard.js +1 -1
  129. package/dist/ImageBillboard/ImageBillboard.css.js +1 -1
  130. package/dist/ImageBillboard/ImageBillboard.js +1 -1
  131. package/dist/ImageBillboard/ImageBillboardSet.js +2 -2
  132. package/dist/ImageLink/ImageLink.css.js +1 -1
  133. package/dist/ImageLink/ImageLink.js +2 -2
  134. package/dist/ImageLink/ImageLinkSet.js +2 -2
  135. package/dist/ImageLink/index.js +2 -2
  136. package/dist/Input/Checkbox.css.js +1 -1
  137. package/dist/Input/Dropdown.css.js +1 -1
  138. package/dist/Input/Dropdown.js +1 -0
  139. package/dist/Input/Input.css.js +1 -1
  140. package/dist/Input/RadioButton.css.js +1 -1
  141. package/dist/Inputs/Input.css.js +1 -1
  142. package/dist/Insight/Featured/CategorySelector.css.js +1 -1
  143. package/dist/Insight/Featured/CategorySelector.js +4 -4
  144. package/dist/Insight/Featured/Featured.css.js +1 -1
  145. package/dist/Insight/Featured/Featured.js +3 -3
  146. package/dist/Insight/Featured/Header.css.js +1 -1
  147. package/dist/Insight/Featured/Header.js +3 -3
  148. package/dist/Insight/Insight.css.js +1 -1
  149. package/dist/Interstitial/Interstitial-variants.css.js +1 -1
  150. package/dist/Interstitial/Interstitial.module.js +1 -1
  151. package/dist/LandingPageHeader/LandingPageHeader.css.js +1 -1
  152. package/dist/LandingPageHeader/LandingPageHeader.js +1 -1
  153. package/dist/LoadingIndicator/LoadingIndicator.css.js +1 -1
  154. package/dist/Modal/Modal.css.js +1 -1
  155. package/dist/Modal/Modal.js +2 -2
  156. package/dist/Modal/contextApi/store.js +1 -1
  157. package/dist/NavigationMenu/AxosALTS/NavBar.css.js +1 -1
  158. package/dist/NavigationMenu/AxosALTS/NavBar.module.js +1 -1
  159. package/dist/NavigationMenu/AxosALTS/NavData.js +2 -2
  160. package/dist/NavigationMenu/AxosALTS/index.js +2 -2
  161. package/dist/NavigationMenu/AxosAdvisor/NavBar.css.js +1 -1
  162. package/dist/NavigationMenu/AxosAdvisor/NavBar.module.js +1 -1
  163. package/dist/NavigationMenu/AxosAdvisor/SubNavbar.css.js +1 -1
  164. package/dist/NavigationMenu/AxosAdvisorServices/NavBar.css.js +1 -1
  165. package/dist/NavigationMenu/AxosAdvisorServices/NavBar.module.js +1 -1
  166. package/dist/NavigationMenu/AxosAdvisorServices/SubNavbar.css.js +1 -1
  167. package/dist/NavigationMenu/AxosBank/MobileMenu/MobileMenu.module.js +1 -1
  168. package/dist/NavigationMenu/AxosBank/MobileMenu/MobileNavData.d.ts +1 -0
  169. package/dist/NavigationMenu/AxosBank/MobileMenu/MobileNavData.js +5 -2
  170. package/dist/NavigationMenu/AxosBank/NavBar.css.js +1 -1
  171. package/dist/NavigationMenu/AxosBank/NavBar.module.js +1 -1
  172. package/dist/NavigationMenu/AxosBank/NavData.js +2 -2
  173. package/dist/NavigationMenu/AxosBank/SubNavBar.js +23 -2
  174. package/dist/NavigationMenu/AxosBank/SubNavbar.css.js +1 -1
  175. package/dist/NavigationMenu/AxosBank/index.js +2 -2
  176. package/dist/NavigationMenu/AxosClearing/NavBar.css.js +1 -1
  177. package/dist/NavigationMenu/AxosClearing/NavBar.module.js +1 -1
  178. package/dist/NavigationMenu/AxosFiduciary/NavBar.module.js +1 -1
  179. package/dist/NavigationMenu/LaVictoire/NavBar.css.js +1 -1
  180. package/dist/NavigationMenu/LaVictoire/NavBar.module.js +1 -1
  181. package/dist/NavigationMenu/LaVictoire/NavData.js +2 -2
  182. package/dist/NavigationMenu/LaVictoire/index.js +2 -2
  183. package/dist/NavigationMenu/NavDataJson.js +2 -2
  184. package/dist/NavigationMenu/Navbar.js +2 -2
  185. package/dist/NavigationMenu/SignInNavButton.js +2 -2
  186. package/dist/PageNavItem/PageNavItem.css.js +1 -1
  187. package/dist/PageNavSet/PageNavSet.js +1 -1
  188. package/dist/PageNavSet/PageNavigationSet.css.js +1 -1
  189. package/dist/Pagination/Pagination.css.js +1 -1
  190. package/dist/Pagination/Pagination.js +2 -2
  191. package/dist/SecondaryFooter/SecondaryFooter.css.js +1 -1
  192. package/dist/SecondaryFooter/index.js +1 -1
  193. package/dist/SetContainer/SetContainer.css.js +1 -1
  194. package/dist/SetContainer/SetContainer.js +3 -3
  195. package/dist/SocialMediaBar/SocialMediaBar.css.js +1 -1
  196. package/dist/SocialMediaBar/iconsRepository.js +2 -2
  197. package/dist/StepItem/StepItem.css.js +1 -1
  198. package/dist/StepItemSet/StepItemSet.css.d.ts +1 -0
  199. package/dist/StepItemSet/StepItemSet.css.js +9 -5
  200. package/dist/StepItemSet/StepItemSet.d.ts +6 -0
  201. package/dist/StepItemSet/StepItemSet.js +22 -3
  202. package/dist/StepItemSet/index.js +2 -1
  203. package/dist/Tab/Tab.css.js +1 -1
  204. package/dist/Table/Table.css.js +1 -1
  205. package/dist/Table/Table.d.ts +1 -1
  206. package/dist/Table/Table.js +2 -2
  207. package/dist/TextBlock/TextBlock.css.js +1 -1
  208. package/dist/TextBlock/TextBlock.js +1 -1
  209. package/dist/Topic/Topic.css.js +1 -1
  210. package/dist/TopicalNavItem/TopicalNavItem.css.js +1 -1
  211. package/dist/TopicalNavSet/TopicalNavSet.css.js +1 -1
  212. package/dist/Typography/Typography.css.js +1 -1
  213. package/dist/VideoTile/VideoTile.css.js +1 -1
  214. package/dist/VideoTile/VideoTile.js +2 -2
  215. package/dist/VideoWrapper/VideoWrapper.css.js +1 -1
  216. package/dist/VideoWrapper/index.js +2 -2
  217. package/dist/WalnutIframe/wrapper.module.js +1 -1
  218. package/dist/assets/Chatbot/Bubble.css +43 -43
  219. package/dist/assets/Chatbot/ChatWindow.css +180 -35
  220. package/dist/assets/Comparison/Comparison.css +3 -1
  221. package/dist/assets/StepItemSet/StepItemSet.css +27 -10
  222. package/dist/globals.css.js +1 -1
  223. package/dist/icons/ArrowIcon/ArrowIcon.css.js +1 -1
  224. package/dist/icons/CheckIcon/CheckIcon.css.js +1 -1
  225. package/dist/icons/DownloadIcon/DownloadIcon.css.js +1 -1
  226. package/dist/icons/FollowIcon/FollowIcon.css.js +1 -1
  227. package/dist/icons/Star/Star.css.js +1 -1
  228. package/dist/index.css.js +1 -1
  229. package/dist/main.js +21 -7
  230. package/dist/themes/axos.css.js +1 -1
  231. package/dist/themes/premier.css.js +1 -1
  232. package/dist/themes/victorie.css.js +1 -1
  233. package/dist/utils/optimizeImage/optimizeImage.module.js +1 -1
  234. package/package.json +1 -1
@@ -1,10 +1,12 @@
1
1
  "use client";
2
- import { jsxs, jsx } from "react/jsx-runtime";
2
+ import { jsxs, jsx, Fragment } from "react/jsx-runtime";
3
3
  import clsx from "clsx";
4
- import React, { useRef, useEffect, Fragment } from "react";
4
+ import React, { useRef, useEffect, Fragment as Fragment$1 } from "react";
5
5
  import ReactMarkdown from "react-markdown";
6
+ import { useNetworkState, useMount } from "react-use";
6
7
  import remarkGfm from "remark-gfm";
7
- import { windowStyle, windowOpenStyle, windowBarStyle, messagesContainerStyle, inputStyle, sendButtonStyle } 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
+ import { EllipsisIcon } from "./EllipsisIcon.js";
8
10
  import { useOpenChat } from "./store/chat.js";
9
11
  const ChatWindow = ({
10
12
  messages,
@@ -14,11 +16,17 @@ const ChatWindow = ({
14
16
  onClose,
15
17
  endChat = () => {
16
18
  console.log("End chat");
17
- }
19
+ },
20
+ showReconnect = false,
21
+ virtualAgent
18
22
  }) => {
23
+ const [mounted, setMounted] = React.useState(false);
24
+ const [menuOpen, setMenuOpen] = React.useState(false);
25
+ const [showEndChatDialog, setShowEndChatDialog] = React.useState(false);
26
+ const state = useNetworkState();
19
27
  const [input, setInput] = React.useState("");
20
28
  const messagesEndRef = useRef(null);
21
- const isOpen = useOpenChat((state) => state.isOpen);
29
+ const isOpen = useOpenChat((state2) => state2.isOpen);
22
30
  useEffect(() => {
23
31
  messagesEndRef.current?.scrollIntoView({ behavior: "smooth" });
24
32
  }, [messages]);
@@ -29,104 +37,202 @@ const ChatWindow = ({
29
37
  setInput("");
30
38
  }
31
39
  };
40
+ useMount(() => {
41
+ setMounted(true);
42
+ });
43
+ const project = process.env.CCAI_PROJECT_ID;
44
+ const isAxos = project === "axos";
45
+ const endUserBg = isAxos ? "#14263d" : "#323339";
46
+ const chatbotBg = isAxos ? "#E9F8FF" : "#EAE8E8";
32
47
  return /* @__PURE__ */ jsxs("div", { className: clsx(windowStyle, isOpen && windowOpenStyle), children: [
33
- /* @__PURE__ */ jsxs("div", { className: clsx(windowBarStyle), children: [
34
- /* @__PURE__ */ jsx("b", { children: "Chat" }),
35
- onClose && /* @__PURE__ */ jsx(
48
+ /* @__PURE__ */ jsxs("div", { className: windowBarStyle, children: [
49
+ /* @__PURE__ */ jsxs("div", { className: "flex middle", style: { paddingBlock: "6px" }, children: [
50
+ /* @__PURE__ */ jsx(
51
+ "img",
52
+ {
53
+ src: "https://www.axos.com/images/2xmVfQm5l0HWOKjgxQO1Iw/axb-assistant.svg",
54
+ style: { marginRight: 12 },
55
+ height: 18,
56
+ width: 18
57
+ }
58
+ ),
59
+ /* @__PURE__ */ jsx("h2", { className: chat_title, children: "Evo Virtual Assistant" })
60
+ ] }),
61
+ /* @__PURE__ */ jsx(
36
62
  "button",
37
63
  {
38
- onClick: onClose,
64
+ onClick: () => {
65
+ setMenuOpen(!menuOpen);
66
+ },
39
67
  style: {
40
- marginLeft: 8,
41
- background: "transparent",
42
68
  border: "none",
43
- fontSize: 18,
69
+ background: "transparent",
70
+ marginLeft: "auto",
44
71
  cursor: "pointer",
45
- color: "#fff",
46
72
  padding: 0,
47
- lineHeight: 1
73
+ display: "flex",
74
+ alignContent: "center"
75
+ },
76
+ children: /* @__PURE__ */ jsx(EllipsisIcon, { color: "#fff" })
77
+ }
78
+ ),
79
+ menuOpen && /* @__PURE__ */ jsx("ul", { className: clsx(chatbotMenu), children: /* @__PURE__ */ jsx("li", { className: chatbotMenuItem, children: /* @__PURE__ */ jsx(
80
+ "button",
81
+ {
82
+ type: "button",
83
+ onClick: () => {
84
+ setShowEndChatDialog(true);
85
+ setMenuOpen(false);
48
86
  },
87
+ style: { width: "100%" },
88
+ children: "Finish chat"
89
+ }
90
+ ) }) }),
91
+ showEndChatDialog && /* @__PURE__ */ jsxs(Fragment, { children: [
92
+ /* @__PURE__ */ jsx(
93
+ "div",
94
+ {
95
+ style: {
96
+ background: "#00000080",
97
+ position: "fixed",
98
+ top: 0,
99
+ left: 0,
100
+ right: 0,
101
+ bottom: 0,
102
+ zIndex: 999,
103
+ opacity: 0.75
104
+ }
105
+ }
106
+ ),
107
+ /* @__PURE__ */ jsx(
108
+ "dialog",
109
+ {
110
+ open: showEndChatDialog,
111
+ style: {
112
+ padding: "1rem",
113
+ borderRadius: 8,
114
+ background: "#fff",
115
+ color: "#000",
116
+ border: `1px solid ${endUserBg}`,
117
+ outline: "none",
118
+ maxWidth: "90%",
119
+ top: "25%",
120
+ marginInline: "auto",
121
+ zIndex: 1e3
122
+ },
123
+ children: /* @__PURE__ */ jsxs("form", { method: "dialog", className: chatFinishDialog, children: [
124
+ /* @__PURE__ */ jsx("p", { children: "Are you sure you want to end this chat?" }),
125
+ /* @__PURE__ */ jsxs(
126
+ "div",
127
+ {
128
+ style: { display: "flex", gap: "1rem", marginTop: "1rem" },
129
+ children: [
130
+ /* @__PURE__ */ jsx(
131
+ "button",
132
+ {
133
+ className: endChatButtonStyle,
134
+ type: "submit",
135
+ onClick: () => {
136
+ endChat();
137
+ setShowEndChatDialog(false);
138
+ },
139
+ children: "Yes"
140
+ }
141
+ ),
142
+ /* @__PURE__ */ jsx(
143
+ "button",
144
+ {
145
+ className: endChatButtonStyle,
146
+ type: "button",
147
+ onClick: () => {
148
+ setShowEndChatDialog(false);
149
+ },
150
+ children: "No"
151
+ }
152
+ )
153
+ ]
154
+ }
155
+ )
156
+ ] })
157
+ }
158
+ )
159
+ ] }),
160
+ onClose && /* @__PURE__ */ jsx(
161
+ "button",
162
+ {
163
+ onClick: onClose,
164
+ className: button_reset,
49
165
  "aria-label": "Close chat",
50
166
  title: "Close",
51
167
  children: /* @__PURE__ */ jsx(
52
168
  "svg",
53
169
  {
54
170
  xmlns: "http://www.w3.org/2000/svg",
55
- height: "24px",
56
- viewBox: "0 -960 960 960",
57
- width: "24px",
58
- fill: "#faa74a",
59
- children: /* @__PURE__ */ jsx("path", { d: "M360-200v-80h264L160-744l56-56 464 464v-264h80v400H360Z" })
171
+ width: "24",
172
+ height: "24",
173
+ viewBox: "0 0 24 24",
174
+ fill: "none",
175
+ children: /* @__PURE__ */ jsx(
176
+ "path",
177
+ {
178
+ className: arrowFill,
179
+ d: "M2.46875 7.76574L11.9991 17.2961L21.5294 7.76574L20.4687 6.70508L11.9991 15.1749L3.52941 6.70508L2.46875 7.76574Z",
180
+ fill: "#98DDFF"
181
+ }
182
+ )
60
183
  }
61
184
  )
62
185
  }
63
186
  )
64
187
  ] }),
188
+ mounted && !state.online ? /* @__PURE__ */ jsx("div", { className: clsx(chatNetworkStatus), children: /* @__PURE__ */ jsxs(
189
+ "div",
190
+ {
191
+ style: {
192
+ color: "#d32f2f",
193
+ textAlign: "center",
194
+ padding: "8px 0",
195
+ fontWeight: 500
196
+ },
197
+ children: [
198
+ /* @__PURE__ */ jsx(
199
+ "span",
200
+ {
201
+ role: "img",
202
+ "aria-label": "disconnected",
203
+ style: { marginRight: 6 },
204
+ children: "⚠️"
205
+ }
206
+ ),
207
+ "You are currently disconnected. Please check your connection."
208
+ ]
209
+ }
210
+ ) }) : null,
65
211
  /* @__PURE__ */ jsxs("div", { className: clsx(messagesContainerStyle), children: [
66
- messages?.map((msg) => /* @__PURE__ */ jsxs(Fragment, { children: [
67
- msg.type == "noti" && msg.$userType == "system" && msg.event == "escalationStarted" && /* @__PURE__ */ jsx(
68
- "div",
69
- {
70
- style: {
71
- fontSize: 10,
72
- color: "#888",
73
- marginBottom: 4,
74
- textAlign: "center"
75
- },
76
- children: "We are connecting you with a human agent..."
77
- },
78
- msg.$index
79
- ),
80
- msg.type == "noti" && msg.$userType == "system" && msg.event == "memberLeft" && /* @__PURE__ */ jsxs(
81
- "div",
82
- {
83
- style: {
84
- fontSize: 10,
85
- color: "#888",
86
- marginBottom: 4,
87
- textAlign: "center"
88
- },
89
- children: [
90
- /* @__PURE__ */ jsx("strong", { children: "Virtual Agent" }),
91
- " just left the conversation."
92
- ]
93
- },
94
- msg.$index
95
- ),
96
- msg.type == "noti" && msg.$userType == "system" && msg.event == "escalationAccepted" && /* @__PURE__ */ jsxs(
97
- "div",
98
- {
99
- style: {
100
- fontSize: 10,
101
- color: "#888",
102
- marginBottom: 4,
103
- textAlign: "center"
104
- },
105
- children: [
106
- "You are now connected with a",
107
- " ",
108
- msg.to_agent ? /* @__PURE__ */ jsx("strong", { children: msg?.to_agent?.name }) : "an agent"
109
- ]
110
- },
111
- msg.$index
112
- ),
212
+ messages?.map((msg) => /* @__PURE__ */ jsxs(Fragment$1, { children: [
213
+ 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),
214
+ msg.type == "noti" && msg.$userType == "system" && msg.event == "memberLeft" && /* @__PURE__ */ jsxs("div", { className: notificationStyle, children: [
215
+ /* @__PURE__ */ jsx("strong", { children: "Virtual Agent" }),
216
+ " just left the conversation."
217
+ ] }, msg.$index),
218
+ msg.type == "noti" && msg.$userType == "system" && msg.event == "escalationAccepted" && /* @__PURE__ */ jsxs("div", { className: notificationStyle, children: [
219
+ "You are now connected with a",
220
+ " ",
221
+ msg.to_agent ? /* @__PURE__ */ jsx("strong", { children: msg?.to_agent?.name }) : "an agent"
222
+ ] }, msg.$index),
113
223
  ["text", "markdown_template", "markdown"].includes(msg.type) && /* @__PURE__ */ jsxs(
114
224
  "div",
115
225
  {
116
- className: clsx(),
226
+ className: messageStyle,
117
227
  style: {
118
228
  textAlign: msg.$userType == "end_user" ? "right" : "left",
119
229
  alignSelf: msg.$userType == "end_user" ? "flex-end" : "flex-start",
120
- background: msg.$userType == "end_user" ? "#1e3860" : "#eee",
121
- color: msg.$userType == "end_user" ? "#fff" : "#1e3860",
122
- borderRadius: 16,
123
- padding: "8px 8px",
124
- maxWidth: "80%",
125
- boxShadow: msg.$userType == "end_user" ? "0 1px 4px #b3e0ff55" : void 0,
126
- marginBottom: 2
230
+ background: msg.$userType == "end_user" ? endUserBg : chatbotBg,
231
+ color: msg.$userType == "end_user" ? "#fff" : "#1F1F1F",
232
+ boxShadow: msg.$userType == "end_user" ? "0 1px 4px #b3e0ff55" : void 0
127
233
  },
128
234
  children: [
129
- /* @__PURE__ */ jsx(
235
+ /* @__PURE__ */ jsxs(
130
236
  "div",
131
237
  {
132
238
  style: {
@@ -135,16 +241,48 @@ const ChatWindow = ({
135
241
  flexDirection: "column",
136
242
  gap: 4
137
243
  },
138
- children: /* @__PURE__ */ jsx(
139
- ReactMarkdown,
140
- {
141
- remarkPlugins: [[remarkGfm, { singleTilde: false }]],
142
- components: {
143
- p: ({ ...props }) => /* @__PURE__ */ jsx("p", { style: { margin: 0 }, ...props })
144
- },
145
- children: msg.content
146
- }
147
- )
244
+ children: [
245
+ msg.$userType == "virtual_agent" && /* @__PURE__ */ jsxs(
246
+ "div",
247
+ {
248
+ style: {
249
+ display: "flex",
250
+ // justifyContent: "center",
251
+ alignItems: "center",
252
+ gap: "8px"
253
+ },
254
+ children: [
255
+ /* @__PURE__ */ jsx(
256
+ "img",
257
+ {
258
+ width: 24,
259
+ height: 24,
260
+ src: virtualAgent?.avatar_url,
261
+ alt: "agent avatar"
262
+ }
263
+ ),
264
+ /* @__PURE__ */ jsx("strong", { children: virtualAgent?.name })
265
+ ]
266
+ }
267
+ ),
268
+ /* @__PURE__ */ jsx(
269
+ ReactMarkdown,
270
+ {
271
+ remarkPlugins: [[remarkGfm, { singleTilde: false }]],
272
+ components: {
273
+ p: ({ ...props }) => /* @__PURE__ */ jsx(
274
+ "p",
275
+ {
276
+ style: { margin: 0, fontSize: "inherit" },
277
+ title: new Date(msg.$timestamp).toLocaleString(),
278
+ ...props
279
+ }
280
+ )
281
+ },
282
+ children: msg.content
283
+ }
284
+ )
285
+ ]
148
286
  }
149
287
  ),
150
288
  /* @__PURE__ */ jsx("div", { style: { fontSize: 10, color: "#888", marginTop: 2 } })
@@ -152,57 +290,57 @@ const ChatWindow = ({
152
290
  },
153
291
  msg.$index
154
292
  ),
155
- msg.type == "inline_button" && Array.isArray(msg.buttons) && msg.buttons.length > 0 && /* @__PURE__ */ jsx(
156
- "div",
157
- {
158
- style: {
159
- display: "flex",
160
- flexDirection: "column",
161
- // gap: 4,
162
- marginTop: 4,
163
- marginBottom: 8,
164
- border: "1px solid #ddd",
165
- borderRadius: "12px",
166
- boxShadow: "0 1px 4px #b3e0ff55"
167
- },
168
- children: msg.buttons.length !== 0 && Array.isArray(msg.buttons) && msg.buttons.map((button, index) => {
169
- const lastItem = msg.buttons && msg.buttons?.length - 1;
170
- return /* @__PURE__ */ jsx(
171
- "button",
172
- {
173
- style: {
174
- fontSize: 12,
175
- textAlign: "left",
176
- background: "#fff",
177
- color: "#1e3860",
178
- borderRadius: "0px",
179
- borderTopLeftRadius: [0].includes(index) ? 8 : 0,
180
- borderTopRightRadius: [0].includes(index) ? 8 : 0,
181
- borderBottomLeftRadius: [lastItem].includes(index) ? 8 : 0,
182
- borderBottomRightRadius: [lastItem].includes(index) ? 8 : 0
183
- },
184
- onClick: () => {
185
- onSend(button?.title);
186
- },
187
- children: button.title
188
- },
189
- index
190
- );
191
- })
192
- }
193
- ),
194
- msg.event == "chatEnded" && /* @__PURE__ */ jsx("div", { children: /* @__PURE__ */ jsx(
195
- "button",
196
- {
197
- style: {
198
- fontSize: 12,
199
- textAlign: "center"
293
+ 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) => {
294
+ const lastItem = msg.buttons && msg.buttons?.length - 1;
295
+ return /* @__PURE__ */ jsx(
296
+ "button",
297
+ {
298
+ className: inline_button,
299
+ style: {
300
+ borderRadius: "0px",
301
+ borderTopLeftRadius: [0].includes(index) ? 8 : 0,
302
+ borderTopRightRadius: [0].includes(index) ? 8 : 0,
303
+ borderBottomLeftRadius: [lastItem].includes(index) ? 8 : 0,
304
+ borderBottomRightRadius: [lastItem].includes(index) ? 8 : 0
305
+ },
306
+ onClick: () => {
307
+ onSend(button?.title);
308
+ },
309
+ children: button.title
200
310
  },
201
- onClick: endChat,
202
- children: "End Chat"
203
- }
204
- ) })
311
+ index
312
+ );
313
+ }) }),
314
+ msg.event == "chatEnded" && /* @__PURE__ */ jsxs(Fragment, { children: [
315
+ /* @__PURE__ */ jsxs(
316
+ "div",
317
+ {
318
+ title: (/* @__PURE__ */ new Date()).toLocaleString(),
319
+ style: {
320
+ fontSize: 12,
321
+ color: "#888",
322
+ marginBottom: 4,
323
+ textAlign: "center"
324
+ },
325
+ children: [
326
+ "Thank you for chatting!",
327
+ /* @__PURE__ */ jsx("br", {}),
328
+ " This conversation has ended."
329
+ ]
330
+ }
331
+ ),
332
+ /* @__PURE__ */ jsx("div", { style: { textAlign: "center", marginBottom: 12 }, children: /* @__PURE__ */ jsx("button", { className: endChatButtonStyle, onClick: endChat, children: "End Chat" }) })
333
+ ] })
205
334
  ] }, msg.$index)),
335
+ showReconnect && /* @__PURE__ */ jsx(
336
+ "button",
337
+ {
338
+ style: { margin: "12px auto", display: "block" },
339
+ onClick: () => {
340
+ },
341
+ children: "Reconnect Chat"
342
+ }
343
+ ),
206
344
  /* @__PURE__ */ jsx("div", { ref: messagesEndRef })
207
345
  ] }),
208
346
  /* @__PURE__ */ jsxs(
@@ -210,13 +348,9 @@ const ChatWindow = ({
210
348
  {
211
349
  onSubmit: handleSend,
212
350
  style: {
213
- display: "flex",
214
- gap: 8,
215
- padding: "1rem",
216
351
  borderTop: "1px solid #eee",
217
- background: "#fafbfc",
218
- borderBottomLeftRadius: 16,
219
- borderBottomRightRadius: 16
352
+ display: "flex",
353
+ gap: 8
220
354
  },
221
355
  children: [
222
356
  /* @__PURE__ */ jsx(
@@ -225,8 +359,9 @@ const ChatWindow = ({
225
359
  type: "text",
226
360
  value: input,
227
361
  onChange: (e) => setInput(e.target.value),
228
- placeholder: "Ask something.. .",
229
- className: clsx(inputStyle),
362
+ placeholder: "Ask something...",
363
+ className: inputStyle,
364
+ autoFocus: true,
230
365
  disabled: inputDisabled || status !== "connected"
231
366
  }
232
367
  ),
@@ -1 +1,2 @@
1
- export declare const chatbotWrapper: string;
1
+ export declare const chatbotAXB: string;
2
+ export declare const chatbotUFB: string;
@@ -1,5 +1,6 @@
1
- import "./Chatbot.css.ts.vanilla.css.js";
2
- var chatbotWrapper = "_1hpv6vm0";
1
+ var chatbotAXB = "_1hpv6vm0";
2
+ var chatbotUFB = "_1hpv6vm1";
3
3
  export {
4
- chatbotWrapper
4
+ chatbotAXB,
5
+ chatbotUFB
5
6
  };
@@ -1 +1,5 @@
1
- export declare const Chatbot: () => import("react/jsx-runtime").JSX.Element;
1
+ export type ChatbotProps = {
2
+ project?: "axos" | "ufb";
3
+ debug?: boolean;
4
+ };
5
+ export declare const Chatbot: (props: ChatbotProps) => import("react/jsx-runtime").JSX.Element;
@@ -2,24 +2,24 @@
2
2
  import { jsxs, jsx } from "react/jsx-runtime";
3
3
  import { authenticate } from "./authenticate.js";
4
4
  import { Bubble } from "./Bubble.js";
5
+ import { chatbotUFB, chatbotAXB } from "./Chatbot.css.js";
5
6
  import { ChatWindow } from "./ChatWindow.js";
6
7
  import { useOpenChat } from "./store/chat.js";
7
8
  import { useMessages } from "./store/messages.js";
8
9
  import { useHeadlessChat } from "./useHeadlessChat.js";
9
- const Chatbot = () => {
10
+ const Chatbot = (props) => {
10
11
  const messages = useMessages((state) => state.messages);
11
12
  const close = useOpenChat((state) => state.close);
12
- const { status, sendMessage } = useHeadlessChat({
13
+ const { status, sendMessage, showReconnect, endChat, virtualAgent } = useHeadlessChat({
13
14
  companyId: process.env.CCAI_COMPANY_ID || "",
14
15
  tenant: process.env.CCAI_TENANT_NAME || "",
15
16
  host: process.env.CCAI_HOST || "",
16
17
  // or your region
17
- projectId: process.env.CCAI_PROJECT_ID || "axos",
18
- // replace with your project id
18
+ projectId: process.env.CCAI_PROJECT_ID || props.project || "axos",
19
19
  getToken: authenticate,
20
- debug: process.env.NODE_ENV === "development"
20
+ debug: props.debug || process.env.NODE_ENV === "development"
21
21
  });
22
- return /* @__PURE__ */ jsxs("div", { children: [
22
+ return /* @__PURE__ */ jsxs("div", { className: props.project === "ufb" ? chatbotUFB : chatbotAXB, children: [
23
23
  /* @__PURE__ */ jsx(Bubble, {}),
24
24
  /* @__PURE__ */ jsx(
25
25
  ChatWindow,
@@ -29,7 +29,10 @@ const Chatbot = () => {
29
29
  messages,
30
30
  onSend: function(msg) {
31
31
  sendMessage(msg);
32
- }
32
+ },
33
+ endChat,
34
+ virtualAgent,
35
+ showReconnect
33
36
  }
34
37
  )
35
38
  ] });
@@ -0,0 +1,4 @@
1
+ export declare const EllipsisIcon: ({ size, color }: {
2
+ size?: number | undefined;
3
+ color?: string | undefined;
4
+ }) => import("react/jsx-runtime").JSX.Element;
@@ -0,0 +1,19 @@
1
+ import { jsxs, jsx } from "react/jsx-runtime";
2
+ const EllipsisIcon = ({ size = 24, color = "currentColor" }) => /* @__PURE__ */ jsxs(
3
+ "svg",
4
+ {
5
+ width: size,
6
+ height: size,
7
+ viewBox: "0 0 24 24",
8
+ fill: "none",
9
+ "aria-hidden": "true",
10
+ children: [
11
+ /* @__PURE__ */ jsx("circle", { cx: "5", cy: "12", r: "2", fill: color }),
12
+ /* @__PURE__ */ jsx("circle", { cx: "12", cy: "12", r: "2", fill: color }),
13
+ /* @__PURE__ */ jsx("circle", { cx: "19", cy: "12", r: "2", fill: color })
14
+ ]
15
+ }
16
+ );
17
+ export {
18
+ EllipsisIcon
19
+ };
@@ -1,10 +1,10 @@
1
1
  "use client";
2
2
  import { Bubble } from "./Bubble.js";
3
- import { bubbleCircle, bubbleWrapper, closeIcon } from "./Bubble.css.js";
3
+ import { bubbleWrapper, svgFill } from "./Bubble.css.js";
4
4
  import { Chatbot } from "./Chatbot.js";
5
- import { chatbotWrapper } from "./Chatbot.css.js";
5
+ import { chatbotAXB, chatbotUFB } from "./Chatbot.css.js";
6
6
  import { ChatWindow } from "./ChatWindow.js";
7
- import { inputStyle, messageStyle, messagesContainerStyle, 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
  import { useHeadlessChat } from "./useHeadlessChat.js";
@@ -12,14 +12,25 @@ export {
12
12
  Bubble,
13
13
  ChatWindow,
14
14
  Chatbot,
15
- bubbleCircle,
15
+ arrowFill,
16
16
  bubbleWrapper,
17
- chatbotWrapper,
18
- closeIcon,
17
+ button_reset,
18
+ chatFinishDialog,
19
+ chatNetworkStatus,
20
+ chat_title,
21
+ chatbotAXB,
22
+ chatbotMenu,
23
+ chatbotMenuItem,
24
+ chatbotUFB,
25
+ endChatButtonStyle,
26
+ inline_button,
27
+ inline_button_wrapper,
19
28
  inputStyle,
20
29
  messageStyle,
21
30
  messagesContainerStyle,
31
+ notificationStyle,
22
32
  sendButtonStyle,
33
+ svgFill,
23
34
  useHeadlessChat,
24
35
  useMessages,
25
36
  useOpenChat,
@@ -5,6 +5,7 @@ interface MessageStore {
5
5
  addMessage: (message: MessageResponse) => void;
6
6
  removeMessage: (id: string) => void;
7
7
  addMessages: (newMessages: MessageResponse[]) => void;
8
+ clearMessages: () => void;
8
9
  }
9
10
  export interface Message {
10
11
  id: string;
@@ -5,7 +5,8 @@ const useMessages = create((set) => ({
5
5
  removeMessage: (id) => set((state) => ({
6
6
  messages: state.messages.filter((msg) => msg.id !== id)
7
7
  })),
8
- addMessages: (newMessages) => set((state) => ({ messages: [...state.messages, ...newMessages] }))
8
+ addMessages: (newMessages) => set((state) => ({ messages: [...state.messages, ...newMessages] })),
9
+ clearMessages: () => set({ messages: [] })
9
10
  }));
10
11
  export {
11
12
  useMessages