@axos-web-dev/shared-components 1.0.77-patch.32 → 1.0.77-patch.34
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.
- package/dist/ATMLocator/ATMLocator.js +1 -7
- package/dist/Auth/ErrorAlert.js +1 -7
- package/dist/Button/Button.js +1 -7
- package/dist/Calculators/ApyCalculator/index.js +11 -5
- package/dist/Calculators/Calculator.js +2 -8
- package/dist/Carousel/index.js +1 -7
- package/dist/Chevron/index.js +1 -7
- package/dist/Comparison/Comparison.js +1 -7
- package/dist/ExecutiveBio/ExecutiveBio.js +1 -7
- package/dist/FaqAccordion/index.js +1 -7
- package/dist/FooterSiteMap/AxosBank/FooterSiteMap.js +1 -7
- package/dist/Forms/ApplyNow.js +1 -7
- package/dist/Forms/ContactUsBusiness.js +1 -7
- package/dist/Forms/ContactUsBusinessNameEmail.js +1 -7
- package/dist/Forms/ContactUsNMLSId.js +1 -7
- package/dist/Forms/CraPublicFile.js +1 -7
- package/dist/Forms/EmailOnly.js +1 -7
- package/dist/Forms/MortgageRate/MortgageRateForm.js +1 -7
- package/dist/Forms/MortgageRate/MortgageRateWatch.js +1 -7
- package/dist/Forms/MortgageWarehouseLending.js +1 -7
- package/dist/Forms/SuccesForm.js +2 -8
- package/dist/Hyperlink/index.js +1 -7
- package/dist/ImageLink/ImageLink.js +1 -7
- package/dist/ImageLink/ImageLinkSet.js +1 -7
- package/dist/ImageLink/index.js +1 -7
- package/dist/Insight/Featured/CategorySelector.js +1 -7
- package/dist/Insight/Featured/Featured.js +1 -7
- package/dist/Insight/Featured/Header.js +1 -7
- package/dist/Modal/Modal.js +1 -7
- package/dist/NavigationMenu/AxosALTS/NavData.js +1 -7
- package/dist/NavigationMenu/AxosALTS/index.js +1 -7
- package/dist/NavigationMenu/AxosBank/MobileMenu/MobileNavData.d.ts +1 -1
- package/dist/NavigationMenu/AxosBank/MobileMenu/MobileNavData.js +2 -8
- package/dist/NavigationMenu/AxosBank/NavData.js +1 -7
- package/dist/NavigationMenu/AxosBank/SubNavBar.js +2 -8
- package/dist/NavigationMenu/AxosBank/index.js +1 -7
- package/dist/NavigationMenu/LaVictoire/NavData.js +1 -7
- package/dist/NavigationMenu/LaVictoire/index.js +1 -7
- package/dist/SetContainer/SetContainer.js +1 -7
- package/dist/SocialMediaBar/iconsRepository.js +1 -7
- package/dist/VideoTile/VideoTile.js +1 -7
- package/dist/VideoWrapper/index.js +1 -7
- package/dist/assets/TopicalNavItem/TopicalNavItem.css +2 -2
- package/dist/main.d.ts +0 -1
- package/dist/main.js +0 -37
- package/package.json +1 -3
- package/dist/Chatbot/Bubble.css.d.ts +0 -2
- package/dist/Chatbot/Bubble.css.js +0 -7
- package/dist/Chatbot/Bubble.d.ts +0 -3
- package/dist/Chatbot/Bubble.js +0 -100
- package/dist/Chatbot/Chat.d.ts +0 -1
- package/dist/Chatbot/Chat.js +0 -165
- package/dist/Chatbot/ChatWindow.css.d.ts +0 -18
- package/dist/Chatbot/ChatWindow.css.js +0 -39
- package/dist/Chatbot/ChatWindow.d.ts +0 -30
- package/dist/Chatbot/ChatWindow.js +0 -397
- package/dist/Chatbot/Chatbot.css.d.ts +0 -2
- package/dist/Chatbot/Chatbot.css.js +0 -7
- package/dist/Chatbot/Chatbot.css.ts.vanilla.css.js +0 -1
- package/dist/Chatbot/Chatbot.d.ts +0 -5
- package/dist/Chatbot/Chatbot.js +0 -42
- package/dist/Chatbot/EllipsisIcon.d.ts +0 -4
- package/dist/Chatbot/EllipsisIcon.js +0 -19
- package/dist/Chatbot/authenticate.d.ts +0 -3
- package/dist/Chatbot/authenticate.js +0 -16
- package/dist/Chatbot/index.d.ts +0 -9
- package/dist/Chatbot/index.js +0 -40
- package/dist/Chatbot/store/chat.d.ts +0 -9
- package/dist/Chatbot/store/chat.js +0 -11
- package/dist/Chatbot/store/messages.d.ts +0 -15
- package/dist/Chatbot/store/messages.js +0 -13
- package/dist/Chatbot/useHeadlessChat.d.ts +0 -27
- package/dist/Chatbot/useHeadlessChat.js +0 -240
- package/dist/assets/Chatbot/Bubble.css +0 -51
- package/dist/assets/Chatbot/ChatWindow.css +0 -213
|
@@ -1,397 +0,0 @@
|
|
|
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
|
-
};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
|
package/dist/Chatbot/Chatbot.js
DELETED
|
@@ -1,42 +0,0 @@
|
|
|
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
|
-
};
|
|
@@ -1,19 +0,0 @@
|
|
|
1
|
-
import { jsxs, jsx } from "react/jsx-runtime";
|
|
2
|
-
const EllipsisIcon = ({ size = 24, color = "currentColor" }) => /* @__PURE__ */ jsxs(
|
|
3
|
-
"svg",
|
|
4
|
-
{
|
|
5
|
-
width: size,
|
|
6
|
-
height: size,
|
|
7
|
-
viewBox: "0 0 24 24",
|
|
8
|
-
fill: "none",
|
|
9
|
-
"aria-hidden": "true",
|
|
10
|
-
children: [
|
|
11
|
-
/* @__PURE__ */ jsx("circle", { cx: "5", cy: "12", r: "2", fill: color }),
|
|
12
|
-
/* @__PURE__ */ jsx("circle", { cx: "12", cy: "12", r: "2", fill: color }),
|
|
13
|
-
/* @__PURE__ */ jsx("circle", { cx: "19", cy: "12", r: "2", fill: color })
|
|
14
|
-
]
|
|
15
|
-
}
|
|
16
|
-
);
|
|
17
|
-
export {
|
|
18
|
-
EllipsisIcon
|
|
19
|
-
};
|
|
@@ -1,16 +0,0 @@
|
|
|
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
|
-
};
|
package/dist/Chatbot/index.d.ts
DELETED
|
@@ -1,9 +0,0 @@
|
|
|
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';
|
package/dist/Chatbot/index.js
DELETED
|
@@ -1,40 +0,0 @@
|
|
|
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
|
-
};
|
|
@@ -1,11 +0,0 @@
|
|
|
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
|
-
};
|
|
@@ -1,15 +0,0 @@
|
|
|
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 {};
|
|
@@ -1,13 +0,0 @@
|
|
|
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
|
-
};
|
|
@@ -1,27 +0,0 @@
|
|
|
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 {};
|