@axos-web-dev/shared-components 2.2.7-2 → 2.2.8

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 (200) hide show
  1. package/dist/ATMLocator/ATMLocator.d.ts +1 -1
  2. package/dist/ATMLocator/ATMLocator.js +2 -2
  3. package/dist/Accordion/Accordion.d.ts +3 -3
  4. package/dist/Article/Article.d.ts +1 -1
  5. package/dist/Auth/ErrorAlert.d.ts +1 -1
  6. package/dist/Auth/ErrorAlert.js +3 -3
  7. package/dist/Auth/Logout.d.ts +1 -1
  8. package/dist/Auth/SignInPassword.d.ts +1 -1
  9. package/dist/BulletItem/BulletItem.d.ts +1 -1
  10. package/dist/Button/Button.d.ts +1 -1
  11. package/dist/Button/Button.js +18 -2
  12. package/dist/Button/GoBackButton.d.ts +1 -1
  13. package/dist/Calculators/Calculator.d.ts +1 -1
  14. package/dist/Calculators/Calculator.js +3 -3
  15. package/dist/Calculators/MarginTradingCalculator/index.js +2 -2
  16. package/dist/Carousel/index.d.ts +3 -3
  17. package/dist/Carousel/index.js +2 -2
  18. package/dist/Chatbot/AnimatedGradientBorder.css.d.ts +5 -0
  19. package/dist/Chatbot/AnimatedGradientBorder.css.js +13 -3
  20. package/dist/Chatbot/Bubble.d.ts +1 -1
  21. package/dist/Chatbot/ChatWindow.css.d.ts +6 -0
  22. package/dist/Chatbot/ChatWindow.css.js +47 -35
  23. package/dist/Chatbot/ChatWindow.js +130 -68
  24. package/dist/Chatbot/Chatbot.css.js +1 -1
  25. package/dist/Chatbot/Chatbot.css.ts.vanilla.css.js +1 -0
  26. package/dist/Chatbot/Chatbot.d.ts +1 -1
  27. package/dist/Chatbot/Chatbot.js +84 -23
  28. package/dist/Chatbot/ChatbotMessage.js +184 -159
  29. package/dist/Chatbot/EllipsisAnimation.d.ts +1 -1
  30. package/dist/Chatbot/EllipsisAnimation.js +0 -6
  31. package/dist/Chatbot/EllipsisIcon.d.ts +1 -1
  32. package/dist/Chatbot/index.js +7 -1
  33. package/dist/Chevron/index.js +2 -2
  34. package/dist/Comparison/Comparison.d.ts +1 -1
  35. package/dist/Comparison/Comparison.js +2 -2
  36. package/dist/Comparison/ComparisonSet.d.ts +1 -1
  37. package/dist/ExecutiveBio/ExecutiveBio.d.ts +1 -1
  38. package/dist/ExecutiveBio/ExecutiveBio.js +2 -2
  39. package/dist/ExecutiveBio/ExecutiveBioSet.d.ts +1 -1
  40. package/dist/ExecutiveBio/Overlay.d.ts +1 -1
  41. package/dist/FaqAccordion/index.d.ts +5 -5
  42. package/dist/FaqAccordion/index.js +2 -2
  43. package/dist/FdicCallout/index.d.ts +1 -1
  44. package/dist/FooterDisclosure/FooterDisclosure.d.ts +4 -4
  45. package/dist/FooterDisclosure/LVF/LaVictorieFooter.d.ts +1 -1
  46. package/dist/FooterSiteMap/AxosBank/FooterSiteMap.d.ts +1 -1
  47. package/dist/FooterSiteMap/AxosBank/FooterSiteMap.js +2 -2
  48. package/dist/Forms/ApplicationStart.d.ts +1 -1
  49. package/dist/Forms/ApplyNow.d.ts +1 -1
  50. package/dist/Forms/ApplyNow.js +2 -2
  51. package/dist/Forms/BoatMooringLocation.d.ts +1 -1
  52. package/dist/Forms/ClearingForm.d.ts +1 -1
  53. package/dist/Forms/CommercialDeposits.d.ts +1 -1
  54. package/dist/Forms/CommercialDepositsNoLendingOption.d.ts +1 -1
  55. package/dist/Forms/CommercialLending.d.ts +1 -1
  56. package/dist/Forms/CommercialPremiumFinance.d.ts +1 -1
  57. package/dist/Forms/ConstructionLendingDynamic.d.ts +1 -1
  58. package/dist/Forms/ContactCompany.d.ts +1 -1
  59. package/dist/Forms/ContactCompanyTitle.d.ts +1 -1
  60. package/dist/Forms/ContactUs.d.ts +1 -1
  61. package/dist/Forms/ContactUsAAS.d.ts +1 -1
  62. package/dist/Forms/ContactUsBusiness.d.ts +1 -1
  63. package/dist/Forms/ContactUsBusiness.js +2 -2
  64. package/dist/Forms/ContactUsBusinessNameEmail.d.ts +1 -1
  65. package/dist/Forms/ContactUsBusinessNameEmail.js +2 -2
  66. package/dist/Forms/ContactUsLVF.d.ts +1 -1
  67. package/dist/Forms/ContactUsNMLSId.d.ts +1 -1
  68. package/dist/Forms/ContactUsNMLSId.js +2 -2
  69. package/dist/Forms/ContactUsSchwabAAS.d.ts +1 -1
  70. package/dist/Forms/CpraRequest.d.ts +1 -1
  71. package/dist/Forms/CpraRequest.js +2 -2
  72. package/dist/Forms/CraPublicFile.d.ts +1 -1
  73. package/dist/Forms/CraPublicFile.js +2 -2
  74. package/dist/Forms/DealerServices.d.ts +1 -1
  75. package/dist/Forms/EmailOnly.d.ts +1 -1
  76. package/dist/Forms/EmailOnly.js +2 -2
  77. package/dist/Forms/EmailUs.d.ts +1 -1
  78. package/dist/Forms/HoneyPot/index.d.ts +1 -1
  79. package/dist/Forms/MortgageRate/MortgageRateForm.d.ts +1 -1
  80. package/dist/Forms/MortgageRate/MortgageRateForm.js +2 -2
  81. package/dist/Forms/MortgageRate/MortgageRateQuoteFilters.d.ts +1 -1
  82. package/dist/Forms/MortgageRate/MortgageRateWatch.d.ts +1 -1
  83. package/dist/Forms/MortgageRate/MortgageRateWatch.js +2 -2
  84. package/dist/Forms/MortgageWarehouseLending.d.ts +1 -1
  85. package/dist/Forms/MortgageWarehouseLending.js +2 -2
  86. package/dist/Forms/QuickPricer/QuickPricerForm.d.ts +1 -1
  87. package/dist/Forms/QuickPricer/UserInformation.d.ts +1 -1
  88. package/dist/Forms/ScheduleCall.d.ts +1 -1
  89. package/dist/Forms/ScheduleCallPremier.d.ts +1 -1
  90. package/dist/Forms/SuccesForm.d.ts +1 -1
  91. package/dist/Forms/SuccesForm.js +3 -3
  92. package/dist/Forms/VendorQuestionnaire.d.ts +1 -1
  93. package/dist/Forms/WcplSurvey.d.ts +1 -1
  94. package/dist/HeroBanner/HeroBanner.d.ts +1 -1
  95. package/dist/HeroBanner/HeroVideoPoster.d.ts +1 -1
  96. package/dist/HeroBanner/LargeHeroBanner.d.ts +1 -1
  97. package/dist/Hyperlink/index.js +2 -2
  98. package/dist/IconBillboard/IconBillboard.d.ts +1 -1
  99. package/dist/IconBillboard/IconBillboardSet.d.ts +1 -1
  100. package/dist/IconBillboard/sections/CallToActionSection.d.ts +1 -1
  101. package/dist/IconBillboard/sections/HeaderSection.d.ts +2 -2
  102. package/dist/IconBillboard/sections/IconSection.d.ts +1 -1
  103. package/dist/IconBillboard/sections/ItemsSection.d.ts +1 -1
  104. package/dist/IconBillboard/sections/LayoutSection.d.ts +1 -1
  105. package/dist/ImageBillboard/ExitIntentModal/ModalWrapper.d.ts +1 -1
  106. package/dist/ImageBillboard/ImageBillboard.d.ts +1 -1
  107. package/dist/ImageBillboard/ImageBillboardSet.d.ts +1 -1
  108. package/dist/ImageLink/ImageLink.d.ts +1 -1
  109. package/dist/ImageLink/ImageLink.js +2 -2
  110. package/dist/ImageLink/ImageLinkSet.d.ts +1 -1
  111. package/dist/ImageLink/ImageLinkSet.js +2 -2
  112. package/dist/ImageLink/index.js +2 -2
  113. package/dist/ImageWrapper/ImageWrapper.d.ts +1 -1
  114. package/dist/Insight/Featured/CategorySelector.d.ts +2 -2
  115. package/dist/Insight/Featured/CategorySelector.js +2 -2
  116. package/dist/Insight/Featured/Featured.d.ts +2 -2
  117. package/dist/Insight/Featured/Featured.js +2 -2
  118. package/dist/Insight/Featured/Header.d.ts +1 -1
  119. package/dist/Insight/Featured/Header.js +2 -2
  120. package/dist/LandingPageHeader/LandingPageHeader.d.ts +1 -1
  121. package/dist/LoadingIndicator/index.d.ts +1 -1
  122. package/dist/MainHTML/index.d.ts +1 -1
  123. package/dist/Modal/Modal.js +2 -2
  124. package/dist/Modal/contextApi/store.d.ts +1 -1
  125. package/dist/NavigationMenu/AxosALTS/index.d.ts +1 -1
  126. package/dist/NavigationMenu/AxosALTS/index.js +2 -2
  127. package/dist/NavigationMenu/AxosAdvisor/SubNavBar.d.ts +1 -1
  128. package/dist/NavigationMenu/AxosAdvisor/index.d.ts +1 -1
  129. package/dist/NavigationMenu/AxosAdvisorServices/SubNavBar.d.ts +1 -1
  130. package/dist/NavigationMenu/AxosAdvisorServices/index.d.ts +1 -1
  131. package/dist/NavigationMenu/AxosAdvisorServices/index.js +0 -1
  132. package/dist/NavigationMenu/AxosBank/MobileMenu/MobileMenu.d.ts +1 -1
  133. package/dist/NavigationMenu/AxosBank/MobileMenu/MobileMenu.js +2 -2
  134. package/dist/NavigationMenu/AxosBank/MobileMenu/MobileNavData.d.ts +1 -1
  135. package/dist/NavigationMenu/AxosBank/MobileMenu/MobileNavData.js +3 -3
  136. package/dist/NavigationMenu/AxosBank/SubNavBar.d.ts +1 -1
  137. package/dist/NavigationMenu/AxosBank/SubNavBar.js +2 -2
  138. package/dist/NavigationMenu/AxosBank/index.d.ts +1 -1
  139. package/dist/NavigationMenu/AxosBank/index.js +16 -18
  140. package/dist/NavigationMenu/AxosClearing/SubNavBar.d.ts +1 -1
  141. package/dist/NavigationMenu/AxosClearing/index.d.ts +1 -1
  142. package/dist/NavigationMenu/AxosFiduciary/NavBar.module.js +40 -43
  143. package/dist/NavigationMenu/AxosFiduciary/index.d.ts +1 -1
  144. package/dist/NavigationMenu/AxosFiduciary/index.js +0 -1
  145. package/dist/NavigationMenu/LaVictoire/SubNavBar.d.ts +1 -1
  146. package/dist/NavigationMenu/LaVictoire/index.d.ts +1 -1
  147. package/dist/NavigationMenu/LaVictoire/index.js +2 -2
  148. package/dist/NavigationMenu/NavItem/index.d.ts +1 -1
  149. package/dist/NavigationMenu/Navbar.d.ts +1 -1
  150. package/dist/NavigationMenu/Navbar.js +2 -2
  151. package/dist/NavigationMenu/SignInNavButton.d.ts +3 -1
  152. package/dist/NavigationMenu/SignInNavButton.js +2 -2
  153. package/dist/Pagination/Pagination.d.ts +1 -1
  154. package/dist/SecondaryFooter/index.d.ts +1 -1
  155. package/dist/SetContainer/SetContainer.d.ts +1 -1
  156. package/dist/SetContainer/SetContainer.js +2 -2
  157. package/dist/SocialMediaBar/iconsRepository.d.ts +14 -14
  158. package/dist/SocialMediaBar/iconsRepository.js +2 -2
  159. package/dist/SocialMediaBar/index.d.ts +1 -1
  160. package/dist/Tab/Tab.d.ts +1 -1
  161. package/dist/Tab/TabContainer.d.ts +1 -1
  162. package/dist/Table/Table.d.ts +5 -5
  163. package/dist/TextBlock/TextBlock.d.ts +1 -1
  164. package/dist/Topic/Topic.d.ts +4 -4
  165. package/dist/VideoTile/VideoInit.d.ts +1 -1
  166. package/dist/VideoTile/VideoTile.js +2 -2
  167. package/dist/VideoWrapper/index.js +2 -2
  168. package/dist/WalnutIframe/index.d.ts +1 -1
  169. package/dist/assets/Chatbot/AnimatedGradientBorder.css +99 -12
  170. package/dist/assets/Chatbot/Bubble.css +26 -7
  171. package/dist/assets/Chatbot/ChatWindow.css +155 -74
  172. package/dist/assets/NavigationMenu/AxosFiduciary/NavBar.css +82 -82
  173. package/dist/assets/TopicalNavSet/TopicalNavSet.css +1 -1
  174. package/dist/icons/AxosX/Blue.d.ts +1 -1
  175. package/dist/icons/AxosX/index.d.ts +1 -1
  176. package/dist/icons/CheckCircle.d.ts +1 -1
  177. package/dist/icons/CheckCircleLight.d.ts +1 -1
  178. package/dist/icons/CheckIcon/index.d.ts +1 -1
  179. package/dist/icons/ChevronDown.d.ts +1 -1
  180. package/dist/icons/ChevronUp.d.ts +1 -1
  181. package/dist/icons/Clock/index.d.ts +1 -1
  182. package/dist/icons/EqualHousingLender.d.ts +1 -1
  183. package/dist/icons/Logos/AAS.d.ts +1 -1
  184. package/dist/icons/Logos/AFS.d.ts +1 -1
  185. package/dist/icons/Logos/AXA.d.ts +1 -1
  186. package/dist/icons/Logos/AXB.d.ts +1 -1
  187. package/dist/icons/Logos/AXC.d.ts +1 -1
  188. package/dist/icons/Logos/AXI.d.ts +1 -1
  189. package/dist/icons/Logos/AXOS.d.ts +1 -1
  190. package/dist/icons/Logos/GBLVF.d.ts +1 -1
  191. package/dist/icons/Logos/LVF.d.ts +1 -1
  192. package/dist/icons/Logos/LVFText.d.ts +1 -1
  193. package/dist/icons/Logos/SPB.d.ts +1 -1
  194. package/dist/icons/MemberFdicLogo.d.ts +1 -1
  195. package/dist/icons/QuoteIconGrey.d.ts +1 -1
  196. package/dist/icons/QuoteIconWhite.d.ts +1 -1
  197. package/dist/icons/QuoteIconYellow.d.ts +1 -1
  198. package/dist/main.js +7 -1
  199. package/package.json +147 -147
  200. package/dist/assets/Chatbot/Chatbot.css +0 -3
