@axos-web-dev/shared-components 1.0.100-dev.3 → 1.0.100-dev.5

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 (86) hide show
  1. package/dist/ATMLocator/ATMLocator.js +1 -7
  2. package/dist/ArticlesSet/ArticlesSet.js +2 -2
  3. package/dist/Auth/ErrorAlert.js +1 -7
  4. package/dist/Button/Button.js +1 -7
  5. package/dist/Calculators/BuyDownCalculator/index.d.ts +1 -0
  6. package/dist/Calculators/BuyDownCalculator/index.js +163 -77
  7. package/dist/Calculators/Calculator.js +1 -7
  8. package/dist/Carousel/index.js +1 -7
  9. package/dist/Chevron/index.js +1 -7
  10. package/dist/Comparison/Comparison.js +1 -7
  11. package/dist/ExecutiveBio/ExecutiveBio.js +1 -7
  12. package/dist/FaqAccordion/index.js +1 -7
  13. package/dist/FooterSiteMap/AxosBank/FooterSiteMap.js +1 -7
  14. package/dist/Forms/ApplyNow.js +1 -7
  15. package/dist/Forms/ContactUsBusiness.js +1 -7
  16. package/dist/Forms/ContactUsBusinessNameEmail.js +1 -7
  17. package/dist/Forms/ContactUsLVF.d.ts +5 -1
  18. package/dist/Forms/ContactUsLVF.js +8 -6
  19. package/dist/Forms/ContactUsNMLSId.js +1 -7
  20. package/dist/Forms/CraPublicFile.js +1 -7
  21. package/dist/Forms/EmailOnly.js +1 -7
  22. package/dist/Forms/FormEnums.js +2 -14
  23. package/dist/Forms/MortgageRate/MortgageRateForm.js +1 -7
  24. package/dist/Forms/MortgageRate/MortgageRateWatch.js +1 -7
  25. package/dist/Forms/MortgageWarehouseLending.js +1 -7
  26. package/dist/Forms/QuickPricer/QuickPricerForm.js +1 -1
  27. package/dist/Forms/SalesforceFieldsForm.d.ts +5 -0
  28. package/dist/Forms/SalesforceFieldsForm.js +11 -1
  29. package/dist/Forms/SuccesForm.js +1 -7
  30. package/dist/Hyperlink/index.js +1 -7
  31. package/dist/ImageLink/ImageLink.js +1 -7
  32. package/dist/ImageLink/ImageLinkSet.js +1 -7
  33. package/dist/ImageLink/index.js +1 -7
  34. package/dist/Input/Dropdown.js +1 -0
  35. package/dist/Insight/Featured/CategorySelector.js +1 -7
  36. package/dist/Insight/Featured/Featured.js +1 -7
  37. package/dist/Insight/Featured/Header.js +1 -7
  38. package/dist/Modal/Modal.js +1 -7
  39. package/dist/NavigationMenu/AxosALTS/NavData.js +1 -7
  40. package/dist/NavigationMenu/AxosALTS/index.js +1 -7
  41. package/dist/NavigationMenu/AxosBank/MobileMenu/MobileNavData.js +1 -7
  42. package/dist/NavigationMenu/AxosBank/NavData.js +1 -7
  43. package/dist/NavigationMenu/AxosBank/SubNavBar.js +1 -7
  44. package/dist/NavigationMenu/AxosBank/index.js +1 -7
  45. package/dist/NavigationMenu/LaVictoire/NavData.js +1 -7
  46. package/dist/NavigationMenu/LaVictoire/index.js +1 -7
  47. package/dist/NavigationMenu/NavDataJson.js +1 -7
  48. package/dist/NavigationMenu/Navbar.js +1 -7
  49. package/dist/NavigationMenu/SignInNavButton.js +1 -7
  50. package/dist/SetContainer/SetContainer.js +1 -7
  51. package/dist/SocialMediaBar/iconsRepository.js +1 -7
  52. package/dist/Table/Table.d.ts +1 -1
  53. package/dist/VideoTile/VideoTile.js +1 -7
  54. package/dist/VideoWrapper/index.js +1 -7
  55. package/dist/WalnutIframe/wrapper.module.js +3 -3
  56. package/dist/assets/WalnutIframe/wrapper.css.css +49 -49
  57. package/dist/main.d.ts +0 -1
  58. package/dist/main.js +0 -33
  59. package/package.json +133 -136
  60. package/dist/Chatbot/Bubble.css.d.ts +0 -2
  61. package/dist/Chatbot/Bubble.css.js +0 -7
  62. package/dist/Chatbot/Bubble.d.ts +0 -3
  63. package/dist/Chatbot/Bubble.js +0 -100
  64. package/dist/Chatbot/Chat.d.ts +0 -1
  65. package/dist/Chatbot/Chat.js +0 -165
  66. package/dist/Chatbot/ChatWindow.css.d.ts +0 -14
  67. package/dist/Chatbot/ChatWindow.css.js +0 -31
  68. package/dist/Chatbot/ChatWindow.d.ts +0 -23
  69. package/dist/Chatbot/ChatWindow.js +0 -208
  70. package/dist/Chatbot/Chatbot.css.d.ts +0 -2
  71. package/dist/Chatbot/Chatbot.css.js +0 -7
  72. package/dist/Chatbot/Chatbot.css.ts.vanilla.css.js +0 -1
  73. package/dist/Chatbot/Chatbot.d.ts +0 -5
  74. package/dist/Chatbot/Chatbot.js +0 -39
  75. package/dist/Chatbot/authenticate.d.ts +0 -3
  76. package/dist/Chatbot/authenticate.js +0 -16
  77. package/dist/Chatbot/index.d.ts +0 -9
  78. package/dist/Chatbot/index.js +0 -36
  79. package/dist/Chatbot/store/chat.d.ts +0 -9
  80. package/dist/Chatbot/store/chat.js +0 -11
  81. package/dist/Chatbot/store/messages.d.ts +0 -14
  82. package/dist/Chatbot/store/messages.js +0 -12
  83. package/dist/Chatbot/useHeadlessChat.d.ts +0 -22
  84. package/dist/Chatbot/useHeadlessChat.js +0 -157
  85. package/dist/assets/Chatbot/Bubble.css +0 -51
  86. package/dist/assets/Chatbot/ChatWindow.css +0 -157
