@axos-web-dev/shared-components 1.0.77-patch.4 → 1.0.77-patch.40

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 (205) hide show
  1. package/dist/ATMLocator/ATMLocator.js +10 -3
  2. package/dist/Auth/ErrorAlert.js +12 -5
  3. package/dist/Button/Button.js +12 -5
  4. package/dist/Calculators/ApyCalculator/index.js +11 -5
  5. package/dist/Calculators/AxosOneCalculator/BalanceAPYCalculator.css.d.ts +1 -0
  6. package/dist/Calculators/AxosOneCalculator/BalanceAPYCalculator.css.js +3 -1
  7. package/dist/Calculators/AxosOneCalculator/index.d.ts +2 -0
  8. package/dist/Calculators/AxosOneCalculator/index.js +38 -20
  9. package/dist/Calculators/Calculator.d.ts +2 -0
  10. package/dist/Calculators/Calculator.js +29 -8
  11. package/dist/Calculators/MarineLoanMonthlyPaymentCalculator/index.d.ts +9 -0
  12. package/dist/Calculators/MarineLoanMonthlyPaymentCalculator/index.js +219 -0
  13. package/dist/Calculators/MaxLoanCalculator/index.js +22 -5
  14. package/dist/Calculators/MonthlyPaymentCalculator/MonthlyPaymentCalculator.css.d.ts +1 -0
  15. package/dist/Calculators/MonthlyPaymentCalculator/MonthlyPaymentCalculator.css.js +2 -0
  16. package/dist/Calculators/MonthlyPaymentCalculator/index.js +15 -5
  17. package/dist/Calculators/SummitApyCalculator/index.js +15 -6
  18. package/dist/Calculators/index.d.ts +2 -1
  19. package/dist/Calculators/index.js +3 -1
  20. package/dist/Carousel/index.js +20 -13
  21. package/dist/Chatbot/Bubble.css.d.ts +2 -0
  22. package/dist/Chatbot/Bubble.css.js +7 -0
  23. package/dist/Chatbot/Bubble.d.ts +5 -0
  24. package/dist/Chatbot/Bubble.js +103 -0
  25. package/dist/Chatbot/Chat.d.ts +1 -0
  26. package/dist/Chatbot/Chat.js +165 -0
  27. package/dist/Chatbot/ChatWindow.css.d.ts +18 -0
  28. package/dist/Chatbot/ChatWindow.css.js +39 -0
  29. package/dist/Chatbot/ChatWindow.d.ts +26 -0
  30. package/dist/Chatbot/ChatWindow.js +446 -0
  31. package/dist/Chatbot/Chatbot.css.d.ts +2 -0
  32. package/dist/Chatbot/Chatbot.css.js +7 -0
  33. package/dist/Chatbot/Chatbot.css.ts.vanilla.css.js +1 -0
  34. package/dist/Chatbot/Chatbot.d.ts +10 -0
  35. package/dist/Chatbot/Chatbot.js +222 -0
  36. package/dist/Chatbot/EllipsisAnimation.d.ts +2 -0
  37. package/dist/Chatbot/EllipsisAnimation.js +85 -0
  38. package/dist/Chatbot/EllipsisIcon.d.ts +4 -0
  39. package/dist/Chatbot/EllipsisIcon.js +19 -0
  40. package/dist/Chatbot/authenticate.d.ts +3 -0
  41. package/dist/Chatbot/authenticate.js +16 -0
  42. package/dist/Chatbot/index.d.ts +8 -0
  43. package/dist/Chatbot/index.js +38 -0
  44. package/dist/Chatbot/store/chat.d.ts +10 -0
  45. package/dist/Chatbot/store/chat.js +18 -0
  46. package/dist/Chatbot/store/messages.d.ts +15 -0
  47. package/dist/Chatbot/store/messages.js +13 -0
  48. package/dist/Chatbot/useHeadlessChat.d.ts +27 -0
  49. package/dist/Chatbot/useHeadlessChat.js +240 -0
  50. package/dist/Chevron/index.js +12 -5
  51. package/dist/Comparison/Comparison.js +16 -9
  52. package/dist/Comparison/ComparisonSet.js +33 -24
  53. package/dist/ExecutiveBio/ExecutiveBio.js +12 -5
  54. package/dist/FaqAccordion/index.js +12 -5
  55. package/dist/FooterSiteMap/AxosBank/FooterSiteMap.js +30 -9
  56. package/dist/Forms/ApplicationStart.d.ts +1 -1
  57. package/dist/Forms/ApplicationStart.js +111 -89
  58. package/dist/Forms/ApplyNow.d.ts +2 -2
  59. package/dist/Forms/ApplyNow.js +180 -148
  60. package/dist/Forms/ClearingForm.d.ts +1 -1
  61. package/dist/Forms/ClearingForm.js +184 -162
  62. package/dist/Forms/CommercialDeposits.d.ts +1 -1
  63. package/dist/Forms/CommercialDeposits.js +201 -179
  64. package/dist/Forms/CommercialDepositsNoLendingOption.d.ts +16 -0
  65. package/dist/Forms/CommercialDepositsNoLendingOption.js +330 -0
  66. package/dist/Forms/CommercialLending.d.ts +1 -1
  67. package/dist/Forms/CommercialLending.js +278 -256
  68. package/dist/Forms/CommercialPremiumFinance.d.ts +1 -1
  69. package/dist/Forms/CommercialPremiumFinance.js +128 -106
  70. package/dist/Forms/ContactCompany.d.ts +1 -1
  71. package/dist/Forms/ContactCompany.js +113 -91
  72. package/dist/Forms/ContactCompanyTitle.d.ts +1 -1
  73. package/dist/Forms/ContactCompanyTitle.js +127 -105
  74. package/dist/Forms/ContactUs.d.ts +1 -1
  75. package/dist/Forms/ContactUs.js +99 -77
  76. package/dist/Forms/ContactUsAAS.d.ts +1 -1
  77. package/dist/Forms/ContactUsAAS.js +180 -158
  78. package/dist/Forms/ContactUsBusiness.d.ts +2 -2
  79. package/dist/Forms/ContactUsBusiness.js +146 -118
  80. package/dist/Forms/ContactUsBusinessNameEmail.d.ts +1 -1
  81. package/dist/Forms/ContactUsBusinessNameEmail.js +114 -86
  82. package/dist/Forms/ContactUsLVF.d.ts +7 -1
  83. package/dist/Forms/ContactUsLVF.js +133 -105
  84. package/dist/Forms/ContactUsNMLSId.d.ts +1 -1
  85. package/dist/Forms/ContactUsNMLSId.js +128 -100
  86. package/dist/Forms/CpraRequest.d.ts +1 -1
  87. package/dist/Forms/CpraRequest.js +641 -619
  88. package/dist/Forms/CraPublicFile.d.ts +1 -1
  89. package/dist/Forms/CraPublicFile.js +120 -92
  90. package/dist/Forms/DealerServices.d.ts +1 -1
  91. package/dist/Forms/DealerServices.js +225 -203
  92. package/dist/Forms/EmailOnly.d.ts +1 -1
  93. package/dist/Forms/EmailOnly.js +67 -41
  94. package/dist/Forms/EmailUs.d.ts +1 -1
  95. package/dist/Forms/EmailUs.js +75 -53
  96. package/dist/Forms/FormProps.d.ts +3 -0
  97. package/dist/Forms/Forms.css.d.ts +18 -0
  98. package/dist/Forms/Forms.css.js +44 -38
  99. package/dist/Forms/HoneyPot/HoneyPot.css.d.ts +1 -0
  100. package/dist/Forms/HoneyPot/HoneyPot.css.js +5 -0
  101. package/dist/Forms/HoneyPot/index.d.ts +23 -0
  102. package/dist/Forms/HoneyPot/index.js +69 -0
  103. package/dist/Forms/MortgageRate/MortgageRateForm.js +12 -5
  104. package/dist/Forms/MortgageRate/MortgageRateWatch.js +12 -5
  105. package/dist/Forms/MortgageWarehouseLending.d.ts +11 -0
  106. package/dist/Forms/MortgageWarehouseLending.js +343 -0
  107. package/dist/Forms/QuickPricer/QuickPricerForm.d.ts +1 -1
  108. package/dist/Forms/QuickPricer/QuickPricerForm.js +624 -609
  109. package/dist/Forms/SalesforceFieldsForm.d.ts +5 -0
  110. package/dist/Forms/SalesforceFieldsForm.js +11 -1
  111. package/dist/Forms/ScheduleCall.d.ts +1 -1
  112. package/dist/Forms/ScheduleCall.js +156 -134
  113. package/dist/Forms/ScheduleCallPremier.d.ts +1 -1
  114. package/dist/Forms/ScheduleCallPremier.js +178 -156
  115. package/dist/Forms/SuccesForm.js +16 -9
  116. package/dist/Forms/VendorQuestionnaire.d.ts +1 -1
  117. package/dist/Forms/VendorQuestionnaire.js +817 -795
  118. package/dist/Forms/WcplSurvey.d.ts +1 -1
  119. package/dist/Forms/WcplSurvey.js +112 -90
  120. package/dist/Forms/applynow-utils.d.ts +1 -0
  121. package/dist/Forms/applynow-utils.js +48 -0
  122. package/dist/Forms/index.d.ts +4 -0
  123. package/dist/Forms/index.js +14 -2
  124. package/dist/HeroBanner/HeroBanner.css.d.ts +2 -0
  125. package/dist/HeroBanner/HeroBanner.css.js +4 -0
  126. package/dist/HeroBanner/HeroBanner.d.ts +1 -1
  127. package/dist/HeroBanner/HeroBanner.interface.d.ts +3 -0
  128. package/dist/HeroBanner/HeroBanner.js +90 -3
  129. package/dist/HeroBanner/index.js +3 -1
  130. package/dist/Hyperlink/index.js +12 -5
  131. package/dist/IconBillboard/IconBillboard.css.d.ts +1 -0
  132. package/dist/IconBillboard/IconBillboard.css.js +2 -0
  133. package/dist/IconBillboard/IconBillboard.d.ts +1 -2
  134. package/dist/IconBillboard/IconBillboard.js +30 -85
  135. package/dist/IconBillboard/index.js +3 -3
  136. package/dist/IconBillboard/sections/CallToActionSection.d.ts +12 -0
  137. package/dist/IconBillboard/sections/CallToActionSection.js +102 -0
  138. package/dist/IconBillboard/sections/HeaderSection.d.ts +11 -0
  139. package/dist/IconBillboard/sections/HeaderSection.js +23 -0
  140. package/dist/IconBillboard/sections/IconSection.d.ts +7 -0
  141. package/dist/IconBillboard/sections/IconSection.js +18 -0
  142. package/dist/IconBillboard/sections/ItemsSection.d.ts +11 -0
  143. package/dist/IconBillboard/sections/ItemsSection.js +11 -0
  144. package/dist/IconBillboard/sections/LayoutSection.d.ts +8 -0
  145. package/dist/IconBillboard/sections/LayoutSection.js +6 -0
  146. package/dist/ImageBillboard/ExitIntentModal/useExitIntentModal.js +6 -1
  147. package/dist/ImageBillboard/ImageBillboard.interface.d.ts +7 -0
  148. package/dist/ImageBillboard/ImageBillboardSet.d.ts +1 -1
  149. package/dist/ImageBillboard/ImageBillboardSet.js +20 -4
  150. package/dist/ImageLink/ImageLink.js +12 -5
  151. package/dist/ImageLink/ImageLinkSet.js +15 -8
  152. package/dist/ImageLink/index.js +12 -5
  153. package/dist/Insight/Featured/CategorySelector.js +13 -6
  154. package/dist/Insight/Featured/Featured.js +20 -13
  155. package/dist/Insight/Featured/Header.js +19 -12
  156. package/dist/LandingPageHeader/LandingPageHeader.css.d.ts +2 -0
  157. package/dist/LandingPageHeader/LandingPageHeader.css.js +6 -2
  158. package/dist/LandingPageHeader/LandingPageHeader.js +18 -9
  159. package/dist/LandingPageHeader/index.js +3 -1
  160. package/dist/Modal/Modal.js +12 -5
  161. package/dist/NavigationMenu/AxosALTS/NavData.js +12 -5
  162. package/dist/NavigationMenu/AxosALTS/index.js +12 -5
  163. package/dist/NavigationMenu/AxosAdvisor/SubNavBar.js +3 -10
  164. package/dist/NavigationMenu/AxosAdvisor/index.js +3 -11
  165. package/dist/NavigationMenu/AxosBank/MobileMenu/MobileNavData.d.ts +3 -4
  166. package/dist/NavigationMenu/AxosBank/MobileMenu/MobileNavData.js +29 -13
  167. package/dist/NavigationMenu/AxosBank/NavData.js +12 -5
  168. package/dist/NavigationMenu/AxosBank/SubNavBar.js +67 -63
  169. package/dist/NavigationMenu/AxosBank/index.js +12 -5
  170. package/dist/NavigationMenu/LaVictoire/NavData.js +12 -5
  171. package/dist/NavigationMenu/LaVictoire/index.js +12 -5
  172. package/dist/SetContainer/SetContainer.js +12 -5
  173. package/dist/SocialMediaBar/iconsRepository.js +12 -5
  174. package/dist/StepItemSet/StepItemSet.css.d.ts +1 -0
  175. package/dist/StepItemSet/StepItemSet.css.js +9 -5
  176. package/dist/StepItemSet/StepItemSet.d.ts +6 -0
  177. package/dist/StepItemSet/StepItemSet.js +22 -3
  178. package/dist/StepItemSet/index.js +2 -1
  179. package/dist/Table/Table.d.ts +1 -1
  180. package/dist/VideoTile/VideoTile.interface.d.ts +4 -3
  181. package/dist/VideoTile/VideoTile.js +189 -28
  182. package/dist/VideoWrapper/index.js +13 -6
  183. package/dist/WalnutIframe/wrapper.module.js +3 -3
  184. package/dist/assets/Calculators/AxosOneCalculator/BalanceAPYCalculator.css +12 -0
  185. package/dist/assets/Calculators/MonthlyPaymentCalculator/MonthlyPaymentCalculator.css +3 -0
  186. package/dist/assets/Chatbot/Bubble.css +51 -0
  187. package/dist/assets/Chatbot/ChatWindow.css +213 -0
  188. package/dist/assets/Comparison/Comparison.css +3 -1
  189. package/dist/assets/Forms/Forms.css +135 -105
  190. package/dist/assets/Forms/HoneyPot/HoneyPot.css +8 -0
  191. package/dist/assets/HeroBanner/HeroBanner.css +12 -0
  192. package/dist/assets/IconBillboard/IconBillboard.css +21 -1
  193. package/dist/assets/ImageBillboard/ImageBillboard.css +26 -15
  194. package/dist/assets/LandingPageHeader/LandingPageHeader.css +36 -3
  195. package/dist/assets/StepItemSet/StepItemSet.css +27 -10
  196. package/dist/assets/TopicalNavItem/TopicalNavItem.css +2 -2
  197. package/dist/assets/WalnutIframe/wrapper.css.css +7 -8
  198. package/dist/icons/Logos/SPB.d.ts +4 -0
  199. package/dist/icons/Logos/SPB.js +132 -0
  200. package/dist/icons/index.d.ts +1 -0
  201. package/dist/icons/index.js +2 -0
  202. package/dist/main.d.ts +1 -0
  203. package/dist/main.js +79 -23
  204. package/dist/utils/allowedAxosDomains.js +4 -2
  205. package/package.json +3 -1