@@ -1,16 +1,17 @@
1
1
  "use client";
2
2
  import { jsxs, jsx, Fragment } from "react/jsx-runtime";
3
+ import { LoadingIndicator } from "../LoadingIndicator/index.js";
3
4
  import { vars } from "../themes/axos.css.js";
4
5
  import '../assets/themes/victorie.css';import '../assets/themes/ufb.css';import '../assets/themes/premier.css';import '../assets/themes/axos.css';/* empty css */
5
6
  /* empty css */
6
7
  /* empty css */
7
8
  /* empty css */
8
9
  import clsx from "clsx";
9
- import React, { useRef, useEffect } from "react";
10
+ import React, { useRef, useState, useEffect } from "react";
10
11
  import { useNetworkState, useMount } from "react-use";
11
- import { gradientFocus } from "./AnimatedGradientBorder.css.js";
12
+ import { focusAnimation, gradientFocus } from "./AnimatedGradientBorder.css.js";
12
13
  import { ChatbotMessage } from "./ChatbotMessage.js";
13
- import { windowBarStyle, left_bar_section, chat_title, button_bar, chatbotMenuItem, chatbotMenu, chatEndDialogOverlay, chatFinishDialog, chatEndCircle, endChatButtonStyle, noAnswerButton, arrowFill, button_reset, buttonss_section, chatNetworkStatus, shimmerText, messagesContainerStyle, inputStyle, autoResize, sendButtonStyle, windowStyle, windowOpenStyle, windowExpandedStyle } from "./ChatWindow.css.js";
14
+ import { windowBarStyle, left_bar_section, chat_title, button_bar, chatbotMenuItem, chatbotMenu, chatEndDialogOverlay, chatFinishDialog, chatEndCircle, endChatButtonStyle, noAnswerButton, arrowFill, button_reset, buttonss_section, chatNetworkStatus, shimmerText, messagesContainerStyle, formTextButton, inputStyle, autoResize, sendButtonStyle, chatAiDisclaimer, windowStyle, windowOpenStyle, windowExpandedStyle } from "./ChatWindow.css.js";
14
15
  import { EllipsisIcon } from "./EllipsisIcon.js";
