@axos-web-dev/shared-components 1.0.77-patch.68 → 1.0.77-patch.69
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 +0 -1
- package/dist/Auth/ErrorAlert.js +0 -1
- package/dist/Button/Button.js +0 -1
- package/dist/Calculators/Calculator.js +1 -2
- package/dist/Carousel/index.js +0 -1
- package/dist/Chatbot/Bubble.d.ts +1 -0
- package/dist/Chatbot/ChatWindow.js +6 -1
- package/dist/Chatbot/Chatbot.d.ts +10 -2
- package/dist/Chatbot/Chatbot.js +67 -52
- package/dist/Chevron/index.js +0 -1
- package/dist/Comparison/Comparison.js +0 -1
- package/dist/ExecutiveBio/ExecutiveBio.js +0 -1
- package/dist/FaqAccordion/index.js +0 -1
- package/dist/FooterSiteMap/AxosBank/FooterSiteMap.js +0 -1
- package/dist/Forms/ApplyNow.js +0 -1
- package/dist/Forms/ContactUsBusiness.js +0 -1
- package/dist/Forms/ContactUsBusinessNameEmail.js +0 -1
- package/dist/Forms/ContactUsNMLSId.js +0 -1
- package/dist/Forms/CraPublicFile.js +0 -1
- package/dist/Forms/EmailOnly.js +0 -1
- package/dist/Forms/MortgageRate/MortgageRateForm.js +0 -1
- package/dist/Forms/MortgageRate/MortgageRateWatch.js +0 -1
- package/dist/Forms/MortgageWarehouseLending.js +0 -1
- package/dist/Forms/SuccesForm.js +1 -2
- package/dist/Hyperlink/index.js +0 -1
- package/dist/ImageLink/ImageLink.js +0 -1
- package/dist/ImageLink/ImageLinkSet.js +0 -1
- package/dist/ImageLink/index.js +0 -1
- package/dist/Insight/Featured/CategorySelector.js +0 -1
- package/dist/Insight/Featured/Featured.js +0 -1
- package/dist/Insight/Featured/Header.js +0 -1
- package/dist/Modal/Modal.js +0 -1
- package/dist/NavigationMenu/AxosALTS/NavData.js +0 -1
- package/dist/NavigationMenu/AxosALTS/index.js +0 -1
- package/dist/NavigationMenu/AxosBank/MobileMenu/MobileNavData.js +0 -1
- package/dist/NavigationMenu/AxosBank/NavData.js +0 -1
- package/dist/NavigationMenu/AxosBank/SubNavBar.js +0 -1
- package/dist/NavigationMenu/AxosBank/index.js +0 -1
- package/dist/NavigationMenu/LaVictoire/NavData.js +0 -1
- package/dist/NavigationMenu/LaVictoire/index.js +0 -1
- package/dist/NavigationMenu/NavDataJson.js +0 -1
- package/dist/NavigationMenu/Navbar.js +0 -1
- package/dist/NavigationMenu/SignInNavButton.js +0 -1
- package/dist/SetContainer/SetContainer.js +0 -1
- package/dist/SocialMediaBar/iconsRepository.js +0 -1
- package/dist/VideoTile/VideoTile.js +0 -1
- package/dist/VideoWrapper/index.js +0 -1
- package/package.json +1 -1
package/dist/Auth/ErrorAlert.js
CHANGED
package/dist/Button/Button.js
CHANGED
|
@@ -53,9 +53,8 @@ import "../Carousel/index.js";
|
|
|
53
53
|
/* empty css */
|
|
54
54
|
/* empty css */
|
|
55
55
|
import "../Chatbot/store/chat.js";
|
|
56
|
-
import "../Chatbot/authenticate.js";
|
|
57
|
-
/* empty css */
|
|
58
56
|
import "react-use";
|
|
57
|
+
/* empty css */
|
|
59
58
|
/* empty css */
|
|
60
59
|
import "../Chatbot/store/messages.js";
|
|
61
60
|
/* empty css */
|
package/dist/Carousel/index.js
CHANGED
package/dist/Chatbot/Bubble.d.ts
CHANGED
|
@@ -96,6 +96,11 @@ const ChatWindow = ({
|
|
|
96
96
|
setInput("");
|
|
97
97
|
toggleThankyouMessage?.();
|
|
98
98
|
};
|
|
99
|
+
useEffect(() => {
|
|
100
|
+
if (inputRef.current) {
|
|
101
|
+
inputRef.current.focus();
|
|
102
|
+
}
|
|
103
|
+
}, [messages]);
|
|
99
104
|
return /* @__PURE__ */ jsxs("div", { className: clsx(windowStyle, isOpen && windowOpenStyle), children: [
|
|
100
105
|
/* @__PURE__ */ jsxs("div", { className: windowBarStyle, children: [
|
|
101
106
|
/* @__PURE__ */ jsx("div", { className: clsx(left_bar_section) }),
|
|
@@ -415,7 +420,7 @@ const ChatWindow = ({
|
|
|
415
420
|
flexDirection: "column",
|
|
416
421
|
gap: 4
|
|
417
422
|
},
|
|
418
|
-
children: /* @__PURE__ */ jsx("p", { className: shimmerText, children: "
|
|
423
|
+
children: /* @__PURE__ */ jsx("p", { className: shimmerText, children: "Chat connecting..." })
|
|
419
424
|
}
|
|
420
425
|
)
|
|
421
426
|
}
|
|
@@ -2,9 +2,17 @@ export type ChatbotProps = {
|
|
|
2
2
|
project?: "axos" | "ufb";
|
|
3
3
|
debug?: boolean;
|
|
4
4
|
};
|
|
5
|
-
|
|
6
|
-
|
|
5
|
+
type InitalizeChatbot = {
|
|
6
|
+
companyId: string;
|
|
7
|
+
tenantName: string;
|
|
8
|
+
host: string;
|
|
9
|
+
authUrl: string;
|
|
10
|
+
};
|
|
11
|
+
export declare const Chatbot: ({ project, projectEnv, menuOption, config, }: {
|
|
12
|
+
project?: "axos" | "ufb" | "Axos" | "Ufb";
|
|
7
13
|
projectEnv?: "dev" | "qa" | "uat" | "stg" | "prod";
|
|
8
14
|
menuOption?: "Support Virtual Agent" | string;
|
|
9
15
|
debug?: boolean;
|
|
16
|
+
config: InitalizeChatbot;
|
|
10
17
|
}) => false | import("react/jsx-runtime").JSX.Element;
|
|
18
|
+
export {};
|
package/dist/Chatbot/Chatbot.js
CHANGED
|
@@ -1,18 +1,17 @@
|
|
|
1
1
|
"use client";
|
|
2
2
|
import { jsxs, jsx } from "react/jsx-runtime";
|
|
3
|
-
import {
|
|
3
|
+
import { useRef, useState, useEffect } from "react";
|
|
4
|
+
import { useMount, useUnmount } from "react-use";
|
|
4
5
|
import { Bubble } from "./Bubble.js";
|
|
5
|
-
import {
|
|
6
|
+
import { chatbotAXB, chatbotUFB } from "./Chatbot.css.js";
|
|
6
7
|
import { ChatWindow } from "./ChatWindow.js";
|
|
7
8
|
import { useOpenChat } from "./store/chat.js";
|
|
8
9
|
import { useMessages } from "./store/messages.js";
|
|
9
|
-
import { useRef, useState, useEffect } from "react";
|
|
10
|
-
import { useMount, useUnmount } from "react-use";
|
|
11
10
|
const Chatbot = ({
|
|
12
11
|
project = "axos",
|
|
13
12
|
projectEnv = "dev",
|
|
14
13
|
menuOption = "Support Virtual Agent",
|
|
15
|
-
|
|
14
|
+
config
|
|
16
15
|
}) => {
|
|
17
16
|
const {
|
|
18
17
|
hasOpenedOnce,
|
|
@@ -28,13 +27,11 @@ const Chatbot = ({
|
|
|
28
27
|
const clientRef = useRef(null);
|
|
29
28
|
const menuRef = useRef(null);
|
|
30
29
|
const isMountedRef = useRef(false);
|
|
31
|
-
const hasLoadedBefore = useRef(true);
|
|
32
30
|
const chatRef = useRef(null);
|
|
33
31
|
const agent_virtual = useRef(null);
|
|
34
32
|
const [status, setStatus] = useState("idle");
|
|
35
33
|
const [hasStarted, setHasStarted] = useState(false);
|
|
36
34
|
const [menusLoaded, setMenusLoaded] = useState(false);
|
|
37
|
-
const [pendingStart, setPendingStart] = useState(false);
|
|
38
35
|
const [isTyping, setIsTyping] = useState(false);
|
|
39
36
|
const [scalationStarted, setScalationStarted] = useState(false);
|
|
40
37
|
useEffect(() => {
|
|
@@ -89,6 +86,9 @@ const Chatbot = ({
|
|
|
89
86
|
menuRef.current = await clientRef.current.getMenus();
|
|
90
87
|
setMenusLoaded(true);
|
|
91
88
|
console.log("menus:", menuRef.current);
|
|
89
|
+
if (menuRef.current !== null) {
|
|
90
|
+
await startChat();
|
|
91
|
+
}
|
|
92
92
|
}
|
|
93
93
|
};
|
|
94
94
|
const onAuthenticatedHandler = async () => {
|
|
@@ -219,20 +219,27 @@ const Chatbot = ({
|
|
|
219
219
|
clientRef.current?.off("chat.connected", onChatConnectedHandler);
|
|
220
220
|
};
|
|
221
221
|
const createClient = async () => {
|
|
222
|
-
const { Client
|
|
223
|
-
if (projectEnv !== "prod" || debug) {
|
|
224
|
-
Logger.addHandler(consoleLoggerHandler);
|
|
225
|
-
}
|
|
222
|
+
const { Client } = await import("@ujet/websdk-headless");
|
|
226
223
|
if (clientRef.current) return;
|
|
224
|
+
console.log({
|
|
225
|
+
config
|
|
226
|
+
});
|
|
227
227
|
const client = new Client({
|
|
228
|
-
companyId:
|
|
229
|
-
tenant:
|
|
230
|
-
host:
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
228
|
+
companyId: config.companyId,
|
|
229
|
+
tenant: config.tenantName,
|
|
230
|
+
host: config.host,
|
|
231
|
+
authenticate: async () => {
|
|
232
|
+
const res = await fetch(config.authUrl, {
|
|
233
|
+
method: "GET",
|
|
234
|
+
headers: {
|
|
235
|
+
"Content-Type": "application/json"
|
|
236
|
+
}
|
|
237
|
+
});
|
|
238
|
+
const data = await res.json();
|
|
239
|
+
return {
|
|
240
|
+
token: data.token
|
|
241
|
+
};
|
|
242
|
+
}
|
|
236
243
|
});
|
|
237
244
|
client?.on("ready", onReadyHandler);
|
|
238
245
|
client?.on("authenticated", onAuthenticatedHandler);
|
|
@@ -242,9 +249,10 @@ const Chatbot = ({
|
|
|
242
249
|
return;
|
|
243
250
|
};
|
|
244
251
|
const startChat = async () => {
|
|
245
|
-
console.log("Starting chat");
|
|
252
|
+
console.log("Starting chat", chatRef.current);
|
|
246
253
|
const client = clientRef.current;
|
|
247
254
|
if (!client) return;
|
|
255
|
+
if (hasStarted) return;
|
|
248
256
|
if (!menuRef.current || !menuRef.current.menus) {
|
|
249
257
|
let waited = 0;
|
|
250
258
|
while ((!menuRef.current || !menuRef.current.menus) && waited < 5e3) {
|
|
@@ -257,19 +265,26 @@ const Chatbot = ({
|
|
|
257
265
|
}
|
|
258
266
|
}
|
|
259
267
|
try {
|
|
268
|
+
console.log("menus: ->", menuRef.current);
|
|
260
269
|
const ongoingChat = await client.loadOngoingChat();
|
|
270
|
+
console.log("theres a ongoing chat?: -->", ongoingChat);
|
|
261
271
|
if (ongoingChat) {
|
|
262
272
|
console.log("Ongoing chat found:", ongoingChat);
|
|
263
273
|
console.log("Resuming chat:", ongoingChat.id);
|
|
264
|
-
chatRef.current =
|
|
274
|
+
chatRef.current = ongoingChat;
|
|
265
275
|
agent_virtual.current = ongoingChat.agent;
|
|
266
276
|
return;
|
|
267
277
|
}
|
|
278
|
+
console.log("not ongoing chat ");
|
|
279
|
+
console.log(!!ongoingChat);
|
|
268
280
|
const foundMenu = menuRef.current.menus.find(
|
|
269
281
|
(menu) => menu.name === menuOption
|
|
270
282
|
);
|
|
271
283
|
const menuId = foundMenu && foundMenu.id;
|
|
272
284
|
console.log("Creating new chat with menu ID:", menuId);
|
|
285
|
+
if (!foundMenu) {
|
|
286
|
+
throw new Error("Menu not found: " + menuOption);
|
|
287
|
+
}
|
|
273
288
|
const newChat = await client.createChat(menuId, { custom_data });
|
|
274
289
|
if (newChat !== null) {
|
|
275
290
|
chatRef.current = newChat;
|
|
@@ -278,15 +293,13 @@ const Chatbot = ({
|
|
|
278
293
|
}
|
|
279
294
|
} catch (err) {
|
|
280
295
|
console.error("Error creating chat:", err);
|
|
296
|
+
} finally {
|
|
297
|
+
setHasStarted(true);
|
|
281
298
|
}
|
|
282
299
|
};
|
|
283
300
|
const handleClick = async () => {
|
|
284
301
|
toggle();
|
|
285
302
|
if (hasStarted) return;
|
|
286
|
-
if (!menusLoaded) {
|
|
287
|
-
setPendingStart(true);
|
|
288
|
-
return;
|
|
289
|
-
}
|
|
290
303
|
if (!hasOpenedOnce) {
|
|
291
304
|
await startChat();
|
|
292
305
|
setHasStarted(true);
|
|
@@ -327,17 +340,9 @@ const Chatbot = ({
|
|
|
327
340
|
isMountedRef.current = true;
|
|
328
341
|
await createClient();
|
|
329
342
|
});
|
|
330
|
-
useEffect(() => {
|
|
331
|
-
if (menusLoaded && pendingStart && !hasStarted) {
|
|
332
|
-
startChat();
|
|
333
|
-
setPendingStart(false);
|
|
334
|
-
}
|
|
335
|
-
}, [menusLoaded, pendingStart, hasStarted]);
|
|
336
343
|
useUnmount(() => {
|
|
337
344
|
console.log("Chatbot unmounted");
|
|
338
345
|
deregisterEventHandlers();
|
|
339
|
-
isMountedRef.current = false;
|
|
340
|
-
hasLoadedBefore.current = true;
|
|
341
346
|
reset();
|
|
342
347
|
setHasStarted(false);
|
|
343
348
|
setStatus("idle");
|
|
@@ -350,9 +355,13 @@ const Chatbot = ({
|
|
|
350
355
|
const onClose = () => {
|
|
351
356
|
toggle();
|
|
352
357
|
};
|
|
353
|
-
const
|
|
358
|
+
const newChatSession = async () => {
|
|
359
|
+
console.log("create new session");
|
|
360
|
+
};
|
|
361
|
+
const onCloseAfterThankYou = async () => {
|
|
354
362
|
reset();
|
|
355
363
|
setHasStarted(false);
|
|
364
|
+
newChatSession();
|
|
356
365
|
};
|
|
357
366
|
const onPreviewTyping = async (msg) => {
|
|
358
367
|
console.log("Preview typing message:", msg);
|
|
@@ -365,24 +374,30 @@ const Chatbot = ({
|
|
|
365
374
|
console.error("Error sending preview message:", error);
|
|
366
375
|
}
|
|
367
376
|
};
|
|
368
|
-
return menusLoaded && /* @__PURE__ */ jsxs(
|
|
369
|
-
|
|
370
|
-
|
|
371
|
-
|
|
372
|
-
|
|
373
|
-
|
|
374
|
-
|
|
375
|
-
|
|
376
|
-
|
|
377
|
-
|
|
378
|
-
|
|
379
|
-
|
|
380
|
-
|
|
381
|
-
|
|
382
|
-
|
|
383
|
-
|
|
384
|
-
|
|
385
|
-
|
|
377
|
+
return menusLoaded && /* @__PURE__ */ jsxs(
|
|
378
|
+
"div",
|
|
379
|
+
{
|
|
380
|
+
className: ["axos", "Axos"].includes(project) ? chatbotAXB : chatbotUFB,
|
|
381
|
+
children: [
|
|
382
|
+
/* @__PURE__ */ jsx(Bubble, { onClick: handleClick, project }),
|
|
383
|
+
/* @__PURE__ */ jsx(
|
|
384
|
+
ChatWindow,
|
|
385
|
+
{
|
|
386
|
+
status,
|
|
387
|
+
virtualAgent: agent_virtual.current,
|
|
388
|
+
messages,
|
|
389
|
+
onSend: onSendMessage,
|
|
390
|
+
endChat: onEndChat,
|
|
391
|
+
onClose,
|
|
392
|
+
onNewChat: onEndAndStartNewChat,
|
|
393
|
+
onCloseAfterThankYou,
|
|
394
|
+
previewTyping: onPreviewTyping,
|
|
395
|
+
isTyping
|
|
396
|
+
}
|
|
397
|
+
)
|
|
398
|
+
]
|
|
399
|
+
}
|
|
400
|
+
);
|
|
386
401
|
};
|
|
387
402
|
export {
|
|
388
403
|
Chatbot
|
package/dist/Chevron/index.js
CHANGED
package/dist/Forms/ApplyNow.js
CHANGED
package/dist/Forms/EmailOnly.js
CHANGED
package/dist/Forms/SuccesForm.js
CHANGED
|
@@ -62,9 +62,8 @@ import "../Carousel/index.js";
|
|
|
62
62
|
/* empty css */
|
|
63
63
|
/* empty css */
|
|
64
64
|
import "../Chatbot/store/chat.js";
|
|
65
|
-
import "../Chatbot/authenticate.js";
|
|
66
|
-
/* empty css */
|
|
67
65
|
import "react-use";
|
|
66
|
+
/* empty css */
|
|
68
67
|
/* empty css */
|
|
69
68
|
import "../Chatbot/store/messages.js";
|
|
70
69
|
/* empty css */
|
package/dist/Hyperlink/index.js
CHANGED
package/dist/ImageLink/index.js
CHANGED
package/dist/Modal/Modal.js
CHANGED
package/package.json
CHANGED