@jrapps/my_tickets_chat_ui 0.0.5 → 0.0.6

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 (26) hide show
  1. package/dist/cjs/components/SiteChatComponent/index.js +302 -252
  2. package/dist/cjs/components/SiteChatComponent/index.js.map +4 -4
  3. package/dist/cjs/index.js +302 -252
  4. package/dist/cjs/index.js.map +4 -4
  5. package/dist/esm/chunks/{chunk-E5MBV2MX.js → chunk-P3P4FPSX.js} +304 -254
  6. package/dist/esm/chunks/chunk-P3P4FPSX.js.map +7 -0
  7. package/dist/esm/components/SiteChatComponent/index.js +1 -1
  8. package/dist/esm/index.js +1 -1
  9. package/dist/types/components/SiteChatComponent/FabButton/FabButton.d.ts.map +1 -1
  10. package/dist/types/components/SiteChatComponent/FabButton/FabButton.types.d.ts +1 -1
  11. package/dist/types/components/SiteChatComponent/FabButton/FabButton.types.d.ts.map +1 -1
  12. package/dist/types/components/SiteChatComponent/Footer/Footer.d.ts.map +1 -1
  13. package/dist/types/components/SiteChatComponent/Footer/Footer.types.d.ts +10 -2
  14. package/dist/types/components/SiteChatComponent/Footer/Footer.types.d.ts.map +1 -1
  15. package/dist/types/components/SiteChatComponent/Footer/message-input/message-input.d.ts +5 -1
  16. package/dist/types/components/SiteChatComponent/Footer/message-input/message-input.d.ts.map +1 -1
  17. package/dist/types/components/SiteChatComponent/Footer/message-input/open-file-picker.d.ts +10 -0
  18. package/dist/types/components/SiteChatComponent/Footer/message-input/open-file-picker.d.ts.map +1 -0
  19. package/dist/types/components/SiteChatComponent/Header/Header.d.ts.map +1 -1
  20. package/dist/types/components/SiteChatComponent/MessageContainer/MessageContainer.d.ts.map +1 -1
  21. package/dist/types/components/SiteChatComponent/SiteChatComponent.d.ts +1 -1
  22. package/dist/types/components/SiteChatComponent/SiteChatComponent.d.ts.map +1 -1
  23. package/dist/types/components/SiteChatComponent/SiteChatComponent.types.d.ts +1 -9
  24. package/dist/types/components/SiteChatComponent/SiteChatComponent.types.d.ts.map +1 -1
  25. package/package.json +6 -3
  26. package/dist/esm/chunks/chunk-E5MBV2MX.js.map +0 -7
@@ -1,187 +1,57 @@
1
1
  // src/components/SiteChatComponent/SiteChatComponent.tsx
2
2
  import React5 from "react";
3
+ import { Box as Box7, Text } from "@wix/design-system";
4
+ import "@wix/design-system/styles.global.css";
3
5
 
4
6
  // src/components/SiteChatComponent/useSiteChatComponent.ts
5
7
  function useSiteChatComponent() {
6
8
  return {};
7
9
  }
8
10
 
9
- // src/components/SiteChatComponent/Header/Header.tsx
11
+ // src/components/SiteChatComponent/FabButton/FabButton.tsx
10
12
  import React from "react";
11
13
  import { Box } from "@wix/design-system";
14
+ import { WixChat } from "@wix/wix-ui-icons-common";
12
15
  import { jsx, jsxs } from "react/jsx-runtime";
