@axos-web-dev/shared-components 1.0.100-dev.6 → 1.0.100-dev.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 (92) hide show
  1. package/dist/ATMLocator/ATMLocator.js +7 -1
  2. package/dist/ArticlesSet/ArticlesSet.js +2 -2
  3. package/dist/Auth/ErrorAlert.js +7 -1
  4. package/dist/Avatar/Avatar.module.js +7 -7
  5. package/dist/Blockquote/Blockquote.module.js +3 -3
  6. package/dist/Button/Button.js +7 -1
  7. package/dist/Calculators/Calculator.js +8 -2
  8. package/dist/Carousel/index.js +7 -1
  9. package/dist/Chatbot/Bubble.css.d.ts +2 -0
  10. package/dist/Chatbot/Bubble.css.js +7 -0
  11. package/dist/Chatbot/Bubble.d.ts +3 -0
  12. package/dist/Chatbot/Bubble.js +100 -0
  13. package/dist/Chatbot/Chat.d.ts +1 -0
  14. package/dist/Chatbot/Chat.js +165 -0
  15. package/dist/Chatbot/ChatWindow.css.d.ts +18 -0
  16. package/dist/Chatbot/ChatWindow.css.js +39 -0
  17. package/dist/Chatbot/ChatWindow.d.ts +29 -0
  18. package/dist/Chatbot/ChatWindow.js +396 -0
  19. package/dist/Chatbot/Chatbot.css.d.ts +2 -0
  20. package/dist/Chatbot/Chatbot.css.js +7 -0
  21. package/dist/Chatbot/Chatbot.css.ts.vanilla.css.js +1 -0
  22. package/dist/Chatbot/Chatbot.d.ts +5 -0
  23. package/dist/Chatbot/Chatbot.js +42 -0
  24. package/dist/Chatbot/EllipsisIcon.d.ts +4 -0
  25. package/dist/Chatbot/EllipsisIcon.js +19 -0
  26. package/dist/Chatbot/authenticate.d.ts +3 -0
  27. package/dist/Chatbot/authenticate.js +16 -0
  28. package/dist/Chatbot/index.d.ts +9 -0
  29. package/dist/Chatbot/index.js +40 -0
  30. package/dist/Chatbot/store/chat.d.ts +9 -0
  31. package/dist/Chatbot/store/chat.js +11 -0
  32. package/dist/Chatbot/store/messages.d.ts +15 -0
  33. package/dist/Chatbot/store/messages.js +13 -0
  34. package/dist/Chatbot/useHeadlessChat.d.ts +26 -0
  35. package/dist/Chatbot/useHeadlessChat.js +195 -0
  36. package/dist/Chevron/index.js +7 -1
  37. package/dist/Comparison/Comparison.js +7 -1
  38. package/dist/ExecutiveBio/ExecutiveBio.js +7 -1
  39. package/dist/FaqAccordion/index.js +7 -1
  40. package/dist/FooterSiteMap/AxosBank/FooterSiteMap.js +7 -1
  41. package/dist/Forms/ApplyNow.js +7 -1
  42. package/dist/Forms/ContactUsBusiness.js +7 -1
  43. package/dist/Forms/ContactUsBusinessNameEmail.js +7 -1
  44. package/dist/Forms/ContactUsNMLSId.js +7 -1
  45. package/dist/Forms/CraPublicFile.js +7 -1
  46. package/dist/Forms/EmailOnly.js +7 -1
  47. package/dist/Forms/MortgageRate/MortgageRateForm.js +7 -1
  48. package/dist/Forms/MortgageRate/MortgageRateWatch.js +7 -1
  49. package/dist/Forms/MortgageWarehouseLending.js +7 -1
  50. package/dist/Forms/SuccesForm.js +8 -2
  51. package/dist/Hyperlink/index.js +7 -1
  52. package/dist/ImageLink/ImageLink.js +7 -1
  53. package/dist/ImageLink/ImageLinkSet.js +7 -1
  54. package/dist/ImageLink/index.js +7 -1
  55. package/dist/Insight/Featured/CategorySelector.js +7 -1
  56. package/dist/Insight/Featured/Featured.js +7 -1
  57. package/dist/Insight/Featured/Header.js +7 -1
  58. package/dist/Modal/Modal.js +7 -1
  59. package/dist/NavigationMenu/AxosALTS/NavData.js +7 -1
  60. package/dist/NavigationMenu/AxosALTS/index.js +7 -1
  61. package/dist/NavigationMenu/AxosAdvisor/NavBar.module.js +52 -52
  62. package/dist/NavigationMenu/AxosAdvisorServices/NavBar.module.js +53 -53
  63. package/dist/NavigationMenu/AxosBank/MobileMenu/MobileMenu.module.js +16 -16
  64. package/dist/NavigationMenu/AxosBank/MobileMenu/MobileNavData.js +7 -1
  65. package/dist/NavigationMenu/AxosBank/NavBar.module.js +39 -39
  66. package/dist/NavigationMenu/AxosBank/NavData.js +7 -1
  67. package/dist/NavigationMenu/AxosBank/SubNavBar.js +7 -1
  68. package/dist/NavigationMenu/AxosBank/index.js +7 -1
  69. package/dist/NavigationMenu/AxosClearing/NavBar.module.js +37 -37
  70. package/dist/NavigationMenu/LaVictoire/NavData.js +7 -1
  71. package/dist/NavigationMenu/LaVictoire/index.js +7 -1
  72. package/dist/NavigationMenu/NavDataJson.js +7 -1
  73. package/dist/NavigationMenu/Navbar.js +7 -1
  74. package/dist/NavigationMenu/SignInNavButton.js +7 -1
  75. package/dist/SetContainer/SetContainer.js +7 -1
  76. package/dist/SocialMediaBar/iconsRepository.js +7 -1
  77. package/dist/VideoTile/VideoTile.js +7 -1
  78. package/dist/VideoWrapper/index.js +7 -1
  79. package/dist/WalnutIframe/wrapper.module.js +3 -3
  80. package/dist/assets/Avatar/Avatar.css.css +59 -59
  81. package/dist/assets/Blockquote/Blockquote.css.css +68 -68
  82. package/dist/assets/Chatbot/Bubble.css +51 -0
  83. package/dist/assets/Chatbot/ChatWindow.css +213 -0
  84. package/dist/assets/NavigationMenu/AxosAdvisor/NavBar.css.css +597 -597
  85. package/dist/assets/NavigationMenu/AxosAdvisorServices/NavBar.css.css +618 -618
  86. package/dist/assets/NavigationMenu/AxosBank/MobileMenu/MobileMenu.css.css +191 -191
  87. package/dist/assets/NavigationMenu/AxosBank/NavBar.css.css +473 -473
  88. package/dist/assets/NavigationMenu/AxosClearing/NavBar.css.css +458 -458
  89. package/dist/assets/WalnutIframe/wrapper.css.css +49 -49
  90. package/dist/main.d.ts +1 -0
  91. package/dist/main.js +37 -0
  92. package/package.json +136 -133