@@ -1,165 +0,0 @@
1
- "use client";
2
- import { jsxs, jsx } from "react/jsx-runtime";
3
- import { useRef, useEffect } from "react";
4
- import { authenticate } from "./authenticate.js";
5
- import { useMessages } from "./store/messages.js";
6
- const companyId = process.env.CCAI_COMPANY_ID || "";
7
- const tenant = process.env.CCAI_TENANT_NAME || "";
8
- const host = process.env.CCAI_HOST || "";
9
- const COBROWSE_CONSENT_TEMPLATE = `
10
- <script class="cobrowse-template" type="text/template">
11
- <div class="cobrowse">
12
- <div class="cobrowse-title">$title</div>
13
- <div class="cobrowse-content">$content</div>
14
- <div class="cobrowse-footer">
15
- <button class="cobrowse-deny js-cobrowse-deny">$deny</button>
16
- <button class="cobrowse-allow js-cobrowse-allow">$allow</button>
17
- </div>
18
- </div>
19
- <\/script>
20
- `;
21
- function Chat() {
22
- const clientRef = useRef(null);
23
- const hasLoadedBefore = useRef(true);
24
- const addMessages = useMessages((state) => state.addMessages);
25
- const addMessage = useMessages((state) => state.addMessage);
26
- const chatRef = useRef(null);
27
- const isMounted = useRef(true);
28
- useEffect(() => {
29
- let messageHandler;
30
- let identityHandler;
31
- let chatUpdatedHandler;
32
- let memberJoinedHandler;
33
- let chatConnectedHandler;
34
- async function initChat() {
35
- const { Client, consoleLoggerHandler, Logger } = await import("@ujet/websdk-headless");
36
- console.log("this", isMounted);
37
- Logger.addHandler(consoleLoggerHandler);
38
- clientRef.current = new Client({
39
- companyId,
40
- tenant,
41
- cobrowse: {
42
- enabled: true,
43
- template: COBROWSE_CONSENT_TEMPLATE,
44
- messages: {
45
- confirmSessionTitle: "...",
46
- confirmSessionContent: "...",
47
- endSessionText: "...",
48
- confirmRemoteControlTitle: "...",
49
- confirmRemoteControlContent: "...",
50
- confirmFullDeviceTitle: "...",
51
- confirmFullDeviceContent: "...",
52
- allowText: "...",
53
- denyText: "..."
54
- }
55
- },
56
- host,
57
- authenticate
58
- });
59
- const menus = await clientRef.current?.getMenus();
60
- try {
61
- chatRef.current = await clientRef.current?.loadOngoingChat();
62
- console.log("chat:", chatRef.current);
63
- if (!chatRef.current) {
64
- chatRef.current = await clientRef.current?.createChat(
65
- menus?.menus[5].id
66
- );
67
- }
68
- } catch (error) {
69
- console.error("Error creating chat:", error);
70
- chatRef.current = await clientRef.current?.createChat(
71
- menus?.menus[5].id
72
- );
73
- }
74
- console.log("this");
75
- identityHandler = (identity) => {
76
- if (!isMounted.current) return;
77
- console.log("identity:", identity);
78
- };
79
- messageHandler = (msg) => {
80
- console.log("new message:", msg);
81
- console.log("addMessage:", msg);
82
- addMessage(msg);
83
- };
84
- chatUpdatedHandler = (chat) => {
85
- console.log("chat updated:", chat);
86
- };
87
- chatConnectedHandler = async () => {
88
- console.log("connected");
89
- const messagesFetched = await clientRef.current?.fetchMessages();
90
- console.log("[messages]:", messagesFetched);
91
- addMessages(messagesFetched || []);
92
- };
93
- memberJoinedHandler = (identity) => {
94
- console.log("member joined:", identity);
95
- };
96
- console.log(isMounted.current);
97
- clientRef.current?.on("authenticated", () => {
98
- console.log("authenticated");
99
- });
100
- clientRef.current?.on("chat.ongoing", (chat) => {
101
- if (!isMounted.current) return;
102
- console.log("chat:", chat);
103
- });
104
- clientRef.current?.on("chat.connected", chatConnectedHandler);
105
- clientRef.current?.on("chat.updated", chatUpdatedHandler);
106
- clientRef.current?.on("chat.identity", identityHandler);
107
- clientRef.current?.on("chat.message", messageHandler);
108
- clientRef.current?.on("cobrowse.request", ({ from }) => {
109
- console.log("request by", from);
110
- });
111
- clientRef.current?.on("chat.memberJoined", memberJoinedHandler);
112
- }
113
- if (hasLoadedBefore.current) {
114
- console.log("Initial setup");
115
- initChat();
116
- hasLoadedBefore.current = false;
117
- }
118
- return () => {
119
- isMounted.current = false;
120
- console.log("Component unmounted. Cancelling pending async operations.");
121
- if (clientRef.current) {
122
- if (messageHandler)
123
- clientRef.current.off("chat.message", messageHandler);
124
- if (identityHandler)
125
- clientRef.current.off("chat.identity", identityHandler);
126
- clientRef.current.off("chat.connected", chatConnectedHandler);
127
- clientRef.current.off("chat.updated", chatUpdatedHandler);
128
- clientRef.current.off("chat.memberJoined", memberJoinedHandler);
129
- if (typeof clientRef.current.destroyChat === "function") {
130
- console.log("Destroying chat:", chatRef.current);
131
- clientRef.current.destroyChat();
132
- }
133
- }
134
- };
135
- }, [addMessage, addMessages]);
136
- return /* @__PURE__ */ jsxs("div", { children: [
137
- /* @__PURE__ */ jsx("h2", { children: "Chat" }),
138
- /* @__PURE__ */ jsxs(
139
- "form",
140
- {
141
- style: { marginTop: "1rem", display: "flex", gap: "0.5rem" },
142
- onSubmit: async (e) => {
143
- e.preventDefault();
144
- const form = e.target;
145
- const input = form.elements[0];
146
- const message = input.value;
147
- console.log("Sending message:", message);
148
- try {
149
- await clientRef.current?.sendTextMessage(message);
150
- input.value = "";
151
- } catch (error) {
152
- console.error("Error sending message:", error);
153
- }
154
- },
155
- children: [
156
- /* @__PURE__ */ jsx("input", { type: "text", name: "message", placeholder: "Type a message..." }),
157
- /* @__PURE__ */ jsx("button", { type: "submit", children: "Send" })
158
- ]
159
- }
160
- )
161
- ] });
162
- }
163
- export {
164
- Chat as default
165
- };
@@ -1,14 +0,0 @@
1
- export declare const windowStyle: string;
2
- export declare const windowOpenStyle: string;
3
- export declare const windowBarStyle: string;
4
- export declare const chat_title: string;
5
- export declare const button_reset: string;
6
- export declare const arrowFill: string;
7
- export declare const inputStyle: string;
8
- export declare const sendButtonStyle: string;
9
- export declare const messagesContainerStyle: string;
10
- export declare const notificationStyle: string;
11
- export declare const messageStyle: string;
12
- export declare const inline_button_wrapper: string;
13
- export declare const inline_button: string;
14
- export declare const endChatButtonStyle: string;
@@ -1,31 +0,0 @@
1
- import '../assets/Chatbot/ChatWindow.css';/* empty css */
2
- var windowStyle = "_13n1jqk0";
3
- var windowOpenStyle = "_13n1jqk1";
4
- var windowBarStyle = "_13n1jqk2";
5
- var chat_title = "_13n1jqk3";
6
- var button_reset = "_13n1jqk4";
7
- var arrowFill = "_13n1jqk5";
8
- var inputStyle = "_13n1jqk6";
9
- var sendButtonStyle = "_13n1jqk7";
10
- var messagesContainerStyle = "_13n1jqk8";
11
- var notificationStyle = "_13n1jqk9";
12
- var messageStyle = "_13n1jqka";
13
- var inline_button_wrapper = "_13n1jqkb";
14
- var inline_button = "_13n1jqkc";
15
- var endChatButtonStyle = "_13n1jqkd";
16
- export {
17
- arrowFill,
18
- button_reset,
19
- chat_title,
20
- endChatButtonStyle,
21
- inline_button,
22
- inline_button_wrapper,
23
- inputStyle,
24
- messageStyle,
25
- messagesContainerStyle,
26
- notificationStyle,
27
- sendButtonStyle,
28
- windowBarStyle,
29
- windowOpenStyle,
30
- windowStyle
31
- };
@@ -1,23 +0,0 @@
1
- import { MessageResponse as BaseMessageResponse, HumanAgent } from '@ujet/websdk-headless';
2
- import { default as React } from 'react';
3
-
4
- interface MessageResponse extends BaseMessageResponse {
5
- to_agent?: HumanAgent;
6
- }
7
- export interface ChatBubble {
8
- id: string | number;
9
- body: string;
10
- sender?: string;
11
- timestamp?: string;
12
- isOwn?: boolean;
13
- }
14
- interface ChatWindowProps {
15
- messages: MessageResponse[];
16
- status?: string;
17
- onSend: (msg: string) => void;
18
- inputDisabled?: boolean;
19
- onClose?: () => void;
20
- endChat?: () => void;
21
- }
22
- export declare const ChatWindow: React.FC<ChatWindowProps>;
23
- export {};
@@ -1,208 +0,0 @@
1
- "use client";
2
- import { jsxs, jsx } from "react/jsx-runtime";
3
- import clsx from "clsx";
4
- import React, { useRef, useEffect, Fragment } from "react";
5
- import ReactMarkdown from "react-markdown";
6
- import remarkGfm from "remark-gfm";
7
- import { useOpenChat } from "./store/chat.js";
8
- import { windowBarStyle, chat_title, button_reset, arrowFill, notificationStyle, messageStyle, inline_button_wrapper, inline_button, endChatButtonStyle, messagesContainerStyle, inputStyle, sendButtonStyle, windowStyle, windowOpenStyle } from "./ChatWindow.css.js";
9
- const ChatWindow = ({
10
- messages,
11
- status = "connected",
12
- onSend,
13
- inputDisabled = false,
14
- onClose,
15
- endChat = () => {
16
- console.log("End chat");
17
- }
18
- }) => {
19
- const [input, setInput] = React.useState("");
20
- const messagesEndRef = useRef(null);
21
- const isOpen = useOpenChat((state) => state.isOpen);
22
- useEffect(() => {
23
- messagesEndRef.current?.scrollIntoView({ behavior: "smooth" });
24
- }, [messages]);
25
- const handleSend = (e) => {
26
- e.preventDefault();
27
- if (input.trim()) {
28
- onSend(input);
29
- setInput("");
30
- }
31
- };
32
- const project = process.env.CCAI_PROJECT_ID;
33
- const isAxos = project === "axos";
34
- const endUserBg = isAxos ? "#14263d" : "#323339";
35
- const chatbotBg = isAxos ? "#E9F8FF" : "#EAE8E8";
36
- return /* @__PURE__ */ jsxs("div", { className: clsx(windowStyle, isOpen && windowOpenStyle), children: [
37
- /* @__PURE__ */ jsxs("div", { className: windowBarStyle, children: [
38
- /* @__PURE__ */ jsxs("div", { className: "flex middle", style: { paddingBlock: "6px" }, children: [
39
- /* @__PURE__ */ jsx(
40
- "img",
41
- {
42
- src: "https://www.axos.com/images/2xmVfQm5l0HWOKjgxQO1Iw/axb-assistant.svg",
43
- style: { marginRight: 12 },
44
- height: 18,
45
- width: 18
46
- }
47
- ),
48
- /* @__PURE__ */ jsx("h2", { className: chat_title, children: "Evo Virtual Assistant" })
49
- ] }),
50
- onClose && /* @__PURE__ */ jsx(
51
- "button",
52
- {
53
- onClick: onClose,
54
- className: button_reset,
55
- "aria-label": "Close chat",
56
- title: "Close",
57
- children: /* @__PURE__ */ jsx(
58
- "svg",
59
- {
60
- xmlns: "http://www.w3.org/2000/svg",
61
- width: "24",
62
- height: "24",
63
- viewBox: "0 0 24 24",
64
- fill: "none",
65
- children: /* @__PURE__ */ jsx(
66
- "path",
67
- {
68
- className: arrowFill,
69
- d: "M2.46875 7.76574L11.9991 17.2961L21.5294 7.76574L20.4687 6.70508L11.9991 15.1749L3.52941 6.70508L2.46875 7.76574Z",
70
- fill: "#98DDFF"
71
- }
72
- )
73
- }
74
- )
75
- }
76
- )
77
- ] }),
78
- /* @__PURE__ */ jsxs("div", { className: clsx(messagesContainerStyle), children: [
79
- messages?.map((msg) => /* @__PURE__ */ jsxs(Fragment, { children: [
80
- 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),
81
- msg.type == "noti" && msg.$userType == "system" && msg.event == "memberLeft" && /* @__PURE__ */ jsxs("div", { className: notificationStyle, children: [
82
- /* @__PURE__ */ jsx("strong", { children: "Virtual Agent" }),
83
- " just left the conversation."
84
- ] }, msg.$index),
85
- msg.type == "noti" && msg.$userType == "system" && msg.event == "escalationAccepted" && /* @__PURE__ */ jsxs("div", { className: notificationStyle, children: [
86
- "You are now connected with a",
87
- " ",
88
- msg.to_agent ? /* @__PURE__ */ jsx("strong", { children: msg?.to_agent?.name }) : "an agent"
89
- ] }, msg.$index),
90
- ["text", "markdown_template", "markdown"].includes(msg.type) && /* @__PURE__ */ jsxs(
91
- "div",
92
- {
93
- className: messageStyle,
94
- style: {
95
- textAlign: msg.$userType == "end_user" ? "right" : "left",
96
- alignSelf: msg.$userType == "end_user" ? "flex-end" : "flex-start",
97
- background: msg.$userType == "end_user" ? endUserBg : chatbotBg,
98
- color: msg.$userType == "end_user" ? "#fff" : "#1F1F1F",
99
- boxShadow: msg.$userType == "end_user" ? "0 1px 4px #b3e0ff55" : void 0
100
- },
101
- children: [
102
- /* @__PURE__ */ jsx(
103
- "div",
104
- {
105
- style: {
106
- fontSize: 13,
107
- display: "flex",
108
- flexDirection: "column",
109
- gap: 4
110
- },
111
- children: /* @__PURE__ */ jsx(
112
- ReactMarkdown,
113
- {
114
- remarkPlugins: [[remarkGfm, { singleTilde: false }]],
115
- components: {
116
- p: ({ ...props }) => /* @__PURE__ */ jsx(
117
- "p",
118
- {
119
- style: { margin: 0, fontSize: "inherit" },
120
- ...props
121
- }
122
- )
123
- },
124
- children: msg.content
125
- }
126
- )
127
- }
128
- ),
129
- /* @__PURE__ */ jsx("div", { style: { fontSize: 10, color: "#888", marginTop: 2 } })
130
- ]
131
- },
132
- msg.$index
133
- ),
134
- 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) => {
135
- const lastItem = msg.buttons && msg.buttons?.length - 1;
136
- return /* @__PURE__ */ jsx(
137
- "button",
138
- {
139
- className: inline_button,
140
- style: {
141
- borderRadius: "0px",
142
- borderTopLeftRadius: [0].includes(index) ? 8 : 0,
143
- borderTopRightRadius: [0].includes(index) ? 8 : 0,
144
- borderBottomLeftRadius: [lastItem].includes(index) ? 8 : 0,
145
- borderBottomRightRadius: [lastItem].includes(index) ? 8 : 0
146
- },
147
- onClick: () => {
148
- onSend(button?.title);
149
- },
150
- children: button.title
151
- },
152
- index
153
- );
154
- }) }),
155
- msg.event == "chatEnded" && /* @__PURE__ */ jsx("div", { children: /* @__PURE__ */ jsx("button", { className: endChatButtonStyle, onClick: endChat, children: "End Chat" }) })
156
- ] }, msg.$index)),
157
- /* @__PURE__ */ jsx("div", { ref: messagesEndRef })
158
- ] }),
159
- /* @__PURE__ */ jsxs(
160
- "form",
161
- {
162
- onSubmit: handleSend,
163
- style: {
164
- borderTop: "1px solid #eee",
165
- display: "flex",
166
- gap: 8
167
- },
168
- children: [
169
- /* @__PURE__ */ jsx(
170
- "input",
171
- {
172
- type: "text",
173
- value: input,
174
- onChange: (e) => setInput(e.target.value),
175
- placeholder: "Ask something...",
176
- className: inputStyle,
177
- disabled: inputDisabled || status !== "connected"
178
- }
179
- ),
180
- /* @__PURE__ */ jsx(
181
- "button",
182
- {
183
- className: clsx(sendButtonStyle, input.trim().length > 0 && "active"),
184
- type: "submit",
185
- disabled: inputDisabled || status !== "connected" || !input.trim(),
186
- children: /* @__PURE__ */ jsxs(
187
- "svg",
188
- {
189
- xmlns: "http://www.w3.org/2000/svg",
190
- id: "send-icon",
191
- width: 24,
192
- height: 24,
193
- children: [
194
- /* @__PURE__ */ jsx("path", { d: "M2.01 21L23 12 2.01 3 2 10l15 2-15 2z" }),
195
- /* @__PURE__ */ jsx("path", { d: "M0 0h24v24H0z", fill: "none" })
196
- ]
197
- }
198
- )
199
- }
200
- )
201
- ]
202
- }
203
- )
204
- ] });
205
- };
206
- export {
207
- ChatWindow
208
- };
@@ -1,2 +0,0 @@
1
- export declare const chatbotAXB: string;
2
- export declare const chatbotUFB: string;
@@ -1,7 +0,0 @@
1
- import "./Chatbot.css.ts.vanilla.css.js";
2
- var chatbotAXB = "_1hpv6vm0";
3
- var chatbotUFB = "_1hpv6vm1";
4
- export {
5
- chatbotAXB,
6
- chatbotUFB
7
- };
@@ -1,5 +0,0 @@
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;
@@ -1,39 +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 { ChatWindow } from "./ChatWindow.js";
6
- import { useOpenChat } from "./store/chat.js";
7
- import { useMessages } from "./store/messages.js";
8
- import { useHeadlessChat } from "./useHeadlessChat.js";
9
- import { chatbotUFB, chatbotAXB } from "./Chatbot.css.js";
10
- const Chatbot = (props) => {
11
- const messages = useMessages((state) => state.messages);
12
- const close = useOpenChat((state) => state.close);
13
- const { status, sendMessage } = 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
- }
34
- )
35
- ] });
36
- };
37
- export {
38
- Chatbot
39
- };
@@ -1,3 +0,0 @@
1
- export declare const authenticate: () => Promise<{
2
- token: any;
3
- }>;
@@ -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
- };
@@ -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';
@@ -1,36 +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, chat_title, 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
- chat_title,
19
- chatbotAXB,
20
- chatbotUFB,
21
- endChatButtonStyle,
22
- inline_button,
23
- inline_button_wrapper,
24
- inputStyle,
25
- messageStyle,
26
- messagesContainerStyle,
27
- notificationStyle,
28
- sendButtonStyle,
29
- svgFill,
30
- useHeadlessChat,
31
- useMessages,
32
- useOpenChat,
33
- windowBarStyle,
34
- windowOpenStyle,
35
- windowStyle
36
- };
@@ -1,9 +0,0 @@
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 {};
@@ -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,14 +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
- }
9
- export interface Message {
10
- id: string;
11
- text: string;
12
- }
13
- export declare const useMessages: import('zustand').UseBoundStore<import('zustand').StoreApi<MessageStore>>;
14
- export {};
@@ -1,12 +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
- }));
10
- export {
11
- useMessages
12
- };
@@ -1,22 +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
- }
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
- };
22
- export {};