@@ -0,0 +1,2 @@
1
+ export declare const chatbotAXB: string;
2
+ export declare const chatbotUFB: string;
@@ -0,0 +1,7 @@
1
+ import "./Chatbot.css.ts.vanilla.css.js";
2
+ var chatbotAXB = "_1hpv6vm0";
3
+ var chatbotUFB = "_1hpv6vm1";
4
+ export {
5
+ chatbotAXB,
6
+ chatbotUFB
7
+ };
@@ -0,0 +1,10 @@
1
+ export type ChatbotProps = {
2
+ project?: "axos" | "ufb";
3
+ debug?: boolean;
4
+ };
5
+ export declare const Chatbot: ({ project, projectEnv, menuOption, debug, }: {
6
+ project?: "axos" | "ufb";
7
+ projectEnv?: "dev" | "qa" | "uat" | "stg" | "prod";
8
+ menuOption?: "Support Virtual Agent" | string;
9
+ debug?: boolean;
10
+ }) => import("react/jsx-runtime").JSX.Element;
@@ -0,0 +1,222 @@
1
+ "use client";
2
+ import { jsxs, jsx } from "react/jsx-runtime";
3
+ import { authenticate } from "./authenticate.js";
4
+ import { Bubble } from "./Bubble.js";
5
+ import { chatbotUFB, chatbotAXB } from "./Chatbot.css.js";
6
+ import { ChatWindow } from "./ChatWindow.js";
7
+ import { useOpenChat } from "./store/chat.js";
8
+ import { useMessages } from "./store/messages.js";
9
+ import { useRef, useState } from "react";
10
+ import { useMount, useUnmount } from "react-use";
11
+ const Chatbot = ({
12
+ project = "axos",
13
+ projectEnv = "dev",
14
+ menuOption = "Support Virtual Agent",
15
+ debug = false
16
+ }) => {
17
+ const { hasOpenedOnce, toggle, reset } = useOpenChat();
18
+ const { addMessage, addMessages, clearMessages, messages } = useMessages();
19
+ const clientRef = useRef(null);
20
+ const menuRef = useRef(null);
21
+ const isMountedRef = useRef(false);
22
+ const hasLoadedBefore = useRef(true);
23
+ const chatRef = useRef(null);
24
+ const agent_virtual = useRef(null);
25
+ const [status, setStatus] = useState("idle");
26
+ const [hasStarted, setHasStarted] = useState(false);
27
+ const brandMap = /* @__PURE__ */ new Map([
28
+ ["axos", 1],
29
+ ["ufb", 3]
30
+ ]);
31
+ const custom_data = {
32
+ unsigned: {
33
+ facingBrandId: {
34
+ label: "facingBrandId",
35
+ value: `${brandMap.get(project) || 1}`
36
+ },
37
+ channel: {
38
+ label: "channel",
39
+ value: "in_web"
40
+ },
41
+ user_auth: {
42
+ label: "user_auth",
43
+ value: "false"
44
+ },
45
+ env: {
46
+ label: "env",
47
+ value: projectEnv === "dev" ? "uat" : projectEnv
48
+ }
49
+ }
50
+ };
51
+ const onReadyHandler = async () => {
52
+ console.log("Chat client is ready");
53
+ };
54
+ const onAuthenticatedHandler = async () => {
55
+ console.log("Chat client is authenticated");
56
+ };
57
+ const onChatOngoingHandler = async (chat) => {
58
+ console.log("Ongoing chat:", chat);
59
+ };
60
+ const onChatMessageHandler = async (message) => {
61
+ console.log("Received message:", message);
62
+ addMessage(message);
63
+ };
64
+ const onChatTypingStartedHandler = async (identity) => {
65
+ console.log("Typing started by:", identity);
66
+ };
67
+ const onChatDisconnectedHandler = async () => {
68
+ console.log("Chat disconnected");
69
+ setStatus("idle");
70
+ };
71
+ const onDismissedHandler = async () => {
72
+ console.log("Chat dismissed");
73
+ };
74
+ const onTimeoutHandler = async () => {
75
+ console.log("Chat timeout");
76
+ };
77
+ const onEndedHandler = async () => {
78
+ console.log("Chat ended");
79
+ setStatus("finished");
80
+ };
81
+ const onDestroyedHandler = async () => {
82
+ console.log("Chat destroyed");
83
+ };
84
+ const onChatMemberLeftHandler = async (identity) => {
85
+ console.log("Chat member left:", identity);
86
+ };
87
+ const onChatConnectedHandler = async () => {
88
+ setStatus("connected");
89
+ console.log("connected");
90
+ const messages2 = await clientRef.current?.fetchMessages();
91
+ if (messages2) {
92
+ addMessages(messages2);
93
+ }
94
+ };
95
+ const registerEventHandlers = () => {
96
+ clientRef.current?.on("ready", onReadyHandler);
97
+ clientRef.current?.on("authenticated", onAuthenticatedHandler);
98
+ clientRef.current?.on("chat.ongoing", onChatOngoingHandler);
99
+ clientRef.current?.on("chat.message", onChatMessageHandler);
100
+ clientRef.current?.on("chat.typingStarted", onChatTypingStartedHandler);
101
+ clientRef.current?.on("chat.disconnected", onChatDisconnectedHandler);
102
+ clientRef.current?.on("chat.dismissed", onDismissedHandler);
103
+ clientRef.current?.on("chat.timeout", onTimeoutHandler);
104
+ clientRef.current?.on("chat.ended", onEndedHandler);
105
+ clientRef.current?.on("chat.destroyed", onDestroyedHandler);
106
+ clientRef.current?.on("chat.memberLeft", onChatMemberLeftHandler);
107
+ clientRef?.current?.on("chat.connected", onChatConnectedHandler);
108
+ };
109
+ const deregisterEventHandlers = () => {
110
+ clientRef.current?.off("ready", onReadyHandler);
111
+ clientRef.current?.off("authenticated", onAuthenticatedHandler);
112
+ clientRef.current?.off("chat.ongoing", onDismissedHandler);
113
+ clientRef.current?.off("chat.message", onChatMessageHandler);
114
+ clientRef.current?.off("chat.typingStarted", onChatTypingStartedHandler);
115
+ clientRef.current?.off("chat.disconnected", onChatDisconnectedHandler);
116
+ clientRef.current?.off("chat.dismissed", onDismissedHandler);
117
+ clientRef.current?.off("chat.timeout", onTimeoutHandler);
118
+ clientRef.current?.off("chat.ended", onEndedHandler);
119
+ clientRef.current?.off("chat.destroyed", onDestroyedHandler);
120
+ clientRef.current?.off("chat.memberLeft", onChatMemberLeftHandler);
121
+ clientRef.current?.off("chat.connected", onChatConnectedHandler);
122
+ };
123
+ const createClient = async () => {
124
+ const { Client, Logger, consoleLoggerHandler } = await import("@ujet/websdk-headless");
125
+ if (projectEnv !== "prod" || debug) {
126
+ Logger.addHandler(consoleLoggerHandler);
127
+ }
128
+ if (clientRef.current) return;
129
+ const client = new Client({
130
+ companyId: process.env.CCAI_COMPANY_ID || "",
131
+ tenant: process.env.CCAI_TENANT_NAME || "",
132
+ host: process.env.CCAI_HOST || "",
133
+ // or your region
134
+ authenticate
135
+ });
136
+ isMountedRef.current = true;
137
+ clientRef.current = client;
138
+ menuRef.current = await client.getMenus();
139
+ console.log("menus:", menuRef.current);
140
+ registerEventHandlers();
141
+ return;
142
+ };
143
+ const startChat = async () => {
144
+ console.log("Starting chat");
145
+ const client = clientRef.current;
146
+ if (!client) return;
147
+ try {
148
+ const ongoingChat = await client.loadOngoingChat();
149
+ if (ongoingChat) {
150
+ console.log("Ongoing chat found:", ongoingChat);
151
+ console.log("Resuming chat:", ongoingChat.id);
152
+ chatRef.current = await client.resumeChat(ongoingChat.id);
153
+ agent_virtual.current = ongoingChat.agent;
154
+ return;
155
+ }
156
+ const foundMenu = menuRef.current.menus.find(
157
+ (menu) => menu.name === menuOption
158
+ );
159
+ const menuId = foundMenu && foundMenu.id;
160
+ console.log("Creating new chat with menu ID:", menuId);
161
+ const newChat = await client.createChat(menuId, { custom_data });
162
+ if (newChat !== null) {
163
+ chatRef.current = newChat;
164
+ console.log("Chat created id:", newChat.id);
165
+ }
166
+ } catch (err) {
167
+ console.error("Error creating chat:", err);
168
+ }
169
+ };
170
+ const handleClick = async () => {
171
+ toggle();
172
+ if (hasStarted) return;
173
+ if (!hasOpenedOnce) {
174
+ await startChat();
175
+ setHasStarted(true);
176
+ }
177
+ };
178
+ const onSendMessage = (msg) => {
179
+ console.log("Sending message:", msg);
180
+ clientRef.current?.sendTextMessage(msg);
181
+ };
182
+ const onEndChat = async () => {
183
+ console.log("Ending chat");
184
+ if (chatRef.current) {
185
+ await clientRef.current?.finishChat();
186
+ await chatRef.current.destroy();
187
+ clearMessages();
188
+ chatRef.current = null;
189
+ console.log("Chat ended");
190
+ setHasStarted(false);
191
+ reset();
192
+ }
193
+ };
194
+ useMount(async () => {
195
+ console.log("Chatbot mounted");
196
+ if (isMountedRef.current) return;
197
+ isMountedRef.current = true;
198
+ await createClient();
199
+ });
200
+ useUnmount(() => {
201
+ console.log("Chatbot unmounted");
202
+ deregisterEventHandlers();
203
+ isMountedRef.current = false;
204
+ hasLoadedBefore.current = true;
205
+ });
206
+ return /* @__PURE__ */ jsxs("div", { className: project === "ufb" ? chatbotUFB : chatbotAXB, children: [
207
+ /* @__PURE__ */ jsx(Bubble, { onClick: handleClick }),
208
+ /* @__PURE__ */ jsx(
209
+ ChatWindow,
210
+ {
211
+ status,
212
+ virtualAgent: agent_virtual.current,
213
+ messages,
214
+ onSend: onSendMessage,
215
+ endChat: onEndChat
216
+ }
217
+ )
218
+ ] });
219
+ };
220
+ export {
221
+ Chatbot
222
+ };
@@ -0,0 +1,2 @@
1
+ declare const EllipsisLoader: () => import("react/jsx-runtime").JSX.Element;
2
+ export default EllipsisLoader;
@@ -0,0 +1,85 @@
1
+ import { jsxs, jsx } from "react/jsx-runtime";
2
+ import { motion } from "framer-motion";
3
+ const loadingContainerVariants = {
4
+ start: {
5
+ transition: {
6
+ staggerChildren: 0.2
7
+ // Delay between each dot's animation
8
+ }
9
+ },
10
+ end: {
11
+ transition: {
12
+ staggerChildren: 0.2
13
+ }
14
+ }
15
+ };
16
+ const loadingCircleVariants = {
17
+ start: {
18
+ y: "0%"
19
+ },
20
+ end: {
21
+ y: "100%"
22
+ // Move down by 100% of its height
23
+ }
24
+ };
25
+ const loadingTransition = {
26
+ duration: 0.6,
27
+ repeat: Infinity,
28
+ repeatType: "reverse",
29
+ // Reverse the animation direction
30
+ ease: "easeInOut"
31
+ };
32
+ const EllipsisLoader = () => {
33
+ const project = process.env.CCAI_PROJECT_ID;
34
+ const isAxos = project === "axos";
35
+ const endUserBg = isAxos ? "#14263d" : "#323339";
36
+ return /* @__PURE__ */ jsxs(
37
+ motion.svg,
38
+ {
39
+ width: "30",
40
+ height: "15",
41
+ viewBox: "0 0 100 50",
42
+ variants: loadingContainerVariants,
43
+ initial: "start",
44
+ animate: "end",
45
+ children: [
46
+ /* @__PURE__ */ jsx(
47
+ motion.circle,
48
+ {
49
+ cx: "20",
50
+ cy: "15",
51
+ r: "8",
52
+ fill: endUserBg,
53
+ variants: loadingCircleVariants,
54
+ transition: loadingTransition
55
+ }
56
+ ),
57
+ /* @__PURE__ */ jsx(
58
+ motion.circle,
59
+ {
60
+ cx: "50",
61
+ cy: "15",
62
+ r: "8",
63
+ fill: endUserBg,
64
+ variants: loadingCircleVariants,
65
+ transition: loadingTransition
66
+ }
67
+ ),
68
+ /* @__PURE__ */ jsx(
69
+ motion.circle,
70
+ {
71
+ cx: "80",
72
+ cy: "15",
73
+ r: "8",
74
+ fill: endUserBg,
75
+ variants: loadingCircleVariants,
76
+ transition: loadingTransition
77
+ }
78
+ )
79
+ ]
80
+ }
81
+ );
82
+ };
83
+ export {
84
+ EllipsisLoader as default
85
+ };
@@ -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
+ };
@@ -0,0 +1,3 @@
1
+ export declare const authenticate: () => Promise<{
2
+ token: any;
3
+ }>;
@@ -0,0 +1,16 @@
1
+ const AUTH_URL = process.env.AUTH_CHAT_URL || "http://localhost:3000/api/auth/token";
2
+ const authenticate = async () => {
3
+ const res = await fetch(AUTH_URL, {
4
+ method: "GET",
5
+ headers: {
6
+ "Content-Type": "application/json"
7
+ }
8
+ });
9
+ const data = await res.json();
10
+ return {
11
+ token: data.token
12
+ };
13
+ };
14
+ export {
15
+ authenticate
16
+ };
@@ -0,0 +1,8 @@
1
+ export * from './Bubble';
2
+ export * from './Bubble.css';
3
+ export * from './Chatbot';
4
+ export * from './Chatbot.css';
5
+ export * from './ChatWindow';
6
+ export * from './ChatWindow.css';
7
+ export * from './store/chat';
8
+ export * from './store/messages';
@@ -0,0 +1,38 @@
1
+ "use client";
2
+ import { Bubble } from "./Bubble.js";
3
+ import { bubbleWrapper, svgFill } from "./Bubble.css.js";
4
+ import { Chatbot } from "./Chatbot.js";
5
+ import { chatbotAXB, chatbotUFB } from "./Chatbot.css.js";
6
+ import { ChatWindow } from "./ChatWindow.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
+ import { useOpenChat } from "./store/chat.js";
9
+ import { useMessages } from "./store/messages.js";
10
+ export {
11
+ Bubble,
12
+ ChatWindow,
13
+ Chatbot,
14
+ arrowFill,
15
+ bubbleWrapper,
16
+ button_reset,
17
+ chatFinishDialog,
18
+ chatNetworkStatus,
19
+ chat_title,
20
+ chatbotAXB,
21
+ chatbotMenu,
22
+ chatbotMenuItem,
23
+ chatbotUFB,
24
+ endChatButtonStyle,
25
+ inline_button,
26
+ inline_button_wrapper,
27
+ inputStyle,
28
+ messageStyle,
29
+ messagesContainerStyle,
30
+ notificationStyle,
31
+ sendButtonStyle,
32
+ svgFill,
33
+ useMessages,
34
+ useOpenChat,
35
+ windowBarStyle,
36
+ windowOpenStyle,
37
+ windowStyle
38
+ };
@@ -0,0 +1,10 @@
1
+ interface OpenChatState {
2
+ isOpen: boolean;
3
+ hasOpenedOnce: boolean;
4
+ toggle: () => void;
5
+ open: () => void;
6
+ close: () => void;
7
+ reset: () => void;
8
+ }
9
+ export declare const useOpenChat: import('zustand').UseBoundStore<import('zustand').StoreApi<OpenChatState>>;
10
+ export {};
@@ -0,0 +1,18 @@
1
+ import { create } from "zustand";
2
+ const useOpenChat = create((set, get) => ({
3
+ isOpen: false,
4
+ hasOpenedOnce: false,
5
+ toggle: () => set((state) => ({ isOpen: !state.isOpen, hasOpenedOnce: true })),
6
+ open: () => {
7
+ const alreadyOpened = get().hasOpenedOnce;
8
+ set({
9
+ isOpen: true,
10
+ hasOpenedOnce: alreadyOpened ? true : true
11
+ });
12
+ },
13
+ close: () => set({ isOpen: false }),
14
+ reset: () => set({ hasOpenedOnce: false, isOpen: false })
15
+ }));
16
+ export {
17
+ useOpenChat
18
+ };
@@ -0,0 +1,15 @@
1
+ import { MessageResponse } from '@ujet/websdk-headless';
2
+
3
+ interface MessageStore {
4
+ messages: MessageResponse[];
5
+ addMessage: (message: MessageResponse) => void;
6
+ removeMessage: (id: string) => void;
7
+ addMessages: (newMessages: MessageResponse[]) => void;
8
+ clearMessages: () => void;
9
+ }
10
+ export interface Message {
11
+ id: string;
12
+ text: string;
13
+ }
14
+ export declare const useMessages: import('zustand').UseBoundStore<import('zustand').StoreApi<MessageStore>>;
15
+ export {};
@@ -0,0 +1,13 @@
1
+ import { create } from "zustand";
2
+ const useMessages = create((set) => ({
3
+ messages: [],
4
+ addMessage: (message) => set((state) => ({ messages: [...state.messages, message] })),
5
+ removeMessage: (id) => set((state) => ({
6
+ messages: state.messages.filter((msg) => msg.id !== id)
7
+ })),
8
+ addMessages: (newMessages) => set((state) => ({ messages: [...state.messages, ...newMessages] })),
9
+ clearMessages: () => set({ messages: [] })
10
+ }));
11
+ export {
12
+ useMessages
13
+ };
@@ -0,0 +1,27 @@
1
+ import { TokenResponse } from '@ujet/websdk-headless';
2
+
3
+ interface UseHeadlessChatOptions {
4
+ companyId: string;
5
+ tenant: string;
6
+ host: string;
7
+ getToken: () => Promise<TokenResponse>;
8
+ channelId?: string;
9
+ projectId?: "axos" | "" | "ufb" | string;
10
+ debug?: boolean;
11
+ menuOption?: string;
12
+ }
13
+ export interface ChatMessage {
14
+ id: string;
15
+ body: string;
16
+ sender?: string;
17
+ timestamp?: string;
18
+ }
19
+ export declare function useHeadlessChat({ companyId, tenant, host, getToken, projectId, debug, menuOption, }: UseHeadlessChatOptions): {
20
+ status: "error" | "idle" | "connected" | "connecting" | "finished";
21
+ sendMessage: (body: string) => Promise<void>;
22
+ showReconnect: boolean;
23
+ setShowReconnect: import('react').Dispatch<import('react').SetStateAction<boolean>>;
24
+ endChat: () => Promise<void>;
25
+ virtualAgent: any;
26
+ };
27
+ export {};