@@ -0,0 +1,396 @@
1
+ "use client";
2
+ import { jsxs, jsx, Fragment } from "react/jsx-runtime";
3
+ import clsx from "clsx";
4
+ import React, { useRef, useEffect, Fragment as Fragment$1 } from "react";
5
+ import ReactMarkdown from "react-markdown";
6
+ import { useNetworkState, useMount } from "react-use";
7
+ import remarkGfm from "remark-gfm";
8
+ import { windowBarStyle, chat_title, chatbotMenuItem, chatbotMenu, chatFinishDialog, endChatButtonStyle, button_reset, arrowFill, chatNetworkStatus, notificationStyle, messageStyle, inline_button_wrapper, inline_button, messagesContainerStyle, inputStyle, sendButtonStyle, windowStyle, windowOpenStyle } from "./ChatWindow.css.js";
9
+ import { EllipsisIcon } from "./EllipsisIcon.js";
10
+ import { useOpenChat } from "./store/chat.js";
11
+ const ChatWindow = ({
12
+ messages,
13
+ status = "connected",
14
+ onSend,
15
+ inputDisabled = false,
16
+ onClose,
17
+ endChat = () => {
18
+ console.log("End chat");
19
+ },
20
+ showReconnect = false,
21
+ virtualAgent
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();
27
+ const [input, setInput] = React.useState("");
28
+ const messagesEndRef = useRef(null);
29
+ const isOpen = useOpenChat((state2) => state2.isOpen);
30
+ useEffect(() => {
31
+ messagesEndRef.current?.scrollIntoView({ behavior: "smooth" });
32
+ }, [messages]);
33
+ const handleSend = (e) => {
34
+ e.preventDefault();
35
+ if (input.trim()) {
36
+ onSend(input);
37
+ setInput("");
38
+ }
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";
47
+ return /* @__PURE__ */ jsxs("div", { className: clsx(windowStyle, isOpen && windowOpenStyle), children: [
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(
62
+ "button",
63
+ {
64
+ onClick: () => {
65
+ setMenuOpen(!menuOpen);
66
+ },
67
+ style: {
68
+ border: "none",
69
+ background: "transparent",
70
+ marginLeft: "auto",
71
+ cursor: "pointer",
72
+ padding: 0,
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);
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,
165
+ "aria-label": "Close chat",
166
+ title: "Close",
167
+ children: /* @__PURE__ */ jsx(
168
+ "svg",
169
+ {
170
+ xmlns: "http://www.w3.org/2000/svg",
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
+ )
183
+ }
184
+ )
185
+ }
186
+ )
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,
211
+ /* @__PURE__ */ jsxs("div", { className: clsx(messagesContainerStyle), children: [
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),
223
+ ["text", "markdown_template", "markdown"].includes(msg.type) && /* @__PURE__ */ jsxs(
224
+ "div",
225
+ {
226
+ className: messageStyle,
227
+ style: {
228
+ textAlign: msg.$userType == "end_user" ? "right" : "left",
229
+ alignSelf: msg.$userType == "end_user" ? "flex-end" : "flex-start",
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
233
+ },
234
+ children: [
235
+ /* @__PURE__ */ jsxs(
236
+ "div",
237
+ {
238
+ style: {
239
+ fontSize: 13,
240
+ display: "flex",
241
+ flexDirection: "column",
242
+ gap: 4
243
+ },
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
+ ]
286
+ }
287
+ ),
288
+ /* @__PURE__ */ jsx("div", { style: { fontSize: 10, color: "#888", marginTop: 2 } })
289
+ ]
290
+ },
291
+ msg.$index
292
+ ),
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
310
+ },
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
+ ] })
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
+ ),
344
+ /* @__PURE__ */ jsx("div", { ref: messagesEndRef })
345
+ ] }),
346
+ /* @__PURE__ */ jsxs(
347
+ "form",
348
+ {
349
+ onSubmit: handleSend,
350
+ style: {
351
+ borderTop: "1px solid #eee",
352
+ display: "flex",
353
+ gap: 8
354
+ },
355
+ children: [
356
+ /* @__PURE__ */ jsx(
357
+ "input",
358
+ {
359
+ type: "text",
360
+ value: input,
361
+ onChange: (e) => setInput(e.target.value),
362
+ placeholder: "Ask something...",
363
+ className: inputStyle,
364
+ autoFocus: true,
365
+ disabled: inputDisabled || status !== "connected"
366
+ }
367
+ ),
368
+ /* @__PURE__ */ jsx(
369
+ "button",
370
+ {
371
+ className: clsx(sendButtonStyle, input.trim().length > 0 && "active"),
372
+ type: "submit",
373
+ disabled: inputDisabled || status !== "connected" || !input.trim(),
374
+ children: /* @__PURE__ */ jsxs(
375
+ "svg",
376
+ {
377
+ xmlns: "http://www.w3.org/2000/svg",
378
+ id: "send-icon",
379
+ width: 24,
380
+ height: 24,
381
+ children: [
382
+ /* @__PURE__ */ jsx("path", { d: "M2.01 21L23 12 2.01 3 2 10l15 2-15 2z" }),
383
+ /* @__PURE__ */ jsx("path", { d: "M0 0h24v24H0z", fill: "none" })
384
+ ]
385
+ }
386
+ )
387
+ }
388
+ )
389
+ ]
390
+ }
391
+ )
392
+ ] });
393
+ };
394
+ export {
395
+ ChatWindow
396
+ };
@@ -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,5 @@
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;
@@ -0,0 +1,42 @@
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 { useHeadlessChat } from "./useHeadlessChat.js";
10
+ const Chatbot = (props) => {
11
+ const messages = useMessages((state) => state.messages);
12
+ const close = useOpenChat((state) => state.close);
13
+ const { status, sendMessage, showReconnect, endChat, virtualAgent } = useHeadlessChat({
14
+ companyId: process.env.CCAI_COMPANY_ID || "",
15
+ tenant: process.env.CCAI_TENANT_NAME || "",
16
+ host: process.env.CCAI_HOST || "",
17
+ // or your region
18
+ projectId: process.env.CCAI_PROJECT_ID || props.project || "axos",
19
+ getToken: authenticate,
20
+ debug: props.debug || process.env.NODE_ENV === "development"
21
+ });
22
+ return /* @__PURE__ */ jsxs("div", { className: props.project === "ufb" ? chatbotUFB : chatbotAXB, children: [
23
+ /* @__PURE__ */ jsx(Bubble, {}),
24
+ /* @__PURE__ */ jsx(
25
+ ChatWindow,
26
+ {
27
+ status,
28
+ onClose: close,
29
+ messages,
30
+ onSend: function(msg) {
31
+ sendMessage(msg);
32
+ },
33
+ endChat,
34
+ virtualAgent,
35
+ showReconnect
36
+ }
37
+ )
38
+ ] });
39
+ };
40
+ export {
41
+ Chatbot
42
+ };
@@ -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,9 @@
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';
9
+ export * from './useHeadlessChat';
@@ -0,0 +1,40 @@
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
+ import { useHeadlessChat } from "./useHeadlessChat.js";
11
+ export {
12
+ Bubble,
13
+ ChatWindow,
14
+ Chatbot,
15
+ arrowFill,
16
+ bubbleWrapper,
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,
28
+ inputStyle,
29
+ messageStyle,
30
+ messagesContainerStyle,
31
+ notificationStyle,
32
+ sendButtonStyle,
33
+ svgFill,
34
+ useHeadlessChat,
35
+ useMessages,
36
+ useOpenChat,
37
+ windowBarStyle,
38
+ windowOpenStyle,
39
+ windowStyle
40
+ };
@@ -0,0 +1,9 @@
1
+ interface OpenChatState {
2
+ isOpen: boolean;
3
+ toggle: () => void;
4
+ open: () => void;
5
+ close: () => void;
6
+ reset: () => void;
7
+ }
8
+ export declare const useOpenChat: import('zustand').UseBoundStore<import('zustand').StoreApi<OpenChatState>>;
9
+ export {};
@@ -0,0 +1,11 @@
1
+ import { create } from "zustand";
2
+ const useOpenChat = create((set) => ({
3
+ isOpen: false,
4
+ toggle: () => set((state) => ({ isOpen: !state.isOpen })),
5
+ open: () => set({ isOpen: true }),
6
+ close: () => set({ isOpen: false }),
7
+ reset: () => set({ isOpen: false })
8
+ }));
9
+ export {
10
+ useOpenChat
11
+ };
@@ -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,26 @@
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
+ }
12
+ export interface ChatMessage {
13
+ id: string;
14
+ body: string;
15
+ sender?: string;
16
+ timestamp?: string;
17
+ }
18
+ export declare function useHeadlessChat({ companyId, tenant, host, getToken, projectId, debug, }: UseHeadlessChatOptions): {
19
+ status: "error" | "idle" | "connected" | "connecting" | "finished";
20
+ sendMessage: (body: string) => Promise<void>;
21
+ showReconnect: boolean;
22
+ setShowReconnect: import('react').Dispatch<import('react').SetStateAction<boolean>>;
23
+ endChat: () => Promise<void>;
24
+ virtualAgent: any;
25
+ };
26
+ export {};