13
- var Header = React.forwardRef(
16
+ var FabButton = React.forwardRef(
14
17
  ({
15
18
  className,
16
19
  children,
17
- title,
18
- subtitle,
19
- image,
20
- onClose,
20
+ onClick,
21
+ type = "textIcon",
22
+ icon = /* @__PURE__ */ jsx(WixChat, {}),
23
+ text,
21
24
  ...rest
22
25
  }, ref) => {
23
- return /* @__PURE__ */ jsx("div", { ref, className: ["site-chat-header", className].filter(Boolean).join(" "), ...rest, children: /* @__PURE__ */ jsx(Box, { className: "site-chat-component-header-container", verticalAlign: "middle", children: /* @__PURE__ */ jsxs(Box, { width: "100%", direction: "horizontal", align: "center", gap: "10px", children: [
24
- image && /* @__PURE__ */ jsx(Box, { className: "site-chat-component-header-image", width: "60px", height: "50px", borderRadius: "999px", children: /* @__PURE__ */ jsx("img", { style: { borderRadius: "999px" }, width: "100%", height: "100%", src: "https://www.techsmith.com/wp-content/uploads/2023/08/What-are-High-Resolution-Images.png", alt: "Business Logo" }) }),
25
- /* @__PURE__ */ jsxs(Box, { direction: "vertical", className: "site-chat-component-header-text-section", children: [
26
- /* @__PURE__ */ jsx(Box, { className: "site-chat-component-header-top-section", children: /* @__PURE__ */ jsxs(Box, { className: "site-chat-component-header-top", verticalAlign: "middle", WebkitJustifyContent: "space-between", width: "100%", children: [
27
- title && /* @__PURE__ */ jsx("h2", { className: "site-chat-component-header-title", children: title }),
28
- /* @__PURE__ */ jsx(
29
- "button",
30
- {
31
- onClick: onClose,
32
- "aria-label": "Close",
33
- className: "site-chat-component-header-close-button",
34
- children: "\u2715"
35
- }
36
- )
37
- ] }) }),
38
- /* @__PURE__ */ jsx(Box, { className: "site-chat-component-header-bottom-section", children: subtitle && /* @__PURE__ */ jsx("h3", { className: "site-chat-component-header-subtitle", children: subtitle }) })
39
- ] })
40
- ] }) }) });
26
+ return /* @__PURE__ */ jsx("div", { ref, children: /* @__PURE__ */ jsxs(
27
+ "button",
28
+ {
29
+ className: "site-chat-component-fab",
30
+ onClick,
31
+ children: [
32
+ type === "textIcon" ? /* @__PURE__ */ jsx("span", { className: "site-chat-component-fab-fab-button-icon", children: /* @__PURE__ */ jsx(Box, { height: "100%", children: icon }) }) : null,
33
+ type === "textIcon" || type === "text" ? /* @__PURE__ */ jsx("span", { className: "site-chat-component-fab-fab-button-text", children: /* @__PURE__ */ jsx("span", { className: "site-chat-component-fab-fab-button-label", children: text }) }) : null,
34
+ type === "icon" ? /* @__PURE__ */ jsx("span", { className: "site-chat-component-fab-fab-button-icon", children: /* @__PURE__ */ jsx(Box, { height: "100%", width: "max-content", children: icon }) }) : null
35
+ ]
36
+ }
37
+ ) });
41
38
  }
42
39
  );
43
- Header.displayName = "SiteChatComponent.Header";
40
+ FabButton.displayName = "SiteChatComponent.FabButton";
44
41
 
45
- // src/components/SiteChatComponent/MessageContainer/MessageContainer.tsx
42
+ // src/components/SiteChatComponent/Footer/Footer.tsx
46
43
  import React2 from "react";
47
44
  import { Box as Box3 } from "@wix/design-system";
48
45
 
49
- // src/components/SiteChatComponent/MessageContainer/messages/messages-wrapper.tsx
50
- import { useRef, useEffect } from "react";
51
- import { Avatar } from "@wix/design-system";
52
-
53
- // src/components/SiteChatComponent/MessageContainer/messages/attachment.tsx
54
- import { TextButton, Box as Box2 } from "@wix/design-system";
55
- import {
56
- Page as PageSmallIcon
57
- } from "@wix/wix-ui-icons-common";
58
- import { ArrowTopRight as ArrowTopRightIcon } from "@wix/wix-ui-icons-common/on-stage";
59
- import { jsx as jsx2, jsxs as jsxs2 } from "react/jsx-runtime";
60
- var Attachment = ({ item }) => {
61
- return /* @__PURE__ */ jsx2(Box2, { direction: "horizontal", maxWidth: "100%", boxSizing: "border-box", className: "site-chat-component-message-container-in-chat-file-item-wrapper-box", children: item && /* @__PURE__ */ jsxs2("div", { className: "site-chat-component-message-container-in-chat-file-item-container", children: [
62
- /* @__PURE__ */ jsx2(PageSmallIcon, { className: "site-chat-component-message-container-in-chat-file-icon", width: "20px", height: "20px" }),
63
- /* @__PURE__ */ jsxs2("div", { className: "site-chat-component-message-container-in-chat-file-names-container", children: [
64
- /* @__PURE__ */ jsx2("span", { className: "site-chat-component-message-container-in-chat-file-name", children: item.name }),
65
- /* @__PURE__ */ jsx2("span", { className: "site-chat-component-message-container-in-chat-file-sub-name", children: "Attachment" })
66
- ] }),
67
- /* @__PURE__ */ jsx2(TextButton, { size: "tiny", onClick: () => window.open(item.url, "_blank"), suffixIcon: /* @__PURE__ */ jsx2(ArrowTopRightIcon, { size: "tiny" }), children: "Open" })
68
- ] }, item.id) });
69
- };
70
- var attachment_default = Attachment;
71
-
72
- // src/components/SiteChatComponent/MessageContainer/messages/messages-wrapper.tsx
73
- import { jsx as jsx3, jsxs as jsxs3 } from "react/jsx-runtime";
74
- var AGENT_MESSAGE_GAP = "10px";
75
- var AGENT_MESSAGE_WIDTH = "75%";
76
- var AGENT_MESSAGE_INNER_GAP = "4px";
77
- var ONE_MINUTE_MS = 6e4;
78
- var ONE_DAY_MS = 864e5;
79
- var DAYS_IN_WEEK = 7;
80
- var formatTimestamp = (timestamp) => {
81
- if (!timestamp) return "";
82
- const date = new Date(timestamp);
83
- const now = /* @__PURE__ */ new Date();
84
- if (now.getTime() - date.getTime() < ONE_MINUTE_MS) return "Just now";
85
- const time = date.toLocaleTimeString([], { hour: "2-digit", minute: "2-digit" });
86
- const startOfToday = new Date(now.getFullYear(), now.getMonth(), now.getDate());
87
- const startOfDay = new Date(date.getFullYear(), date.getMonth(), date.getDate());
88
- const diffDays = Math.floor((startOfToday.getTime() - startOfDay.getTime()) / ONE_DAY_MS);
89
- if (diffDays === 0) return `Today at ${time}`;
90
- if (diffDays === 1) return `Yesterday at ${time}`;
91
- if (diffDays < DAYS_IN_WEEK && date.getDay() < now.getDay())
92
- return `${date.toLocaleDateString([], { weekday: "short" })} at ${time}`;
93
- return `${date.toLocaleDateString([], { month: "short", day: "numeric", year: "numeric" })} at ${time}`;
94
- };
95
- var MessagesWrapper = ({ messages = [] }) => {
96
- const wrapperRef = useRef(null);
97
- useEffect(() => {
98
- if (wrapperRef.current) {
99
- wrapperRef.current.scrollTop = wrapperRef.current.scrollHeight;
100
- }
101
- }, [messages]);
102
- return /* @__PURE__ */ jsx3("div", { className: "site-chat-component-message-container-messages-wrapper", ref: wrapperRef, children: messages.map(({ _id, message, attachment, timestamp, type, agentName }, index) => /* @__PURE__ */ jsx3("div", { className: `message-item ${type}`, children: type === "agent" ? /* @__PURE__ */ jsx3(AgentMessageWrapper, { message, attachment: attachment ? Array.isArray(attachment) ? attachment[0] : attachment : void 0, timestamp, agentName }) : type === "user" ? /* @__PURE__ */ jsx3(UserMessageWrapper, { message, attachment: attachment ? Array.isArray(attachment) ? attachment[0] : attachment : void 0, timestamp }) : /* @__PURE__ */ jsx3(SystemMessageWrapper, { message, timestamp }) }, _id || index)) });
103
- };
104
- var GetSystemMessage = ({ type }) => {
105
- switch (type) {
106
- case "AGENT_JOINED":
107
- return /* @__PURE__ */ jsx3("div", { className: "site-chat-component-message-container-system-message-message", children: "An agent has joined the chat." });
108
- case "AGENT_LEFT":
109
- return /* @__PURE__ */ jsx3("div", { className: "site-chat-component-message-container-system-message-message", children: "An agent has left the chat." });
110
- case "USER_JOINED":
111
- return /* @__PURE__ */ jsx3("div", { className: "site-chat-component-message-container-system-message-message", children: "A user has joined the chat." });
112
- case "USER_LEFT":
113
- return /* @__PURE__ */ jsx3("div", { className: "site-chat-component-message-container-system-message-message", children: "A user has left the chat." });
114
- case "CHAT_ENDED":
115
- return /* @__PURE__ */ jsx3("div", { className: "site-chat-component-message-container-system-message-message", children: "The chat has ended." });
116
- case "CHAT_REOPENED":
117
- return /* @__PURE__ */ jsx3("div", { className: "site-chat-component-message-container-system-message-message", children: "The chat has been reopened." });
118
- case "CHAT_TRANSFERRED":
119
- return /* @__PURE__ */ jsx3("div", { className: "site-chat-component-message-container-system-message-message", children: "The chat has been transferred to another agent." });
120
- case "WAITING_FOR_AGENT":
121
- return /* @__PURE__ */ jsx3("div", { className: "site-chat-component-message-container-system-message-message", children: "Waiting for an agent to join the chat..." });
122
- default:
123
- return /* @__PURE__ */ jsx3("div", { className: "site-chat-component-message-container-system-message-message", children: "System message" });
124
- }
125
- };
126
- var SystemMessageWrapper = ({ message, timestamp }) => {
127
- return /* @__PURE__ */ jsx3("div", { className: "site-chat-component-message-container-system-message-wrapper", children: /* @__PURE__ */ jsxs3("div", { className: "site-chat-component-message-container-system-message", children: [
128
- /* @__PURE__ */ jsx3("hr", { className: "dashed" }),
129
- /* @__PURE__ */ jsx3(GetSystemMessage, { type: message }),
130
- /* @__PURE__ */ jsx3("hr", { className: "dashed" })
131
- ] }) });
132
- };
133
- var AgentMessageWrapper = ({ message, attachment, timestamp, agentName }) => {
134
- return /* @__PURE__ */ jsxs3("div", { style: { display: "flex", flexDirection: "row", gap: AGENT_MESSAGE_GAP }, children: [
135
- /* @__PURE__ */ jsx3(Avatar, { size: "size24", className: "site-chat-component-message-container-agent-message-avatar", name: agentName }),
136
- /* @__PURE__ */ jsxs3("div", { style: { width: AGENT_MESSAGE_WIDTH, gap: AGENT_MESSAGE_INNER_GAP, display: "flex", flexDirection: "column" }, children: [
137
- agentName && /* @__PURE__ */ jsxs3("div", { className: "site-chat-component-message-container-agent-name-time-container", children: [
138
- /* @__PURE__ */ jsx3("div", { className: "site-chat-component-message-container-agent-name", children: agentName }),
139
- /* @__PURE__ */ jsx3("div", { className: "site-chat-component-message-container-agent-message-timestamp", children: formatTimestamp(timestamp) })
140
- ] }),
141
- /* @__PURE__ */ jsx3("div", { className: `site-chat-component-message-container-agent-message-wrapper${attachment ? "-attachment" : ""}`, children: /* @__PURE__ */ jsxs3("div", { className: "site-chat-component-message-container-agent-message", children: [
142
- message && message,
143
- attachment && /* @__PURE__ */ jsx3(attachment_default, { item: attachment })
144
- ] }) })
145
- ] })
146
- ] });
147
- };
148
- var UserMessageWrapper = ({ message, attachment, timestamp }) => {
149
- return /* @__PURE__ */ jsxs3("div", { style: { display: "flex", flexDirection: "column", alignItems: "flex-end", gap: "4px" }, children: [
150
- !attachment && /* @__PURE__ */ jsx3("div", { className: "site-chat-component-message-container-user-name", children: "Me" }),
151
- /* @__PURE__ */ jsx3("div", { className: `site-chat-component-message-container-user-message-wrapper${attachment ? "-attachment" : ""}`, children: /* @__PURE__ */ jsxs3("div", { className: "site-chat-component-message-container-user-message", children: [
152
- message && message,
153
- attachment && /* @__PURE__ */ jsx3(attachment_default, { item: attachment })
154
- ] }) })
155
- ] });
156
- };
157
- var messages_wrapper_default = MessagesWrapper;
158
-
159
- // src/components/SiteChatComponent/MessageContainer/MessageContainer.tsx
160
- import { jsx as jsx4, jsxs as jsxs4 } from "react/jsx-runtime";
161
- var MessageContainer = React2.forwardRef(
162
- ({ className, children, messages, loading, ...rest }, ref) => {
163
- return /* @__PURE__ */ jsx4("div", { ref, className: ["site-chat-message-container", className].filter(Boolean).join(" "), ...rest, children: /* @__PURE__ */ jsxs4(Box3, { className: "site-chat-component-message-container-", children: [
164
- loading && /* @__PURE__ */ jsx4(Box3, { className: "site-chat-component-message-container-loading-state", children: /* @__PURE__ */ jsx4("p", { children: "Loading messages..." }) }),
165
- messages.length === 0 && !loading && /* @__PURE__ */ jsx4(Box3, { className: "site-chat-component-message-container-empty-state", children: /* @__PURE__ */ jsx4("p", { children: "No messages yet. Start a conversation" }) }),
166
- messages.length > 0 && /* @__PURE__ */ jsx4(messages_wrapper_default, { messages })
167
- ] }) });
168
- }
169
- );
170
- MessageContainer.displayName = "SiteChatComponent.MessageContainer";
171
-
172
- // src/components/SiteChatComponent/Footer/Footer.tsx
173
- import React3 from "react";
174
- import { Box as Box5 } from "@wix/design-system";
175
-
176
46
  // src/components/SiteChatComponent/Footer/send-button/send-button.tsx
177
- import { jsx as jsx5 } from "react/jsx-runtime";
47
+ import { jsx as jsx2 } from "react/jsx-runtime";
178
48
  var SendButton = ({
179
49
  text = "Send",
180
50
  className = "",
181
51
  onClick,
182
52
  disabled = false
183
53
  }) => {
184
- return /* @__PURE__ */ jsx5(
54
+ return /* @__PURE__ */ jsx2(
185
55
  "button",
186
56
  {
187
57
  className: `site-chat-component-footer-my-tickets-chat-widget-send-button ${className}`,
@@ -194,16 +64,16 @@ var SendButton = ({
194
64
  var send_button_default = SendButton;
195
65
 
196
66
  // src/components/SiteChatComponent/Footer/attachment-list/attachment-list.tsx
197
- import { useState, useEffect as useEffect2 } from "react";
198
- import { IconButton, Box as Box4 } from "@wix/design-system";
67
+ import { useState, useEffect } from "react";
68
+ import { IconButton, Box as Box2 } from "@wix/design-system";
199
69
  import {
200
- Page as PageSmallIcon2,
70
+ Page as PageSmallIcon,
201
71
  DismissSmall as DismissIcon
202
72
  } from "@wix/wix-ui-icons-common";
203
- import { jsx as jsx6, jsxs as jsxs5 } from "react/jsx-runtime";
73
+ import { jsx as jsx3, jsxs as jsxs2 } from "react/jsx-runtime";
204
74
  var AttachmentList = ({ items, onRemove, onClick, onFilesSent }) => {
205
75
  const [localItems, setLocalItems] = useState(items);
206
- useEffect2(() => {
76
+ useEffect(() => {
207
77
  setLocalItems(items);
208
78
  }, [items]);
209
79
  const handleOnRemove = (id) => {
@@ -218,60 +88,137 @@ var AttachmentList = ({ items, onRemove, onClick, onFilesSent }) => {
218
88
  setLocalItems([]);
219
89
  }
220
90
  };
221
- return /* @__PURE__ */ jsx6(Box4, { direction: "horizontal", gap: 2, maxWidth: "100%", minWidth: "100%", overflowY: "hidden", boxSizing: "border-box", scrollbarWidth: "thin", overflowX: "auto", children: localItems.map((item) => /* @__PURE__ */ jsxs5("div", { className: "site-chat-component-footer-file-item-container", onClick: () => onClick && onClick(item.id, item.url), children: [
222
- /* @__PURE__ */ jsx6(PageSmallIcon2, { size: "15px" }),
223
- /* @__PURE__ */ jsx6("span", { className: "site-chat-component-footer-file-name", children: item.name }),
224
- /* @__PURE__ */ jsx6(IconButton, { size: "tiny", onClick: () => handleOnRemove(item.id), children: /* @__PURE__ */ jsx6(DismissIcon, {}) })
91
+ return /* @__PURE__ */ jsx3(Box2, { direction: "horizontal", gap: 2, maxWidth: "100%", minWidth: "100%", overflowY: "hidden", boxSizing: "border-box", scrollbarWidth: "thin", overflowX: "auto", children: localItems.map((item) => /* @__PURE__ */ jsxs2("div", { className: "site-chat-component-footer-file-item-container", onClick: () => onClick && onClick(item.id, item.url), children: [
92
+ /* @__PURE__ */ jsx3(PageSmallIcon, { size: "15px" }),
93
+ /* @__PURE__ */ jsx3("span", { className: "site-chat-component-footer-file-name", children: item.name }),
94
+ /* @__PURE__ */ jsx3(IconButton, { size: "tiny", onClick: () => handleOnRemove(item.id), children: /* @__PURE__ */ jsx3(DismissIcon, {}) })
225
95
  ] }, item.id)) });
226
96
  };
227
97
  var attachment_list_default = AttachmentList;
228
98
 
229
99
  // src/components/SiteChatComponent/Footer/message-input/message-input.tsx
230
- import { jsx as jsx7, jsxs as jsxs6 } from "react/jsx-runtime";
100
+ import { IconButton as IconButton2 } from "@wix/design-system";
101
+ import { AttachmentSmall } from "@wix/wix-ui-icons-common";
102
+
103
+ // src/components/SiteChatComponent/Footer/message-input/open-file-picker.ts
104
+ import { httpClient } from "@wix/essentials";
105
+ var import_meta = {};
106
+ var uploadFile = async (file) => {
107
+ var _a;
108
+ try {
109
+ const baseApiUrl = new URL(import_meta.url).origin;
110
+ const response = await httpClient.fetchWithAuth(`${baseApiUrl}/api/widget/chat/upload-attachment`, {
111
+ method: "POST",
112
+ headers: {
113
+ "Content-Type": file.type || "application/octet-stream",
114
+ "x-file-name": encodeURIComponent(file.name),
115
+ "x-file-type": file.type || "application/octet-stream"
116
+ },
117
+ body: file
118
+ });
119
+ const data = await response.json();
120
+ if (!response.ok) {
121
+ throw new Error(data.error || "Failed to upload file");
122
+ }
123
+ if (!((_a = data.file) == null ? void 0 : _a.id) || !data.file.displayName || !data.file.url) {
124
+ throw new Error("Invalid response format from upload endpoint");
125
+ }
126
+ return data.file;
127
+ } catch (error) {
128
+ console.error("Error uploading file:", error);
129
+ return null;
130
+ }
131
+ };
132
+ var openFilePicker = async (options) => {
133
+ const win = window;
134
+ if (!win.showOpenFilePicker) {
135
+ console.error("File Picker API is not supported in this browser.");
136
+ return;
137
+ }
138
+ try {
139
+ const fileHandles = await win.showOpenFilePicker(options);
140
+ const fileHandle = fileHandles[0];
141
+ const file = await fileHandle.getFile();
142
+ const uploadedFile = await uploadFile(file);
143
+ if (!uploadedFile) {
144
+ console.error("Failed to upload file.");
145
+ return;
146
+ }
147
+ return {
148
+ id: uploadedFile.id,
149
+ name: uploadedFile.displayName,
150
+ url: uploadedFile.url
151
+ };
152
+ } catch (error) {
153
+ console.error("Error opening file picker:", error);
154
+ return null;
155
+ }
156
+ };
157
+
158
+ // src/components/SiteChatComponent/Footer/message-input/message-input.tsx
159
+ import { jsx as jsx4, jsxs as jsxs3 } from "react/jsx-runtime";
231
160
  var MessageInput = ({
232
161
  placeholder = "Type a message...",
233
162
  disabled = false,
234
163
  className = "",
235
- suffix = null,
164
+ suffix,
236
165
  value = "",
237
166
  onChange,
238
167
  onKeyDown,
239
- attachmentButton
168
+ onAttachmentAdded
240
169
  }) => {
241
- return /* @__PURE__ */ jsxs6("div", { className: `site-chat-component-footer-input-wrapper ${className}`, children: [
242
- /* @__PURE__ */ jsx7(
170
+ const handleAttachmentOnClick = async () => {
171
+ try {
172
+ await openFilePicker({ multiple: false }).then((file) => {
173
+ if (file && onAttachmentAdded) {
174
+ onAttachmentAdded(file);
175
+ }
176
+ });
177
+ } catch (error) {
178
+ console.error("Error opening file picker:", error);
179
+ }
180
+ };
181
+ return /* @__PURE__ */ jsxs3("div", { className: `site-chat-component-footer-input-wrapper ${className}`, children: [
182
+ /* @__PURE__ */ jsx4(
243
183
  "input",
244
184
  {
245
185
  name: "messageInput",
246
- className: "chat-input",
186
+ className: "site-chat-component-footer-chat-input",
247
187
  placeholder,
248
188
  disabled,
249
189
  value,
250
190
  onChange,
251
- onKeyDown,
252
- readOnly: !onChange
191
+ onKeyDown
253
192
  }
254
193
  ),
255
- suffix && /* @__PURE__ */ jsx7("sub", { className: "suffix", children: attachmentButton })
194
+ /* @__PURE__ */ jsx4("sub", { className: "site-chat-component-footer-suffix", children: /* @__PURE__ */ jsx4(IconButton2, { onClick: handleAttachmentOnClick, className: "attachment-icon-button", children: /* @__PURE__ */ jsx4(AttachmentSmall, {}) }) })
256
195
  ] });
257
196
  };
258
197
  var message_input_default = MessageInput;
259
198
 
260
199
  // src/components/SiteChatComponent/Footer/Footer.tsx
261
- import { jsx as jsx8, jsxs as jsxs7 } from "react/jsx-runtime";
262
- var Footer = React3.forwardRef(
200
+ import { jsx as jsx5, jsxs as jsxs4 } from "react/jsx-runtime";
201
+ var Footer = React2.forwardRef(
263
202
  ({
264
203
  className,
265
204
  children,
266
205
  sendButtonConfig,
267
206
  attachmentListConfig,
268
207
  messageInputConfig,
208
+ onAttachmentAdded,
269
209
  ...rest
270
210
  }, ref) => {
271
- return /* @__PURE__ */ jsx8("div", { ref, className: ["site-chat-footer", className].filter(Boolean).join(" "), ...rest, children: /* @__PURE__ */ jsxs7(Box5, { className: "site-chat-component-footer-message-input-container", direction: "vertical", gap: 1, verticalAlign: "middle", children: [
272
- /* @__PURE__ */ jsx8(Box5, { width: "100%", children: /* @__PURE__ */ jsx8(attachment_list_default, { items: (attachmentListConfig == null ? void 0 : attachmentListConfig.items) || [], onRemove: attachmentListConfig == null ? void 0 : attachmentListConfig.onRemove, onClick: attachmentListConfig == null ? void 0 : attachmentListConfig.onClick, onFilesSent: attachmentListConfig == null ? void 0 : attachmentListConfig.onFilesSent }) }),
273
- /* @__PURE__ */ jsxs7(Box5, { alignContent: "bottom", width: "100%", direction: "horizontal", gap: 2, verticalAlign: "middle", children: [
274
- /* @__PURE__ */ jsx8(
211
+ const handleSendMessage = (text, messageType, attachment) => {
212
+ if (sendButtonConfig == null ? void 0 : sendButtonConfig.onClick) {
213
+ sendButtonConfig.onClick(text, messageType, attachment);
214
+ } else {
215
+ console.warn("handleSendMessage function is not provided in sendButtonConfig");
216
+ }
217
+ };
218
+ return /* @__PURE__ */ jsxs4(Box3, { ref, className: "site-chat-component-footer-message-input-container", direction: "vertical", gap: 1, verticalAlign: "middle", children: [
219
+ /* @__PURE__ */ jsx5(Box3, { width: "100%", children: /* @__PURE__ */ jsx5(attachment_list_default, { items: (attachmentListConfig == null ? void 0 : attachmentListConfig.items) || [], onRemove: attachmentListConfig == null ? void 0 : attachmentListConfig.onRemove, onClick: attachmentListConfig == null ? void 0 : attachmentListConfig.onClick, onFilesSent: attachmentListConfig == null ? void 0 : attachmentListConfig.onFilesSent }) }),
220
+ /* @__PURE__ */ jsxs4(Box3, { alignContent: "bottom", width: "100%", direction: "horizontal", gap: 2, verticalAlign: "middle", children: [
221
+ /* @__PURE__ */ jsx5(
275
222
  message_input_default,
276
223
  {
277
224
  placeholder: (messageInputConfig == null ? void 0 : messageInputConfig.placeholder) || "Type your message here...",
@@ -280,56 +227,191 @@ var Footer = React3.forwardRef(
280
227
  onChange: messageInputConfig == null ? void 0 : messageInputConfig.onChange,
281
228
  onKeyDown: messageInputConfig == null ? void 0 : messageInputConfig.onKeyDown,
282
229
  disabled: messageInputConfig == null ? void 0 : messageInputConfig.disabled,
283
- attachmentButton: messageInputConfig == null ? void 0 : messageInputConfig.attachmentButton
230
+ onAttachmentAdded
284
231
  }
285
232
  ),
286
- /* @__PURE__ */ jsx8(
233
+ /* @__PURE__ */ jsx5(
287
234
  send_button_default,
288
235
  {
289
- onClick: sendButtonConfig == null ? void 0 : sendButtonConfig.onClick,
236
+ onClick: () => handleSendMessage((messageInputConfig == null ? void 0 : messageInputConfig.value) || "", (attachmentListConfig == null ? void 0 : attachmentListConfig.items) ? "ATTACHMENT" : "TEXT"),
290
237
  disabled: sendButtonConfig == null ? void 0 : sendButtonConfig.disabled,
291
238
  text: (sendButtonConfig == null ? void 0 : sendButtonConfig.buttonText) || "Send"
292
239
  }
293
240
  )
294
241
  ] })
295
- ] }) });
242
+ ] });
296
243
  }
297
244
  );
298
245
  Footer.displayName = "SiteChatComponent.Footer";
299
246
 
300
- // src/components/SiteChatComponent/FabButton/FabButton.tsx
247
+ // src/components/SiteChatComponent/Header/Header.tsx
248
+ import React3 from "react";
249
+ import { Box as Box4 } from "@wix/design-system";
250
+ import { jsx as jsx6, jsxs as jsxs5 } from "react/jsx-runtime";
251
+ var Header = React3.forwardRef(
252
+ ({
253
+ className,
254
+ children,
255
+ title,
256
+ subtitle,
257
+ image,
258
+ onClose,
259
+ ...rest
260
+ }, ref) => {
261
+ return /* @__PURE__ */ jsx6(Box4, { ref, className: "site-chat-component-header-container", verticalAlign: "middle", children: /* @__PURE__ */ jsxs5(Box4, { width: "100%", direction: "horizontal", align: "center", gap: "10px", children: [
262
+ image && /* @__PURE__ */ jsx6(Box4, { className: "site-chat-component-header-image", width: "60px", height: "50px", borderRadius: "999px", children: /* @__PURE__ */ jsx6("img", { style: { borderRadius: "999px" }, width: "100%", height: "100%", src: String(image), alt: "Business Logo" }) }),
263
+ /* @__PURE__ */ jsxs5(Box4, { direction: "vertical", className: "site-chat-component-header-text-section", children: [
264
+ /* @__PURE__ */ jsx6(Box4, { className: "site-chat-component-header-top-section", children: /* @__PURE__ */ jsxs5(Box4, { className: "site-chat-component-header-top", verticalAlign: "middle", WebkitJustifyContent: "space-between", width: "100%", children: [
265
+ title && /* @__PURE__ */ jsx6("h2", { className: "site-chat-component-header-title", children: title }),
266
+ /* @__PURE__ */ jsx6(
267
+ "button",
268
+ {
269
+ onClick: onClose,
270
+ "aria-label": "Close",
271
+ className: "site-chat-component-header-close-button",
272
+ children: "\u2715"
273
+ }
274
+ )
275
+ ] }) }),
276
+ /* @__PURE__ */ jsx6(Box4, { className: "site-chat-component-header-bottom-section", children: subtitle && /* @__PURE__ */ jsx6("h3", { className: "site-chat-component-header-subtitle", children: subtitle }) })
277
+ ] })
278
+ ] }) });
279
+ }
280
+ );
281
+ Header.displayName = "SiteChatComponent.Header";
282
+
283
+ // src/components/SiteChatComponent/MessageContainer/MessageContainer.tsx
301
284
  import React4 from "react";
302
285
  import { Box as Box6 } from "@wix/design-system";
286
+
287
+ // src/components/SiteChatComponent/MessageContainer/messages/messages-wrapper.tsx
288
+ import { useRef, useEffect as useEffect2 } from "react";
289
+ import { Avatar } from "@wix/design-system";
290
+
291
+ // src/components/SiteChatComponent/MessageContainer/messages/attachment.tsx
292
+ import { TextButton, Box as Box5 } from "@wix/design-system";
293
+ import {
294
+ Page as PageSmallIcon2
295
+ } from "@wix/wix-ui-icons-common";
296
+ import { ArrowTopRight as ArrowTopRightIcon } from "@wix/wix-ui-icons-common/on-stage";
297
+ import { jsx as jsx7, jsxs as jsxs6 } from "react/jsx-runtime";
298
+ var Attachment = ({ item }) => {
299
+ return /* @__PURE__ */ jsx7(Box5, { direction: "horizontal", maxWidth: "100%", boxSizing: "border-box", className: "site-chat-component-message-container-in-chat-file-item-wrapper-box", children: item && /* @__PURE__ */ jsxs6("div", { className: "site-chat-component-message-container-in-chat-file-item-container", children: [
300
+ /* @__PURE__ */ jsx7(PageSmallIcon2, { className: "site-chat-component-message-container-in-chat-file-icon", width: "20px", height: "20px" }),
301
+ /* @__PURE__ */ jsxs6("div", { className: "site-chat-component-message-container-in-chat-file-names-container", children: [
302
+ /* @__PURE__ */ jsx7("span", { className: "site-chat-component-message-container-in-chat-file-name", children: item.name }),
303
+ /* @__PURE__ */ jsx7("span", { className: "site-chat-component-message-container-in-chat-file-sub-name", children: "Attachment" })
304
+ ] }),
305
+ /* @__PURE__ */ jsx7(TextButton, { size: "tiny", onClick: () => window.open(item.url, "_blank"), suffixIcon: /* @__PURE__ */ jsx7(ArrowTopRightIcon, { size: "tiny" }), children: "Open" })
306
+ ] }, item.id) });
307
+ };
308
+ var attachment_default = Attachment;
309
+
310
+ // src/components/SiteChatComponent/MessageContainer/messages/messages-wrapper.tsx
311
+ import { jsx as jsx8, jsxs as jsxs7 } from "react/jsx-runtime";
312
+ var AGENT_MESSAGE_GAP = "10px";
313
+ var AGENT_MESSAGE_WIDTH = "75%";
314
+ var AGENT_MESSAGE_INNER_GAP = "4px";
315
+ var ONE_MINUTE_MS = 6e4;
316
+ var ONE_DAY_MS = 864e5;
317
+ var DAYS_IN_WEEK = 7;
318
+ var formatTimestamp = (timestamp) => {
319
+ if (!timestamp) return "";
320
+ const date = new Date(timestamp);
321
+ const now = /* @__PURE__ */ new Date();
322
+ if (now.getTime() - date.getTime() < ONE_MINUTE_MS) return "Just now";
323
+ const time = date.toLocaleTimeString([], { hour: "2-digit", minute: "2-digit" });
324
+ const startOfToday = new Date(now.getFullYear(), now.getMonth(), now.getDate());
325
+ const startOfDay = new Date(date.getFullYear(), date.getMonth(), date.getDate());
326
+ const diffDays = Math.floor((startOfToday.getTime() - startOfDay.getTime()) / ONE_DAY_MS);
327
+ if (diffDays === 0) return `Today at ${time}`;
328
+ if (diffDays === 1) return `Yesterday at ${time}`;
329
+ if (diffDays < DAYS_IN_WEEK && date.getDay() < now.getDay())
330
+ return `${date.toLocaleDateString([], { weekday: "short" })} at ${time}`;
331
+ return `${date.toLocaleDateString([], { month: "short", day: "numeric", year: "numeric" })} at ${time}`;
332
+ };
333
+ var MessagesWrapper = ({ messages = [] }) => {
334
+ const wrapperRef = useRef(null);
335
+ useEffect2(() => {
336
+ if (wrapperRef.current) {
337
+ wrapperRef.current.scrollTop = wrapperRef.current.scrollHeight;
338
+ }
339
+ }, [messages]);
340
+ return /* @__PURE__ */ jsx8("div", { className: "site-chat-component-message-container-messages-wrapper", ref: wrapperRef, children: messages.map(({ _id, message, attachment, timestamp, type, agentName }, index) => /* @__PURE__ */ jsx8("div", { className: `message-item ${type}`, children: type === "agent" ? /* @__PURE__ */ jsx8(AgentMessageWrapper, { message, attachment: attachment ? Array.isArray(attachment) ? attachment[0] : attachment : void 0, timestamp, agentName }) : type === "user" ? /* @__PURE__ */ jsx8(UserMessageWrapper, { message, attachment: attachment ? Array.isArray(attachment) ? attachment[0] : attachment : void 0, timestamp }) : /* @__PURE__ */ jsx8(SystemMessageWrapper, { message, timestamp }) }, _id || index)) });
341
+ };
342
+ var GetSystemMessage = ({ type }) => {
343
+ switch (type) {
344
+ case "AGENT_JOINED":
345
+ return /* @__PURE__ */ jsx8("div", { className: "site-chat-component-message-container-system-message-message", children: "An agent has joined the chat." });
346
+ case "AGENT_LEFT":
347
+ return /* @__PURE__ */ jsx8("div", { className: "site-chat-component-message-container-system-message-message", children: "An agent has left the chat." });
348
+ case "USER_JOINED":
349
+ return /* @__PURE__ */ jsx8("div", { className: "site-chat-component-message-container-system-message-message", children: "A user has joined the chat." });
350
+ case "USER_LEFT":
351
+ return /* @__PURE__ */ jsx8("div", { className: "site-chat-component-message-container-system-message-message", children: "A user has left the chat." });
352
+ case "CHAT_ENDED":
353
+ return /* @__PURE__ */ jsx8("div", { className: "site-chat-component-message-container-system-message-message", children: "The chat has ended." });
354
+ case "CHAT_REOPENED":
355
+ return /* @__PURE__ */ jsx8("div", { className: "site-chat-component-message-container-system-message-message", children: "The chat has been reopened." });
356
+ case "CHAT_TRANSFERRED":
357
+ return /* @__PURE__ */ jsx8("div", { className: "site-chat-component-message-container-system-message-message", children: "The chat has been transferred to another agent." });
358
+ case "WAITING_FOR_AGENT":
359
+ return /* @__PURE__ */ jsx8("div", { className: "site-chat-component-message-container-system-message-message", children: "Waiting for an agent to join the chat..." });
360
+ default:
361
+ return /* @__PURE__ */ jsx8("div", { className: "site-chat-component-message-container-system-message-message", children: "System message" });
362
+ }
363
+ };
364
+ var SystemMessageWrapper = ({ message, timestamp }) => {
365
+ return /* @__PURE__ */ jsx8("div", { className: "site-chat-component-message-container-system-message-wrapper", children: /* @__PURE__ */ jsxs7("div", { className: "site-chat-component-message-container-system-message", children: [
366
+ /* @__PURE__ */ jsx8("hr", { className: "dashed" }),
367
+ /* @__PURE__ */ jsx8(GetSystemMessage, { type: message }),
368
+ /* @__PURE__ */ jsx8("hr", { className: "dashed" })
369
+ ] }) });
370
+ };
371
+ var AgentMessageWrapper = ({ message, attachment, timestamp, agentName }) => {
372
+ return /* @__PURE__ */ jsxs7("div", { style: { display: "flex", flexDirection: "row", gap: AGENT_MESSAGE_GAP }, children: [
373
+ /* @__PURE__ */ jsx8(Avatar, { size: "size24", className: "site-chat-component-message-container-agent-message-avatar", name: agentName }),
374
+ /* @__PURE__ */ jsxs7("div", { style: { width: AGENT_MESSAGE_WIDTH, gap: AGENT_MESSAGE_INNER_GAP, display: "flex", flexDirection: "column" }, children: [
375
+ agentName && /* @__PURE__ */ jsxs7("div", { className: "site-chat-component-message-container-agent-name-time-container", children: [
376
+ /* @__PURE__ */ jsx8("div", { className: "site-chat-component-message-container-agent-name", children: agentName }),
377
+ /* @__PURE__ */ jsx8("div", { className: "site-chat-component-message-container-agent-message-timestamp", children: formatTimestamp(timestamp) })
378
+ ] }),
379
+ /* @__PURE__ */ jsx8("div", { className: `site-chat-component-message-container-agent-message-wrapper${attachment ? "-attachment" : ""}`, children: /* @__PURE__ */ jsxs7("div", { className: "site-chat-component-message-container-agent-message", children: [
380
+ message && message,
381
+ attachment && /* @__PURE__ */ jsx8(attachment_default, { item: attachment })
382
+ ] }) })
383
+ ] })
384
+ ] });
385
+ };
386
+ var UserMessageWrapper = ({ message, attachment, timestamp }) => {
387
+ return /* @__PURE__ */ jsxs7("div", { style: { display: "flex", flexDirection: "column", alignItems: "flex-end", gap: "4px" }, children: [
388
+ !attachment && /* @__PURE__ */ jsx8("div", { className: "site-chat-component-message-container-user-name", children: "Me" }),
389
+ /* @__PURE__ */ jsx8("div", { className: `site-chat-component-message-container-user-message-wrapper${attachment ? "-attachment" : ""}`, children: /* @__PURE__ */ jsxs7("div", { className: "site-chat-component-message-container-user-message", children: [
390
+ message && message,
391
+ attachment && /* @__PURE__ */ jsx8(attachment_default, { item: attachment })
392
+ ] }) })
393
+ ] });
394
+ };
395
+ var messages_wrapper_default = MessagesWrapper;
396
+
397
+ // src/components/SiteChatComponent/MessageContainer/MessageContainer.tsx
303
398
  import { jsx as jsx9, jsxs as jsxs8 } from "react/jsx-runtime";
304
- var FabButton = React4.forwardRef(
399
+ var MessageContainer = React4.forwardRef(
305
400
  ({
306
401
  className,
307
402
  children,
308
- onClick,
309
- type,
310
- icon,
311
- text,
403
+ messages,
404
+ loading,
312
405
  ...rest
313
406
  }, ref) => {
314
- return /* @__PURE__ */ jsx9("div", { ref, className: ["site-chat-fab-button", className].filter(Boolean).join(" "), ...rest, children: /* @__PURE__ */ jsxs8(
315
- "button",
316
- {
317
- className: "site-chat-component-fab",
318
- onClick,
319
- children: [
320
- type === "textIcon" ? /* @__PURE__ */ jsx9("span", { className: "site-chat-component-fab-fab-button-icon", children: /* @__PURE__ */ jsx9(Box6, { height: "100%", children: icon }) }) : null,
321
- type === "textIcon" || type === "text" ? /* @__PURE__ */ jsx9("span", { className: "site-chat-component-fab-fab-button-text", children: /* @__PURE__ */ jsx9("span", { className: "site-chat-component-fab-fab-button-label", children: text }) }) : null,
322
- type === "icon" ? /* @__PURE__ */ jsx9("span", { className: "site-chat-component-fab-fab-button-icon", children: /* @__PURE__ */ jsx9(Box6, { height: "100%", width: "max-content", children: icon }) }) : null
323
- ]
324
- }
325
- ) });
407
+ return /* @__PURE__ */ jsxs8(Box6, { ref, className: "site-chat-component-message-container", children: [
408
+ loading && /* @__PURE__ */ jsx9(Box6, { className: "site-chat-component-message-container-loading-state", children: /* @__PURE__ */ jsx9("p", { children: "Loading messages..." }) }),
409
+ messages.length === 0 && !loading && /* @__PURE__ */ jsx9(Box6, { className: "site-chat-component-message-container-empty-state", children: /* @__PURE__ */ jsx9("p", { children: "No messages yet. Start a conversation" }) }),
410
+ messages.length > 0 && /* @__PURE__ */ jsx9(messages_wrapper_default, { messages })
411
+ ] });
326
412
  }
327
413
  );
328
- FabButton.displayName = "SiteChatComponent.FabButton";
329
-
330
- // src/components/SiteChatComponent/SiteChatComponent.tsx
331
- import { Box as Box7, Text } from "@wix/design-system";
332
- import "@wix/design-system/styles.global.css";
414
+ MessageContainer.displayName = "SiteChatComponent.MessageContainer";
333
415
 
334
416
  // src/components/SiteChatComponent/SiteChatComponent.css
335
417
  if (typeof document !== "undefined" && !document.getElementById("jrapps-style-3c48ccde")) {
@@ -348,7 +430,7 @@ if (typeof document !== "undefined" && !document.getElementById("jrapps-style-3c
348
430
  border-top-left-radius: inherit;
349
431
  }
350
432
 
351
- .site-chat-component-header-container .text-section {
433
+ .site-chat-component-header-container .site-chat-component-header-text-section {
352
434
  width: 100%;
353
435
  }
354
436
 
@@ -666,13 +748,13 @@ if (typeof document !== "undefined" && !document.getElementById("jrapps-style-3c
666
748
  gap: 0px;
667
749
  }
668
750
 
669
- .site-chat-component-message-container-user-message-wrapper-attachment .in-chat-file-item-wrapper-box {
751
+ .site-chat-component-message-container-user-message-wrapper-attachment .site-chat-component-message-container-in-chat-file-item-wrapper-box {
670
752
  align-items: flex-end;
671
753
  display: flex;
672
754
  flex-direction: column;
673
755
  }
674
756
 
675
- .site-chat-component-message-container-agent-message-wrapper-attachment .in-chat-file-item-wrapper-box {
757
+ .site-chat-component-message-container-agent-message-wrapper-attachment .site-chat-component-message-container-in-chat-file-item-wrapper-box {
676
758
  align-items: flex-start;
677
759
  display: flex;
678
760
  flex-direction: column;
@@ -852,59 +934,27 @@ if (typeof document !== "undefined" && !document.getElementById("jrapps-style-3c
852
934
  import { jsx as jsx10, jsxs as jsxs9 } from "react/jsx-runtime";
853
935
  var SiteChatComponentRoot = React5.forwardRef(
854
936
  ({
855
- className,
856
937
  children,
857
938
  viewMode,
858
939
  editorShowChatPanel,
859
940
  handleToggle,
860
- handleClose,
861
941
  buttonTextValue,
862
- demoMessages,
863
- loading,
864
- messages,
865
- handleSendMessage,
866
- isOpen,
867
- ...rest
868
- }, ref) => {
869
- const {} = useSiteChatComponent();
870
- const ToRender = ({ children: children2 }) => {
871
- if (viewMode === "Editor") {
872
- editorShowChatPanel = true;
873
- if (typeof editorShowChatPanel === "undefined") {
874
- console.error("Editor view mode detected but editorShowChatPanel prop is not provided. Please provide editorShowChatPanel prop to control the chat panel visibility in Editor mode.");
875
- return /* @__PURE__ */ jsx10(Box7, { align: "center", verticalAlign: "middle", height: "100%", width: "100%", children: /* @__PURE__ */ jsx10(Text, { children: "Editor view mode detected but editorShowChatPanel prop is not provided" }) });
876
- }
877
- return /* @__PURE__ */ jsxs9(Box7, { children: [
878
- /* @__PURE__ */ jsx10(FabButton, { onClick: handleToggle, text: buttonTextValue }),
879
- /* @__PURE__ */ jsx10(
880
- Box7,
881
- {
882
- className: `site-chat-component-panel ${editorShowChatPanel ? "open" : ""}`,
883
- children: children2
884
- }
885
- )
886
- ] });
942
+ isOpen
943
+ }, _ref) => {
944
+ useSiteChatComponent();
945
+ if (viewMode === "Editor") {
946
+ if (typeof editorShowChatPanel === "undefined") {
947
+ return /* @__PURE__ */ jsx10(Box7, { align: "center", verticalAlign: "middle", height: "100%", width: "100%", children: /* @__PURE__ */ jsx10(Text, { children: "Editor view mode detected but editorShowChatPanel prop is not provided" }) });
887
948
  }
888
949
  return /* @__PURE__ */ jsxs9(Box7, { children: [
889
950
  /* @__PURE__ */ jsx10(FabButton, { onClick: handleToggle, text: buttonTextValue }),
890
- /* @__PURE__ */ jsx10(
891
- Box7,
892
- {
893
- className: `site-chat-component-panel ${isOpen ? "open" : ""}`,
894
- children: children2
895
- }
896
- )
951
+ /* @__PURE__ */ jsx10(Box7, { className: `site-chat-component-panel ${editorShowChatPanel ? "open" : ""}`, children })
897
952
  ] });
898
- };
899
- return /* @__PURE__ */ jsx10(
900
- "div",
901
- {
902
- ref,
903
- className: ["site-chat-component", className].filter(Boolean).join(" "),
904
- ...rest,
905
- children: /* @__PURE__ */ jsx10(ToRender, { children })
906
- }
907
- );
953
+ }
954
+ return /* @__PURE__ */ jsxs9(Box7, { children: [
955
+ /* @__PURE__ */ jsx10(FabButton, { onClick: handleToggle, text: buttonTextValue }),
956
+ /* @__PURE__ */ jsx10(Box7, { className: `site-chat-component-panel ${isOpen ? "open" : ""}`, children })
957
+ ] });
908
958
  }
909
959
  );
910
960
  SiteChatComponentRoot.displayName = "SiteChatComponent";
@@ -918,4 +968,4 @@ var SiteChatComponent = Object.assign(SiteChatComponentRoot, {
918
968
  export {
919
969
  SiteChatComponent
920
970
  };
921
- //# sourceMappingURL=chunk-E5MBV2MX.js.map
971
+ //# sourceMappingURL=chunk-P3P4FPSX.js.map