@jrapps/my_tickets_chat_ui 0.0.4 → 0.0.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.
- package/dist/cjs/components/SiteChatComponent/index.js +17 -2835
- package/dist/cjs/components/SiteChatComponent/index.js.map +4 -4
- package/dist/cjs/index.js +17 -2835
- package/dist/cjs/index.js.map +4 -4
- package/dist/esm/chunks/chunk-E5MBV2MX.js +921 -0
- package/dist/esm/chunks/chunk-E5MBV2MX.js.map +7 -0
- package/dist/esm/components/SiteChatComponent/index.js +1 -1
- package/dist/esm/index.js +1 -1
- package/package.json +5 -1
- package/dist/esm/chunks/chunk-UB6ZZ4NT.js +0 -3762
- package/dist/esm/chunks/chunk-UB6ZZ4NT.js.map +0 -7
|
@@ -0,0 +1,921 @@
|
|
|
1
|
+
// src/components/SiteChatComponent/SiteChatComponent.tsx
|
|
2
|
+
import React5 from "react";
|
|
3
|
+
|
|
4
|
+
// src/components/SiteChatComponent/useSiteChatComponent.ts
|
|
5
|
+
function useSiteChatComponent() {
|
|
6
|
+
return {};
|
|
7
|
+
}
|
|
8
|
+
|
|
9
|
+
// src/components/SiteChatComponent/Header/Header.tsx
|
|
10
|
+
import React from "react";
|
|
11
|
+
import { Box } from "@wix/design-system";
|
|
12
|
+
import { jsx, jsxs } from "react/jsx-runtime";
|
|
13
|
+
var Header = React.forwardRef(
|
|
14
|
+
({
|
|
15
|
+
className,
|
|
16
|
+
children,
|
|
17
|
+
title,
|
|
18
|
+
subtitle,
|
|
19
|
+
image,
|
|
20
|
+
onClose,
|
|
21
|
+
...rest
|
|
22
|
+
}, 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
|
+
] }) }) });
|
|
41
|
+
}
|
|
42
|
+
);
|
|
43
|
+
Header.displayName = "SiteChatComponent.Header";
|
|
44
|
+
|
|
45
|
+
// src/components/SiteChatComponent/MessageContainer/MessageContainer.tsx
|
|
46
|
+
import React2 from "react";
|
|
47
|
+
import { Box as Box3 } from "@wix/design-system";
|
|
48
|
+
|
|
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
|
+
// src/components/SiteChatComponent/Footer/send-button/send-button.tsx
|
|
177
|
+
import { jsx as jsx5 } from "react/jsx-runtime";
|
|
178
|
+
var SendButton = ({
|
|
179
|
+
text = "Send",
|
|
180
|
+
className = "",
|
|
181
|
+
onClick,
|
|
182
|
+
disabled = false
|
|
183
|
+
}) => {
|
|
184
|
+
return /* @__PURE__ */ jsx5(
|
|
185
|
+
"button",
|
|
186
|
+
{
|
|
187
|
+
className: `site-chat-component-footer-my-tickets-chat-widget-send-button ${className}`,
|
|
188
|
+
onClick,
|
|
189
|
+
disabled,
|
|
190
|
+
children: text
|
|
191
|
+
}
|
|
192
|
+
);
|
|
193
|
+
};
|
|
194
|
+
var send_button_default = SendButton;
|
|
195
|
+
|
|
196
|
+
// 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";
|
|
199
|
+
import {
|
|
200
|
+
Page as PageSmallIcon2,
|
|
201
|
+
DismissSmall as DismissIcon
|
|
202
|
+
} from "@wix/wix-ui-icons-common";
|
|
203
|
+
import { jsx as jsx6, jsxs as jsxs5 } from "react/jsx-runtime";
|
|
204
|
+
var AttachmentList = ({ items, onRemove, onClick, onFilesSent }) => {
|
|
205
|
+
const [localItems, setLocalItems] = useState(items);
|
|
206
|
+
useEffect2(() => {
|
|
207
|
+
setLocalItems(items);
|
|
208
|
+
}, [items]);
|
|
209
|
+
const handleOnRemove = (id) => {
|
|
210
|
+
if (onRemove) {
|
|
211
|
+
onRemove(id);
|
|
212
|
+
}
|
|
213
|
+
setLocalItems((prev) => prev.filter((item) => item.id !== id));
|
|
214
|
+
};
|
|
215
|
+
const handleSendFiles = () => {
|
|
216
|
+
if (onFilesSent && localItems.length > 0) {
|
|
217
|
+
onFilesSent(localItems);
|
|
218
|
+
setLocalItems([]);
|
|
219
|
+
}
|
|
220
|
+
};
|
|
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, {}) })
|
|
225
|
+
] }, item.id)) });
|
|
226
|
+
};
|
|
227
|
+
var attachment_list_default = AttachmentList;
|
|
228
|
+
|
|
229
|
+
// src/components/SiteChatComponent/Footer/message-input/message-input.tsx
|
|
230
|
+
import { jsx as jsx7, jsxs as jsxs6 } from "react/jsx-runtime";
|
|
231
|
+
var MessageInput = ({
|
|
232
|
+
placeholder = "Type a message...",
|
|
233
|
+
disabled = false,
|
|
234
|
+
className = "",
|
|
235
|
+
suffix = null,
|
|
236
|
+
value = "",
|
|
237
|
+
onChange,
|
|
238
|
+
onKeyDown,
|
|
239
|
+
attachmentButton
|
|
240
|
+
}) => {
|
|
241
|
+
return /* @__PURE__ */ jsxs6("div", { className: `site-chat-component-footer-input-wrapper ${className}`, children: [
|
|
242
|
+
/* @__PURE__ */ jsx7(
|
|
243
|
+
"input",
|
|
244
|
+
{
|
|
245
|
+
name: "messageInput",
|
|
246
|
+
className: "chat-input",
|
|
247
|
+
placeholder,
|
|
248
|
+
disabled,
|
|
249
|
+
value,
|
|
250
|
+
onChange,
|
|
251
|
+
onKeyDown,
|
|
252
|
+
readOnly: !onChange
|
|
253
|
+
}
|
|
254
|
+
),
|
|
255
|
+
suffix && /* @__PURE__ */ jsx7("sub", { className: "suffix", children: attachmentButton })
|
|
256
|
+
] });
|
|
257
|
+
};
|
|
258
|
+
var message_input_default = MessageInput;
|
|
259
|
+
|
|
260
|
+
// src/components/SiteChatComponent/Footer/Footer.tsx
|
|
261
|
+
import { jsx as jsx8, jsxs as jsxs7 } from "react/jsx-runtime";
|
|
262
|
+
var Footer = React3.forwardRef(
|
|
263
|
+
({
|
|
264
|
+
className,
|
|
265
|
+
children,
|
|
266
|
+
sendButtonConfig,
|
|
267
|
+
attachmentListConfig,
|
|
268
|
+
messageInputConfig,
|
|
269
|
+
...rest
|
|
270
|
+
}, 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(
|
|
275
|
+
message_input_default,
|
|
276
|
+
{
|
|
277
|
+
placeholder: (messageInputConfig == null ? void 0 : messageInputConfig.placeholder) || "Type your message here...",
|
|
278
|
+
className: (messageInputConfig == null ? void 0 : messageInputConfig.className) || "message-input",
|
|
279
|
+
value: (messageInputConfig == null ? void 0 : messageInputConfig.value) || "",
|
|
280
|
+
onChange: messageInputConfig == null ? void 0 : messageInputConfig.onChange,
|
|
281
|
+
onKeyDown: messageInputConfig == null ? void 0 : messageInputConfig.onKeyDown,
|
|
282
|
+
disabled: messageInputConfig == null ? void 0 : messageInputConfig.disabled,
|
|
283
|
+
attachmentButton: messageInputConfig == null ? void 0 : messageInputConfig.attachmentButton
|
|
284
|
+
}
|
|
285
|
+
),
|
|
286
|
+
/* @__PURE__ */ jsx8(
|
|
287
|
+
send_button_default,
|
|
288
|
+
{
|
|
289
|
+
onClick: sendButtonConfig == null ? void 0 : sendButtonConfig.onClick,
|
|
290
|
+
disabled: sendButtonConfig == null ? void 0 : sendButtonConfig.disabled,
|
|
291
|
+
text: (sendButtonConfig == null ? void 0 : sendButtonConfig.buttonText) || "Send"
|
|
292
|
+
}
|
|
293
|
+
)
|
|
294
|
+
] })
|
|
295
|
+
] }) });
|
|
296
|
+
}
|
|
297
|
+
);
|
|
298
|
+
Footer.displayName = "SiteChatComponent.Footer";
|
|
299
|
+
|
|
300
|
+
// src/components/SiteChatComponent/FabButton/FabButton.tsx
|
|
301
|
+
import React4 from "react";
|
|
302
|
+
import { Box as Box6 } from "@wix/design-system";
|
|
303
|
+
import { jsx as jsx9, jsxs as jsxs8 } from "react/jsx-runtime";
|
|
304
|
+
var FabButton = React4.forwardRef(
|
|
305
|
+
({
|
|
306
|
+
className,
|
|
307
|
+
children,
|
|
308
|
+
onClick,
|
|
309
|
+
type,
|
|
310
|
+
icon,
|
|
311
|
+
text,
|
|
312
|
+
...rest
|
|
313
|
+
}, 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
|
+
) });
|
|
326
|
+
}
|
|
327
|
+
);
|
|
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";
|
|
333
|
+
|
|
334
|
+
// src/components/SiteChatComponent/SiteChatComponent.css
|
|
335
|
+
if (typeof document !== "undefined" && !document.getElementById("jrapps-style-3c48ccde")) {
|
|
336
|
+
const s = document.createElement("style");
|
|
337
|
+
s.id = "jrapps-style-3c48ccde";
|
|
338
|
+
s.textContent = `.site-chat-component {
|
|
339
|
+
/* SiteChatComponent base styles */
|
|
340
|
+
}
|
|
341
|
+
|
|
342
|
+
/* ---------- Header styles ---------- */
|
|
343
|
+
|
|
344
|
+
.site-chat-component-header-container {
|
|
345
|
+
background: var(--my-tickets-chat-widget-panel-header-background-color);
|
|
346
|
+
padding: 10px;
|
|
347
|
+
border-top-right-radius: inherit;
|
|
348
|
+
border-top-left-radius: inherit;
|
|
349
|
+
}
|
|
350
|
+
|
|
351
|
+
.site-chat-component-header-container .text-section {
|
|
352
|
+
width: 100%;
|
|
353
|
+
}
|
|
354
|
+
|
|
355
|
+
.site-chat-component-header-title {
|
|
356
|
+
font-style: var(--my-tickets-chat-widget-panel-header-title-font-style);
|
|
357
|
+
margin-bottom: 0 !important;
|
|
358
|
+
color: var(--my-tickets-chat-widget-panel-header-title-color);
|
|
359
|
+
}
|
|
360
|
+
|
|
361
|
+
.site-chat-component-header-subtitle {
|
|
362
|
+
font-style: var(--my-tickets-chat-widget-panel-header-subtitle-font-style);
|
|
363
|
+
font-weight: normal !important;
|
|
364
|
+
margin-top: 0 !important;
|
|
365
|
+
color: var(--my-tickets-chat-widget-panel-header-subtitle-color);
|
|
366
|
+
}
|
|
367
|
+
|
|
368
|
+
.site-chat-component-header-close-button {
|
|
369
|
+
cursor: pointer !important;
|
|
370
|
+
background: none;
|
|
371
|
+
border: none;
|
|
372
|
+
padding: 4px;
|
|
373
|
+
color: var(--my-tickets-chat-widget-panel-header-button-color);
|
|
374
|
+
font-size: 1.25rem;
|
|
375
|
+
line-height: 1;
|
|
376
|
+
border-radius: 4px;
|
|
377
|
+
transition: opacity 0.15s;
|
|
378
|
+
}
|
|
379
|
+
|
|
380
|
+
.site-chat-component-header-close-button:hover {
|
|
381
|
+
opacity: 0.8;
|
|
382
|
+
}
|
|
383
|
+
|
|
384
|
+
/* ---------- Footer styles ---------- */
|
|
385
|
+
|
|
386
|
+
.site-chat-component-footer-message-input-container {
|
|
387
|
+
padding: var(--cw-space-md, 16px);
|
|
388
|
+
background: var(--my-tickets-chat-widget-panel-footer-background-color);
|
|
389
|
+
font-family: var(--cw-font, sans-serif);
|
|
390
|
+
border-radius: 0 0 var(--cw-radius-panel, 16px) var(--cw-radius-panel, 16px);
|
|
391
|
+
}
|
|
392
|
+
|
|
393
|
+
.site-chat-component-footer-attachment-icon-button {
|
|
394
|
+
width: 20px;
|
|
395
|
+
height: 20px;
|
|
396
|
+
}
|
|
397
|
+
|
|
398
|
+
.site-chat-component-footer-my-tickets-chat-widget-send-button {
|
|
399
|
+
background: var(--my-tickets-chat-widget-panel-footer-button-color);
|
|
400
|
+
border: 1px solid var(--my-tickets-chat-widget-panel-footer-button-border-color);
|
|
401
|
+
color: var(--my-tickets-chat-widget-panel-footer-button-text-color);
|
|
402
|
+
padding: 6px;
|
|
403
|
+
border-radius: 4px;
|
|
404
|
+
width: 80px;
|
|
405
|
+
cursor: pointer;
|
|
406
|
+
}
|
|
407
|
+
|
|
408
|
+
.site-chat-component-footer-my-tickets-chat-widget-send-button:disabled {
|
|
409
|
+
opacity: 0.5;
|
|
410
|
+
cursor: default;
|
|
411
|
+
}
|
|
412
|
+
|
|
413
|
+
.site-chat-component-footer-file-item-container {
|
|
414
|
+
display: flex;
|
|
415
|
+
align-items: center;
|
|
416
|
+
gap: 8px;
|
|
417
|
+
padding: 2px 4px;
|
|
418
|
+
border-radius: var(--wds-input-area-border-radius-default-medium, 6px);
|
|
419
|
+
background-color: var(--wds-color-surface, var(--wsr-color-surface, #FFFFFF));
|
|
420
|
+
border: 1px solid var(--wds-input-border-color, var(--wsr-color-B40, #D6E6FE));
|
|
421
|
+
box-sizing: border-box;
|
|
422
|
+
}
|
|
423
|
+
|
|
424
|
+
.site-chat-component-footer-file-name {
|
|
425
|
+
font-family: var(--wds-font-family-default, var(--wsr-font-family, Madefor, "Helvetica Neue", Helvetica, Arial, "\\30E1\\30A4\\30EA\\30AA", "meiryo", "\\30D2\\30E9\\30AE\\30CE\\89D2\\30B4 pro w3", "hiragino kaku gothic pro", sans-serif));
|
|
426
|
+
font-size: var(--wds-font-size-body-small, var(--wsr-text-font-size-small, 14px));
|
|
427
|
+
font-weight: var(--wds-font-weight-regular, var(--wsr-font-weight-regular, 400));
|
|
428
|
+
line-height: var(--wds-font-line-height-body-small, var(--wsr-text-line-height-small, 20px));
|
|
429
|
+
letter-spacing: var(--wds-font-letter-spacing-0, unset);
|
|
430
|
+
white-space: nowrap;
|
|
431
|
+
overflow: hidden;
|
|
432
|
+
text-overflow: ellipsis;
|
|
433
|
+
max-width: 115px;
|
|
434
|
+
}
|
|
435
|
+
|
|
436
|
+
.site-chat-component-footer-input-wrapper {
|
|
437
|
+
padding: 5px;
|
|
438
|
+
box-sizing: border-box;
|
|
439
|
+
width: inherit;
|
|
440
|
+
display: flex;
|
|
441
|
+
justify-content: center;
|
|
442
|
+
flex-direction: row;
|
|
443
|
+
gap: 10px;
|
|
444
|
+
border-radius: 4px;
|
|
445
|
+
background: var(--my-tickets-chat-widget-panel-footer-input-background-color);
|
|
446
|
+
border: 2px solid var(--my-tickets-chat-widget-panel-footer-input-border-color);
|
|
447
|
+
color: var(--my-tickets-chat-widget-panel-footer-input-text-color);
|
|
448
|
+
font-size: var(--my-tickets-chat-widget-panel-footer-input-text-size);
|
|
449
|
+
font-family: 'Arial', sans-serif;
|
|
450
|
+
}
|
|
451
|
+
|
|
452
|
+
.site-chat-component-footer-suffix {
|
|
453
|
+
background: inherit;
|
|
454
|
+
width: max-content;
|
|
455
|
+
min-height: 100%;
|
|
456
|
+
max-height: 100%;
|
|
457
|
+
align-items: center;
|
|
458
|
+
justify-content: center;
|
|
459
|
+
display: flex;
|
|
460
|
+
font-size: inherit;
|
|
461
|
+
padding: 0px;
|
|
462
|
+
margin: 0px;
|
|
463
|
+
font-family: inherit;
|
|
464
|
+
color: inherit;
|
|
465
|
+
box-sizing: border-box;
|
|
466
|
+
}
|
|
467
|
+
|
|
468
|
+
.site-chat-component-footer-chat-input {
|
|
469
|
+
background: inherit;
|
|
470
|
+
border: none;
|
|
471
|
+
font-size: inherit;
|
|
472
|
+
font-family: inherit;
|
|
473
|
+
color: inherit;
|
|
474
|
+
width: inherit;
|
|
475
|
+
}
|
|
476
|
+
|
|
477
|
+
.site-chat-component-footer-chat-input::placeholder {
|
|
478
|
+
background: inherit;
|
|
479
|
+
border: none;
|
|
480
|
+
font-size: inherit;
|
|
481
|
+
font-family: inherit;
|
|
482
|
+
color: inherit;
|
|
483
|
+
opacity: 0.5;
|
|
484
|
+
}
|
|
485
|
+
|
|
486
|
+
.site-chat-component-footer-chat-input:focus {
|
|
487
|
+
outline: none;
|
|
488
|
+
}
|
|
489
|
+
|
|
490
|
+
/* ---------- Messages styles ---------- */
|
|
491
|
+
/* Message Container */
|
|
492
|
+
.site-chat-component-message-container {
|
|
493
|
+
display: flex !important;
|
|
494
|
+
flex-direction: column !important;
|
|
495
|
+
padding: var(--cw-space-md, 16px) !important;
|
|
496
|
+
background: var(--my-tickets-chat-widget-panel-messages-background-color) !important;
|
|
497
|
+
flex: 1 !important;
|
|
498
|
+
min-height: 0;
|
|
499
|
+
overflow-y: auto !important;
|
|
500
|
+
}
|
|
501
|
+
|
|
502
|
+
.site-chat-component-message-container-messages-wrapper {
|
|
503
|
+
display: flex;
|
|
504
|
+
flex-direction: column;
|
|
505
|
+
gap: var(--cw-space-sm, 8px);
|
|
506
|
+
}
|
|
507
|
+
|
|
508
|
+
.site-chat-component-message-container-agent-message-wrapper,
|
|
509
|
+
.site-chat-component-message-container-user-message-wrapper {
|
|
510
|
+
display: flex;
|
|
511
|
+
padding: 10px 14px;
|
|
512
|
+
border-radius: var(--cw-radius-bubble, 12px);
|
|
513
|
+
width: max-content;
|
|
514
|
+
max-width: 80%;
|
|
515
|
+
font-family: var(--cw-font, sans-serif);
|
|
516
|
+
}
|
|
517
|
+
|
|
518
|
+
.site-chat-component-message-container-agent-name {
|
|
519
|
+
color: var(--my-tickets-chat-widget-panel-messages-agent-name-text-color);
|
|
520
|
+
font-size: var(--my-tickets-chat-widget-panel-messages-agent-name-text-size);
|
|
521
|
+
font-weight: 500;
|
|
522
|
+
}
|
|
523
|
+
|
|
524
|
+
.site-chat-component-message-container-user-name {
|
|
525
|
+
color: var(--my-tickets-chat-widget-panel-messages-user-name-text-color);
|
|
526
|
+
font-size: var(--my-tickets-chat-widget-panel-messages-user-name-text-size);
|
|
527
|
+
font-weight: 500;
|
|
528
|
+
display: var(--my-tickets-chat-widget-panel-messages-user-name-text-visible);
|
|
529
|
+
}
|
|
530
|
+
|
|
531
|
+
.site-chat-component-message-container-agent-message-avatar {
|
|
532
|
+
margin-top: 20px;
|
|
533
|
+
display: var(--my-tickets-chat-widget-panel-messages-agent-icon-visible);
|
|
534
|
+
}
|
|
535
|
+
|
|
536
|
+
.site-chat-component-message-container-user-message,
|
|
537
|
+
.site-chat-component-message-container-agent-message {
|
|
538
|
+
line-height: 1.5;
|
|
539
|
+
word-wrap: break-word;
|
|
540
|
+
}
|
|
541
|
+
|
|
542
|
+
.site-chat-component-message-container-agent-message {
|
|
543
|
+
font-size: var(--my-tickets-chat-widget-panel-messages-agent-text-size);
|
|
544
|
+
}
|
|
545
|
+
|
|
546
|
+
.site-chat-component-message-container-user-message {
|
|
547
|
+
font-size: var(--my-tickets-chat-widget-panel-messages-user-text-size);
|
|
548
|
+
}
|
|
549
|
+
|
|
550
|
+
.site-chat-component-message-container-agent-message-wrapper {
|
|
551
|
+
justify-content: flex-start;
|
|
552
|
+
align-self: flex-start;
|
|
553
|
+
background-color: var(--my-tickets-chat-widget-panel-messages-agent-bubble-color);
|
|
554
|
+
color: var(--my-tickets-chat-widget-panel-messages-agent-text-color);
|
|
555
|
+
}
|
|
556
|
+
|
|
557
|
+
.site-chat-component-message-container-user-message-wrapper {
|
|
558
|
+
justify-content: flex-end;
|
|
559
|
+
align-self: flex-end;
|
|
560
|
+
margin-left: auto;
|
|
561
|
+
background-color: var(--my-tickets-chat-widget-panel-messages-user-bubble-color);
|
|
562
|
+
color: var(--my-tickets-chat-widget-panel-messages-user-text-color);
|
|
563
|
+
}
|
|
564
|
+
|
|
565
|
+
.site-chat-component-message-container-agent-name-time-container {
|
|
566
|
+
gap: 8px;
|
|
567
|
+
display: flex;
|
|
568
|
+
align-items: center;
|
|
569
|
+
font-family: 'Madefor';
|
|
570
|
+
font-size: 13px;
|
|
571
|
+
}
|
|
572
|
+
|
|
573
|
+
/* System Messages */
|
|
574
|
+
|
|
575
|
+
.site-chat-component-message-container-system-message {
|
|
576
|
+
display: flex;
|
|
577
|
+
justify-content: center;
|
|
578
|
+
align-items: center;
|
|
579
|
+
width: 100%;
|
|
580
|
+
gap: var(--cw-space-sm, 8px);
|
|
581
|
+
}
|
|
582
|
+
|
|
583
|
+
.site-chat-component-message-container-system-message .dashed {
|
|
584
|
+
flex: 1;
|
|
585
|
+
border: none;
|
|
586
|
+
border-top: 1px dashed var(--my-tickets-chat-widget-panel-messages-system-color);
|
|
587
|
+
margin: 0;
|
|
588
|
+
}
|
|
589
|
+
|
|
590
|
+
.site-chat-component-message-container-system-message-message {
|
|
591
|
+
color: var(--my-tickets-chat-widget-panel-messages-system-color);
|
|
592
|
+
font-family: var(--cw-font, sans-serif);
|
|
593
|
+
font-size: var(--my-tickets-chat-widget-panel-messages-system-size);
|
|
594
|
+
font-weight: 500;
|
|
595
|
+
white-space: nowrap;
|
|
596
|
+
}
|
|
597
|
+
|
|
598
|
+
/* Empty and Loading States */
|
|
599
|
+
|
|
600
|
+
.site-chat-component-message-container-empty-state {
|
|
601
|
+
display: flex;
|
|
602
|
+
flex: 1;
|
|
603
|
+
align-items: center;
|
|
604
|
+
justify-content: center;
|
|
605
|
+
}
|
|
606
|
+
|
|
607
|
+
.site-chat-component-message-container-empty-state p {
|
|
608
|
+
font-family: var(--cw-font, sans-serif);
|
|
609
|
+
font-size: 14px;
|
|
610
|
+
color: var(--my-tickets-chat-widget-panel-messages-system-color);
|
|
611
|
+
}
|
|
612
|
+
|
|
613
|
+
.site-chat-component-message-container-loading-state {
|
|
614
|
+
display: flex;
|
|
615
|
+
flex: 1;
|
|
616
|
+
align-items: center;
|
|
617
|
+
justify-content: center;
|
|
618
|
+
}
|
|
619
|
+
|
|
620
|
+
.site-chat-component-message-container-loading-state p {
|
|
621
|
+
font-family: var(--cw-font, sans-serif);
|
|
622
|
+
font-size: 14px;
|
|
623
|
+
color: var(--my-tickets-chat-widget-panel-messages-system-color);
|
|
624
|
+
}
|
|
625
|
+
|
|
626
|
+
.site-chat-component-message-container-in-chat-file-item-container {
|
|
627
|
+
display: flex;
|
|
628
|
+
align-items: center;
|
|
629
|
+
gap: 8px;
|
|
630
|
+
padding: 4px 8px;
|
|
631
|
+
border-radius: var(--wds-input-area-border-radius-default-medium, 6px);
|
|
632
|
+
background-color: var(--wds-color-surface, var(--wsr-color-surface, #FFFFFF));
|
|
633
|
+
border: 1px solid var(--wds-input-border-color, var(--wsr-color-B40, #D6E6FE));
|
|
634
|
+
box-sizing: border-box;
|
|
635
|
+
}
|
|
636
|
+
|
|
637
|
+
.site-chat-component-message-container-in-chat-file-name {
|
|
638
|
+
font-family: var(--wds-font-family-default, var(--wsr-font-family, Madefor, "Helvetica Neue", Helvetica, Arial, "\\30E1\\30A4\\30EA\\30AA", "meiryo", "\\30D2\\30E9\\30AE\\30CE\\89D2\\30B4 pro w3", "hiragino kaku gothic pro", sans-serif));
|
|
639
|
+
font-size: var(--wds-font-size-body-tiny, var(--wsr-text-font-size-tiny, 10px));
|
|
640
|
+
font-weight: var(--wds-font-weight-regular, var(--wsr-font-weight-regular, 400));
|
|
641
|
+
line-height: var(--wds-font-line-height-body-tiny, var(--wsr-text-line-height-tiny, 12px));
|
|
642
|
+
letter-spacing: var(--wds-font-letter-spacing-0, unset);
|
|
643
|
+
white-space: nowrap;
|
|
644
|
+
overflow: hidden;
|
|
645
|
+
text-overflow: ellipsis;
|
|
646
|
+
max-width: 150px;
|
|
647
|
+
color: black;
|
|
648
|
+
}
|
|
649
|
+
|
|
650
|
+
.site-chat-component-message-container-in-chat-file-sub-name {
|
|
651
|
+
font-family: var(--wds-font-family-default, var(--wsr-font-family, Madefor, "Helvetica Neue", Helvetica, Arial, "\\30E1\\30A4\\30EA\\30AA", "meiryo", "\\30D2\\30E9\\30AE\\30CE\\89D2\\30B4 pro w3", "hiragino kaku gothic pro", sans-serif));
|
|
652
|
+
font-size: var(--wds-font-size-body-tiny, var(--wsr-text-font-size-tiny, 10px));
|
|
653
|
+
font-weight: var(--wds-font-weight-regular, var(--wsr-font-weight-regular, 400));
|
|
654
|
+
line-height: var(--wds-font-line-height-body-tiny, var(--wsr-text-line-height-tiny, 12px));
|
|
655
|
+
letter-spacing: var(--wds-font-letter-spacing-0, unset);
|
|
656
|
+
color: var(--wds-color-text-secondary, var(--wsr-color-text-secondary, #6B6B6B));
|
|
657
|
+
}
|
|
658
|
+
|
|
659
|
+
.site-chat-component-message-container-in-chat-file-icon {
|
|
660
|
+
fill: black !important;
|
|
661
|
+
}
|
|
662
|
+
|
|
663
|
+
.site-chat-component-message-container-in-chat-file-names-container {
|
|
664
|
+
display: flex;
|
|
665
|
+
flex-direction: column;
|
|
666
|
+
gap: 0px;
|
|
667
|
+
}
|
|
668
|
+
|
|
669
|
+
.site-chat-component-message-container-user-message-wrapper-attachment .in-chat-file-item-wrapper-box {
|
|
670
|
+
align-items: flex-end;
|
|
671
|
+
display: flex;
|
|
672
|
+
flex-direction: column;
|
|
673
|
+
}
|
|
674
|
+
|
|
675
|
+
.site-chat-component-message-container-agent-message-wrapper-attachment .in-chat-file-item-wrapper-box {
|
|
676
|
+
align-items: flex-start;
|
|
677
|
+
display: flex;
|
|
678
|
+
flex-direction: column;
|
|
679
|
+
}
|
|
680
|
+
|
|
681
|
+
/* FAB */
|
|
682
|
+
.site-chat-component-fab {
|
|
683
|
+
position: fixed;
|
|
684
|
+
bottom: 24px;
|
|
685
|
+
right: 24px;
|
|
686
|
+
gap: 4.5px;
|
|
687
|
+
cursor: pointer;
|
|
688
|
+
z-index: 100;
|
|
689
|
+
user-select: none;
|
|
690
|
+
border-radius: 99px;
|
|
691
|
+
padding: 9px 25px;
|
|
692
|
+
transition: background-color 0.2s ease, border-color 0.2s ease, color 0.2s ease;
|
|
693
|
+
display: flex;
|
|
694
|
+
justify-content: center;
|
|
695
|
+
align-items: center;
|
|
696
|
+
flex-direction: row;
|
|
697
|
+
|
|
698
|
+
font-size: var(--my-tickets-chat-widget-button-text-size) !important;
|
|
699
|
+
background-color: var(--my-tickets-chat-widget-button-color);
|
|
700
|
+
border: 1px solid var(--my-tickets-chat-widget-button-border-color);
|
|
701
|
+
color: var(--my-tickets-chat-widget-button-text-color);
|
|
702
|
+
font: var(--my-tickets-chat-widget-button-text-font);
|
|
703
|
+
}
|
|
704
|
+
|
|
705
|
+
.site-chat-component-fab-fab-button-label {
|
|
706
|
+
margin: 0;
|
|
707
|
+
padding: 0;
|
|
708
|
+
line-height: 1;
|
|
709
|
+
display: inline-flex;
|
|
710
|
+
align-items: center;
|
|
711
|
+
margin-top: 2px;
|
|
712
|
+
}
|
|
713
|
+
|
|
714
|
+
.site-chat-component-fab-fab-button-icon,
|
|
715
|
+
.site-chat-component-fab-fab-button-text {
|
|
716
|
+
display: inline-flex;
|
|
717
|
+
align-items: center;
|
|
718
|
+
height: 100%;
|
|
719
|
+
}
|
|
720
|
+
|
|
721
|
+
.site-chat-component-fab-fab-button-icon svg {
|
|
722
|
+
width: var(--my-tickets-chat-widget-button-icon-size);
|
|
723
|
+
height: var(--my-tickets-chat-widget-button-icon-size);
|
|
724
|
+
font-weight: inherit;
|
|
725
|
+
}
|
|
726
|
+
|
|
727
|
+
/* \u2500\u2500 Design Tokens \u2500\u2500 */
|
|
728
|
+
:host {
|
|
729
|
+
--cw-font: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
|
|
730
|
+
|
|
731
|
+
/* Primary palette */
|
|
732
|
+
--cw-primary: #3B82F6;
|
|
733
|
+
--cw-primary-hover: #2563EB;
|
|
734
|
+
--cw-primary-light: #EFF6FF;
|
|
735
|
+
--cw-primary-shadow: rgba(59, 130, 246, 0.35);
|
|
736
|
+
--cw-primary-shadow-hover: rgba(59, 130, 246, 0.5);
|
|
737
|
+
|
|
738
|
+
/* Neutrals */
|
|
739
|
+
--cw-bg: #F8FAFC;
|
|
740
|
+
--cw-surface: #FFFFFF;
|
|
741
|
+
--cw-border: #E2E8F0;
|
|
742
|
+
|
|
743
|
+
/* Text */
|
|
744
|
+
--cw-text: #1E293B;
|
|
745
|
+
--cw-text-muted: #64748B;
|
|
746
|
+
--cw-text-inverse: #FFFFFF;
|
|
747
|
+
|
|
748
|
+
/* Message bubbles */
|
|
749
|
+
--cw-bubble-user: var(--cw-primary);
|
|
750
|
+
--cw-bubble-user-text: var(--cw-text-inverse);
|
|
751
|
+
--cw-bubble-agent: #F1F5F9;
|
|
752
|
+
--cw-bubble-agent-text: var(--cw-text);
|
|
753
|
+
|
|
754
|
+
/* Radii */
|
|
755
|
+
--cw-radius-panel: 16px;
|
|
756
|
+
--cw-radius-bubble: 12px;
|
|
757
|
+
--cw-radius-pill: 50px;
|
|
758
|
+
|
|
759
|
+
/* Spacing */
|
|
760
|
+
--cw-space-xs: 4px;
|
|
761
|
+
--cw-space-sm: 8px;
|
|
762
|
+
--cw-space-md: 16px;
|
|
763
|
+
--cw-space-lg: 24px;
|
|
764
|
+
|
|
765
|
+
/* Shadows */
|
|
766
|
+
--cw-shadow-panel: 0 20px 60px rgba(0, 0, 0, 0.12), 0 4px 16px rgba(0, 0, 0, 0.05);
|
|
767
|
+
--cw-shadow-fab: 0 8px 24px var(--cw-primary-shadow);
|
|
768
|
+
--cw-shadow-fab-hover: 0 12px 32px var(--cw-primary-shadow-hover);
|
|
769
|
+
}
|
|
770
|
+
|
|
771
|
+
/* \u2500\u2500 Hide toggle \u2500\u2500 */
|
|
772
|
+
#site-chat-component-chat-toggle {
|
|
773
|
+
display: none;
|
|
774
|
+
}
|
|
775
|
+
|
|
776
|
+
/* \u2500\u2500 Panel \u2500\u2500 */
|
|
777
|
+
.site-chat-component-panel {
|
|
778
|
+
position: fixed !important;
|
|
779
|
+
bottom: 60px;
|
|
780
|
+
right: 30px;
|
|
781
|
+
width: min(340px, 100vw);
|
|
782
|
+
max-height: 50vh;
|
|
783
|
+
max-height: 50dvh;
|
|
784
|
+
background: var(--cw-surface);
|
|
785
|
+
border-radius: var(--cw-radius-panel, 16px) !important;
|
|
786
|
+
box-shadow: var(--cw-shadow-panel);
|
|
787
|
+
transform: scale(0.85) translateY(16px);
|
|
788
|
+
transform-origin: bottom right;
|
|
789
|
+
opacity: 0;
|
|
790
|
+
pointer-events: none;
|
|
791
|
+
transition: transform 0.3s cubic-bezier(.175, .885, .32, 1.275), opacity 0.25s ease;
|
|
792
|
+
z-index: 99;
|
|
793
|
+
display: flex !important;
|
|
794
|
+
flex-direction: column !important;
|
|
795
|
+
min-height: 450px;
|
|
796
|
+
font-family: var(--cw-font);
|
|
797
|
+
overflow: hidden;
|
|
798
|
+
border: 0px solid var(--wst-color-line);
|
|
799
|
+
box-shadow: 0 2px 6px var(--wst-color-line), 0 0 0 1px var(--wst-color-line);
|
|
800
|
+
}
|
|
801
|
+
|
|
802
|
+
.site-chat-component-panel.open {
|
|
803
|
+
transform: scale(1) translateY(0);
|
|
804
|
+
opacity: 1;
|
|
805
|
+
pointer-events: all;
|
|
806
|
+
z-index: 101;
|
|
807
|
+
bottom: 10px;
|
|
808
|
+
}
|
|
809
|
+
|
|
810
|
+
/* \u2500\u2500 Mobile: fill screen \u2500\u2500 */
|
|
811
|
+
@media (max-width: 480px) {
|
|
812
|
+
.site-chat-component-panel {
|
|
813
|
+
width: 100vw;
|
|
814
|
+
height: 100vh;
|
|
815
|
+
height: 100dvh;
|
|
816
|
+
min-height: 0;
|
|
817
|
+
max-height: none;
|
|
818
|
+
bottom: 0;
|
|
819
|
+
right: 0;
|
|
820
|
+
}
|
|
821
|
+
|
|
822
|
+
.site-chat-component-panel.open {
|
|
823
|
+
top: 0;
|
|
824
|
+
left: 0;
|
|
825
|
+
right: 0;
|
|
826
|
+
bottom: 0;
|
|
827
|
+
}
|
|
828
|
+
}
|
|
829
|
+
|
|
830
|
+
/* \u2500\u2500 Small tablets \u2500\u2500 */
|
|
831
|
+
@media (min-width: 481px) and (max-width: 768px) {
|
|
832
|
+
.site-chat-component-panel {
|
|
833
|
+
width: min(380px, calc(100vw - 24px));
|
|
834
|
+
max-height: 70vh;
|
|
835
|
+
max-height: 70dvh;
|
|
836
|
+
}
|
|
837
|
+
}
|
|
838
|
+
|
|
839
|
+
/* \u2500\u2500 Large screens \u2500\u2500 */
|
|
840
|
+
@media (min-width: 1200px) {
|
|
841
|
+
.site-chat-component-panel {
|
|
842
|
+
width: 350px;
|
|
843
|
+
max-height: 70vh;
|
|
844
|
+
max-height: 70dvh;
|
|
845
|
+
}
|
|
846
|
+
}
|
|
847
|
+
`;
|
|
848
|
+
document.head.appendChild(s);
|
|
849
|
+
}
|
|
850
|
+
|
|
851
|
+
// src/components/SiteChatComponent/SiteChatComponent.tsx
|
|
852
|
+
import { jsx as jsx10, jsxs as jsxs9 } from "react/jsx-runtime";
|
|
853
|
+
var SiteChatComponentRoot = React5.forwardRef(
|
|
854
|
+
({
|
|
855
|
+
className,
|
|
856
|
+
children,
|
|
857
|
+
viewMode,
|
|
858
|
+
editorShowChatPanel,
|
|
859
|
+
handleToggle,
|
|
860
|
+
handleClose,
|
|
861
|
+
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
|
+
] });
|
|
887
|
+
}
|
|
888
|
+
return /* @__PURE__ */ jsxs9(Box7, { children: [
|
|
889
|
+
/* @__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
|
+
)
|
|
897
|
+
] });
|
|
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
|
+
);
|
|
908
|
+
}
|
|
909
|
+
);
|
|
910
|
+
SiteChatComponentRoot.displayName = "SiteChatComponent";
|
|
911
|
+
var SiteChatComponent = Object.assign(SiteChatComponentRoot, {
|
|
912
|
+
Header,
|
|
913
|
+
MessageContainer,
|
|
914
|
+
Footer,
|
|
915
|
+
FabButton
|
|
916
|
+
});
|
|
917
|
+
|
|
918
|
+
export {
|
|
919
|
+
SiteChatComponent
|
|
920
|
+
};
|
|
921
|
+
//# sourceMappingURL=chunk-E5MBV2MX.js.map
|