@axos-web-dev/shared-components 1.0.77-patch.29 → 1.0.77-patch.31

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 (41) hide show
  1. package/dist/Chatbot/Bubble.css.d.ts +2 -0
  2. package/dist/Chatbot/Bubble.css.js +8 -0
  3. package/dist/Chatbot/Bubble.d.ts +3 -0
  4. package/dist/Chatbot/Bubble.js +100 -0
  5. package/dist/Chatbot/Chat.d.ts +1 -0
  6. package/dist/Chatbot/Chat.js +165 -0
  7. package/dist/Chatbot/ChatWindow.css.d.ts +18 -0
  8. package/dist/Chatbot/ChatWindow.css.js +39 -0
  9. package/dist/Chatbot/ChatWindow.d.ts +30 -0
  10. package/dist/Chatbot/ChatWindow.js +397 -0
  11. package/dist/Chatbot/Chatbot.css.d.ts +2 -0
  12. package/dist/Chatbot/Chatbot.css.js +6 -0
  13. package/dist/Chatbot/Chatbot.css.ts.vanilla.css.js +1 -0
  14. package/dist/Chatbot/Chatbot.d.ts +5 -0
  15. package/dist/Chatbot/Chatbot.js +42 -0
  16. package/dist/Chatbot/EllipsisIcon.d.ts +4 -0
  17. package/dist/Chatbot/EllipsisIcon.js +19 -0
  18. package/dist/Chatbot/authenticate.d.ts +3 -0
  19. package/dist/Chatbot/authenticate.js +16 -0
  20. package/dist/Chatbot/index.d.ts +9 -0
  21. package/dist/Chatbot/index.js +40 -0
  22. package/dist/Chatbot/store/chat.d.ts +9 -0
  23. package/dist/Chatbot/store/chat.js +11 -0
  24. package/dist/Chatbot/store/messages.d.ts +15 -0
  25. package/dist/Chatbot/store/messages.js +13 -0
  26. package/dist/Chatbot/useHeadlessChat.d.ts +27 -0
  27. package/dist/Chatbot/useHeadlessChat.js +240 -0
  28. package/dist/Forms/CommercialDepositsNoLendingOption.d.ts +16 -0
  29. package/dist/Forms/CommercialDepositsNoLendingOption.js +330 -0
  30. package/dist/Forms/index.d.ts +1 -0
  31. package/dist/Forms/index.js +2 -0
  32. package/dist/StepItemSet/StepItemSet.css.d.ts +1 -0
  33. package/dist/StepItemSet/StepItemSet.css.js +9 -5
  34. package/dist/StepItemSet/StepItemSet.d.ts +6 -0
  35. package/dist/StepItemSet/StepItemSet.js +22 -3
  36. package/dist/StepItemSet/index.js +2 -1
  37. package/dist/assets/Chatbot/Bubble.css +51 -0
  38. package/dist/assets/Chatbot/ChatWindow.css +213 -0
  39. package/dist/assets/StepItemSet/StepItemSet.css +27 -10
  40. package/dist/main.js +4 -1
  41. package/package.json +3 -1