15
16
  import { ExpandChatToggle } from "./ExpandChatToggle.js";
16
17
  import { useOpenChat } from "./store/chat.js";
@@ -40,12 +41,13 @@ const ChatWindow = ({
40
41
  }) => {
41
42
  const {
42
43
  showThankyouMessage,
43
- displayThankyouMessage,
44
44
  toggleThankyouMessage,
45
45
  hasEscalated,
46
46
  isBlockedInput,
47
47
  isOpen,
48
48
  hasOpenedOnce,
49
+ chatStatus,
50
+ setChatStatus,
49
51
  isWindowExpanded,
50
52
  toggleWindowExpanded
51
53
  } = useOpenChat();
@@ -56,6 +58,7 @@ const ChatWindow = ({
56
58
  const [input, setInput] = React.useState("");
57
59
  const messagesEndRef = useRef(null);
58
60
  const inputRef = useRef(null);
61
+ const [focused, setFocused] = useState(false);
59
62
  useEffect(() => {
60
63
  messagesEndRef.current?.scrollIntoView({ behavior: "smooth" });
61
64
  }, [messages]);
@@ -86,9 +89,6 @@ const ChatWindow = ({
86
89
  useEffect(() => {
87
90
  autoResizeTextarea();
88
91
  }, [input]);
89
- const displayThankYouScreen = () => {
90
- displayThankyouMessage();
91
- };
92
92
  const onCancelEndChat = () => {
93
93
  setShowEndChatDialog(false);
94
94
  toggleThankyouMessage?.();
@@ -182,7 +182,7 @@ const ChatWindow = ({
182
182
  alignContent: "center",
183
183
  background: menuOpen ? "#0000000f" : void 0
184
184
  },
185
- children: /* @__PURE__ */ jsx(EllipsisIcon, {})
185
+ children: /* @__PURE__ */ jsx(EllipsisIcon, { color: vars.chatbot.window.headerText })
186
186
  }
187
187
  ),
188
188
  menuOpen && /* @__PURE__ */ jsx("ul", { className: clsx(chatbotMenu), children: /* @__PURE__ */ jsx("li", { className: chatbotMenuItem, children: /* @__PURE__ */ jsxs(
@@ -214,7 +214,7 @@ const ChatWindow = ({
214
214
  "path",
215
215
  {
216
216
  d: "M11.1236 5.37374L8.60278 7.89457L11.1236 10.4167L10.4166 11.1237L7.89445 8.6029L5.37362 11.1237L4.66658 10.4167L7.18742 7.89457L4.66658 5.37374L5.37362 4.66671L7.89445 7.18754L10.4166 4.66671L11.1236 5.37374Z",
217
- fill: "#1E3860"
217
+ fill: vars.chatbot.window.headerText
218
218
  }
219
219
  ),
220
220
  /* @__PURE__ */ jsx(
@@ -223,7 +223,7 @@ const ChatWindow = ({
223
223
  fillRule: "evenodd",
224
224
  clipRule: "evenodd",
225
225
  d: "M13.3333 0.833374C14.3458 0.833374 15.1666 1.65419 15.1666 2.66671V13.3334C15.1666 14.3459 14.3458 15.1667 13.3333 15.1667H2.66659C1.65406 15.1667 0.833252 14.3459 0.833252 13.3334V2.66671C0.833252 1.65419 1.65406 0.833374 2.66659 0.833374H13.3333ZM2.66659 1.83337C2.20635 1.83337 1.83325 2.20647 1.83325 2.66671V13.3334C1.83325 13.7936 2.20635 14.1667 2.66659 14.1667H13.3333C13.7935 14.1667 14.1666 13.7936 14.1666 13.3334V2.66671C14.1666 2.20647 13.7935 1.83337 13.3333 1.83337H2.66659Z",
226
- fill: "#1E3860"
226
+ fill: vars.chatbot.window.headerText
227
227
  }
228
228
  )
229
229
  ] }),
@@ -310,7 +310,7 @@ const ChatWindow = ({
310
310
  type: "submit",
311
311
  onClick: () => {
312
312
  endChat();
313
- displayThankYouScreen();
313
+ setChatStatus("ending");
314
314
  setShowEndChatDialog(false);
315
315
  },
316
316
  children: "Yes, End Chat"
@@ -333,6 +333,45 @@ const ChatWindow = ({
333
333
  " "
334
334
  ] }) })
335
335
  ] }),
336
+ chatStatus == "ending" && /* @__PURE__ */ jsxs("div", { children: [
337
+ /* @__PURE__ */ jsx(
338
+ "div",
339
+ {
340
+ style: {
341
+ background: "#00000080",
342
+ position: "fixed",
343
+ top: 0,
344
+ left: 0,
345
+ right: 0,
346
+ bottom: 0,
347
+ zIndex: 999
348
+ }
349
+ }
350
+ ),
351
+ /* @__PURE__ */ jsx(
352
+ "div",
353
+ {
354
+ style: {
355
+ position: "fixed",
356
+ top: 0,
357
+ left: 0,
358
+ right: 0,
359
+ bottom: 0,
360
+ zIndex: 1e3,
361
+ display: "flex",
362
+ justifyContent: "center",
363
+ alignItems: "center"
364
+ },
365
+ children: /* @__PURE__ */ jsx(
366
+ LoadingIndicator,
367
+ {
368
+ variant: "primary",
369
+ style: { borderTopColor: vars.chatbot.bubble.glowShadow }
370
+ }
371
+ )
372
+ }
373
+ )
374
+ ] }),
336
375
  /* @__PURE__ */ jsx(
337
376
  ThankYouMessage,
338
377
  {
@@ -436,7 +475,7 @@ const ChatWindow = ({
436
475
  fontSize: 14,
437
476
  display: "flex",
438
477
  flexDirection: "column",
439
- gap: 4
478
+ gap: 16
440
479
  },
441
480
  children: /* @__PURE__ */ jsx("p", { className: shimmerText, children: "Chat connecting..." })
442
481
  }
@@ -476,71 +515,94 @@ const ChatWindow = ({
476
515
  ),
477
516
  /* @__PURE__ */ jsx("div", { ref: messagesEndRef })
478
517
  ] }),
479
- /* @__PURE__ */ jsx("div", { style: { padding: "16px 16px 24px 16px" }, children: /* @__PURE__ */ jsx("form", { onSubmit: handleSend, className: clsx(gradientFocus), children: /* @__PURE__ */ jsxs(
480
- "div",
481
- {
482
- style: {
483
- display: "flex",
484
- padding: "12px 16px",
485
- background: isBlockedInput || inputDisabled || status !== "connected" || messages.length == 0 || escalationDeflected ? "light-dark(rgba(239, 239, 239, 0.3), rgba(59, 59, 59, 0.3))" : "#ffffff",
486
- borderRadius: 12
487
- },
488
- children: [
489
- /* @__PURE__ */ jsx(
490
- "textarea",
491
- {
492
- ref: inputRef,
493
- value: input,
494
- onChange: (e) => setInput(e.target.value),
495
- onKeyDown: (e) => {
496
- if (hasEscalated) {
497
- previewTyping(e.target?.value);
498
- }
499
- if (e.key === "Enter" && !e.shiftKey) {
500
- handleSend(e);
501
- }
502
- },
503
- placeholder: "Ask anything...",
504
- className: clsx(inputStyle, autoResize),
505
- autoFocus: true,
506
- disabled: isBlockedInput || inputDisabled || status !== "connected" || messages.length == 0 || escalationDeflected,
507
- rows: 1
518
+ /* @__PURE__ */ jsxs("div", { style: { padding: "16px 16px 24px 16px" }, children: [
519
+ /* @__PURE__ */ jsxs("form", { onSubmit: handleSend, className: clsx(gradientFocus), children: [
520
+ /* @__PURE__ */ jsx(
521
+ "div",
522
+ {
523
+ className: clsx(
524
+ focused && !inputDisabled && !isBlockedInput ? focusAnimation : ""
525
+ ),
526
+ style: {
527
+ position: "absolute",
528
+ left: "10%",
529
+ width: "80%",
530
+ height: "40px",
531
+ zIndex: "-1"
508
532
  }
509
- ),
510
- /* @__PURE__ */ jsx(
511
- "button",
512
- {
513
- className: clsx(
514
- sendButtonStyle,
515
- input.trim().length > 0 && "active"
533
+ }
534
+ ),
535
+ /* @__PURE__ */ jsxs(
536
+ "div",
537
+ {
538
+ className: formTextButton,
539
+ style: {
540
+ display: "flex",
541
+ padding: "12px 16px",
542
+ background: isBlockedInput || inputDisabled || status !== "connected" || messages.length == 0 || escalationDeflected ? "light-dark(rgba(239, 239, 239, 0.3), rgba(59, 59, 59, 0.3))" : "#ffffff",
543
+ borderRadius: 12
544
+ },
545
+ children: [
546
+ /* @__PURE__ */ jsx(
547
+ "textarea",
548
+ {
549
+ ref: inputRef,
550
+ value: input,
551
+ onChange: (e) => setInput(e.target.value),
552
+ onKeyDown: (e) => {
553
+ if (hasEscalated) {
554
+ previewTyping(e.target?.value);
555
+ }
556
+ if (e.key === "Enter" && !e.shiftKey) {
557
+ handleSend(e);
558
+ }
559
+ },
560
+ onFocus: () => setFocused(() => true),
561
+ onBlur: () => setFocused(() => false),
562
+ placeholder: "Ask anything...",
563
+ className: clsx(inputStyle, autoResize),
564
+ autoFocus: true,
565
+ disabled: isBlockedInput || inputDisabled || status !== "connected" || messages.length == 0 || escalationDeflected,
566
+ rows: 1
567
+ }
516
568
  ),
517
- type: "submit",
518
- title: "Send message",
519
- disabled: isBlockedInput || inputDisabled || status !== "connected" || !input.trim() || messages.length == 0 || escalationDeflected,
520
- children: /* @__PURE__ */ jsx(
521
- "svg",
569
+ /* @__PURE__ */ jsx(
570
+ "button",
522
571
  {
523
- xmlns: "http://www.w3.org/2000/svg",
524
- width: "16",
525
- height: "16",
526
- viewBox: "0 0 16 16",
527
- fill: "none",
572
+ className: clsx(
573
+ sendButtonStyle,
574
+ input.trim().length > 0 && "active"
575
+ ),
576
+ type: "submit",
577
+ title: "Send message",
578
+ disabled: isBlockedInput || inputDisabled || status !== "connected" || !input.trim() || messages.length == 0 || escalationDeflected,
528
579
  children: /* @__PURE__ */ jsx(
529
- "path",
580
+ "svg",
530
581
  {
531
- fillRule: "evenodd",
532
- clipRule: "evenodd",
533
- d: "M0.0030533 5.42479C0.0273417 5.1795 0.193529 4.9714 0.427369 4.89345L15.0114 0.0320896C15.236 -0.0427712 15.4836 0.0156801 15.651 0.183075C15.8184 0.35047 15.8769 0.598075 15.802 0.822659L10.9407 15.4067C10.8627 15.6406 10.6546 15.8068 10.4093 15.8311C10.164 15.8553 9.92737 15.7332 9.80508 15.5192L6.35411 9.47999L0.314925 6.02903C0.100912 5.90673 -0.0212351 5.67008 0.0030533 5.42479ZM7.59169 9.1263L9.64202 12.7144C9.85645 13.0896 10.4138 13.0344 10.5505 12.6244L13.9046 2.56191C14.0349 2.17103 13.6631 1.79916 13.2722 1.92946L3.20969 5.28362C2.79967 5.4203 2.74448 5.97766 3.11973 6.19209L6.70781 8.24242L9.90579 5.04443C10.1499 4.80036 10.5456 4.80036 10.7897 5.04443C11.0337 5.28851 11.0337 5.68424 10.7897 5.92832L7.59169 9.1263Z",
534
- fill: "#435164"
582
+ xmlns: "http://www.w3.org/2000/svg",
583
+ width: "20",
584
+ height: "20",
585
+ viewBox: "0 0 16 16",
586
+ fill: "none",
587
+ children: /* @__PURE__ */ jsx(
588
+ "path",
589
+ {
590
+ fillRule: "evenodd",
591
+ clipRule: "evenodd",
592
+ d: "M0.0030533 5.42479C0.0273417 5.1795 0.193529 4.9714 0.427369 4.89345L15.0114 0.0320896C15.236 -0.0427712 15.4836 0.0156801 15.651 0.183075C15.8184 0.35047 15.8769 0.598075 15.802 0.822659L10.9407 15.4067C10.8627 15.6406 10.6546 15.8068 10.4093 15.8311C10.164 15.8553 9.92737 15.7332 9.80508 15.5192L6.35411 9.47999L0.314925 6.02903C0.100912 5.90673 -0.0212351 5.67008 0.0030533 5.42479ZM7.59169 9.1263L9.64202 12.7144C9.85645 13.0896 10.4138 13.0344 10.5505 12.6244L13.9046 2.56191C14.0349 2.17103 13.6631 1.79916 13.2722 1.92946L3.20969 5.28362C2.79967 5.4203 2.74448 5.97766 3.11973 6.19209L6.70781 8.24242L9.90579 5.04443C10.1499 4.80036 10.5456 4.80036 10.7897 5.04443C11.0337 5.28851 11.0337 5.68424 10.7897 5.92832L7.59169 9.1263Z",
593
+ fill: "#435164"
594
+ }
595
+ )
535
596
  }
536
597
  )
537
598
  }
538
599
  )
539
- }
540
- )
541
- ]
542
- }
543
- ) }) })
600
+ ]
601
+ }
602
+ )
603
+ ] }),
604
+ /* @__PURE__ */ jsx("p", { className: chatAiDisclaimer, children: "Evo is AI and can make mistakes. Verify important details." })
605
+ ] })
544
606
  ]
545
607
  }
546
608
  );
@@ -1,4 +1,4 @@
1
- import '../assets/Chatbot/Chatbot.css';/* empty css */
1
+ import "./Chatbot.css.ts.vanilla.css.js";
2
2
  var chatbotAXB = "_1hpv6vm0";
3
3
  var chatbotUFB = "_1hpv6vm1";
4
4
  export {
@@ -17,5 +17,5 @@ export declare const Chatbot: ({ project, projectEnv, menuOption, config, }: {
17
17
  menuOption?: "Support Virtual Agent" | string;
18
18
  debug?: boolean;
19
19
  config: InitalizeChatbot;
20
- }) => false | import("react/jsx-runtime").JSX.Element;
20
+ }) => false | import("react").JSX.Element;
21
21
  export {};
@@ -13,6 +13,9 @@ import { useMessages } from "./store/messages.js";
13
13
  const audioManager = new AudioManager();
14
14
  audioManager.installUjetAudioOverride(notificationSound);
15
15
  audioManager.setSoundEnabled(false);
16
+ function isChat(obj) {
17
+ return obj !== null && typeof obj === "object" && "id" in obj && "agent" in obj && typeof obj.connect === "function";
18
+ }
16
19
  const Chatbot = ({
17
20
  project = "axos",
18
21
  projectEnv = "dev",
@@ -28,7 +31,13 @@ const Chatbot = ({
28
31
  hasEscalated,
29
32
  endEscalation,
30
33
  unblockInput,
31
- blockInput
34
+ blockInput,
35
+ hasStarted,
36
+ setChatStarted,
37
+ resetChatStarted,
38
+ setChatStatus,
39
+ displayThankyouMessage,
40
+ hideDisplayThankyouMessage
32
41
  } = useOpenChat();
33
42
  const isVisible = usePageVisibility();
34
43
  const { addMessage, addMessages, clearMessages, messages } = useMessages();
@@ -39,7 +48,6 @@ const Chatbot = ({
39
48
  const chatLoading = useRef(false);
40
49
  const agent_virtual = useRef(null);
41
50
  const [status, setStatus] = useState("idle");
42
- const [hasStarted, setHasStarted] = useState(false);
43
51
  const [menusLoaded, setMenusLoaded] = useState(false);
44
52
  const [isTyping, setIsTyping] = useState(false);
45
53
  const [scalationStarted, setScalationStarted] = useState(false);
@@ -69,7 +77,7 @@ const Chatbot = ({
69
77
  $index: -10,
70
78
  $userId: 0
71
79
  };
72
- const custom_data = {
80
+ const custom_data = () => ({
73
81
  unsigned: {
74
82
  facingBrandId: {
75
83
  label: "facingBrandId",
@@ -86,9 +94,13 @@ const Chatbot = ({
86
94
  env: {
87
95
  label: "env",
88
96
  value: projectEnv === "uat" ? "dev" : projectEnv
97
+ },
98
+ url: {
99
+ label: "url",
100
+ value: window.location.href
89
101
  }
90
102
  }
91
- };
103
+ });
92
104
  const onReadyHandler = async () => {
93
105
  console.log("Chat client is ready");
94
106
  if (clientRef.current) {
@@ -230,9 +242,6 @@ const Chatbot = ({
230
242
  const createClient = async () => {
231
243
  const { Client } = await import("@ujet/websdk-headless");
232
244
  if (clientRef.current) return;
233
- console.log({
234
- config
235
- });
236
245
  const client = new Client({
237
246
  companyId: config.companyId,
238
247
  tenant: config.tenantName,
@@ -259,12 +268,20 @@ const Chatbot = ({
259
268
  };
260
269
  const startChat = async (source) => {
261
270
  const client = clientRef.current;
262
- if (!client) return;
263
- if (hasStarted) return;
271
+ if (!client) {
272
+ console.log(`no client detected`);
273
+ return;
274
+ }
275
+ if (hasStarted) {
276
+ console.log(`has started is ${hasStarted}`);
277
+ return;
278
+ }
279
+ hideDisplayThankyouMessage();
264
280
  if (chatLoading.current) {
265
281
  console.log(`startChat skipped [${source}] — already in progress`);
266
282
  return;
267
283
  }
284
+ setChatStatus("connected");
268
285
  try {
269
286
  console.log(`Starting chat [${source}]`, chatRef.current);
270
287
  chatLoading.current = true;
@@ -299,8 +316,10 @@ const Chatbot = ({
299
316
  if (!foundMenu) {
300
317
  throw new Error("Menu not found: " + menuOption);
301
318
  }
302
- const newChat = await client.createChat(menuId, { custom_data });
303
- if (newChat !== null) {
319
+ const newChat = await client.createChat(menuId, {
320
+ custom_data: custom_data()
321
+ });
322
+ if (newChat && typeof newChat === "object" && isChat(newChat)) {
304
323
  chatRef.current = newChat;
305
324
  agent_virtual.current = newChat.agent;
306
325
  console.log("Chat created id:", newChat.id);
@@ -309,7 +328,7 @@ const Chatbot = ({
309
328
  console.error("Error creating chat:", err);
310
329
  } finally {
311
330
  chatLoading.current = false;
312
- setHasStarted(true);
331
+ setChatStarted();
313
332
  }
314
333
  };
315
334
  const handleClick = async () => {
@@ -318,7 +337,7 @@ const Chatbot = ({
318
337
  if (hasStarted) return;
319
338
  if (!hasOpenedOnce) {
320
339
  await startChat("bubbleClick");
321
- setHasStarted(true);
340
+ setChatStarted();
322
341
  }
323
342
  };
324
343
  const onSendMessage = async (msg) => {
@@ -343,15 +362,27 @@ const Chatbot = ({
343
362
  }
344
363
  };
345
364
  const onEndChat = async () => {
346
- console.log("Ending chat");
365
+ console.log(`Ending chat [end chat]`);
347
366
  if (chatRef.current) {
348
- await clientRef.current?.finishChat();
349
- await chatRef.current?.destroy();
350
- clearMessages();
351
- chatRef.current = null;
352
- console.log("Chat ended");
353
- setHasStarted(false);
354
- endEscalation?.();
367
+ try {
368
+ clientRef.current?.finishChat().then(() => {
369
+ console.log(`Chat finished`);
370
+ chatRef.current?.destroy().then(() => {
371
+ console.log(`Chat destroyed`);
372
+ clearMessages();
373
+ chatRef.current = null;
374
+ resetChatStarted();
375
+ console.log("Chat ended");
376
+ endEscalation?.();
377
+ }).finally(() => {
378
+ setChatStatus("ending");
379
+ displayThankyouMessage();
380
+ });
381
+ });
382
+ } catch (error) {
383
+ console.log(error, "from onEndChat");
384
+ }
385
+ return;
355
386
  }
356
387
  };
357
388
  const onEndAndStartNewChat = async () => {
@@ -370,7 +401,7 @@ const Chatbot = ({
370
401
  deregisterEventHandlers();
371
402
  chatLoading.current = false;
372
403
  reset();
373
- setHasStarted(false);
404
+ resetChatStarted();
374
405
  setStatus("idle");
375
406
  clearMessages();
376
407
  endEscalation?.();
@@ -386,7 +417,7 @@ const Chatbot = ({
386
417
  };
387
418
  const onCloseAfterThankYou = async () => {
388
419
  reset();
389
- setHasStarted(false);
420
+ resetChatStarted();
390
421
  newChatSession();
391
422
  };
392
423
  const onPreviewTyping = async (msg) => {
@@ -413,6 +444,36 @@ const Chatbot = ({
413
444
  }
414
445
  }
415
446
  }, [isOpen, isVisible]);
447
+ useMount(() => {
448
+ const hasParams = () => {
449
+ return window.location.search.includes("utm_");
450
+ };
451
+ const tryStart = () => {
452
+ if (hasParams()) {
453
+ startChat("utm-ready");
454
+ return true;
455
+ }
456
+ return false;
457
+ };
458
+ if (tryStart()) return;
459
+ const original = history.replaceState;
460
+ history.replaceState = function(...args) {
461
+ original.apply(this, args);
462
+ if (tryStart()) {
463
+ history.replaceState = original;
464
+ }
465
+ };
466
+ const interval = setInterval(() => {
467
+ if (tryStart()) {
468
+ clearInterval(interval);
469
+ history.replaceState = original;
470
+ }
471
+ }, 100);
472
+ return () => {
473
+ clearInterval(interval);
474
+ history.replaceState = original;
475
+ };
476
+ });
416
477
  return menusLoaded && /* @__PURE__ */ jsxs(
417
478
  "div",
418
479
  {