@@ -0,0 +1,397 @@
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
+ showAvatar = false
23
+ }) => {
24
+ const [mounted, setMounted] = React.useState(false);
25
+ const [menuOpen, setMenuOpen] = React.useState(false);
26
+ const [showEndChatDialog, setShowEndChatDialog] = React.useState(false);
27
+ const state = useNetworkState();
28
+ const [input, setInput] = React.useState("");
29
+ const messagesEndRef = useRef(null);
30
+ const isOpen = useOpenChat((state2) => state2.isOpen);
31
+ useEffect(() => {
32
+ messagesEndRef.current?.scrollIntoView({ behavior: "smooth" });
33
+ }, [messages]);
34
+ const handleSend = (e) => {
35
+ e.preventDefault();
36
+ if (input.trim()) {
37
+ onSend(input);
38
+ setInput("");
39
+ }
40
+ };
41
+ useMount(() => {
42
+ setMounted(true);
43
+ });
44
+ const project = process.env.CCAI_PROJECT_ID;
45
+ const isAxos = project === "axos";
46
+ const endUserBg = isAxos ? "#14263d" : "#323339";
47
+ const chatbotBg = isAxos ? "#E9F8FF" : "#EAE8E8";
48
+ return /* @__PURE__ */ jsxs("div", { className: clsx(windowStyle, isOpen && windowOpenStyle), children: [
49
+ /* @__PURE__ */ jsxs("div", { className: windowBarStyle, children: [
50
+ /* @__PURE__ */ jsxs("div", { className: "flex middle", style: { paddingBlock: "6px" }, children: [
51
+ /* @__PURE__ */ jsx(
52
+ "img",
53
+ {
54
+ src: "https://www.axos.com/images/2xmVfQm5l0HWOKjgxQO1Iw/axb-assistant.svg",
55
+ style: { marginRight: 12 },
56
+ height: 18,
57
+ width: 18
58
+ }
59
+ ),
60
+ /* @__PURE__ */ jsx("h2", { className: chat_title, children: "Evo Virtual Assistant" })
61
+ ] }),
62
+ /* @__PURE__ */ jsx(
63
+ "button",
64
+ {
65
+ onClick: () => {
66
+ setMenuOpen(!menuOpen);
67
+ },
68
+ style: {
69
+ border: "none",
70
+ background: "transparent",
71
+ marginLeft: "auto",
72
+ cursor: "pointer",
73
+ padding: 0,
74
+ display: "flex",
75
+ alignContent: "center"
76
+ },
77
+ children: /* @__PURE__ */ jsx(EllipsisIcon, { color: "#fff" })
78
+ }
79
+ ),
80
+ menuOpen && /* @__PURE__ */ jsx("ul", { className: clsx(chatbotMenu), children: /* @__PURE__ */ jsx("li", { className: chatbotMenuItem, children: /* @__PURE__ */ jsx(
81
+ "button",
82
+ {
83
+ type: "button",
84
+ onClick: () => {
85
+ setShowEndChatDialog(true);
86
+ setMenuOpen(false);
87
+ },
88
+ style: { width: "100%" },
89
+ children: "Finish chat"
90
+ }
91
+ ) }) }),
92
+ showEndChatDialog && /* @__PURE__ */ jsxs(Fragment, { children: [
93
+ /* @__PURE__ */ jsx(
94
+ "div",
95
+ {
96
+ style: {
97
+ background: "#00000080",
98
+ position: "fixed",
99
+ top: 0,
100
+ left: 0,
101
+ right: 0,
102
+ bottom: 0,
103
+ zIndex: 999,
104
+ opacity: 0.75
105
+ }
106
+ }
107
+ ),
108
+ /* @__PURE__ */ jsx(
109
+ "dialog",
110
+ {
111
+ open: showEndChatDialog,
112
+ style: {
113
+ padding: "1rem",
114
+ borderRadius: 8,
115
+ background: "#fff",
116
+ color: "#000",
117
+ border: `1px solid ${endUserBg}`,
118
+ outline: "none",
119
+ maxWidth: "90%",
120
+ top: "25%",
121
+ marginInline: "auto",
122
+ zIndex: 1e3
123
+ },
124
+ children: /* @__PURE__ */ jsxs("form", { method: "dialog", className: chatFinishDialog, children: [
125
+ /* @__PURE__ */ jsx("p", { children: "Are you sure you want to end this chat?" }),
126
+ /* @__PURE__ */ jsxs(
127
+ "div",
128
+ {
129
+ style: { display: "flex", gap: "1rem", marginTop: "1rem" },
130
+ children: [
131
+ /* @__PURE__ */ jsx(
132
+ "button",
133
+ {
134
+ className: endChatButtonStyle,
135
+ type: "submit",
136
+ onClick: () => {
137
+ endChat();
138
+ setShowEndChatDialog(false);
139
+ },
140
+ children: "Yes"
141
+ }
142
+ ),
143
+ /* @__PURE__ */ jsx(
144
+ "button",
145
+ {
146
+ className: endChatButtonStyle,
147
+ type: "button",
148
+ onClick: () => {
149
+ setShowEndChatDialog(false);
150
+ },
151
+ children: "No"
152
+ }
153
+ )
154
+ ]
155
+ }
156
+ )
157
+ ] })
158
+ }
159
+ )
160
+ ] }),
161
+ onClose && /* @__PURE__ */ jsx(
162
+ "button",
163
+ {
164
+ onClick: onClose,
165
+ className: button_reset,
166
+ "aria-label": "Close chat",
167
+ title: "Close",
168
+ children: /* @__PURE__ */ jsx(
169
+ "svg",
170
+ {
171
+ xmlns: "http://www.w3.org/2000/svg",
172
+ width: "24",
173
+ height: "24",
174
+ viewBox: "0 0 24 24",
175
+ fill: "none",
176
+ children: /* @__PURE__ */ jsx(
177
+ "path",
178
+ {
179
+ className: arrowFill,
180
+ d: "M2.46875 7.76574L11.9991 17.2961L21.5294 7.76574L20.4687 6.70508L11.9991 15.1749L3.52941 6.70508L2.46875 7.76574Z",
181
+ fill: "#98DDFF"
182
+ }
183
+ )
184
+ }
185
+ )
186
+ }
187
+ )
188
+ ] }),
189
+ mounted && !state.online ? /* @__PURE__ */ jsx("div", { className: clsx(chatNetworkStatus), children: /* @__PURE__ */ jsxs(
190
+ "div",
191
+ {
192
+ style: {
193
+ color: "#d32f2f",
194
+ textAlign: "center",
195
+ padding: "8px 0",
196
+ fontWeight: 500
197
+ },
198
+ children: [
199
+ /* @__PURE__ */ jsx(
200
+ "span",
201
+ {
202
+ role: "img",
203
+ "aria-label": "disconnected",
204
+ style: { marginRight: 6 },
205
+ children: "⚠️"
206
+ }
207
+ ),
208
+ "You are currently disconnected. Please check your connection."
209
+ ]
210
+ }
211
+ ) }) : null,
212
+ /* @__PURE__ */ jsxs("div", { className: clsx(messagesContainerStyle), children: [
213
+ messages?.map((msg) => /* @__PURE__ */ jsxs(Fragment$1, { children: [
214
+ 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),
215
+ msg.type == "noti" && msg.$userType == "system" && msg.event == "memberLeft" && /* @__PURE__ */ jsxs("div", { className: notificationStyle, children: [
216
+ /* @__PURE__ */ jsx("strong", { children: "Virtual Agent" }),
217
+ " just left the conversation."
218
+ ] }, msg.$index),
219
+ msg.type == "noti" && msg.$userType == "system" && msg.event == "escalationAccepted" && /* @__PURE__ */ jsxs("div", { className: notificationStyle, children: [
220
+ "You are now connected with a",
221
+ " ",
222
+ msg.to_agent ? /* @__PURE__ */ jsx("strong", { children: msg?.to_agent?.name }) : "an agent"
223
+ ] }, msg.$index),
224
+ ["text", "markdown_template", "markdown"].includes(msg.type) && /* @__PURE__ */ jsxs(
225
+ "div",
226
+ {
227
+ className: messageStyle,
228
+ style: {
229
+ textAlign: msg.$userType == "end_user" ? "right" : "left",
230
+ alignSelf: msg.$userType == "end_user" ? "flex-end" : "flex-start",
231
+ background: msg.$userType == "end_user" ? endUserBg : chatbotBg,
232
+ color: msg.$userType == "end_user" ? "#fff" : "#1F1F1F",
233
+ boxShadow: msg.$userType == "end_user" ? "0 1px 4px #b3e0ff55" : void 0
234
+ },
235
+ children: [
236
+ /* @__PURE__ */ jsxs(
237
+ "div",
238
+ {
239
+ style: {
240
+ fontSize: 13,
241
+ display: "flex",
242
+ flexDirection: "column",
243
+ gap: 4
244
+ },
245
+ children: [
246
+ msg.$userType == "virtual_agent" && /* @__PURE__ */ jsxs(
247
+ "div",
248
+ {
249
+ style: {
250
+ display: "flex",
251
+ // justifyContent: "center",
252
+ alignItems: "center",
253
+ gap: "8px"
254
+ },
255
+ children: [
256
+ showAvatar && /* @__PURE__ */ jsx(
257
+ "img",
258
+ {
259
+ width: 24,
260
+ height: 24,
261
+ src: virtualAgent?.avatar_url,
262
+ alt: "agent avatar"
263
+ }
264
+ ),
265
+ /* @__PURE__ */ jsx("strong", { children: virtualAgent?.name })
266
+ ]
267
+ }
268
+ ),
269
+ /* @__PURE__ */ jsx(
270
+ ReactMarkdown,
271
+ {
272
+ remarkPlugins: [[remarkGfm, { singleTilde: false }]],
273
+ components: {
274
+ p: ({ ...props }) => /* @__PURE__ */ jsx(
275
+ "p",
276
+ {
277
+ style: { margin: 0, fontSize: "inherit" },
278
+ title: new Date(msg.$timestamp).toLocaleString(),
279
+ ...props
280
+ }
281
+ )
282
+ },
283
+ children: msg.content
284
+ }
285
+ )
286
+ ]
287
+ }
288
+ ),
289
+ /* @__PURE__ */ jsx("div", { style: { fontSize: 10, color: "#888", marginTop: 2 } })
290
+ ]
291
+ },
292
+ msg.$index
293
+ ),
294
+ 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) => {
295
+ const lastItem = msg.buttons && msg.buttons?.length - 1;
296
+ return /* @__PURE__ */ jsx(
297
+ "button",
298
+ {
299
+ className: inline_button,
300
+ style: {
301
+ borderRadius: "0px",
302
+ borderTopLeftRadius: [0].includes(index) ? 8 : 0,
303
+ borderTopRightRadius: [0].includes(index) ? 8 : 0,
304
+ borderBottomLeftRadius: [lastItem].includes(index) ? 8 : 0,
305
+ borderBottomRightRadius: [lastItem].includes(index) ? 8 : 0
306
+ },
307
+ onClick: () => {
308
+ onSend(button?.title);
309
+ },
310
+ children: button.title
311
+ },
312
+ index
313
+ );
314
+ }) }),
315
+ msg.event == "chatEnded" && /* @__PURE__ */ jsxs(Fragment, { children: [
316
+ /* @__PURE__ */ jsxs(
317
+ "div",
318
+ {
319
+ title: (/* @__PURE__ */ new Date()).toLocaleString(),
320
+ style: {
321
+ fontSize: 12,
322
+ color: "#888",
323
+ marginBottom: 4,
324
+ textAlign: "center"
325
+ },
326
+ children: [
327
+ "Thank you for chatting!",
328
+ /* @__PURE__ */ jsx("br", {}),
329
+ " This conversation has ended."
330
+ ]
331
+ }
332
+ ),
333
+ /* @__PURE__ */ jsx("div", { style: { textAlign: "center", marginBottom: 12 }, children: /* @__PURE__ */ jsx("button", { className: endChatButtonStyle, onClick: endChat, children: "End Chat" }) })
334
+ ] })
335
+ ] }, msg.$index)),
336
+ showReconnect && /* @__PURE__ */ jsx(
337
+ "button",
338
+ {
339
+ style: { margin: "12px auto", display: "block" },
340
+ onClick: () => {
341
+ },
342
+ children: "Reconnect Chat"
343
+ }
344
+ ),
345
+ /* @__PURE__ */ jsx("div", { ref: messagesEndRef })
346
+ ] }),
347
+ /* @__PURE__ */ jsxs(
348
+ "form",
349
+ {
350
+ onSubmit: handleSend,
351
+ style: {
352
+ borderTop: "1px solid #eee",
353
+ display: "flex",
354
+ gap: 8
355
+ },
356
+ children: [
357
+ /* @__PURE__ */ jsx(
358
+ "input",
359
+ {
360
+ type: "text",
361
+ value: input,
362
+ onChange: (e) => setInput(e.target.value),
363
+ placeholder: "Ask something...",
364
+ className: inputStyle,
365
+ autoFocus: true,
366
+ disabled: inputDisabled || status !== "connected"
367
+ }
368
+ ),
369
+ /* @__PURE__ */ jsx(
370
+ "button",
371
+ {
372
+ className: clsx(sendButtonStyle, input.trim().length > 0 && "active"),
373
+ type: "submit",
374
+ disabled: inputDisabled || status !== "connected" || !input.trim(),
375
+ children: /* @__PURE__ */ jsxs(
376
+ "svg",
377
+ {
378
+ xmlns: "http://www.w3.org/2000/svg",
379
+ id: "send-icon",
380
+ width: 24,
381
+ height: 24,
382
+ children: [
383
+ /* @__PURE__ */ jsx("path", { d: "M2.01 21L23 12 2.01 3 2 10l15 2-15 2z" }),
384
+ /* @__PURE__ */ jsx("path", { d: "M0 0h24v24H0z", fill: "none" })
385
+ ]
386
+ }
387
+ )
388
+ }
389
+ )
390
+ ]
391
+ }
392
+ )
393
+ ] });
394
+ };
395
+ export {
396
+ ChatWindow
397
+ };
@@ -0,0 +1,2 @@
1
+ export declare const chatbotAXB: string;
2
+ export declare const chatbotUFB: string;
@@ -0,0 +1,6 @@
1
+ var chatbotAXB = "_1hpv6vm0";
2
+ var chatbotUFB = "_1hpv6vm1";
3
+ export {
4
+ chatbotAXB,
5
+ chatbotUFB
6
+ };
@@ -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,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 {};