@jrapps/my_tickets_chat_ui 0.2.2 → 0.3.1

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 (130) hide show
  1. package/dist/cjs/components/SiteChatComponentNew/index.js +115 -97
  2. package/dist/cjs/components/SiteChatComponentNew/index.js.map +2 -2
  3. package/dist/cjs/components/SiteChatComponentNewErc/index.js +1334 -0
  4. package/dist/cjs/components/SiteChatComponentNewErc/index.js.map +7 -0
  5. package/dist/cjs/index.js +1688 -1334
  6. package/dist/cjs/index.js.map +4 -4
  7. package/dist/esm/chunks/chunk-KT236RUF.js +1302 -0
  8. package/dist/esm/chunks/chunk-KT236RUF.js.map +7 -0
  9. package/dist/esm/chunks/{chunk-BTOGFMSB.js → chunk-QGWQSJDB.js} +116 -98
  10. package/dist/esm/chunks/chunk-QGWQSJDB.js.map +7 -0
  11. package/dist/esm/components/SiteChatComponentNew/index.js +1 -1
  12. package/dist/esm/components/SiteChatComponentNewErc/index.js +9 -0
  13. package/dist/esm/index.js +8 -6
  14. package/dist/types/components/SiteChatComponentNew/Footer/Footer.d.ts.map +1 -1
  15. package/dist/types/components/SiteChatComponentNewErc/Footer/Footer.d.ts +6 -0
  16. package/dist/types/components/SiteChatComponentNewErc/Footer/Footer.d.ts.map +1 -0
  17. package/dist/types/components/SiteChatComponentNewErc/Footer/index.d.ts +2 -0
  18. package/dist/types/components/SiteChatComponentNewErc/Footer/index.d.ts.map +1 -0
  19. package/dist/types/components/SiteChatComponentNewErc/Header/Header.d.ts +6 -0
  20. package/dist/types/components/SiteChatComponentNewErc/Header/Header.d.ts.map +1 -0
  21. package/dist/types/components/SiteChatComponentNewErc/Header/index.d.ts +2 -0
  22. package/dist/types/components/SiteChatComponentNewErc/Header/index.d.ts.map +1 -0
  23. package/dist/types/components/SiteChatComponentNewErc/Messages/AgentMessage.d.ts +10 -0
  24. package/dist/types/components/SiteChatComponentNewErc/Messages/AgentMessage.d.ts.map +1 -0
  25. package/dist/types/components/SiteChatComponentNewErc/Messages/AttachmentMessage.d.ts +9 -0
  26. package/dist/types/components/SiteChatComponentNewErc/Messages/AttachmentMessage.d.ts.map +1 -0
  27. package/dist/types/components/SiteChatComponentNewErc/Messages/MessageList.d.ts +10 -0
  28. package/dist/types/components/SiteChatComponentNewErc/Messages/MessageList.d.ts.map +1 -0
  29. package/dist/types/components/SiteChatComponentNewErc/Messages/MessageRenderer.d.ts +9 -0
  30. package/dist/types/components/SiteChatComponentNewErc/Messages/MessageRenderer.d.ts.map +1 -0
  31. package/dist/types/components/SiteChatComponentNewErc/Messages/SystemMessage.d.ts +10 -0
  32. package/dist/types/components/SiteChatComponentNewErc/Messages/SystemMessage.d.ts.map +1 -0
  33. package/dist/types/components/SiteChatComponentNewErc/Messages/TypingIndicator.d.ts +5 -0
  34. package/dist/types/components/SiteChatComponentNewErc/Messages/TypingIndicator.d.ts.map +1 -0
  35. package/dist/types/components/SiteChatComponentNewErc/Messages/UserMessage.d.ts +10 -0
  36. package/dist/types/components/SiteChatComponentNewErc/Messages/UserMessage.d.ts.map +1 -0
  37. package/dist/types/components/SiteChatComponentNewErc/Messages/index.d.ts +8 -0
  38. package/dist/types/components/SiteChatComponentNewErc/Messages/index.d.ts.map +1 -0
  39. package/dist/types/components/SiteChatComponentNewErc/OfflineForm/OfflineForm.d.ts +10 -0
  40. package/dist/types/components/SiteChatComponentNewErc/OfflineForm/OfflineForm.d.ts.map +1 -0
  41. package/dist/types/components/SiteChatComponentNewErc/OfflineForm/index.d.ts +2 -0
  42. package/dist/types/components/SiteChatComponentNewErc/OfflineForm/index.d.ts.map +1 -0
  43. package/dist/types/components/SiteChatComponentNewErc/Shared/Avatar.d.ts +10 -0
  44. package/dist/types/components/SiteChatComponentNewErc/Shared/Avatar.d.ts.map +1 -0
  45. package/dist/types/components/SiteChatComponentNewErc/Shared/Button.d.ts +14 -0
  46. package/dist/types/components/SiteChatComponentNewErc/Shared/Button.d.ts.map +1 -0
  47. package/dist/types/components/SiteChatComponentNewErc/Shared/index.d.ts +3 -0
  48. package/dist/types/components/SiteChatComponentNewErc/Shared/index.d.ts.map +1 -0
  49. package/dist/types/components/SiteChatComponentNewErc/SiteChatComponentNewErc.d.ts +5 -0
  50. package/dist/types/components/SiteChatComponentNewErc/SiteChatComponentNewErc.d.ts.map +1 -0
  51. package/dist/types/components/SiteChatComponentNewErc/SiteChatComponentNewErc.types.d.ts +146 -0
  52. package/dist/types/components/SiteChatComponentNewErc/SiteChatComponentNewErc.types.d.ts.map +1 -0
  53. package/dist/types/components/SiteChatComponentNewErc/States/ChatEndedState.d.ts +5 -0
  54. package/dist/types/components/SiteChatComponentNewErc/States/ChatEndedState.d.ts.map +1 -0
  55. package/dist/types/components/SiteChatComponentNewErc/States/LoadingState.d.ts +5 -0
  56. package/dist/types/components/SiteChatComponentNewErc/States/LoadingState.d.ts.map +1 -0
  57. package/dist/types/components/SiteChatComponentNewErc/States/OfflineState.d.ts +10 -0
  58. package/dist/types/components/SiteChatComponentNewErc/States/OfflineState.d.ts.map +1 -0
  59. package/dist/types/components/SiteChatComponentNewErc/States/StartChatState.d.ts +11 -0
  60. package/dist/types/components/SiteChatComponentNewErc/States/StartChatState.d.ts.map +1 -0
  61. package/dist/types/components/SiteChatComponentNewErc/States/index.d.ts +5 -0
  62. package/dist/types/components/SiteChatComponentNewErc/States/index.d.ts.map +1 -0
  63. package/dist/types/components/SiteChatComponentNewErc/hooks/index.d.ts +3 -0
  64. package/dist/types/components/SiteChatComponentNewErc/hooks/index.d.ts.map +1 -0
  65. package/dist/types/components/SiteChatComponentNewErc/hooks/useAutoScroll.d.ts +15 -0
  66. package/dist/types/components/SiteChatComponentNewErc/hooks/useAutoScroll.d.ts.map +1 -0
  67. package/dist/types/components/SiteChatComponentNewErc/hooks/useOfflineForm.d.ts +12 -0
  68. package/dist/types/components/SiteChatComponentNewErc/hooks/useOfflineForm.d.ts.map +1 -0
  69. package/dist/types/components/SiteChatComponentNewErc/index.d.ts +4 -0
  70. package/dist/types/components/SiteChatComponentNewErc/index.d.ts.map +1 -0
  71. package/dist/types/components/SiteChatComponentNewErc/useSiteChatComponentNewErc.d.ts +3 -0
  72. package/dist/types/components/SiteChatComponentNewErc/useSiteChatComponentNewErc.d.ts.map +1 -0
  73. package/dist/types/components/SiteChatComponentNewErc/utils/classNames.d.ts +28 -0
  74. package/dist/types/components/SiteChatComponentNewErc/utils/classNames.d.ts.map +1 -0
  75. package/dist/types/components/SiteChatComponentNewErc/utils/format.d.ts +9 -0
  76. package/dist/types/components/SiteChatComponentNewErc/utils/format.d.ts.map +1 -0
  77. package/dist/types/components/SiteChatComponentNewErc/utils/index.d.ts +4 -0
  78. package/dist/types/components/SiteChatComponentNewErc/utils/index.d.ts.map +1 -0
  79. package/dist/types/components/SiteChatComponentNewErc/utils/systemMessages.d.ts +4 -0
  80. package/dist/types/components/SiteChatComponentNewErc/utils/systemMessages.d.ts.map +1 -0
  81. package/dist/types/components/SiteChatComponentNewErc/utils/theme.d.ts +8 -0
  82. package/dist/types/components/SiteChatComponentNewErc/utils/theme.d.ts.map +1 -0
  83. package/dist/types/components/index.d.ts +1 -1
  84. package/dist/types/components/index.d.ts.map +1 -1
  85. package/package.json +2 -5
  86. package/dist/cjs/components/SiteChatComponent/index.js +0 -998
  87. package/dist/cjs/components/SiteChatComponent/index.js.map +0 -7
  88. package/dist/esm/chunks/chunk-BTOGFMSB.js.map +0 -7
  89. package/dist/esm/chunks/chunk-QPJPV2T3.js +0 -971
  90. package/dist/esm/chunks/chunk-QPJPV2T3.js.map +0 -7
  91. package/dist/esm/components/SiteChatComponent/index.js +0 -7
  92. package/dist/types/components/SiteChatComponent/FabButton/FabButton.d.ts +0 -4
  93. package/dist/types/components/SiteChatComponent/FabButton/FabButton.d.ts.map +0 -1
  94. package/dist/types/components/SiteChatComponent/FabButton/FabButton.types.d.ts +0 -8
  95. package/dist/types/components/SiteChatComponent/FabButton/FabButton.types.d.ts.map +0 -1
  96. package/dist/types/components/SiteChatComponent/Footer/Footer.d.ts +0 -4
  97. package/dist/types/components/SiteChatComponent/Footer/Footer.d.ts.map +0 -1
  98. package/dist/types/components/SiteChatComponent/Footer/Footer.types.d.ts +0 -45
  99. package/dist/types/components/SiteChatComponent/Footer/Footer.types.d.ts.map +0 -1
  100. package/dist/types/components/SiteChatComponent/Footer/attachment-list/attachment-list.d.ts +0 -5
  101. package/dist/types/components/SiteChatComponent/Footer/attachment-list/attachment-list.d.ts.map +0 -1
  102. package/dist/types/components/SiteChatComponent/Footer/message-input/message-input.d.ts +0 -18
  103. package/dist/types/components/SiteChatComponent/Footer/message-input/message-input.d.ts.map +0 -1
  104. package/dist/types/components/SiteChatComponent/Footer/message-input/open-file-picker.d.ts +0 -10
  105. package/dist/types/components/SiteChatComponent/Footer/message-input/open-file-picker.d.ts.map +0 -1
  106. package/dist/types/components/SiteChatComponent/Footer/send-button/send-button.d.ts +0 -10
  107. package/dist/types/components/SiteChatComponent/Footer/send-button/send-button.d.ts.map +0 -1
  108. package/dist/types/components/SiteChatComponent/Header/Header.d.ts +0 -4
  109. package/dist/types/components/SiteChatComponent/Header/Header.d.ts.map +0 -1
  110. package/dist/types/components/SiteChatComponent/Header/Header.types.d.ts +0 -8
  111. package/dist/types/components/SiteChatComponent/Header/Header.types.d.ts.map +0 -1
  112. package/dist/types/components/SiteChatComponent/MessageContainer/MessageContainer.d.ts +0 -4
  113. package/dist/types/components/SiteChatComponent/MessageContainer/MessageContainer.d.ts.map +0 -1
  114. package/dist/types/components/SiteChatComponent/MessageContainer/MessageContainer.types.d.ts +0 -7
  115. package/dist/types/components/SiteChatComponent/MessageContainer/MessageContainer.types.d.ts.map +0 -1
  116. package/dist/types/components/SiteChatComponent/MessageContainer/messages/attachment.d.ts +0 -5
  117. package/dist/types/components/SiteChatComponent/MessageContainer/messages/attachment.d.ts.map +0 -1
  118. package/dist/types/components/SiteChatComponent/MessageContainer/messages/messages-wrapper.d.ts +0 -5
  119. package/dist/types/components/SiteChatComponent/MessageContainer/messages/messages-wrapper.d.ts.map +0 -1
  120. package/dist/types/components/SiteChatComponent/SiteChatComponent.d.ts +0 -11
  121. package/dist/types/components/SiteChatComponent/SiteChatComponent.d.ts.map +0 -1
  122. package/dist/types/components/SiteChatComponent/SiteChatComponent.types.d.ts +0 -10
  123. package/dist/types/components/SiteChatComponent/SiteChatComponent.types.d.ts.map +0 -1
  124. package/dist/types/components/SiteChatComponent/index.d.ts +0 -6
  125. package/dist/types/components/SiteChatComponent/index.d.ts.map +0 -1
  126. package/dist/types/components/SiteChatComponent/useSiteChatComponent.d.ts +0 -8
  127. package/dist/types/components/SiteChatComponent/useSiteChatComponent.d.ts.map +0 -1
  128. package/dist/types/test/test.d.ts +0 -8
  129. package/dist/types/test/test.d.ts.map +0 -1
  130. /package/dist/esm/components/{SiteChatComponent → SiteChatComponentNewErc}/index.js.map +0 -0
package/dist/cjs/index.js CHANGED
@@ -30,983 +30,22 @@ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: tru
30
30
  // src/index.ts
31
31
  var src_exports = {};
32
32
  __export(src_exports, {
33
- SiteChatComponent: () => SiteChatComponent,
34
33
  SiteChatComponentNew: () => SiteChatComponentNew,
35
- useSiteChatComponentNew: () => useSiteChatComponentNew
34
+ SiteChatComponentNewErc: () => SiteChatComponentNewErc,
35
+ useSiteChatComponentNew: () => useSiteChatComponentNew,
36
+ useSiteChatComponentNewErc: () => useSiteChatComponentNewErc
36
37
  });
37
38
  module.exports = __toCommonJS(src_exports);
38
39
 
39
- // src/components/SiteChatComponent/SiteChatComponent.tsx
40
- var import_react7 = __toESM(require("react"));
41
- var import_design_system9 = require("@wix/design-system");
42
- var import_styles_global = require("@wix/design-system/styles.global.css");
43
-
44
- // src/components/SiteChatComponent/useSiteChatComponent.ts
45
- function useSiteChatComponent() {
46
- return {};
47
- }
48
-
49
- // src/components/SiteChatComponent/FabButton/FabButton.tsx
50
- var import_react = __toESM(require("react"));
51
- var import_design_system = require("@wix/design-system");
52
- var import_wix_ui_icons_common = require("@wix/wix-ui-icons-common");
53
- var import_jsx_runtime = require("react/jsx-runtime");
54
- var FabButton = import_react.default.forwardRef(
55
- ({
56
- className,
57
- children,
58
- onClick,
59
- type = "textIcon",
60
- icon = /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_wix_ui_icons_common.WixChat, {}),
61
- text,
62
- ...rest
63
- }, ref) => {
64
- return /* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", { ref, children: /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(
65
- "button",
66
- {
67
- className: "site-chat-component-fab",
68
- onClick,
69
- children: [
70
- type === "textIcon" ? /* @__PURE__ */ (0, import_jsx_runtime.jsx)("span", { className: "site-chat-component-fab-fab-button-icon", children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_design_system.Box, { height: "100%", children: icon }) }) : null,
71
- type === "textIcon" || type === "text" ? /* @__PURE__ */ (0, import_jsx_runtime.jsx)("span", { className: "site-chat-component-fab-fab-button-text", children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)("span", { className: "site-chat-component-fab-fab-button-label", children: text }) }) : null,
72
- type === "icon" ? /* @__PURE__ */ (0, import_jsx_runtime.jsx)("span", { className: "site-chat-component-fab-fab-button-icon", children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_design_system.Box, { height: "100%", width: "max-content", children: icon }) }) : null
73
- ]
74
- }
75
- ) });
76
- }
77
- );
78
- FabButton.displayName = "SiteChatComponent.FabButton";
79
-
80
- // src/components/SiteChatComponent/Footer/Footer.tsx
81
- var import_react3 = __toESM(require("react"));
82
- var import_design_system4 = require("@wix/design-system");
83
-
84
- // src/components/SiteChatComponent/Footer/send-button/send-button.tsx
85
- var import_jsx_runtime2 = require("react/jsx-runtime");
86
- var SendButton = ({
87
- text = "Send",
88
- className = "",
89
- onClick,
90
- disabled = false
91
- }) => {
92
- return /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(
93
- "button",
94
- {
95
- className: `site-chat-component-footer-my-tickets-chat-widget-send-button ${className}`,
96
- onClick,
97
- disabled,
98
- children: text
99
- }
100
- );
101
- };
102
- var send_button_default = SendButton;
103
-
104
- // src/components/SiteChatComponent/Footer/attachment-list/attachment-list.tsx
105
- var import_react2 = require("react");
106
- var import_design_system2 = require("@wix/design-system");
107
- var import_wix_ui_icons_common2 = require("@wix/wix-ui-icons-common");
108
- var import_jsx_runtime3 = require("react/jsx-runtime");
109
- var AttachmentList = ({ items, onRemove, onClick, onFilesSent }) => {
110
- const [localItems, setLocalItems] = (0, import_react2.useState)(items);
111
- (0, import_react2.useEffect)(() => {
112
- setLocalItems(items);
113
- }, [items]);
114
- const handleOnRemove = (id) => {
115
- if (onRemove) {
116
- onRemove(id);
117
- }
118
- setLocalItems((prev) => prev.filter((item) => item.id !== id));
119
- };
120
- const handleSendFiles = () => {
121
- if (onFilesSent && localItems.length > 0) {
122
- onFilesSent(localItems);
123
- setLocalItems([]);
124
- }
125
- };
126
- return /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(import_design_system2.Box, { direction: "horizontal", gap: 2, maxWidth: "100%", minWidth: "100%", overflowY: "hidden", boxSizing: "border-box", scrollbarWidth: "thin", overflowX: "auto", children: localItems.map((item) => /* @__PURE__ */ (0, import_jsx_runtime3.jsxs)("div", { className: "site-chat-component-footer-file-item-container", onClick: () => onClick && onClick(item.id, item.url), children: [
127
- /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(import_wix_ui_icons_common2.Page, { size: "15px" }),
128
- /* @__PURE__ */ (0, import_jsx_runtime3.jsx)("span", { className: "site-chat-component-footer-file-name", children: item.name }),
129
- /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(import_design_system2.IconButton, { size: "tiny", onClick: () => handleOnRemove(item.id), children: /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(import_wix_ui_icons_common2.DismissSmall, {}) })
130
- ] }, item.id)) });
131
- };
132
- var attachment_list_default = AttachmentList;
133
-
134
- // src/components/SiteChatComponent/Footer/message-input/message-input.tsx
135
- var import_design_system3 = require("@wix/design-system");
136
- var import_wix_ui_icons_common3 = require("@wix/wix-ui-icons-common");
137
-
138
- // src/components/SiteChatComponent/Footer/message-input/open-file-picker.ts
139
- var import_essentials = require("@wix/essentials");
140
- var import_meta = {};
141
- var uploadFile = async (file) => {
142
- var _a;
143
- try {
144
- const baseApiUrl = new URL(import_meta.url).origin;
145
- const response = await import_essentials.httpClient.fetchWithAuth(`${baseApiUrl}/api/widget/chat/upload-attachment`, {
146
- method: "POST",
147
- headers: {
148
- "Content-Type": file.type || "application/octet-stream",
149
- "x-file-name": encodeURIComponent(file.name),
150
- "x-file-type": file.type || "application/octet-stream"
151
- },
152
- body: file
153
- });
154
- const data = await response.json();
155
- if (!response.ok) {
156
- throw new Error(data.error || "Failed to upload file");
157
- }
158
- if (!((_a = data.file) == null ? void 0 : _a.id) || !data.file.displayName || !data.file.url) {
159
- throw new Error("Invalid response format from upload endpoint");
160
- }
161
- return data.file;
162
- } catch (error) {
163
- console.error("Error uploading file:", error);
164
- return null;
165
- }
166
- };
167
- var openFilePicker = async (options) => {
168
- const win = window;
169
- if (!win.showOpenFilePicker) {
170
- console.error("File Picker API is not supported in this browser.");
171
- return;
172
- }
173
- try {
174
- const fileHandles = await win.showOpenFilePicker(options);
175
- const fileHandle = fileHandles[0];
176
- const file = await fileHandle.getFile();
177
- const uploadedFile = await uploadFile(file);
178
- if (!uploadedFile) {
179
- console.error("Failed to upload file.");
180
- return;
181
- }
182
- return {
183
- id: uploadedFile.id,
184
- name: uploadedFile.displayName,
185
- url: uploadedFile.url
186
- };
187
- } catch (error) {
188
- console.error("Error opening file picker:", error);
189
- return null;
190
- }
191
- };
192
-
193
- // src/components/SiteChatComponent/Footer/message-input/message-input.tsx
194
- var import_jsx_runtime4 = require("react/jsx-runtime");
195
- var MessageInput = ({
196
- placeholder = "Type a message...",
197
- disabled = false,
198
- className = "",
199
- suffix,
200
- value = "",
201
- onChange,
202
- onKeyDown,
203
- onAttachmentAdded
204
- }) => {
205
- const handleAttachmentOnClick = async () => {
206
- try {
207
- await openFilePicker({ multiple: false }).then((file) => {
208
- if (file && onAttachmentAdded) {
209
- onAttachmentAdded(file);
210
- }
211
- });
212
- } catch (error) {
213
- console.error("Error opening file picker:", error);
214
- }
215
- };
216
- return /* @__PURE__ */ (0, import_jsx_runtime4.jsxs)("div", { className: `site-chat-component-footer-input-wrapper ${className}`, children: [
217
- /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(
218
- "input",
219
- {
220
- name: "messageInput",
221
- className: "site-chat-component-footer-chat-input",
222
- placeholder,
223
- disabled,
224
- value,
225
- onChange,
226
- onKeyDown
227
- }
228
- ),
229
- /* @__PURE__ */ (0, import_jsx_runtime4.jsx)("sub", { className: "site-chat-component-footer-suffix", children: /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(import_design_system3.IconButton, { onClick: handleAttachmentOnClick, className: "attachment-icon-button", children: /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(import_wix_ui_icons_common3.AttachmentSmall, {}) }) })
230
- ] });
231
- };
232
- var message_input_default = MessageInput;
233
-
234
- // src/components/SiteChatComponent/Footer/Footer.tsx
235
- var import_jsx_runtime5 = require("react/jsx-runtime");
236
- var Footer = import_react3.default.forwardRef(
237
- ({
238
- className,
239
- children,
240
- sendButtonConfig,
241
- attachmentListConfig,
242
- messageInputConfig,
243
- onAttachmentAdded,
244
- ...rest
245
- }, ref) => {
246
- const handleSendMessage = (text, messageType, attachment) => {
247
- if (sendButtonConfig == null ? void 0 : sendButtonConfig.onClick) {
248
- sendButtonConfig.onClick(text, messageType, attachment);
249
- } else {
250
- console.warn("handleSendMessage function is not provided in sendButtonConfig");
251
- }
252
- };
253
- return /* @__PURE__ */ (0, import_jsx_runtime5.jsxs)(import_design_system4.Box, { ref, className: "site-chat-component-footer-message-input-container", direction: "vertical", gap: 1, verticalAlign: "middle", children: [
254
- /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(import_design_system4.Box, { width: "100%", children: /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(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 }) }),
255
- /* @__PURE__ */ (0, import_jsx_runtime5.jsxs)(import_design_system4.Box, { alignContent: "bottom", width: "100%", direction: "horizontal", gap: 2, verticalAlign: "middle", children: [
256
- /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(
257
- message_input_default,
258
- {
259
- placeholder: (messageInputConfig == null ? void 0 : messageInputConfig.placeholder) || "Type your message here...",
260
- className: (messageInputConfig == null ? void 0 : messageInputConfig.className) || "message-input",
261
- value: (messageInputConfig == null ? void 0 : messageInputConfig.value) || "",
262
- onChange: messageInputConfig == null ? void 0 : messageInputConfig.onChange,
263
- onKeyDown: messageInputConfig == null ? void 0 : messageInputConfig.onKeyDown,
264
- disabled: messageInputConfig == null ? void 0 : messageInputConfig.disabled,
265
- onAttachmentAdded
266
- }
267
- ),
268
- /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(
269
- send_button_default,
270
- {
271
- onClick: () => handleSendMessage((messageInputConfig == null ? void 0 : messageInputConfig.value) || "", (attachmentListConfig == null ? void 0 : attachmentListConfig.items) ? "ATTACHMENT" : "TEXT"),
272
- disabled: sendButtonConfig == null ? void 0 : sendButtonConfig.disabled,
273
- text: (sendButtonConfig == null ? void 0 : sendButtonConfig.buttonText) || "Send"
274
- }
275
- )
276
- ] })
277
- ] });
278
- }
279
- );
280
- Footer.displayName = "SiteChatComponent.Footer";
281
-
282
- // src/components/SiteChatComponent/Header/Header.tsx
283
- var import_react4 = __toESM(require("react"));
284
- var import_design_system5 = require("@wix/design-system");
285
- var import_jsx_runtime6 = require("react/jsx-runtime");
286
- var Header = import_react4.default.forwardRef(
287
- ({
288
- className,
289
- children,
290
- title,
291
- subtitle,
292
- image,
293
- onClose,
294
- ...rest
295
- }, ref) => {
296
- return /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(import_design_system5.Box, { ref, className: "site-chat-component-header-container", verticalAlign: "middle", children: /* @__PURE__ */ (0, import_jsx_runtime6.jsxs)(import_design_system5.Box, { width: "100%", direction: "horizontal", align: "center", gap: "10px", children: [
297
- image && /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(import_design_system5.Box, { className: "site-chat-component-header-image", width: "60px", height: "50px", borderRadius: "999px", children: /* @__PURE__ */ (0, import_jsx_runtime6.jsx)("img", { style: { borderRadius: "999px" }, width: "100%", height: "100%", src: String(image), alt: "Business Logo" }) }),
298
- /* @__PURE__ */ (0, import_jsx_runtime6.jsxs)(import_design_system5.Box, { direction: "vertical", className: "site-chat-component-header-text-section", children: [
299
- /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(import_design_system5.Box, { className: "site-chat-component-header-top-section", children: /* @__PURE__ */ (0, import_jsx_runtime6.jsxs)(import_design_system5.Box, { className: "site-chat-component-header-top", verticalAlign: "middle", WebkitJustifyContent: "space-between", width: "100%", children: [
300
- title && /* @__PURE__ */ (0, import_jsx_runtime6.jsx)("h2", { className: "site-chat-component-header-title", children: title }),
301
- /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(
302
- "button",
303
- {
304
- onClick: onClose,
305
- "aria-label": "Close",
306
- className: "site-chat-component-header-close-button",
307
- children: "\u2715"
308
- }
309
- )
310
- ] }) }),
311
- /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(import_design_system5.Box, { className: "site-chat-component-header-bottom-section", children: subtitle && /* @__PURE__ */ (0, import_jsx_runtime6.jsx)("h3", { className: "site-chat-component-header-subtitle", children: subtitle }) })
312
- ] })
313
- ] }) });
314
- }
315
- );
316
- Header.displayName = "SiteChatComponent.Header";
317
-
318
- // src/components/SiteChatComponent/MessageContainer/MessageContainer.tsx
319
- var import_react6 = __toESM(require("react"));
320
- var import_design_system8 = require("@wix/design-system");
321
-
322
- // src/components/SiteChatComponent/MessageContainer/messages/messages-wrapper.tsx
323
- var import_react5 = require("react");
324
- var import_design_system7 = require("@wix/design-system");
325
-
326
- // src/components/SiteChatComponent/MessageContainer/messages/attachment.tsx
327
- var import_design_system6 = require("@wix/design-system");
328
- var import_wix_ui_icons_common4 = require("@wix/wix-ui-icons-common");
329
- var import_on_stage = require("@wix/wix-ui-icons-common/on-stage");
330
- var import_jsx_runtime7 = require("react/jsx-runtime");
331
- var Attachment = ({ item }) => {
332
- return /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(import_design_system6.Box, { direction: "horizontal", maxWidth: "100%", boxSizing: "border-box", className: "site-chat-component-message-container-in-chat-file-item-wrapper-box", children: item && /* @__PURE__ */ (0, import_jsx_runtime7.jsxs)("div", { className: "site-chat-component-message-container-in-chat-file-item-container", children: [
333
- /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(import_wix_ui_icons_common4.Page, { className: "site-chat-component-message-container-in-chat-file-icon", width: "20px", height: "20px" }),
334
- /* @__PURE__ */ (0, import_jsx_runtime7.jsxs)("div", { className: "site-chat-component-message-container-in-chat-file-names-container", children: [
335
- /* @__PURE__ */ (0, import_jsx_runtime7.jsx)("span", { className: "site-chat-component-message-container-in-chat-file-name", children: item.name }),
336
- /* @__PURE__ */ (0, import_jsx_runtime7.jsx)("span", { className: "site-chat-component-message-container-in-chat-file-sub-name", children: "Attachment" })
337
- ] }),
338
- /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(import_design_system6.TextButton, { size: "tiny", onClick: () => window.open(item.url, "_blank"), suffixIcon: /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(import_on_stage.ArrowTopRight, { size: "tiny" }), children: "Open" })
339
- ] }, item.id) });
340
- };
341
- var attachment_default = Attachment;
342
-
343
- // src/components/SiteChatComponent/MessageContainer/messages/messages-wrapper.tsx
344
- var import_jsx_runtime8 = require("react/jsx-runtime");
345
- var AGENT_MESSAGE_GAP = "10px";
346
- var AGENT_MESSAGE_WIDTH = "75%";
347
- var AGENT_MESSAGE_INNER_GAP = "4px";
348
- var ONE_MINUTE_MS = 6e4;
349
- var ONE_DAY_MS = 864e5;
350
- var DAYS_IN_WEEK = 7;
351
- var formatTimestamp = (timestamp) => {
352
- if (!timestamp) return "";
353
- const date = new Date(timestamp);
354
- const now = /* @__PURE__ */ new Date();
355
- if (now.getTime() - date.getTime() < ONE_MINUTE_MS) return "Just now";
356
- const time = date.toLocaleTimeString([], { hour: "2-digit", minute: "2-digit" });
357
- const startOfToday = new Date(now.getFullYear(), now.getMonth(), now.getDate());
358
- const startOfDay = new Date(date.getFullYear(), date.getMonth(), date.getDate());
359
- const diffDays = Math.floor((startOfToday.getTime() - startOfDay.getTime()) / ONE_DAY_MS);
360
- if (diffDays === 0) return `Today at ${time}`;
361
- if (diffDays === 1) return `Yesterday at ${time}`;
362
- if (diffDays < DAYS_IN_WEEK && date.getDay() < now.getDay())
363
- return `${date.toLocaleDateString([], { weekday: "short" })} at ${time}`;
364
- return `${date.toLocaleDateString([], { month: "short", day: "numeric", year: "numeric" })} at ${time}`;
365
- };
366
- var MessagesWrapper = ({ messages = [] }) => {
367
- const wrapperRef = (0, import_react5.useRef)(null);
368
- (0, import_react5.useEffect)(() => {
369
- if (wrapperRef.current) {
370
- wrapperRef.current.scrollTop = wrapperRef.current.scrollHeight;
371
- }
372
- }, [messages]);
373
- return /* @__PURE__ */ (0, import_jsx_runtime8.jsx)("div", { className: "site-chat-component-message-container-messages-wrapper", ref: wrapperRef, children: messages.map(({ _id, message, attachment, timestamp, senderType, senderName }, index) => /* @__PURE__ */ (0, import_jsx_runtime8.jsx)("div", { className: `message-item ${senderType}`, children: senderType === "agent" ? /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(AgentMessageWrapper, { message, attachment: attachment ? Array.isArray(attachment) ? attachment[0] : attachment : void 0, timestamp, agentName: senderName }) : senderType === "user" ? /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(UserMessageWrapper, { message, attachment: attachment ? Array.isArray(attachment) ? attachment[0] : attachment : void 0, timestamp }) : /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(SystemMessageWrapper, { message, timestamp }) }, _id || index)) });
374
- };
375
- var GetSystemMessage = ({ type }) => {
376
- switch (type) {
377
- case "AGENT_JOINED":
378
- return /* @__PURE__ */ (0, import_jsx_runtime8.jsx)("div", { className: "site-chat-component-message-container-system-message-message", children: "An agent has joined the chat." });
379
- case "AGENT_LEFT":
380
- return /* @__PURE__ */ (0, import_jsx_runtime8.jsx)("div", { className: "site-chat-component-message-container-system-message-message", children: "An agent has left the chat." });
381
- case "USER_JOINED":
382
- return /* @__PURE__ */ (0, import_jsx_runtime8.jsx)("div", { className: "site-chat-component-message-container-system-message-message", children: "A user has joined the chat." });
383
- case "USER_LEFT":
384
- return /* @__PURE__ */ (0, import_jsx_runtime8.jsx)("div", { className: "site-chat-component-message-container-system-message-message", children: "A user has left the chat." });
385
- case "CHAT_ENDED":
386
- return /* @__PURE__ */ (0, import_jsx_runtime8.jsx)("div", { className: "site-chat-component-message-container-system-message-message", children: "The chat has ended." });
387
- case "CHAT_REOPENED":
388
- return /* @__PURE__ */ (0, import_jsx_runtime8.jsx)("div", { className: "site-chat-component-message-container-system-message-message", children: "The chat has been reopened." });
389
- case "CHAT_TRANSFERRED":
390
- return /* @__PURE__ */ (0, import_jsx_runtime8.jsx)("div", { className: "site-chat-component-message-container-system-message-message", children: "The chat has been transferred to another agent." });
391
- case "WAITING_FOR_AGENT":
392
- return /* @__PURE__ */ (0, import_jsx_runtime8.jsx)("div", { className: "site-chat-component-message-container-system-message-message", children: "Waiting for an agent to join the chat..." });
393
- default:
394
- return /* @__PURE__ */ (0, import_jsx_runtime8.jsx)("div", { className: "site-chat-component-message-container-system-message-message", children: "System message" });
395
- }
396
- };
397
- var SystemMessageWrapper = ({ message, timestamp }) => {
398
- return /* @__PURE__ */ (0, import_jsx_runtime8.jsx)("div", { className: "site-chat-component-message-container-system-message-wrapper", children: /* @__PURE__ */ (0, import_jsx_runtime8.jsxs)("div", { className: "site-chat-component-message-container-system-message", children: [
399
- /* @__PURE__ */ (0, import_jsx_runtime8.jsx)("hr", { className: "dashed" }),
400
- /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(GetSystemMessage, { type: message }),
401
- /* @__PURE__ */ (0, import_jsx_runtime8.jsx)("hr", { className: "dashed" })
402
- ] }) });
403
- };
404
- var AgentMessageWrapper = ({ message, attachment, timestamp, agentName }) => {
405
- return /* @__PURE__ */ (0, import_jsx_runtime8.jsxs)("div", { style: { display: "flex", flexDirection: "row", gap: AGENT_MESSAGE_GAP }, children: [
406
- /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(import_design_system7.Avatar, { size: "size24", className: "site-chat-component-message-container-agent-message-avatar", name: agentName }),
407
- /* @__PURE__ */ (0, import_jsx_runtime8.jsxs)("div", { style: { width: AGENT_MESSAGE_WIDTH, gap: AGENT_MESSAGE_INNER_GAP, display: "flex", flexDirection: "column" }, children: [
408
- agentName && /* @__PURE__ */ (0, import_jsx_runtime8.jsxs)("div", { className: "site-chat-component-message-container-agent-name-time-container", children: [
409
- /* @__PURE__ */ (0, import_jsx_runtime8.jsx)("div", { className: "site-chat-component-message-container-agent-name", children: agentName }),
410
- /* @__PURE__ */ (0, import_jsx_runtime8.jsx)("div", { className: "site-chat-component-message-container-agent-message-timestamp", children: formatTimestamp(timestamp) })
411
- ] }),
412
- /* @__PURE__ */ (0, import_jsx_runtime8.jsx)("div", { className: `site-chat-component-message-container-agent-message-wrapper${attachment ? "-attachment" : ""}`, children: /* @__PURE__ */ (0, import_jsx_runtime8.jsxs)("div", { className: "site-chat-component-message-container-agent-message", children: [
413
- message && message,
414
- attachment && /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(attachment_default, { item: attachment })
415
- ] }) })
416
- ] })
417
- ] });
418
- };
419
- var UserMessageWrapper = ({ message, attachment, timestamp }) => {
420
- return /* @__PURE__ */ (0, import_jsx_runtime8.jsxs)("div", { style: { display: "flex", flexDirection: "column", alignItems: "flex-end", gap: "4px" }, children: [
421
- !attachment && /* @__PURE__ */ (0, import_jsx_runtime8.jsx)("div", { className: "site-chat-component-message-container-user-name", children: "Me" }),
422
- /* @__PURE__ */ (0, import_jsx_runtime8.jsx)("div", { className: `site-chat-component-message-container-user-message-wrapper${attachment ? "-attachment" : ""}`, children: /* @__PURE__ */ (0, import_jsx_runtime8.jsxs)("div", { className: "site-chat-component-message-container-user-message", children: [
423
- message && message,
424
- attachment && /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(attachment_default, { item: attachment })
425
- ] }) })
426
- ] });
427
- };
428
- var messages_wrapper_default = MessagesWrapper;
429
-
430
- // src/components/SiteChatComponent/MessageContainer/MessageContainer.tsx
431
- var import_jsx_runtime9 = require("react/jsx-runtime");
432
- var MessageContainer = import_react6.default.forwardRef(
433
- ({
434
- className,
435
- children,
436
- messages,
437
- loading,
438
- ...rest
439
- }, ref) => {
440
- return /* @__PURE__ */ (0, import_jsx_runtime9.jsxs)(import_design_system8.Box, { ref, className: "site-chat-component-message-container", children: [
441
- loading && /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(import_design_system8.Box, { className: "site-chat-component-message-container-loading-state", children: /* @__PURE__ */ (0, import_jsx_runtime9.jsx)("p", { children: "Loading messages..." }) }),
442
- messages.length === 0 && !loading && /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(import_design_system8.Box, { className: "site-chat-component-message-container-empty-state", children: /* @__PURE__ */ (0, import_jsx_runtime9.jsx)("p", { children: "No messages yet. Start a conversation" }) }),
443
- messages.length > 0 && /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(messages_wrapper_default, { messages })
444
- ] });
445
- }
446
- );
447
- MessageContainer.displayName = "SiteChatComponent.MessageContainer";
448
-
449
- // src/components/SiteChatComponent/SiteChatComponent.css
450
- if (typeof document !== "undefined" && !document.getElementById("jrapps-style-3c48ccde")) {
451
- const s = document.createElement("style");
452
- s.id = "jrapps-style-3c48ccde";
453
- s.textContent = `.site-chat-component {
454
- /* SiteChatComponent base styles */
455
- }
456
-
457
- /* ---------- Header styles ---------- */
458
-
459
- .site-chat-component-header-container {
460
- background: var(--my-tickets-chat-widget-panel-header-background-color);
461
- padding: 10px;
462
- border-top-right-radius: inherit;
463
- border-top-left-radius: inherit;
464
- }
465
-
466
- .site-chat-component-header-container .site-chat-component-header-text-section {
467
- width: 100%;
468
- }
469
-
470
- .site-chat-component-header-title {
471
- font-style: var(--my-tickets-chat-widget-panel-header-title-font-style);
472
- margin-bottom: 0 !important;
473
- color: var(--my-tickets-chat-widget-panel-header-title-color);
474
- }
475
-
476
- .site-chat-component-header-subtitle {
477
- font-style: var(--my-tickets-chat-widget-panel-header-subtitle-font-style);
478
- font-weight: normal !important;
479
- margin-top: 0 !important;
480
- color: var(--my-tickets-chat-widget-panel-header-subtitle-color);
481
- }
482
-
483
- .site-chat-component-header-close-button {
484
- cursor: pointer !important;
485
- background: none;
486
- border: none;
487
- padding: 4px;
488
- color: var(--my-tickets-chat-widget-panel-header-button-color);
489
- font-size: 1.25rem;
490
- line-height: 1;
491
- border-radius: 4px;
492
- transition: opacity 0.15s;
493
- }
494
-
495
- .site-chat-component-header-close-button:hover {
496
- opacity: 0.8;
497
- }
498
-
499
- /* ---------- Footer styles ---------- */
500
-
501
- .site-chat-component-footer-message-input-container {
502
- padding: var(--cw-space-md, 16px);
503
- background: var(--my-tickets-chat-widget-panel-footer-background-color);
504
- font-family: var(--cw-font, sans-serif);
505
- border-radius: 0 0 var(--cw-radius-panel, 16px) var(--cw-radius-panel, 16px);
506
- }
507
-
508
- .site-chat-component-footer-attachment-icon-button {
509
- width: 20px;
510
- height: 20px;
511
- }
512
-
513
- .site-chat-component-footer-my-tickets-chat-widget-send-button {
514
- background: var(--my-tickets-chat-widget-panel-footer-button-color);
515
- border: 1px solid var(--my-tickets-chat-widget-panel-footer-button-border-color);
516
- color: var(--my-tickets-chat-widget-panel-footer-button-text-color);
517
- padding: 6px;
518
- border-radius: 4px;
519
- width: 80px;
520
- cursor: pointer;
521
- }
522
-
523
- .site-chat-component-footer-my-tickets-chat-widget-send-button:disabled {
524
- opacity: 0.5;
525
- cursor: default;
526
- }
527
-
528
- .site-chat-component-footer-file-item-container {
529
- display: flex;
530
- align-items: center;
531
- gap: 8px;
532
- padding: 2px 4px;
533
- border-radius: var(--wds-input-area-border-radius-default-medium, 6px);
534
- background-color: var(--wds-color-surface, var(--wsr-color-surface, #FFFFFF));
535
- border: 1px solid var(--wds-input-border-color, var(--wsr-color-B40, #D6E6FE));
536
- box-sizing: border-box;
537
- }
538
-
539
- .site-chat-component-footer-file-name {
540
- 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));
541
- font-size: var(--wds-font-size-body-small, var(--wsr-text-font-size-small, 14px));
542
- font-weight: var(--wds-font-weight-regular, var(--wsr-font-weight-regular, 400));
543
- line-height: var(--wds-font-line-height-body-small, var(--wsr-text-line-height-small, 20px));
544
- letter-spacing: var(--wds-font-letter-spacing-0, unset);
545
- white-space: nowrap;
546
- overflow: hidden;
547
- text-overflow: ellipsis;
548
- max-width: 115px;
549
- }
550
-
551
- .site-chat-component-footer-input-wrapper {
552
- padding: 5px;
553
- box-sizing: border-box;
554
- width: inherit;
555
- display: flex;
556
- justify-content: center;
557
- flex-direction: row;
558
- gap: 10px;
559
- border-radius: 4px;
560
- background: var(--my-tickets-chat-widget-panel-footer-input-background-color);
561
- border: 2px solid var(--my-tickets-chat-widget-panel-footer-input-border-color);
562
- color: var(--my-tickets-chat-widget-panel-footer-input-text-color);
563
- font-size: var(--my-tickets-chat-widget-panel-footer-input-text-size);
564
- font-family: 'Arial', sans-serif;
565
- }
566
-
567
- .site-chat-component-footer-suffix {
568
- background: inherit;
569
- width: max-content;
570
- min-height: 100%;
571
- max-height: 100%;
572
- align-items: center;
573
- justify-content: center;
574
- display: flex;
575
- font-size: inherit;
576
- padding: 0px;
577
- margin: 0px;
578
- font-family: inherit;
579
- color: inherit;
580
- box-sizing: border-box;
581
- }
582
-
583
- .site-chat-component-footer-chat-input {
584
- background: inherit;
585
- border: none;
586
- font-size: inherit;
587
- font-family: inherit;
588
- color: inherit;
589
- width: inherit;
590
- }
591
-
592
- .site-chat-component-footer-chat-input::placeholder {
593
- background: inherit;
594
- border: none;
595
- font-size: inherit;
596
- font-family: inherit;
597
- color: inherit;
598
- opacity: 0.5;
599
- }
600
-
601
- .site-chat-component-footer-chat-input:focus {
602
- outline: none;
603
- }
604
-
605
- /* ---------- Messages styles ---------- */
606
- /* Message Container */
607
- .site-chat-component-message-container {
608
- display: flex !important;
609
- flex-direction: column !important;
610
- padding: var(--cw-space-md, 16px) !important;
611
- background: var(--my-tickets-chat-widget-panel-messages-background-color) !important;
612
- flex: 1 !important;
613
- min-height: 0;
614
- overflow-y: auto !important;
615
- }
616
-
617
- .site-chat-component-message-container-messages-wrapper {
618
- display: flex;
619
- flex-direction: column;
620
- gap: var(--cw-space-sm, 8px);
621
- }
622
-
623
- .site-chat-component-message-container-agent-message-wrapper,
624
- .site-chat-component-message-container-user-message-wrapper {
625
- display: flex;
626
- padding: 10px 14px;
627
- border-radius: var(--cw-radius-bubble, 12px);
628
- width: max-content;
629
- max-width: 80%;
630
- font-family: var(--cw-font, sans-serif);
631
- }
632
-
633
- .site-chat-component-message-container-agent-name {
634
- color: var(--my-tickets-chat-widget-panel-messages-agent-name-text-color);
635
- font-size: var(--my-tickets-chat-widget-panel-messages-agent-name-text-size);
636
- font-weight: 500;
637
- }
638
-
639
- .site-chat-component-message-container-user-name {
640
- color: var(--my-tickets-chat-widget-panel-messages-user-name-text-color);
641
- font-size: var(--my-tickets-chat-widget-panel-messages-user-name-text-size);
642
- font-weight: 500;
643
- display: var(--my-tickets-chat-widget-panel-messages-user-name-text-visible);
644
- }
645
-
646
- .site-chat-component-message-container-agent-message-avatar {
647
- margin-top: 20px;
648
- display: var(--my-tickets-chat-widget-panel-messages-agent-icon-visible);
649
- }
650
-
651
- .site-chat-component-message-container-user-message,
652
- .site-chat-component-message-container-agent-message {
653
- line-height: 1.5;
654
- word-wrap: break-word;
655
- }
656
-
657
- .site-chat-component-message-container-agent-message {
658
- font-size: var(--my-tickets-chat-widget-panel-messages-agent-text-size);
659
- }
660
-
661
- .site-chat-component-message-container-user-message {
662
- font-size: var(--my-tickets-chat-widget-panel-messages-user-text-size);
663
- }
664
-
665
- .site-chat-component-message-container-agent-message-wrapper {
666
- justify-content: flex-start;
667
- align-self: flex-start;
668
- background-color: var(--my-tickets-chat-widget-panel-messages-agent-bubble-color);
669
- color: var(--my-tickets-chat-widget-panel-messages-agent-text-color);
670
- }
671
-
672
- .site-chat-component-message-container-user-message-wrapper {
673
- justify-content: flex-end;
674
- align-self: flex-end;
675
- margin-left: auto;
676
- background-color: var(--my-tickets-chat-widget-panel-messages-user-bubble-color);
677
- color: var(--my-tickets-chat-widget-panel-messages-user-text-color);
678
- }
679
-
680
- .site-chat-component-message-container-agent-name-time-container {
681
- gap: 8px;
682
- display: flex;
683
- align-items: center;
684
- font-family: 'Madefor';
685
- font-size: 13px;
686
- }
687
-
688
- /* System Messages */
689
-
690
- .site-chat-component-message-container-system-message {
691
- display: flex;
692
- justify-content: center;
693
- align-items: center;
694
- width: 100%;
695
- gap: var(--cw-space-sm, 8px);
696
- }
697
-
698
- .site-chat-component-message-container-system-message .dashed {
699
- flex: 1;
700
- border: none;
701
- border-top: 1px dashed var(--my-tickets-chat-widget-panel-messages-system-color);
702
- margin: 0;
703
- }
704
-
705
- .site-chat-component-message-container-system-message-message {
706
- color: var(--my-tickets-chat-widget-panel-messages-system-color);
707
- font-family: var(--cw-font, sans-serif);
708
- font-size: var(--my-tickets-chat-widget-panel-messages-system-size);
709
- font-weight: 500;
710
- white-space: nowrap;
711
- }
712
-
713
- /* Empty and Loading States */
714
-
715
- .site-chat-component-message-container-empty-state {
716
- display: flex;
717
- flex: 1;
718
- align-items: center;
719
- justify-content: center;
720
- }
721
-
722
- .site-chat-component-message-container-empty-state p {
723
- font-family: var(--cw-font, sans-serif);
724
- font-size: 14px;
725
- color: var(--my-tickets-chat-widget-panel-messages-system-color);
726
- }
727
-
728
- .site-chat-component-message-container-loading-state {
729
- display: flex;
730
- flex: 1;
731
- align-items: center;
732
- justify-content: center;
733
- }
734
-
735
- .site-chat-component-message-container-loading-state p {
736
- font-family: var(--cw-font, sans-serif);
737
- font-size: 14px;
738
- color: var(--my-tickets-chat-widget-panel-messages-system-color);
739
- }
740
-
741
- .site-chat-component-message-container-in-chat-file-item-container {
742
- display: flex;
743
- align-items: center;
744
- gap: 8px;
745
- padding: 4px 8px;
746
- border-radius: var(--wds-input-area-border-radius-default-medium, 6px);
747
- background-color: var(--wds-color-surface, var(--wsr-color-surface, #FFFFFF));
748
- border: 1px solid var(--wds-input-border-color, var(--wsr-color-B40, #D6E6FE));
749
- box-sizing: border-box;
750
- }
751
-
752
- .site-chat-component-message-container-in-chat-file-name {
753
- 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));
754
- font-size: var(--wds-font-size-body-tiny, var(--wsr-text-font-size-tiny, 10px));
755
- font-weight: var(--wds-font-weight-regular, var(--wsr-font-weight-regular, 400));
756
- line-height: var(--wds-font-line-height-body-tiny, var(--wsr-text-line-height-tiny, 12px));
757
- letter-spacing: var(--wds-font-letter-spacing-0, unset);
758
- white-space: nowrap;
759
- overflow: hidden;
760
- text-overflow: ellipsis;
761
- max-width: 150px;
762
- color: black;
763
- }
764
-
765
- .site-chat-component-message-container-in-chat-file-sub-name {
766
- 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));
767
- font-size: var(--wds-font-size-body-tiny, var(--wsr-text-font-size-tiny, 10px));
768
- font-weight: var(--wds-font-weight-regular, var(--wsr-font-weight-regular, 400));
769
- line-height: var(--wds-font-line-height-body-tiny, var(--wsr-text-line-height-tiny, 12px));
770
- letter-spacing: var(--wds-font-letter-spacing-0, unset);
771
- color: var(--wds-color-text-secondary, var(--wsr-color-text-secondary, #6B6B6B));
772
- }
773
-
774
- .site-chat-component-message-container-in-chat-file-icon {
775
- fill: black !important;
776
- }
777
-
778
- .site-chat-component-message-container-in-chat-file-names-container {
779
- display: flex;
780
- flex-direction: column;
781
- gap: 0px;
782
- }
783
-
784
- .site-chat-component-message-container-user-message-wrapper-attachment .site-chat-component-message-container-in-chat-file-item-wrapper-box {
785
- align-items: flex-end;
786
- display: flex;
787
- flex-direction: column;
788
- }
789
-
790
- .site-chat-component-message-container-agent-message-wrapper-attachment .site-chat-component-message-container-in-chat-file-item-wrapper-box {
791
- align-items: flex-start;
792
- display: flex;
793
- flex-direction: column;
794
- }
795
-
796
- /* FAB */
797
- .site-chat-component-fab {
798
- position: fixed;
799
- bottom: 24px;
800
- right: 24px;
801
- gap: 4.5px;
802
- cursor: pointer;
803
- z-index: 100;
804
- user-select: none;
805
- border-radius: 99px;
806
- padding: 9px 25px;
807
- transition: background-color 0.2s ease, border-color 0.2s ease, color 0.2s ease;
808
- display: flex;
809
- justify-content: center;
810
- align-items: center;
811
- flex-direction: row;
812
-
813
- font-size: var(--my-tickets-chat-widget-button-text-size) !important;
814
- background-color: var(--my-tickets-chat-widget-button-color);
815
- border: 1px solid var(--my-tickets-chat-widget-button-border-color);
816
- color: var(--my-tickets-chat-widget-button-text-color);
817
- font: var(--my-tickets-chat-widget-button-text-font);
818
- }
819
-
820
- .site-chat-component-fab-fab-button-label {
821
- margin: 0;
822
- padding: 0;
823
- line-height: 1;
824
- display: inline-flex;
825
- align-items: center;
826
- margin-top: 2px;
827
- }
828
-
829
- .site-chat-component-fab-fab-button-icon,
830
- .site-chat-component-fab-fab-button-text {
831
- display: inline-flex;
832
- align-items: center;
833
- height: 100%;
834
- }
835
-
836
- .site-chat-component-fab-fab-button-icon svg {
837
- width: var(--my-tickets-chat-widget-button-icon-size);
838
- height: var(--my-tickets-chat-widget-button-icon-size);
839
- font-weight: inherit;
840
- }
841
-
842
- /* \u2500\u2500 Design Tokens \u2500\u2500 */
843
- :host {
844
- --cw-font: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
845
-
846
- /* Primary palette */
847
- --cw-primary: #3B82F6;
848
- --cw-primary-hover: #2563EB;
849
- --cw-primary-light: #EFF6FF;
850
- --cw-primary-shadow: rgba(59, 130, 246, 0.35);
851
- --cw-primary-shadow-hover: rgba(59, 130, 246, 0.5);
852
-
853
- /* Neutrals */
854
- --cw-bg: #F8FAFC;
855
- --cw-surface: #FFFFFF;
856
- --cw-border: #E2E8F0;
857
-
858
- /* Text */
859
- --cw-text: #1E293B;
860
- --cw-text-muted: #64748B;
861
- --cw-text-inverse: #FFFFFF;
862
-
863
- /* Message bubbles */
864
- --cw-bubble-user: var(--cw-primary);
865
- --cw-bubble-user-text: var(--cw-text-inverse);
866
- --cw-bubble-agent: #F1F5F9;
867
- --cw-bubble-agent-text: var(--cw-text);
868
-
869
- /* Radii */
870
- --cw-radius-panel: 16px;
871
- --cw-radius-bubble: 12px;
872
- --cw-radius-pill: 50px;
873
-
874
- /* Spacing */
875
- --cw-space-xs: 4px;
876
- --cw-space-sm: 8px;
877
- --cw-space-md: 16px;
878
- --cw-space-lg: 24px;
879
-
880
- /* Shadows */
881
- --cw-shadow-panel: 0 20px 60px rgba(0, 0, 0, 0.12), 0 4px 16px rgba(0, 0, 0, 0.05);
882
- --cw-shadow-fab: 0 8px 24px var(--cw-primary-shadow);
883
- --cw-shadow-fab-hover: 0 12px 32px var(--cw-primary-shadow-hover);
884
- }
885
-
886
- /* \u2500\u2500 Hide toggle \u2500\u2500 */
887
- #site-chat-component-chat-toggle {
888
- display: none;
889
- }
890
-
891
- /* \u2500\u2500 Panel \u2500\u2500 */
892
- .site-chat-component-panel {
893
- position: fixed !important;
894
- bottom: 60px;
895
- right: 30px;
896
- width: min(340px, 100vw);
897
- max-height: 50vh;
898
- max-height: 50dvh;
899
- background: var(--cw-surface);
900
- border-radius: var(--cw-radius-panel, 16px) !important;
901
- box-shadow: var(--cw-shadow-panel);
902
- transform: scale(0.85) translateY(16px);
903
- transform-origin: bottom right;
904
- opacity: 0;
905
- pointer-events: none;
906
- transition: transform 0.3s cubic-bezier(.175, .885, .32, 1.275), opacity 0.25s ease;
907
- z-index: 99;
908
- display: flex !important;
909
- flex-direction: column !important;
910
- min-height: 450px;
911
- font-family: var(--cw-font);
912
- overflow: hidden;
913
- border: 0px solid var(--wst-color-line);
914
- box-shadow: 0 2px 6px var(--wst-color-line), 0 0 0 1px var(--wst-color-line);
915
- }
916
-
917
- .site-chat-component-panel.open {
918
- transform: scale(1) translateY(0);
919
- opacity: 1;
920
- pointer-events: all;
921
- z-index: 101;
922
- bottom: 10px;
923
- }
924
-
925
- /* \u2500\u2500 Mobile: fill screen \u2500\u2500 */
926
- @media (max-width: 480px) {
927
- .site-chat-component-panel {
928
- width: 100vw;
929
- height: 100vh;
930
- height: 100dvh;
931
- min-height: 0;
932
- max-height: none;
933
- bottom: 0;
934
- right: 0;
935
- }
936
-
937
- .site-chat-component-panel.open {
938
- top: 0;
939
- left: 0;
940
- right: 0;
941
- bottom: 0;
942
- }
943
- }
944
-
945
- /* \u2500\u2500 Small tablets \u2500\u2500 */
946
- @media (min-width: 481px) and (max-width: 768px) {
947
- .site-chat-component-panel {
948
- width: min(380px, calc(100vw - 24px));
949
- max-height: 70vh;
950
- max-height: 70dvh;
951
- }
952
- }
953
-
954
- /* \u2500\u2500 Large screens \u2500\u2500 */
955
- @media (min-width: 1200px) {
956
- .site-chat-component-panel {
957
- width: 350px;
958
- max-height: 70vh;
959
- max-height: 70dvh;
960
- }
961
- }
962
- `;
963
- document.head.appendChild(s);
964
- }
965
-
966
- // src/components/SiteChatComponent/SiteChatComponent.tsx
967
- var import_jsx_runtime10 = require("react/jsx-runtime");
968
- var SiteChatComponentRoot = import_react7.default.forwardRef(
969
- ({
970
- children,
971
- viewMode,
972
- editorShowChatPanel,
973
- handleToggle,
974
- buttonTextValue,
975
- isOpen
976
- }, _ref) => {
977
- useSiteChatComponent();
978
- if (viewMode === "Editor") {
979
- if (typeof editorShowChatPanel === "undefined") {
980
- return /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(import_design_system9.Box, { align: "center", verticalAlign: "middle", height: "100%", width: "100%", children: /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(import_design_system9.Text, { children: "Editor view mode detected but editorShowChatPanel prop is not provided" }) });
981
- }
982
- return /* @__PURE__ */ (0, import_jsx_runtime10.jsxs)(import_design_system9.Box, { children: [
983
- /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(FabButton, { onClick: handleToggle, text: buttonTextValue }),
984
- /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(import_design_system9.Box, { className: `site-chat-component-panel ${editorShowChatPanel ? "open" : ""}`, children })
985
- ] });
986
- }
987
- return /* @__PURE__ */ (0, import_jsx_runtime10.jsxs)(import_design_system9.Box, { children: [
988
- /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(FabButton, { onClick: handleToggle, text: buttonTextValue }),
989
- /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(import_design_system9.Box, { className: `site-chat-component-panel ${isOpen ? "open" : ""}`, children })
990
- ] });
991
- }
992
- );
993
- SiteChatComponentRoot.displayName = "SiteChatComponent";
994
- var SiteChatComponent = Object.assign(SiteChatComponentRoot, {
995
- Header,
996
- MessageContainer,
997
- Footer,
998
- FabButton
999
- });
1000
-
1001
40
  // src/components/SiteChatComponentNew/SiteChatComponentNew.tsx
1002
- var import_react12 = __toESM(require("react"));
41
+ var import_react5 = __toESM(require("react"));
1003
42
 
1004
43
  // src/components/SiteChatComponentNew/useSiteChatComponentNew.ts
1005
- var import_react8 = require("react");
44
+ var import_react = require("react");
1006
45
  function useSiteChatComponentNew(defaultOpen = false) {
1007
- const [open, setOpen] = (0, import_react8.useState)(defaultOpen);
1008
- const openWidget = (0, import_react8.useCallback)(() => setOpen(true), []);
1009
- const closeWidget = (0, import_react8.useCallback)(() => setOpen(false), []);
46
+ const [open, setOpen] = (0, import_react.useState)(defaultOpen);
47
+ const openWidget = (0, import_react.useCallback)(() => setOpen(true), []);
48
+ const closeWidget = (0, import_react.useCallback)(() => setOpen(false), []);
1010
49
  return { open, openWidget, closeWidget };
1011
50
  }
1012
51
 
@@ -1084,40 +123,1303 @@ function formatTime(timestamp) {
1084
123
  });
1085
124
  }
1086
125
 
1087
- // src/components/SiteChatComponentNew/Header/Header.css
1088
- if (typeof document !== "undefined" && !document.getElementById("jrapps-style-45eba566")) {
126
+ // src/components/SiteChatComponentNew/Header/Header.css
127
+ if (typeof document !== "undefined" && !document.getElementById("jrapps-style-45eba566")) {
128
+ const s = document.createElement("style");
129
+ s.id = "jrapps-style-45eba566";
130
+ s.textContent = ".cw-header {\n display: flex;\n align-items: center;\n justify-content: space-between;\n padding: 0 16px;\n height: var(--cw-header-height);\n background-color: var(--cw-primary);\n color: #ffffff;\n flex-shrink: 0;\n border-radius: var(--cw-border-radius) var(--cw-border-radius) 0 0;\n}\n\n.cw-header__identity {\n display: flex;\n align-items: center;\n gap: 12px;\n min-width: 0;\n}\n\n.cw-header__avatar {\n width: 40px;\n height: 40px;\n border-radius: 50%;\n object-fit: cover;\n flex-shrink: 0;\n border: 2px solid rgba(255, 255, 255, 0.4);\n}\n\n.cw-header__text {\n display: flex;\n flex-direction: column;\n min-width: 0;\n}\n\n.cw-header__title {\n font-size: 15px;\n font-weight: 600;\n white-space: nowrap;\n overflow: hidden;\n text-overflow: ellipsis;\n line-height: 1.3;\n}\n\n.cw-header__subtitle {\n font-size: 12px;\n opacity: 0.85;\n white-space: nowrap;\n overflow: hidden;\n text-overflow: ellipsis;\n line-height: 1.3;\n}\n\n.cw-header__close {\n background: none;\n border: none;\n cursor: pointer;\n color: #ffffff;\n display: flex;\n align-items: center;\n justify-content: center;\n padding: 6px;\n border-radius: 50%;\n flex-shrink: 0;\n transition: background-color 0.15s ease;\n}\n\n.cw-header__close:hover {\n background-color: rgba(255, 255, 255, 0.15);\n}\n\n.cw-header__close:focus-visible {\n outline: 2px solid #ffffff;\n outline-offset: 2px;\n}\n";
131
+ document.head.appendChild(s);
132
+ }
133
+
134
+ // src/components/SiteChatComponentNew/Header/Header.tsx
135
+ var import_jsx_runtime = require("react/jsx-runtime");
136
+ var Header = ({ image, title, subtitle, onClose }) => {
137
+ return /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("header", { className: "cw-header", role: "banner", children: [
138
+ /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", { className: "cw-header__identity", children: [
139
+ image && /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
140
+ "img",
141
+ {
142
+ src: image,
143
+ alt: `${title} avatar`,
144
+ className: "cw-header__avatar"
145
+ }
146
+ ),
147
+ /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", { className: "cw-header__text", children: [
148
+ /* @__PURE__ */ (0, import_jsx_runtime.jsx)("span", { className: "cw-header__title", children: title }),
149
+ subtitle && /* @__PURE__ */ (0, import_jsx_runtime.jsx)("span", { className: "cw-header__subtitle", children: subtitle })
150
+ ] })
151
+ ] }),
152
+ /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
153
+ "button",
154
+ {
155
+ className: "cw-header__close",
156
+ onClick: onClose,
157
+ "aria-label": "Close chat",
158
+ type: "button",
159
+ children: /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(
160
+ "svg",
161
+ {
162
+ xmlns: "http://www.w3.org/2000/svg",
163
+ width: "20",
164
+ height: "20",
165
+ viewBox: "0 0 24 24",
166
+ fill: "none",
167
+ stroke: "currentColor",
168
+ strokeWidth: "2",
169
+ strokeLinecap: "round",
170
+ strokeLinejoin: "round",
171
+ "aria-hidden": "true",
172
+ children: [
173
+ /* @__PURE__ */ (0, import_jsx_runtime.jsx)("line", { x1: "18", y1: "6", x2: "6", y2: "18" }),
174
+ /* @__PURE__ */ (0, import_jsx_runtime.jsx)("line", { x1: "6", y1: "6", x2: "18", y2: "18" })
175
+ ]
176
+ }
177
+ )
178
+ }
179
+ )
180
+ ] });
181
+ };
182
+ var Header_default = Header;
183
+
184
+ // src/components/SiteChatComponentNew/Footer/Footer.tsx
185
+ var import_react2 = require("react");
186
+
187
+ // src/components/SiteChatComponentNew/Footer/Footer.css
188
+ if (typeof document !== "undefined" && !document.getElementById("jrapps-style-ebcf221d")) {
189
+ const s = document.createElement("style");
190
+ s.id = "jrapps-style-ebcf221d";
191
+ s.textContent = ".cw-footer {\n display: flex;\n flex-direction: column;\n gap: 6px;\n padding: 10px 12px;\n background-color: var(--cw-background);\n border-top: 1px solid var(--cw-border);\n flex-shrink: 0;\n}\n\n.cw-footer__controls {\n display: flex;\n align-items: flex-end;\n gap: 8px;\n}\n\n/* \u2500\u2500\u2500 Staged file chips \u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500 */\n\n.cw-footer__file-list {\n list-style: none;\n margin: 0;\n padding: 0;\n display: flex;\n flex-wrap: wrap;\n gap: 6px;\n}\n\n.cw-footer__file-chip {\n display: flex;\n align-items: center;\n gap: 4px;\n background-color: color-mix(in srgb, var(--cw-primary) 12%, transparent);\n border: 1px solid color-mix(in srgb, var(--cw-primary) 30%, transparent);\n border-radius: 999px;\n padding: 3px 8px 3px 10px;\n font-size: 12px;\n color: var(--cw-primary);\n max-width: 200px;\n}\n\n.cw-footer__file-chip-name {\n overflow: hidden;\n text-overflow: ellipsis;\n white-space: nowrap;\n}\n\n.cw-footer__file-chip-remove {\n background: none;\n border: none;\n cursor: pointer;\n padding: 2px;\n display: flex;\n align-items: center;\n justify-content: center;\n color: inherit;\n border-radius: 50%;\n flex-shrink: 0;\n opacity: 0.7;\n transition: opacity 0.15s ease, background-color 0.15s ease;\n}\n\n.cw-footer__file-chip-remove:hover {\n opacity: 1;\n background-color: color-mix(in srgb, var(--cw-primary) 15%, transparent);\n}\n\n.cw-footer__file-chip-remove:focus-visible {\n outline: 2px solid var(--cw-primary);\n outline-offset: 1px;\n}\n\n.cw-footer__input {\n flex: 1;\n resize: none;\n border: 1px solid var(--cw-input-border);\n border-radius: var(--cw-button-radius);\n background-color: var(--cw-input-background);\n font-family: var(--cw-font-family);\n font-size: var(--cw-font-size);\n color: inherit;\n padding: 8px 12px;\n line-height: 1.5;\n min-height: 38px;\n max-height: 120px;\n overflow-y: auto;\n transition: border-color 0.15s ease;\n}\n\n.cw-footer__input:focus {\n outline: none;\n border-color: var(--cw-primary);\n box-shadow: 0 0 0 2px color-mix(in srgb, var(--cw-primary) 20%, transparent);\n}\n\n.cw-footer__input:disabled {\n opacity: 0.5;\n cursor: not-allowed;\n}\n\n.cw-footer__attach-btn,\n.cw-footer__send-btn {\n background: none;\n border: none;\n cursor: pointer;\n display: flex;\n align-items: center;\n justify-content: center;\n padding: 8px;\n border-radius: 50%;\n flex-shrink: 0;\n transition: background-color 0.15s ease, color 0.15s ease;\n color: var(--cw-primary);\n margin-bottom: 1px;\n}\n\n.cw-footer__attach-btn:hover,\n.cw-footer__send-btn:not(.cw-footer__send-btn--disabled):hover {\n background-color: color-mix(in srgb, var(--cw-primary) 10%, transparent);\n}\n\n.cw-footer__attach-btn:focus-visible,\n.cw-footer__send-btn:focus-visible {\n outline: 2px solid var(--cw-primary);\n outline-offset: 2px;\n}\n\n.cw-footer__attach-btn:disabled {\n opacity: 0.4;\n cursor: not-allowed;\n}\n\n.cw-footer__send-btn--disabled {\n opacity: 0.35;\n cursor: not-allowed;\n}\n\n.cw-footer__file-input {\n display: none;\n}\n";
192
+ document.head.appendChild(s);
193
+ }
194
+
195
+ // src/components/SiteChatComponentNew/Footer/Footer.tsx
196
+ var import_jsx_runtime2 = require("react/jsx-runtime");
197
+ var Footer = ({ onSend, onAttachment, disabled }) => {
198
+ const [text, setText] = (0, import_react2.useState)("");
199
+ const [stagedFiles, setStagedFiles] = (0, import_react2.useState)([]);
200
+ const fileInputRef = (0, import_react2.useRef)(null);
201
+ const textareaRef = (0, import_react2.useRef)(null);
202
+ const isEmpty = text.trim().length === 0 && stagedFiles.length === 0;
203
+ const handleSend = (0, import_react2.useCallback)(() => {
204
+ if (!isEmpty && !disabled) {
205
+ if (text.trim().length > 0) {
206
+ onSend(text.trim());
207
+ setText("");
208
+ }
209
+ stagedFiles.forEach((file) => onAttachment(file));
210
+ setStagedFiles([]);
211
+ if (textareaRef.current) {
212
+ textareaRef.current.style.height = "auto";
213
+ textareaRef.current.focus();
214
+ }
215
+ }
216
+ }, [isEmpty, disabled, onSend, text, stagedFiles, onAttachment]);
217
+ const handleKeyDown = (0, import_react2.useCallback)(
218
+ (e) => {
219
+ if (e.key === "Enter" && !e.shiftKey) {
220
+ e.preventDefault();
221
+ handleSend();
222
+ }
223
+ },
224
+ [handleSend]
225
+ );
226
+ const handleChange = (0, import_react2.useCallback)(
227
+ (e) => {
228
+ setText(e.target.value);
229
+ const el = e.target;
230
+ el.style.height = "auto";
231
+ el.style.height = `${Math.min(el.scrollHeight, 120)}px`;
232
+ },
233
+ []
234
+ );
235
+ const handleAttachmentClick = (0, import_react2.useCallback)(() => {
236
+ var _a;
237
+ (_a = fileInputRef.current) == null ? void 0 : _a.click();
238
+ }, []);
239
+ const handleFileChange = (0, import_react2.useCallback)(
240
+ (e) => {
241
+ var _a;
242
+ const files = Array.from((_a = e.target.files) != null ? _a : []);
243
+ if (files.length > 0) {
244
+ setStagedFiles((prev) => [...prev, ...files]);
245
+ }
246
+ if (fileInputRef.current) {
247
+ fileInputRef.current.value = "";
248
+ }
249
+ },
250
+ []
251
+ );
252
+ const handleRemoveStagedFile = (0, import_react2.useCallback)((index) => {
253
+ setStagedFiles((prev) => prev.filter((_, i) => i !== index));
254
+ }, []);
255
+ return /* @__PURE__ */ (0, import_jsx_runtime2.jsxs)("footer", { className: "cw-footer", role: "contentinfo", children: [
256
+ stagedFiles.length > 0 && /* @__PURE__ */ (0, import_jsx_runtime2.jsx)("ul", { className: "cw-footer__file-list", "aria-label": "Files to send", children: stagedFiles.map((file, i) => /* @__PURE__ */ (0, import_jsx_runtime2.jsxs)("li", { className: "cw-footer__file-chip", children: [
257
+ /* @__PURE__ */ (0, import_jsx_runtime2.jsx)("span", { className: "cw-footer__file-chip-name", title: file.name, children: file.name }),
258
+ /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(
259
+ "button",
260
+ {
261
+ className: "cw-footer__file-chip-remove",
262
+ onClick: () => handleRemoveStagedFile(i),
263
+ "aria-label": `Remove ${file.name}`,
264
+ type: "button",
265
+ children: /* @__PURE__ */ (0, import_jsx_runtime2.jsx)("svg", { xmlns: "http://www.w3.org/2000/svg", width: "12", height: "12", viewBox: "0 0 24 24", fill: "currentColor", "aria-hidden": "true", children: /* @__PURE__ */ (0, import_jsx_runtime2.jsx)("path", { d: "M19 6.41L17.59 5 12 10.59 6.41 5 5 6.41 10.59 12 5 17.59 6.41 19 12 13.41 17.59 19 19 17.59 13.41 12z" }) })
266
+ }
267
+ )
268
+ ] }, `${file.name}-${i}`)) }),
269
+ /* @__PURE__ */ (0, import_jsx_runtime2.jsxs)("div", { className: "cw-footer__controls", children: [
270
+ /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(
271
+ "button",
272
+ {
273
+ className: "cw-footer__attach-btn",
274
+ onClick: handleAttachmentClick,
275
+ "aria-label": "Attach file",
276
+ type: "button",
277
+ disabled,
278
+ children: /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(
279
+ "svg",
280
+ {
281
+ xmlns: "http://www.w3.org/2000/svg",
282
+ width: "20",
283
+ height: "20",
284
+ viewBox: "0 0 24 24",
285
+ fill: "none",
286
+ stroke: "currentColor",
287
+ strokeWidth: "2",
288
+ strokeLinecap: "round",
289
+ strokeLinejoin: "round",
290
+ "aria-hidden": "true",
291
+ children: /* @__PURE__ */ (0, import_jsx_runtime2.jsx)("path", { d: "M21.44 11.05l-9.19 9.19a6 6 0 0 1-8.49-8.49l9.19-9.19a4 4 0 0 1 5.66 5.66l-9.2 9.19a2 2 0 0 1-2.83-2.83l8.49-8.48" })
292
+ }
293
+ )
294
+ }
295
+ ),
296
+ /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(
297
+ "textarea",
298
+ {
299
+ ref: textareaRef,
300
+ className: "cw-footer__input",
301
+ value: text,
302
+ onChange: handleChange,
303
+ onKeyDown: handleKeyDown,
304
+ placeholder: "Type a message\u2026",
305
+ "aria-label": "Message input",
306
+ rows: 1,
307
+ disabled
308
+ }
309
+ ),
310
+ /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(
311
+ "button",
312
+ {
313
+ className: `cw-footer__send-btn${isEmpty || disabled ? " cw-footer__send-btn--disabled" : ""}`,
314
+ onClick: handleSend,
315
+ "aria-label": "Send message",
316
+ type: "button",
317
+ disabled: isEmpty || disabled,
318
+ children: /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(
319
+ "svg",
320
+ {
321
+ xmlns: "http://www.w3.org/2000/svg",
322
+ width: "20",
323
+ height: "20",
324
+ viewBox: "0 0 24 24",
325
+ fill: "currentColor",
326
+ "aria-hidden": "true",
327
+ children: /* @__PURE__ */ (0, import_jsx_runtime2.jsx)("path", { d: "M2.01 21L23 12 2.01 3 2 10l15 2-15 2z" })
328
+ }
329
+ )
330
+ }
331
+ ),
332
+ /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(
333
+ "input",
334
+ {
335
+ ref: fileInputRef,
336
+ type: "file",
337
+ className: "cw-footer__file-input",
338
+ onChange: handleFileChange,
339
+ "aria-hidden": "true",
340
+ tabIndex: -1,
341
+ multiple: true
342
+ }
343
+ )
344
+ ] })
345
+ ] });
346
+ };
347
+ var Footer_default = Footer;
348
+
349
+ // src/components/SiteChatComponentNew/hooks/useAutoScroll.ts
350
+ var import_react3 = require("react");
351
+ function useAutoScroll(dependency) {
352
+ const ref = (0, import_react3.useRef)(null);
353
+ const userScrolledUp = (0, import_react3.useRef)(false);
354
+ (0, import_react3.useEffect)(() => {
355
+ const el = ref.current;
356
+ if (!el) return;
357
+ const handleScroll = () => {
358
+ const atBottom = el.scrollHeight - el.scrollTop - el.clientHeight < 64;
359
+ userScrolledUp.current = !atBottom;
360
+ };
361
+ el.addEventListener("scroll", handleScroll, { passive: true });
362
+ return () => el.removeEventListener("scroll", handleScroll);
363
+ }, []);
364
+ (0, import_react3.useEffect)(() => {
365
+ const el = ref.current;
366
+ if (!el || userScrolledUp.current) return;
367
+ el.scrollTo({ top: el.scrollHeight, behavior: "smooth" });
368
+ }, [dependency]);
369
+ return ref;
370
+ }
371
+
372
+ // src/components/SiteChatComponentNew/hooks/useOfflineForm.ts
373
+ var import_react4 = require("react");
374
+ function validateField(field, value) {
375
+ if (field.required) {
376
+ if (field.type === "checkbox" && !value) {
377
+ return `${field.label} is required.`;
378
+ }
379
+ if (field.type !== "checkbox" && (value === void 0 || value === null || String(value).trim() === "")) {
380
+ return `${field.label} is required.`;
381
+ }
382
+ }
383
+ if (field.type === "email") {
384
+ const emailRegex = /^[^\s@]+@[^\s@]+\.[^\s@]+$/;
385
+ if (value && !emailRegex.test(String(value))) {
386
+ return "Please enter a valid email address.";
387
+ }
388
+ }
389
+ if (field.type === "phone") {
390
+ const phoneRegex = /^\+?[\d\s\-().]{7,20}$/;
391
+ if (value && !phoneRegex.test(String(value))) {
392
+ return "Please enter a valid phone number.";
393
+ }
394
+ }
395
+ return "";
396
+ }
397
+ function useOfflineForm(schema) {
398
+ const initialValues = {};
399
+ for (const field of schema.fields) {
400
+ initialValues[field.id] = field.type === "checkbox" ? false : "";
401
+ }
402
+ const [values, setValues] = (0, import_react4.useState)(initialValues);
403
+ const [errors, setErrors] = (0, import_react4.useState)({});
404
+ const [submitted, setSubmitted] = (0, import_react4.useState)(false);
405
+ const setValue = (0, import_react4.useCallback)(
406
+ (id, value) => {
407
+ setValues((prev) => ({ ...prev, [id]: value }));
408
+ if (submitted) {
409
+ const field = schema.fields.find((f) => f.id === id);
410
+ if (field) {
411
+ const error = validateField(field, value);
412
+ setErrors((prev) => ({ ...prev, [id]: error }));
413
+ }
414
+ }
415
+ },
416
+ [schema.fields, submitted]
417
+ );
418
+ const validate = (0, import_react4.useCallback)(() => {
419
+ const newErrors = {};
420
+ let valid = true;
421
+ for (const field of schema.fields) {
422
+ const error = validateField(field, values[field.id]);
423
+ newErrors[field.id] = error;
424
+ if (error) valid = false;
425
+ }
426
+ setErrors(newErrors);
427
+ return valid;
428
+ }, [schema.fields, values]);
429
+ const handleSubmit = (0, import_react4.useCallback)(
430
+ (onSubmit) => {
431
+ setSubmitted(true);
432
+ if (validate()) {
433
+ onSubmit(values);
434
+ }
435
+ },
436
+ [validate, values]
437
+ );
438
+ const reset = (0, import_react4.useCallback)(() => {
439
+ setValues(initialValues);
440
+ setErrors({});
441
+ setSubmitted(false);
442
+ }, []);
443
+ return { values, errors, setValue, handleSubmit, reset };
444
+ }
445
+
446
+ // src/components/SiteChatComponentNew/Messages/UserMessage.css
447
+ if (typeof document !== "undefined" && !document.getElementById("jrapps-style-aed321e0")) {
448
+ const s = document.createElement("style");
449
+ s.id = "jrapps-style-aed321e0";
450
+ s.textContent = ".cw-user-message {\n display: flex;\n flex-direction: column;\n align-items: flex-end;\n max-width: 75%;\n align-self: flex-end;\n gap: 3px;\n}\n\n.cw-user-message__bubble {\n background-color: var(--cw-user-bubble);\n color: var(--cw-user-text);\n padding: 10px 14px;\n border-radius: 18px 18px 4px 18px;\n font-size: var(--cw-font-size);\n line-height: 1.5;\n word-break: break-word;\n white-space: pre-wrap;\n}\n\n.cw-user-message__time {\n font-size: 11px;\n color: var(--cw-system-text);\n padding-right: 2px;\n}\n";
451
+ document.head.appendChild(s);
452
+ }
453
+
454
+ // src/components/SiteChatComponentNew/Messages/UserMessage.tsx
455
+ var import_jsx_runtime3 = require("react/jsx-runtime");
456
+ var UserMessage = ({ message }) => {
457
+ return /* @__PURE__ */ (0, import_jsx_runtime3.jsxs)("div", { className: "cw-user-message", role: "listitem", "aria-label": "Your message", children: [
458
+ /* @__PURE__ */ (0, import_jsx_runtime3.jsx)("div", { className: "cw-user-message__bubble", children: message.message }),
459
+ message.timestamp !== void 0 && /* @__PURE__ */ (0, import_jsx_runtime3.jsx)("span", { className: "cw-user-message__time", children: formatTime(message.timestamp) })
460
+ ] });
461
+ };
462
+ var UserMessage_default = UserMessage;
463
+
464
+ // src/components/SiteChatComponentNew/Shared/Avatar.css
465
+ if (typeof document !== "undefined" && !document.getElementById("jrapps-style-ce14fbec")) {
466
+ const s = document.createElement("style");
467
+ s.id = "jrapps-style-ce14fbec";
468
+ s.textContent = ".cw-avatar {\n border-radius: 50%;\n flex-shrink: 0;\n display: inline-flex;\n align-items: center;\n justify-content: center;\n}\n\n.cw-avatar--image {\n object-fit: cover;\n}\n\n.cw-avatar--initials {\n background-color: var(--cw-primary);\n color: #ffffff;\n font-weight: 600;\n user-select: none;\n}\n";
469
+ document.head.appendChild(s);
470
+ }
471
+
472
+ // src/components/SiteChatComponentNew/Shared/Avatar.tsx
473
+ var import_jsx_runtime4 = require("react/jsx-runtime");
474
+ function getInitials(name) {
475
+ return name.split(" ").slice(0, 2).map((w) => w[0]).join("").toUpperCase();
476
+ }
477
+ var Avatar = ({ src, name, size = 32 }) => {
478
+ const style = {
479
+ width: `${size}px`,
480
+ height: `${size}px`,
481
+ fontSize: `${Math.round(size * 0.38)}px`
482
+ };
483
+ if (src) {
484
+ return /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(
485
+ "img",
486
+ {
487
+ src,
488
+ alt: name ? `${name} avatar` : "Agent avatar",
489
+ className: "cw-avatar cw-avatar--image",
490
+ style
491
+ }
492
+ );
493
+ }
494
+ return /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(
495
+ "span",
496
+ {
497
+ className: "cw-avatar cw-avatar--initials",
498
+ "aria-label": name ? `${name} avatar` : "Agent avatar",
499
+ style,
500
+ children: name ? getInitials(name) : "A"
501
+ }
502
+ );
503
+ };
504
+ var Avatar_default = Avatar;
505
+
506
+ // src/components/SiteChatComponentNew/Shared/Button.css
507
+ if (typeof document !== "undefined" && !document.getElementById("jrapps-style-2aa106ea")) {
508
+ const s = document.createElement("style");
509
+ s.id = "jrapps-style-2aa106ea";
510
+ s.textContent = ".cw-button {\n display: inline-flex;\n align-items: center;\n justify-content: center;\n gap: 8px;\n padding: 10px 20px;\n border: none;\n border-radius: var(--cw-button-radius);\n font-family: var(--cw-font-family);\n font-size: var(--cw-font-size);\n font-weight: 600;\n cursor: pointer;\n transition: opacity 0.15s ease, transform 0.1s ease;\n white-space: nowrap;\n}\n\n.cw-button:focus-visible {\n outline: 2px solid var(--cw-primary);\n outline-offset: 3px;\n}\n\n.cw-button:active:not(:disabled) {\n transform: scale(0.98);\n}\n\n.cw-button:disabled {\n opacity: 0.45;\n cursor: not-allowed;\n}\n\n.cw-button--primary {\n background-color: var(--cw-primary);\n color: #ffffff;\n}\n\n.cw-button--primary:hover:not(:disabled) {\n opacity: 0.88;\n}\n\n.cw-button--secondary {\n background-color: var(--cw-surface);\n color: var(--cw-primary);\n border: 1px solid var(--cw-border);\n}\n\n.cw-button--secondary:hover:not(:disabled) {\n background-color: var(--cw-border);\n}\n\n.cw-button--full {\n width: 100%;\n}\n";
511
+ document.head.appendChild(s);
512
+ }
513
+
514
+ // src/components/SiteChatComponentNew/Shared/Button.tsx
515
+ var import_jsx_runtime5 = require("react/jsx-runtime");
516
+ var Button = ({
517
+ children,
518
+ onClick,
519
+ variant = "primary",
520
+ disabled = false,
521
+ type = "button",
522
+ fullWidth = false,
523
+ ariaLabel
524
+ }) => {
525
+ return /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(
526
+ "button",
527
+ {
528
+ className: `cw-button cw-button--${variant}${fullWidth ? " cw-button--full" : ""}`,
529
+ onClick,
530
+ disabled,
531
+ type,
532
+ "aria-label": ariaLabel,
533
+ children
534
+ }
535
+ );
536
+ };
537
+ var Button_default = Button;
538
+
539
+ // src/components/SiteChatComponentNew/Messages/AgentMessage.css
540
+ if (typeof document !== "undefined" && !document.getElementById("jrapps-style-5df522b1")) {
541
+ const s = document.createElement("style");
542
+ s.id = "jrapps-style-5df522b1";
543
+ s.textContent = ".cw-agent-message {\n display: flex;\n align-items: flex-end;\n gap: 8px;\n max-width: 75%;\n align-self: flex-start;\n}\n\n.cw-agent-message__content {\n display: flex;\n flex-direction: column;\n gap: 3px;\n}\n\n.cw-agent-message__name {\n font-size: 11px;\n font-weight: 600;\n color: var(--cw-system-text);\n padding-left: 2px;\n}\n\n.cw-agent-message__bubble {\n background-color: var(--cw-agent-bubble);\n color: var(--cw-agent-text);\n padding: 10px 14px;\n border-radius: 18px 18px 18px 4px;\n font-size: var(--cw-font-size);\n line-height: 1.5;\n word-break: break-word;\n white-space: pre-wrap;\n}\n\n.cw-agent-message__time {\n font-size: 11px;\n color: var(--cw-system-text);\n padding-left: 2px;\n}\n";
544
+ document.head.appendChild(s);
545
+ }
546
+
547
+ // src/components/SiteChatComponentNew/Messages/AgentMessage.tsx
548
+ var import_jsx_runtime6 = require("react/jsx-runtime");
549
+ var AgentMessage = ({ message }) => {
550
+ var _a;
551
+ return /* @__PURE__ */ (0, import_jsx_runtime6.jsxs)(
552
+ "div",
553
+ {
554
+ className: "cw-agent-message",
555
+ role: "listitem",
556
+ "aria-label": `Message from ${(_a = message.senderName) != null ? _a : "Agent"}`,
557
+ children: [
558
+ /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(Avatar_default, { name: message.senderName, size: 32 }),
559
+ /* @__PURE__ */ (0, import_jsx_runtime6.jsxs)("div", { className: "cw-agent-message__content", children: [
560
+ message.senderName && /* @__PURE__ */ (0, import_jsx_runtime6.jsx)("span", { className: "cw-agent-message__name", children: message.senderName }),
561
+ /* @__PURE__ */ (0, import_jsx_runtime6.jsx)("div", { className: "cw-agent-message__bubble", children: message.message }),
562
+ message.timestamp !== void 0 && /* @__PURE__ */ (0, import_jsx_runtime6.jsx)("span", { className: "cw-agent-message__time", children: formatTime(message.timestamp) })
563
+ ] })
564
+ ]
565
+ }
566
+ );
567
+ };
568
+ var AgentMessage_default = AgentMessage;
569
+
570
+ // src/components/SiteChatComponentNew/Messages/SystemMessage.css
571
+ if (typeof document !== "undefined" && !document.getElementById("jrapps-style-464a3601")) {
572
+ const s = document.createElement("style");
573
+ s.id = "jrapps-style-464a3601";
574
+ s.textContent = ".cw-system-message {\n display: flex;\n align-items: center;\n gap: 10px;\n align-self: stretch;\n padding: 4px 8px;\n}\n\n.cw-system-message__line {\n flex: 1;\n border-top: 1px dashed var(--cw-border);\n}\n\n.cw-system-message__text {\n font-size: 11px;\n color: var(--cw-system-text);\n white-space: nowrap;\n flex-shrink: 0;\n font-style: italic;\n}\n";
575
+ document.head.appendChild(s);
576
+ }
577
+
578
+ // src/components/SiteChatComponentNew/Messages/SystemMessage.tsx
579
+ var import_jsx_runtime7 = require("react/jsx-runtime");
580
+ var SystemMessage = ({ message }) => {
581
+ var _a;
582
+ const label = message.message ? getSystemLabel(message.message) : (_a = message.message) != null ? _a : "";
583
+ return /* @__PURE__ */ (0, import_jsx_runtime7.jsxs)(
584
+ "div",
585
+ {
586
+ className: "cw-system-message",
587
+ role: "listitem",
588
+ "aria-label": `System notification: ${label}`,
589
+ children: [
590
+ /* @__PURE__ */ (0, import_jsx_runtime7.jsx)("span", { className: "cw-system-message__line", "aria-hidden": "true" }),
591
+ /* @__PURE__ */ (0, import_jsx_runtime7.jsx)("span", { className: "cw-system-message__text", children: label }),
592
+ /* @__PURE__ */ (0, import_jsx_runtime7.jsx)("span", { className: "cw-system-message__line", "aria-hidden": "true" })
593
+ ]
594
+ }
595
+ );
596
+ };
597
+ var SystemMessage_default = SystemMessage;
598
+
599
+ // src/components/SiteChatComponentNew/Messages/AttachmentMessage.css
600
+ if (typeof document !== "undefined" && !document.getElementById("jrapps-style-dd846dee")) {
601
+ const s = document.createElement("style");
602
+ s.id = "jrapps-style-dd846dee";
603
+ s.textContent = ".cw-attachment-message {\n display: flex;\n flex-direction: column;\n gap: 3px;\n align-self: flex-start;\n max-width: 80%;\n}\n\n.cw-attachment-message--user {\n align-self: flex-end;\n align-items: flex-end;\n}\n\n.cw-attachment-message__card {\n display: flex;\n align-items: center;\n gap: 10px;\n background-color: var(--cw-agent-bubble);\n border: 1px solid var(--cw-border);\n border-radius: 12px;\n padding: 10px 14px;\n}\n\n.cw-attachment-message--user .cw-attachment-message__card {\n background-color: var(--cw-user-bubble);\n border-color: transparent;\n color: var(--cw-user-text);\n}\n\n.cw-attachment-message__icon {\n flex-shrink: 0;\n opacity: 0.75;\n display: flex;\n align-items: center;\n}\n\n.cw-attachment-message__info {\n display: flex;\n flex-direction: column;\n min-width: 0;\n flex: 1;\n}\n\n.cw-attachment-message__name {\n font-size: 13px;\n font-weight: 600;\n white-space: nowrap;\n overflow: hidden;\n text-overflow: ellipsis;\n}\n\n.cw-attachment-message__label {\n font-size: 11px;\n opacity: 0.65;\n}\n\n.cw-attachment-message__open-btn {\n background-color: var(--cw-primary);\n color: #ffffff;\n border: none;\n border-radius: 6px;\n padding: 5px 12px;\n font-family: var(--cw-font-family);\n font-size: 12px;\n font-weight: 600;\n cursor: pointer;\n flex-shrink: 0;\n transition: opacity 0.15s ease;\n}\n\n.cw-attachment-message--user .cw-attachment-message__open-btn {\n background-color: rgba(255, 255, 255, 0.25);\n color: #ffffff;\n}\n\n.cw-attachment-message__open-btn:hover {\n opacity: 0.85;\n}\n\n.cw-attachment-message__open-btn:focus-visible {\n outline: 2px solid var(--cw-primary);\n outline-offset: 2px;\n}\n\n.cw-attachment-message__time {\n font-size: 11px;\n color: var(--cw-system-text);\n padding-left: 2px;\n}\n\n.cw-attachment-message__time--right {\n padding-left: 0;\n padding-right: 2px;\n align-self: flex-end;\n}\n";
604
+ document.head.appendChild(s);
605
+ }
606
+
607
+ // src/components/SiteChatComponentNew/Messages/AttachmentMessage.tsx
608
+ var import_jsx_runtime8 = require("react/jsx-runtime");
609
+ var AttachmentMessage = ({ message }) => {
610
+ var _a;
611
+ const attachment = (_a = message.item) != null ? _a : message.attachment;
612
+ if (!attachment) return null;
613
+ const handleOpen = () => {
614
+ window.open(attachment.url, "_blank", "noopener,noreferrer");
615
+ };
616
+ return /* @__PURE__ */ (0, import_jsx_runtime8.jsxs)(
617
+ "div",
618
+ {
619
+ className: `cw-attachment-message${message.senderType === "user" ? " cw-attachment-message--user" : ""}`,
620
+ role: "listitem",
621
+ "aria-label": `Attachment: ${attachment.name}`,
622
+ children: [
623
+ /* @__PURE__ */ (0, import_jsx_runtime8.jsxs)("div", { className: "cw-attachment-message__card", children: [
624
+ /* @__PURE__ */ (0, import_jsx_runtime8.jsx)("div", { className: "cw-attachment-message__icon", "aria-hidden": "true", children: /* @__PURE__ */ (0, import_jsx_runtime8.jsxs)(
625
+ "svg",
626
+ {
627
+ xmlns: "http://www.w3.org/2000/svg",
628
+ width: "24",
629
+ height: "24",
630
+ viewBox: "0 0 24 24",
631
+ fill: "none",
632
+ stroke: "currentColor",
633
+ strokeWidth: "2",
634
+ strokeLinecap: "round",
635
+ strokeLinejoin: "round",
636
+ children: [
637
+ /* @__PURE__ */ (0, import_jsx_runtime8.jsx)("path", { d: "M14 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V8z" }),
638
+ /* @__PURE__ */ (0, import_jsx_runtime8.jsx)("polyline", { points: "14 2 14 8 20 8" })
639
+ ]
640
+ }
641
+ ) }),
642
+ /* @__PURE__ */ (0, import_jsx_runtime8.jsxs)("div", { className: "cw-attachment-message__info", children: [
643
+ /* @__PURE__ */ (0, import_jsx_runtime8.jsx)("span", { className: "cw-attachment-message__name", children: attachment.name }),
644
+ /* @__PURE__ */ (0, import_jsx_runtime8.jsx)("span", { className: "cw-attachment-message__label", children: "Attachment" })
645
+ ] }),
646
+ /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(
647
+ "button",
648
+ {
649
+ className: "cw-attachment-message__open-btn",
650
+ onClick: handleOpen,
651
+ "aria-label": `Open attachment ${attachment.name}`,
652
+ type: "button",
653
+ children: "Open"
654
+ }
655
+ )
656
+ ] }),
657
+ message.timestamp !== void 0 && /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(
658
+ "span",
659
+ {
660
+ className: `cw-attachment-message__time${message.senderType === "user" ? " cw-attachment-message__time--right" : ""}`,
661
+ children: formatTime(message.timestamp)
662
+ }
663
+ )
664
+ ]
665
+ }
666
+ );
667
+ };
668
+ var AttachmentMessage_default = AttachmentMessage;
669
+
670
+ // src/components/SiteChatComponentNew/Messages/MessageRenderer.tsx
671
+ var import_jsx_runtime9 = require("react/jsx-runtime");
672
+ var MessageRenderer = ({ message }) => {
673
+ if (message.messageType === "ATTACHMENT") {
674
+ return /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(AttachmentMessage_default, { message });
675
+ }
676
+ switch (message.senderType) {
677
+ case "user":
678
+ return /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(UserMessage_default, { message });
679
+ case "agent":
680
+ return /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(AgentMessage_default, { message });
681
+ case "system":
682
+ return /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(SystemMessage_default, { message });
683
+ default:
684
+ return null;
685
+ }
686
+ };
687
+ var MessageRenderer_default = MessageRenderer;
688
+
689
+ // src/components/SiteChatComponentNew/Messages/MessageList.css
690
+ if (typeof document !== "undefined" && !document.getElementById("jrapps-style-15ae1a6b")) {
691
+ const s = document.createElement("style");
692
+ s.id = "jrapps-style-15ae1a6b";
693
+ s.textContent = ".cw-message-list {\n flex: 1;\n display: flex;\n flex-direction: column;\n gap: 10px;\n overflow-y: auto;\n padding: 16px;\n background-color: var(--cw-background);\n scroll-behavior: smooth;\n}\n\n/* Scrollbar styling */\n.cw-message-list::-webkit-scrollbar {\n width: 5px;\n}\n\n.cw-message-list::-webkit-scrollbar-track {\n background: transparent;\n}\n\n.cw-message-list::-webkit-scrollbar-thumb {\n background-color: var(--cw-border);\n border-radius: 10px;\n}\n";
694
+ document.head.appendChild(s);
695
+ }
696
+
697
+ // src/components/SiteChatComponentNew/Messages/MessageList.tsx
698
+ var import_jsx_runtime10 = require("react/jsx-runtime");
699
+ var MessageList = ({ messages }) => {
700
+ const scrollRef = useAutoScroll(messages);
701
+ return /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(
702
+ "div",
703
+ {
704
+ ref: scrollRef,
705
+ className: "cw-message-list",
706
+ role: "list",
707
+ "aria-label": "Chat messages",
708
+ "aria-live": "polite",
709
+ "aria-relevant": "additions",
710
+ children: messages.map((msg, index) => {
711
+ var _a, _b;
712
+ return /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(
713
+ MessageRenderer_default,
714
+ {
715
+ message: msg
716
+ },
717
+ (_b = msg._id) != null ? _b : `${(_a = msg.timestamp) != null ? _a : index}-${index}`
718
+ );
719
+ })
720
+ }
721
+ );
722
+ };
723
+ var MessageList_default = MessageList;
724
+
725
+ // src/components/SiteChatComponentNew/Messages/TypingIndicator.css
726
+ if (typeof document !== "undefined" && !document.getElementById("jrapps-style-4b0ca05b")) {
727
+ const s = document.createElement("style");
728
+ s.id = "jrapps-style-4b0ca05b";
729
+ s.textContent = "@keyframes cw-bounce {\n 0%, 60%, 100% {\n transform: translateY(0);\n }\n 30% {\n transform: translateY(-6px);\n }\n}\n\n.cw-typing-indicator {\n align-self: flex-start;\n}\n\n.cw-typing-indicator__bubble {\n display: inline-flex;\n align-items: center;\n gap: 4px;\n background-color: var(--cw-agent-bubble);\n border-radius: 18px 18px 18px 4px;\n padding: 10px 14px;\n}\n\n.cw-typing-indicator__dot {\n display: block;\n width: 7px;\n height: 7px;\n border-radius: 50%;\n background-color: var(--cw-system-text);\n animation: cw-bounce 1.2s infinite ease-in-out;\n}\n\n.cw-typing-indicator__dot:nth-child(2) {\n animation-delay: 0.2s;\n}\n\n.cw-typing-indicator__dot:nth-child(3) {\n animation-delay: 0.4s;\n}\n";
730
+ document.head.appendChild(s);
731
+ }
732
+
733
+ // src/components/SiteChatComponentNew/Messages/TypingIndicator.tsx
734
+ var import_jsx_runtime11 = require("react/jsx-runtime");
735
+
736
+ // src/components/SiteChatComponentNew/States/LoadingState.css
737
+ if (typeof document !== "undefined" && !document.getElementById("jrapps-style-7a5a4f05")) {
738
+ const s = document.createElement("style");
739
+ s.id = "jrapps-style-7a5a4f05";
740
+ s.textContent = "@keyframes cw-spin {\n to {\n transform: rotate(360deg);\n }\n}\n\n.cw-loading-state {\n flex: 1;\n display: flex;\n flex-direction: column;\n align-items: center;\n justify-content: center;\n padding: 32px;\n background-color: var(--cw-background);\n text-align: center;\n gap: 12px;\n}\n\n.cw-loading-state__spinner {\n width: 48px;\n height: 48px;\n}\n\n.cw-loading-state__spinner-ring {\n width: 48px;\n height: 48px;\n border-radius: 50%;\n border: 3px solid var(--cw-border);\n border-top-color: var(--cw-primary);\n animation: cw-spin 0.8s linear infinite;\n}\n\n.cw-loading-state__title {\n font-size: 16px;\n font-weight: 600;\n color: var(--cw-agent-text);\n margin: 0;\n}\n\n.cw-loading-state__subtitle {\n font-size: 13px;\n color: var(--cw-system-text);\n margin: 0;\n max-width: 240px;\n line-height: 1.5;\n}\n";
741
+ document.head.appendChild(s);
742
+ }
743
+
744
+ // src/components/SiteChatComponentNew/States/LoadingState.tsx
745
+ var import_jsx_runtime12 = require("react/jsx-runtime");
746
+ var LoadingState = () => {
747
+ return /* @__PURE__ */ (0, import_jsx_runtime12.jsxs)(
748
+ "div",
749
+ {
750
+ className: "cw-loading-state",
751
+ role: "status",
752
+ "aria-label": "Connecting to chat",
753
+ children: [
754
+ /* @__PURE__ */ (0, import_jsx_runtime12.jsx)("div", { className: "cw-loading-state__spinner", "aria-hidden": "true", children: /* @__PURE__ */ (0, import_jsx_runtime12.jsx)("div", { className: "cw-loading-state__spinner-ring" }) }),
755
+ /* @__PURE__ */ (0, import_jsx_runtime12.jsx)("p", { className: "cw-loading-state__title", children: "Connecting\u2026" }),
756
+ /* @__PURE__ */ (0, import_jsx_runtime12.jsx)("p", { className: "cw-loading-state__subtitle", children: "Please wait while we connect you to an available agent." })
757
+ ]
758
+ }
759
+ );
760
+ };
761
+ var LoadingState_default = LoadingState;
762
+
763
+ // src/components/SiteChatComponentNew/States/StartChatState.css
764
+ if (typeof document !== "undefined" && !document.getElementById("jrapps-style-3e05ef30")) {
765
+ const s = document.createElement("style");
766
+ s.id = "jrapps-style-3e05ef30";
767
+ s.textContent = ".cw-start-chat-state {\n flex: 1;\n display: flex;\n flex-direction: column;\n align-items: center;\n justify-content: center;\n padding: 32px 24px;\n background-color: var(--cw-background);\n text-align: center;\n gap: 14px;\n}\n\n.cw-start-chat-state__image {\n width: 80px;\n height: 80px;\n object-fit: contain;\n border-radius: 50%;\n margin-bottom: 4px;\n}\n\n.cw-start-chat-state__title {\n font-size: 20px;\n font-weight: 700;\n color: var(--cw-agent-text);\n margin: 0;\n}\n\n.cw-start-chat-state__description {\n font-size: 14px;\n color: var(--cw-system-text);\n margin: 0;\n max-width: 260px;\n line-height: 1.6;\n}\n";
768
+ document.head.appendChild(s);
769
+ }
770
+
771
+ // src/components/SiteChatComponentNew/States/StartChatState.tsx
772
+ var import_jsx_runtime13 = require("react/jsx-runtime");
773
+ var StartChatState = ({
774
+ image,
775
+ title,
776
+ description,
777
+ onStart
778
+ }) => {
779
+ return /* @__PURE__ */ (0, import_jsx_runtime13.jsxs)(
780
+ "div",
781
+ {
782
+ className: "cw-start-chat-state",
783
+ role: "main",
784
+ "aria-label": "Start a chat",
785
+ children: [
786
+ image && /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(
787
+ "img",
788
+ {
789
+ src: image,
790
+ alt: "Support illustration",
791
+ className: "cw-start-chat-state__image"
792
+ }
793
+ ),
794
+ /* @__PURE__ */ (0, import_jsx_runtime13.jsx)("h2", { className: "cw-start-chat-state__title", children: title }),
795
+ description && /* @__PURE__ */ (0, import_jsx_runtime13.jsx)("p", { className: "cw-start-chat-state__description", children: description }),
796
+ /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(Button_default, { onClick: onStart, ariaLabel: "Start chat", children: "Start Chat" })
797
+ ]
798
+ }
799
+ );
800
+ };
801
+ var StartChatState_default = StartChatState;
802
+
803
+ // src/components/SiteChatComponentNew/OfflineForm/OfflineForm.css
804
+ if (typeof document !== "undefined" && !document.getElementById("jrapps-style-d9ff3956")) {
805
+ const s = document.createElement("style");
806
+ s.id = "jrapps-style-d9ff3956";
807
+ s.textContent = `.cw-offline-form {
808
+ display: flex;
809
+ flex-direction: column;
810
+ gap: 14px;
811
+ }
812
+
813
+ .cw-offline-form__title {
814
+ font-size: 15px;
815
+ font-weight: 600;
816
+ color: var(--cw-agent-text);
817
+ margin: 0 0 4px;
818
+ }
819
+
820
+ /* Field wrapper */
821
+ .cw-offline-form__field {
822
+ display: flex;
823
+ flex-direction: column;
824
+ gap: 5px;
825
+ }
826
+
827
+ .cw-offline-form__field--checkbox {
828
+ gap: 4px;
829
+ }
830
+
831
+ /* Label */
832
+ .cw-offline-form__label {
833
+ font-size: 13px;
834
+ font-weight: 500;
835
+ color: var(--cw-agent-text);
836
+ }
837
+
838
+ .cw-offline-form__required {
839
+ color: #ef4444;
840
+ }
841
+
842
+ /* Text input */
843
+ .cw-offline-form__input {
844
+ width: 100%;
845
+ padding: 8px 12px;
846
+ border: 1px solid var(--cw-input-border);
847
+ border-radius: var(--cw-button-radius);
848
+ background-color: var(--cw-input-background);
849
+ font-family: var(--cw-font-family);
850
+ font-size: var(--cw-font-size);
851
+ color: inherit;
852
+ box-sizing: border-box;
853
+ transition: border-color 0.15s ease;
854
+ }
855
+
856
+ .cw-offline-form__input:focus {
857
+ outline: none;
858
+ border-color: var(--cw-primary);
859
+ box-shadow: 0 0 0 2px color-mix(in srgb, var(--cw-primary) 20%, transparent);
860
+ }
861
+
862
+ .cw-offline-form__input--error {
863
+ border-color: #ef4444;
864
+ }
865
+
866
+ /* Textarea */
867
+ .cw-offline-form__textarea {
868
+ width: 100%;
869
+ padding: 8px 12px;
870
+ border: 1px solid var(--cw-input-border);
871
+ border-radius: var(--cw-button-radius);
872
+ background-color: var(--cw-input-background);
873
+ font-family: var(--cw-font-family);
874
+ font-size: var(--cw-font-size);
875
+ color: inherit;
876
+ resize: vertical;
877
+ box-sizing: border-box;
878
+ transition: border-color 0.15s ease;
879
+ }
880
+
881
+ .cw-offline-form__textarea:focus {
882
+ outline: none;
883
+ border-color: var(--cw-primary);
884
+ box-shadow: 0 0 0 2px color-mix(in srgb, var(--cw-primary) 20%, transparent);
885
+ }
886
+
887
+ .cw-offline-form__textarea--error {
888
+ border-color: #ef4444;
889
+ }
890
+
891
+ /* Select */
892
+ .cw-offline-form__select {
893
+ width: 100%;
894
+ padding: 8px 12px;
895
+ border: 1px solid var(--cw-input-border);
896
+ border-radius: var(--cw-button-radius);
897
+ background-color: var(--cw-input-background);
898
+ font-family: var(--cw-font-family);
899
+ font-size: var(--cw-font-size);
900
+ color: inherit;
901
+ box-sizing: border-box;
902
+ appearance: none;
903
+ background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%236b7280' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpolyline points='6 9 12 15 18 9'%3E%3C/polyline%3E%3C/svg%3E");
904
+ background-repeat: no-repeat;
905
+ background-position: right 12px center;
906
+ padding-right: 32px;
907
+ cursor: pointer;
908
+ transition: border-color 0.15s ease;
909
+ }
910
+
911
+ .cw-offline-form__select:focus {
912
+ outline: none;
913
+ border-color: var(--cw-primary);
914
+ box-shadow: 0 0 0 2px color-mix(in srgb, var(--cw-primary) 20%, transparent);
915
+ }
916
+
917
+ .cw-offline-form__select--error {
918
+ border-color: #ef4444;
919
+ }
920
+
921
+ /* Checkbox */
922
+ .cw-offline-form__checkbox-label {
923
+ display: flex;
924
+ align-items: flex-start;
925
+ gap: 8px;
926
+ cursor: pointer;
927
+ font-size: 13px;
928
+ color: var(--cw-agent-text);
929
+ }
930
+
931
+ .cw-offline-form__checkbox {
932
+ width: 16px;
933
+ height: 16px;
934
+ accent-color: var(--cw-primary);
935
+ flex-shrink: 0;
936
+ margin-top: 1px;
937
+ cursor: pointer;
938
+ }
939
+
940
+ .cw-offline-form__checkbox:focus-visible {
941
+ outline: 2px solid var(--cw-primary);
942
+ outline-offset: 2px;
943
+ }
944
+
945
+ .cw-offline-form__checkbox-text {
946
+ line-height: 1.4;
947
+ }
948
+
949
+ /* Error message */
950
+ .cw-offline-form__error {
951
+ font-size: 12px;
952
+ color: #ef4444;
953
+ font-weight: 500;
954
+ }
955
+
956
+ /* Actions */
957
+ .cw-offline-form__actions {
958
+ margin-top: 4px;
959
+ }
960
+ `;
961
+ document.head.appendChild(s);
962
+ }
963
+
964
+ // src/components/SiteChatComponentNew/OfflineForm/OfflineForm.tsx
965
+ var import_jsx_runtime14 = require("react/jsx-runtime");
966
+ var FieldRenderer = ({
967
+ field,
968
+ value,
969
+ error,
970
+ onChange
971
+ }) => {
972
+ var _a, _b;
973
+ const hasError = error.length > 0;
974
+ const fieldId = `cw-offline-field-${field.id}`;
975
+ const errorId = `${fieldId}-error`;
976
+ const commonProps = {
977
+ id: fieldId,
978
+ className: `cw-offline-form__input${hasError ? " cw-offline-form__input--error" : ""}`,
979
+ "aria-invalid": hasError,
980
+ "aria-describedby": hasError ? errorId : void 0,
981
+ required: field.required
982
+ };
983
+ if (field.type === "textarea") {
984
+ return /* @__PURE__ */ (0, import_jsx_runtime14.jsxs)("div", { className: "cw-offline-form__field", children: [
985
+ /* @__PURE__ */ (0, import_jsx_runtime14.jsxs)("label", { htmlFor: fieldId, className: "cw-offline-form__label", children: [
986
+ field.label,
987
+ field.required && /* @__PURE__ */ (0, import_jsx_runtime14.jsxs)("span", { className: "cw-offline-form__required", "aria-hidden": "true", children: [
988
+ " ",
989
+ "*"
990
+ ] })
991
+ ] }),
992
+ /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(
993
+ "textarea",
994
+ {
995
+ ...commonProps,
996
+ value: String(value != null ? value : ""),
997
+ placeholder: field.placeholder,
998
+ rows: 3,
999
+ onChange: (e) => onChange(field.id, e.target.value),
1000
+ className: `cw-offline-form__textarea${hasError ? " cw-offline-form__textarea--error" : ""}`
1001
+ }
1002
+ ),
1003
+ hasError && /* @__PURE__ */ (0, import_jsx_runtime14.jsx)("span", { id: errorId, className: "cw-offline-form__error", role: "alert", children: error })
1004
+ ] });
1005
+ }
1006
+ if (field.type === "select") {
1007
+ return /* @__PURE__ */ (0, import_jsx_runtime14.jsxs)("div", { className: "cw-offline-form__field", children: [
1008
+ /* @__PURE__ */ (0, import_jsx_runtime14.jsxs)("label", { htmlFor: fieldId, className: "cw-offline-form__label", children: [
1009
+ field.label,
1010
+ field.required && /* @__PURE__ */ (0, import_jsx_runtime14.jsxs)("span", { className: "cw-offline-form__required", "aria-hidden": "true", children: [
1011
+ " ",
1012
+ "*"
1013
+ ] })
1014
+ ] }),
1015
+ /* @__PURE__ */ (0, import_jsx_runtime14.jsxs)(
1016
+ "select",
1017
+ {
1018
+ ...commonProps,
1019
+ value: String(value != null ? value : ""),
1020
+ onChange: (e) => onChange(field.id, e.target.value),
1021
+ className: `cw-offline-form__select${hasError ? " cw-offline-form__select--error" : ""}`,
1022
+ children: [
1023
+ /* @__PURE__ */ (0, import_jsx_runtime14.jsx)("option", { value: "", children: (_a = field.placeholder) != null ? _a : `Select ${field.label}` }),
1024
+ (_b = field.options) == null ? void 0 : _b.map((opt) => /* @__PURE__ */ (0, import_jsx_runtime14.jsx)("option", { value: opt.value, children: opt.label }, opt.value))
1025
+ ]
1026
+ }
1027
+ ),
1028
+ hasError && /* @__PURE__ */ (0, import_jsx_runtime14.jsx)("span", { id: errorId, className: "cw-offline-form__error", role: "alert", children: error })
1029
+ ] });
1030
+ }
1031
+ if (field.type === "checkbox") {
1032
+ return /* @__PURE__ */ (0, import_jsx_runtime14.jsxs)("div", { className: "cw-offline-form__field cw-offline-form__field--checkbox", children: [
1033
+ /* @__PURE__ */ (0, import_jsx_runtime14.jsxs)("label", { className: "cw-offline-form__checkbox-label", htmlFor: fieldId, children: [
1034
+ /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(
1035
+ "input",
1036
+ {
1037
+ type: "checkbox",
1038
+ id: fieldId,
1039
+ checked: Boolean(value),
1040
+ onChange: (e) => onChange(field.id, e.target.checked),
1041
+ className: "cw-offline-form__checkbox",
1042
+ "aria-invalid": hasError,
1043
+ "aria-describedby": hasError ? errorId : void 0,
1044
+ required: field.required
1045
+ }
1046
+ ),
1047
+ /* @__PURE__ */ (0, import_jsx_runtime14.jsxs)("span", { className: "cw-offline-form__checkbox-text", children: [
1048
+ field.label,
1049
+ field.required && /* @__PURE__ */ (0, import_jsx_runtime14.jsxs)("span", { className: "cw-offline-form__required", "aria-hidden": "true", children: [
1050
+ " ",
1051
+ "*"
1052
+ ] })
1053
+ ] })
1054
+ ] }),
1055
+ hasError && /* @__PURE__ */ (0, import_jsx_runtime14.jsx)("span", { id: errorId, className: "cw-offline-form__error", role: "alert", children: error })
1056
+ ] });
1057
+ }
1058
+ return /* @__PURE__ */ (0, import_jsx_runtime14.jsxs)("div", { className: "cw-offline-form__field", children: [
1059
+ /* @__PURE__ */ (0, import_jsx_runtime14.jsxs)("label", { htmlFor: fieldId, className: "cw-offline-form__label", children: [
1060
+ field.label,
1061
+ field.required && /* @__PURE__ */ (0, import_jsx_runtime14.jsxs)("span", { className: "cw-offline-form__required", "aria-hidden": "true", children: [
1062
+ " ",
1063
+ "*"
1064
+ ] })
1065
+ ] }),
1066
+ /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(
1067
+ "input",
1068
+ {
1069
+ ...commonProps,
1070
+ type: field.type,
1071
+ value: String(value != null ? value : ""),
1072
+ placeholder: field.placeholder,
1073
+ onChange: (e) => onChange(field.id, e.target.value)
1074
+ }
1075
+ ),
1076
+ hasError && /* @__PURE__ */ (0, import_jsx_runtime14.jsx)("span", { id: errorId, className: "cw-offline-form__error", role: "alert", children: error })
1077
+ ] });
1078
+ };
1079
+ var OfflineForm = ({ schema, onSubmit }) => {
1080
+ const { values, errors, setValue, handleSubmit } = useOfflineForm(schema);
1081
+ const onFormSubmit = (e) => {
1082
+ e.preventDefault();
1083
+ handleSubmit(onSubmit);
1084
+ };
1085
+ return /* @__PURE__ */ (0, import_jsx_runtime14.jsxs)(
1086
+ "form",
1087
+ {
1088
+ className: "cw-offline-form",
1089
+ onSubmit: onFormSubmit,
1090
+ "aria-label": schema.title,
1091
+ noValidate: true,
1092
+ children: [
1093
+ /* @__PURE__ */ (0, import_jsx_runtime14.jsx)("h3", { className: "cw-offline-form__title", children: schema.title }),
1094
+ schema.fields.map((field) => {
1095
+ var _a;
1096
+ return /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(
1097
+ FieldRenderer,
1098
+ {
1099
+ field,
1100
+ value: values[field.id],
1101
+ error: (_a = errors[field.id]) != null ? _a : "",
1102
+ onChange: setValue
1103
+ },
1104
+ field.id
1105
+ );
1106
+ }),
1107
+ /* @__PURE__ */ (0, import_jsx_runtime14.jsx)("div", { className: "cw-offline-form__actions", children: /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(Button_default, { type: "submit", fullWidth: true, children: schema.submitButtonText }) })
1108
+ ]
1109
+ }
1110
+ );
1111
+ };
1112
+ var OfflineForm_default = OfflineForm;
1113
+
1114
+ // src/components/SiteChatComponentNew/States/OfflineState.css
1115
+ if (typeof document !== "undefined" && !document.getElementById("jrapps-style-8b15ae78")) {
1116
+ const s = document.createElement("style");
1117
+ s.id = "jrapps-style-8b15ae78";
1118
+ s.textContent = ".cw-offline-state {\n flex: 1;\n display: flex;\n flex-direction: column;\n background-color: var(--cw-background);\n overflow-y: auto;\n}\n\n.cw-offline-state__header {\n display: flex;\n flex-direction: column;\n align-items: center;\n text-align: center;\n padding: 28px 24px 16px;\n gap: 8px;\n}\n\n.cw-offline-state__icon {\n width: 56px;\n height: 56px;\n border-radius: 50%;\n background-color: color-mix(in srgb, var(--cw-primary) 10%, transparent);\n color: var(--cw-primary);\n display: flex;\n align-items: center;\n justify-content: center;\n margin-bottom: 4px;\n}\n\n.cw-offline-state__title {\n font-size: 17px;\n font-weight: 700;\n color: var(--cw-agent-text);\n margin: 0;\n}\n\n.cw-offline-state__subtitle {\n font-size: 13px;\n color: var(--cw-system-text);\n margin: 0;\n line-height: 1.6;\n max-width: 280px;\n}\n\n.cw-offline-state__form-wrapper {\n padding: 0 16px 16px;\n}\n";
1119
+ document.head.appendChild(s);
1120
+ }
1121
+
1122
+ // src/components/SiteChatComponentNew/States/OfflineState.tsx
1123
+ var import_jsx_runtime15 = require("react/jsx-runtime");
1124
+ var OfflineState = ({ form, onSubmit }) => {
1125
+ return /* @__PURE__ */ (0, import_jsx_runtime15.jsxs)(
1126
+ "div",
1127
+ {
1128
+ className: "cw-offline-state",
1129
+ role: "main",
1130
+ "aria-label": "Business is offline",
1131
+ children: [
1132
+ /* @__PURE__ */ (0, import_jsx_runtime15.jsxs)("div", { className: "cw-offline-state__header", children: [
1133
+ /* @__PURE__ */ (0, import_jsx_runtime15.jsx)("div", { className: "cw-offline-state__icon", "aria-hidden": "true", children: /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(
1134
+ "svg",
1135
+ {
1136
+ xmlns: "http://www.w3.org/2000/svg",
1137
+ width: "32",
1138
+ height: "32",
1139
+ viewBox: "0 0 24 24",
1140
+ fill: "none",
1141
+ stroke: "currentColor",
1142
+ strokeWidth: "2",
1143
+ strokeLinecap: "round",
1144
+ strokeLinejoin: "round",
1145
+ children: /* @__PURE__ */ (0, import_jsx_runtime15.jsx)("path", { d: "M20.84 4.61a5.5 5.5 0 0 0-7.78 0L12 5.67l-1.06-1.06a5.5 5.5 0 0 0-7.78 7.78l1.06 1.06L12 21.23l7.78-7.78 1.06-1.06a5.5 5.5 0 0 0 0-7.78z" })
1146
+ }
1147
+ ) }),
1148
+ /* @__PURE__ */ (0, import_jsx_runtime15.jsx)("h2", { className: "cw-offline-state__title", children: "We're currently offline" }),
1149
+ /* @__PURE__ */ (0, import_jsx_runtime15.jsx)("p", { className: "cw-offline-state__subtitle", children: "Please leave us a message and we'll get back to you as soon as possible." })
1150
+ ] }),
1151
+ form && /* @__PURE__ */ (0, import_jsx_runtime15.jsx)("div", { className: "cw-offline-state__form-wrapper", children: /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(OfflineForm_default, { schema: form, onSubmit }) })
1152
+ ]
1153
+ }
1154
+ );
1155
+ };
1156
+ var OfflineState_default = OfflineState;
1157
+
1158
+ // src/components/SiteChatComponentNew/States/ChatEndedState.css
1159
+ if (typeof document !== "undefined" && !document.getElementById("jrapps-style-59a49fdf")) {
1160
+ const s = document.createElement("style");
1161
+ s.id = "jrapps-style-59a49fdf";
1162
+ s.textContent = ".cw-chat-ended-state {\n flex: 1;\n display: flex;\n flex-direction: column;\n align-items: center;\n justify-content: center;\n padding: 32px 24px;\n background-color: var(--cw-background);\n text-align: center;\n gap: 12px;\n}\n\n.cw-chat-ended-state__icon {\n width: 56px;\n height: 56px;\n border-radius: 50%;\n background-color: color-mix(in srgb, var(--cw-primary) 10%, transparent);\n color: var(--cw-primary);\n display: flex;\n align-items: center;\n justify-content: center;\n}\n\n.cw-chat-ended-state__title {\n font-size: 17px;\n font-weight: 700;\n color: var(--cw-agent-text);\n margin: 0;\n}\n\n.cw-chat-ended-state__subtitle {\n font-size: 13px;\n color: var(--cw-system-text);\n margin: 0;\n max-width: 240px;\n line-height: 1.6;\n}\n";
1163
+ document.head.appendChild(s);
1164
+ }
1165
+
1166
+ // src/components/SiteChatComponentNew/States/ChatEndedState.tsx
1167
+ var import_jsx_runtime16 = require("react/jsx-runtime");
1168
+ var ChatEndedState = () => {
1169
+ return /* @__PURE__ */ (0, import_jsx_runtime16.jsxs)(
1170
+ "div",
1171
+ {
1172
+ className: "cw-chat-ended-state",
1173
+ role: "status",
1174
+ "aria-label": "Chat has ended",
1175
+ children: [
1176
+ /* @__PURE__ */ (0, import_jsx_runtime16.jsx)("div", { className: "cw-chat-ended-state__icon", "aria-hidden": "true", children: /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(
1177
+ "svg",
1178
+ {
1179
+ xmlns: "http://www.w3.org/2000/svg",
1180
+ width: "32",
1181
+ height: "32",
1182
+ viewBox: "0 0 24 24",
1183
+ fill: "none",
1184
+ stroke: "currentColor",
1185
+ strokeWidth: "2",
1186
+ strokeLinecap: "round",
1187
+ strokeLinejoin: "round",
1188
+ children: /* @__PURE__ */ (0, import_jsx_runtime16.jsx)("polyline", { points: "20 6 9 17 4 12" })
1189
+ }
1190
+ ) }),
1191
+ /* @__PURE__ */ (0, import_jsx_runtime16.jsx)("p", { className: "cw-chat-ended-state__title", children: "Chat Ended" }),
1192
+ /* @__PURE__ */ (0, import_jsx_runtime16.jsx)("p", { className: "cw-chat-ended-state__subtitle", children: "Your chat session has ended. Thank you for reaching out!" })
1193
+ ]
1194
+ }
1195
+ );
1196
+ };
1197
+ var ChatEndedState_default = ChatEndedState;
1198
+
1199
+ // src/components/SiteChatComponentNew/SiteChatComponentNew.css
1200
+ if (typeof document !== "undefined" && !document.getElementById("jrapps-style-871af89c")) {
1201
+ const s = document.createElement("style");
1202
+ s.id = "jrapps-style-871af89c";
1203
+ s.textContent = "/* \u2500\u2500\u2500 Root container \u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\n * Fixed to bottom-right by default so it works out-of-the-box.\n * Override with your own positioning class if embedding differently.\n * \u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500 */\n.cw-root {\n position: fixed;\n bottom: max(24px, env(safe-area-inset-bottom));\n right: max(24px, env(safe-area-inset-right));\n display: flex;\n flex-direction: column;\n align-items: flex-end;\n gap: 12px;\n z-index: 9999;\n /* Scope CSS vars and stacking context */\n isolation: isolate;\n font-family: var(--cw-font-family);\n font-size: var(--cw-font-size);\n}\n\n/* \u2500\u2500\u2500 Widget Panel \u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500 */\n\n.cw-widget {\n display: flex;\n flex-direction: column;\n width: var(--cw-width);\n height: var(--cw-height);\n /* Clamp so it never overflows the viewport on small screens */\n max-width: calc(100vw - 48px);\n max-height: calc(100dvh - 96px);\n background-color: var(--cw-background);\n border-radius: var(--cw-border-radius);\n box-shadow: var(--cw-shadow);\n overflow: hidden;\n /* Entry animation */\n animation: cw-panel-in 0.22s ease;\n transform-origin: bottom right;\n}\n\n@keyframes cw-panel-in {\n from {\n opacity: 0;\n transform: scale(0.92) translateY(10px);\n }\n to {\n opacity: 1;\n transform: scale(1) translateY(0);\n }\n}\n\n.cw-widget__body {\n display: flex;\n flex-direction: column;\n flex: 1;\n overflow: hidden;\n}\n\n/* \u2500\u2500\u2500 Launcher Button \u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500 */\n\n.cw-launcher {\n width: 56px;\n height: 56px;\n border-radius: 50%;\n border: none;\n background-color: var(--cw-primary);\n color: #ffffff;\n cursor: pointer;\n display: flex;\n align-items: center;\n justify-content: center;\n box-shadow: 0 4px 16px rgba(0, 0, 0, 0.2);\n flex-shrink: 0;\n transition: transform 0.15s ease, box-shadow 0.15s ease;\n}\n\n.cw-launcher:hover {\n transform: scale(1.07);\n box-shadow: 0 6px 20px rgba(0, 0, 0, 0.26);\n}\n\n.cw-launcher:focus-visible {\n outline: 3px solid var(--cw-primary);\n outline-offset: 3px;\n}\n\n.cw-launcher:active {\n transform: scale(0.96);\n}\n\n/* \u2500\u2500\u2500 Tablet (481px \u2013 768px): panel floats, slightly narrower margin \u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500 */\n\n@media (min-width: 481px) and (max-width: 768px) {\n .cw-root {\n bottom: max(16px, env(safe-area-inset-bottom));\n right: max(16px, env(safe-area-inset-right));\n }\n\n .cw-widget {\n max-width: calc(100vw - 32px);\n max-height: calc(100dvh - 80px);\n }\n}\n\n/* \u2500\u2500\u2500 Mobile (\u2264 480px): full-screen panel, launcher stays fixed \u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500 */\n\n@media (max-width: 480px) {\n .cw-root {\n bottom: 0;\n right: 0;\n gap: 0;\n }\n\n .cw-root > .cw-launcher {\n position: fixed;\n bottom: max(20px, env(safe-area-inset-bottom));\n right: max(20px, env(safe-area-inset-right));\n }\n\n .cw-widget {\n width: 100vw;\n max-width: 100vw;\n height: 100dvh;\n max-height: 100dvh;\n border-radius: 0;\n transform-origin: bottom center;\n }\n}\n";
1204
+ document.head.appendChild(s);
1205
+ }
1206
+
1207
+ // src/components/SiteChatComponentNew/SiteChatComponentNew.tsx
1208
+ var import_jsx_runtime17 = require("react/jsx-runtime");
1209
+ var SiteChatComponentNew = import_react5.default.forwardRef(({
1210
+ title,
1211
+ subtitle,
1212
+ image,
1213
+ theme,
1214
+ messages,
1215
+ offlineForm,
1216
+ defaultOpen = false,
1217
+ loading = false,
1218
+ chatEnded = false,
1219
+ width,
1220
+ height,
1221
+ onSend,
1222
+ onAttachment,
1223
+ onOfflineSubmit,
1224
+ onClose
1225
+ }, ref) => {
1226
+ const { open, openWidget, closeWidget } = useSiteChatComponentNew(defaultOpen);
1227
+ const themeVars = buildThemeVars(theme, width, height);
1228
+ const handleClose = () => {
1229
+ closeWidget();
1230
+ onClose == null ? void 0 : onClose();
1231
+ };
1232
+ const renderBody = () => {
1233
+ if (loading) {
1234
+ return /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(LoadingState_default, {});
1235
+ }
1236
+ if (offlineForm) {
1237
+ return /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(OfflineState_default, { form: offlineForm, onSubmit: onOfflineSubmit });
1238
+ }
1239
+ if (messages.length === 0) {
1240
+ return /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(
1241
+ StartChatState_default,
1242
+ {
1243
+ image,
1244
+ title,
1245
+ description: subtitle,
1246
+ onStart: () => onSend("__start_chat__")
1247
+ }
1248
+ );
1249
+ }
1250
+ return /* @__PURE__ */ (0, import_jsx_runtime17.jsxs)(import_jsx_runtime17.Fragment, { children: [
1251
+ /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(MessageList_default, { messages }),
1252
+ chatEnded ? /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(ChatEndedState_default, {}) : /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(Footer_default, { onSend, onAttachment })
1253
+ ] });
1254
+ };
1255
+ return /* @__PURE__ */ (0, import_jsx_runtime17.jsxs)("div", { ref, className: "cw-root", style: themeVars, children: [
1256
+ open && /* @__PURE__ */ (0, import_jsx_runtime17.jsxs)(
1257
+ "div",
1258
+ {
1259
+ className: "cw-widget",
1260
+ role: "dialog",
1261
+ "aria-modal": "true",
1262
+ "aria-label": `${title} chat widget`,
1263
+ children: [
1264
+ /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(
1265
+ Header_default,
1266
+ {
1267
+ image,
1268
+ title,
1269
+ subtitle,
1270
+ onClose: handleClose
1271
+ }
1272
+ ),
1273
+ /* @__PURE__ */ (0, import_jsx_runtime17.jsx)("div", { className: "cw-widget__body", children: renderBody() })
1274
+ ]
1275
+ }
1276
+ ),
1277
+ !open && /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(
1278
+ "button",
1279
+ {
1280
+ className: "cw-launcher",
1281
+ onClick: openWidget,
1282
+ "aria-label": "Open chat",
1283
+ "aria-haspopup": "dialog",
1284
+ type: "button",
1285
+ children: /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(
1286
+ "svg",
1287
+ {
1288
+ xmlns: "http://www.w3.org/2000/svg",
1289
+ width: "26",
1290
+ height: "26",
1291
+ viewBox: "0 0 24 24",
1292
+ fill: "currentColor",
1293
+ "aria-hidden": "true",
1294
+ children: /* @__PURE__ */ (0, import_jsx_runtime17.jsx)("path", { d: "M20 2H4c-1.1 0-2 .9-2 2v18l4-4h14c1.1 0 2-.9 2-2V4c0-1.1-.9-2-2-2z" })
1295
+ }
1296
+ )
1297
+ }
1298
+ )
1299
+ ] });
1300
+ });
1301
+ SiteChatComponentNew.displayName = "SiteChatComponentNew";
1302
+
1303
+ // src/components/SiteChatComponentNewErc/SiteChatComponentNewErc.tsx
1304
+ var import_react10 = __toESM(require("react"));
1305
+
1306
+ // src/components/SiteChatComponentNewErc/useSiteChatComponentNewErc.ts
1307
+ var import_react6 = require("react");
1308
+ function useSiteChatComponentNewErc(defaultOpen = false) {
1309
+ const [open, setOpen] = (0, import_react6.useState)(defaultOpen);
1310
+ const openWidget = (0, import_react6.useCallback)(() => setOpen(true), []);
1311
+ const closeWidget = (0, import_react6.useCallback)(() => setOpen(false), []);
1312
+ return { open, openWidget, closeWidget };
1313
+ }
1314
+
1315
+ // src/components/SiteChatComponentNewErc/utils/theme.ts
1316
+ var FONT_FAMILY2 = "-apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, sans-serif";
1317
+ var FONT_SIZE2 = "14px";
1318
+ var SHADOW2 = "0 4px 24px rgba(0,0,0,0.12)";
1319
+ var WIDTH2 = "400px";
1320
+ var HEIGHT2 = "600px";
1321
+ var HEADER_HEIGHT2 = "64px";
1322
+ var defaultTheme2 = {
1323
+ primary: "#4f46e5",
1324
+ background: "#ffffff",
1325
+ surface: "#f9fafb",
1326
+ border: "#e5e7eb",
1327
+ userBubble: "#4f46e5",
1328
+ userText: "#ffffff",
1329
+ agentBubble: "#f3f4f6",
1330
+ agentText: "#111827",
1331
+ systemText: "#6b7280",
1332
+ inputBackground: "#ffffff",
1333
+ inputBorder: "#d1d5db",
1334
+ buttonRadius: 8,
1335
+ borderRadius: 12
1336
+ };
1337
+ function buildThemeVars2(partial, width, height) {
1338
+ const theme = { ...defaultTheme2, ...partial };
1339
+ return {
1340
+ // Colours
1341
+ "--cw-primary": theme.primary,
1342
+ "--cw-background": theme.background,
1343
+ "--cw-surface": theme.surface,
1344
+ "--cw-border": theme.border,
1345
+ "--cw-user-bubble": theme.userBubble,
1346
+ "--cw-user-text": theme.userText,
1347
+ "--cw-agent-bubble": theme.agentBubble,
1348
+ "--cw-agent-text": theme.agentText,
1349
+ "--cw-system-text": theme.systemText,
1350
+ "--cw-input-background": theme.inputBackground,
1351
+ "--cw-input-border": theme.inputBorder,
1352
+ // Border radii
1353
+ "--cw-button-radius": `${theme.buttonRadius}px`,
1354
+ "--cw-border-radius": `${theme.borderRadius}px`,
1355
+ // Fixed constants — not exposed as theme props
1356
+ "--cw-font-family": FONT_FAMILY2,
1357
+ "--cw-font-size": FONT_SIZE2,
1358
+ "--cw-shadow": SHADOW2,
1359
+ "--cw-width": width !== void 0 ? typeof width === "number" ? `${width}px` : width : WIDTH2,
1360
+ "--cw-height": height !== void 0 ? typeof height === "number" ? `${height}px` : height : HEIGHT2,
1361
+ "--cw-header-height": HEADER_HEIGHT2
1362
+ };
1363
+ }
1364
+
1365
+ // src/components/SiteChatComponentNewErc/utils/systemMessages.ts
1366
+ var systemEventLabels2 = {
1367
+ AGENT_JOINED: "Agent joined",
1368
+ AGENT_LEFT: "Agent left",
1369
+ USER_JOINED: "You joined",
1370
+ USER_LEFT: "You left",
1371
+ CHAT_ENDED: "Chat ended",
1372
+ CHAT_REOPENED: "Chat reopened",
1373
+ CHAT_TRANSFERRED: "Chat transferred",
1374
+ WAITING_FOR_AGENT: "Waiting for an agent"
1375
+ };
1376
+ function getSystemLabel2(event) {
1377
+ var _a;
1378
+ return (_a = systemEventLabels2[event]) != null ? _a : event;
1379
+ }
1380
+
1381
+ // src/components/SiteChatComponentNewErc/utils/format.ts
1382
+ function formatTime2(timestamp) {
1383
+ return new Date(timestamp).toLocaleTimeString([], {
1384
+ hour: "2-digit",
1385
+ minute: "2-digit"
1386
+ });
1387
+ }
1388
+
1389
+ // src/components/SiteChatComponentNewErc/Header/Header.css
1390
+ if (typeof document !== "undefined" && !document.getElementById("jrapps-style-759620f0")) {
1089
1391
  const s = document.createElement("style");
1090
- s.id = "jrapps-style-45eba566";
1392
+ s.id = "jrapps-style-759620f0";
1091
1393
  s.textContent = ".cw-header {\n display: flex;\n align-items: center;\n justify-content: space-between;\n padding: 0 16px;\n height: var(--cw-header-height);\n background-color: var(--cw-primary);\n color: #ffffff;\n flex-shrink: 0;\n border-radius: var(--cw-border-radius) var(--cw-border-radius) 0 0;\n}\n\n.cw-header__identity {\n display: flex;\n align-items: center;\n gap: 12px;\n min-width: 0;\n}\n\n.cw-header__avatar {\n width: 40px;\n height: 40px;\n border-radius: 50%;\n object-fit: cover;\n flex-shrink: 0;\n border: 2px solid rgba(255, 255, 255, 0.4);\n}\n\n.cw-header__text {\n display: flex;\n flex-direction: column;\n min-width: 0;\n}\n\n.cw-header__title {\n font-size: 15px;\n font-weight: 600;\n white-space: nowrap;\n overflow: hidden;\n text-overflow: ellipsis;\n line-height: 1.3;\n}\n\n.cw-header__subtitle {\n font-size: 12px;\n opacity: 0.85;\n white-space: nowrap;\n overflow: hidden;\n text-overflow: ellipsis;\n line-height: 1.3;\n}\n\n.cw-header__close {\n background: none;\n border: none;\n cursor: pointer;\n color: #ffffff;\n display: flex;\n align-items: center;\n justify-content: center;\n padding: 6px;\n border-radius: 50%;\n flex-shrink: 0;\n transition: background-color 0.15s ease;\n}\n\n.cw-header__close:hover {\n background-color: rgba(255, 255, 255, 0.15);\n}\n\n.cw-header__close:focus-visible {\n outline: 2px solid #ffffff;\n outline-offset: 2px;\n}\n";
1092
1394
  document.head.appendChild(s);
1093
1395
  }
1094
1396
 
1095
- // src/components/SiteChatComponentNew/Header/Header.tsx
1096
- var import_jsx_runtime11 = require("react/jsx-runtime");
1097
- var Header2 = ({ image, title, subtitle, onClose }) => {
1098
- return /* @__PURE__ */ (0, import_jsx_runtime11.jsxs)("header", { className: "cw-header", role: "banner", children: [
1099
- /* @__PURE__ */ (0, import_jsx_runtime11.jsxs)("div", { className: "cw-header__identity", children: [
1100
- image && /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(
1397
+ // src/components/SiteChatComponentNewErc/Header/Header.tsx
1398
+ var import_jsx_runtime18 = require("react/jsx-runtime");
1399
+ var Header2 = ({ image, title, subtitle, onClose, ercClasses }) => {
1400
+ return /* @__PURE__ */ (0, import_jsx_runtime18.jsxs)("header", { className: ["cw-header", ercClasses == null ? void 0 : ercClasses.headerClassName].filter(Boolean).join(" "), role: "banner", children: [
1401
+ /* @__PURE__ */ (0, import_jsx_runtime18.jsxs)("div", { className: "cw-header__identity", children: [
1402
+ image && /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(
1101
1403
  "img",
1102
1404
  {
1103
1405
  src: image,
1104
1406
  alt: `${title} avatar`,
1105
- className: "cw-header__avatar"
1407
+ className: ["cw-header__avatar", ercClasses == null ? void 0 : ercClasses.imageClassName].filter(Boolean).join(" ")
1106
1408
  }
1107
1409
  ),
1108
- /* @__PURE__ */ (0, import_jsx_runtime11.jsxs)("div", { className: "cw-header__text", children: [
1109
- /* @__PURE__ */ (0, import_jsx_runtime11.jsx)("span", { className: "cw-header__title", children: title }),
1110
- subtitle && /* @__PURE__ */ (0, import_jsx_runtime11.jsx)("span", { className: "cw-header__subtitle", children: subtitle })
1410
+ /* @__PURE__ */ (0, import_jsx_runtime18.jsxs)("div", { className: "cw-header__text", children: [
1411
+ /* @__PURE__ */ (0, import_jsx_runtime18.jsx)("span", { className: ["cw-header__title", ercClasses == null ? void 0 : ercClasses.titleClassName].filter(Boolean).join(" "), children: title }),
1412
+ subtitle && /* @__PURE__ */ (0, import_jsx_runtime18.jsx)("span", { className: ["cw-header__subtitle", ercClasses == null ? void 0 : ercClasses.subtitleClassName].filter(Boolean).join(" "), children: subtitle })
1111
1413
  ] })
1112
1414
  ] }),
1113
- /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(
1415
+ /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(
1114
1416
  "button",
1115
1417
  {
1116
- className: "cw-header__close",
1418
+ className: ["cw-header__close", ercClasses == null ? void 0 : ercClasses.closeButtonClassName].filter(Boolean).join(" "),
1117
1419
  onClick: onClose,
1118
1420
  "aria-label": "Close chat",
1119
1421
  type: "button",
1120
- children: /* @__PURE__ */ (0, import_jsx_runtime11.jsxs)(
1422
+ children: /* @__PURE__ */ (0, import_jsx_runtime18.jsxs)(
1121
1423
  "svg",
1122
1424
  {
1123
1425
  xmlns: "http://www.w3.org/2000/svg",
@@ -1131,8 +1433,8 @@ var Header2 = ({ image, title, subtitle, onClose }) => {
1131
1433
  strokeLinejoin: "round",
1132
1434
  "aria-hidden": "true",
1133
1435
  children: [
1134
- /* @__PURE__ */ (0, import_jsx_runtime11.jsx)("line", { x1: "18", y1: "6", x2: "6", y2: "18" }),
1135
- /* @__PURE__ */ (0, import_jsx_runtime11.jsx)("line", { x1: "6", y1: "6", x2: "18", y2: "18" })
1436
+ /* @__PURE__ */ (0, import_jsx_runtime18.jsx)("line", { x1: "18", y1: "6", x2: "6", y2: "18" }),
1437
+ /* @__PURE__ */ (0, import_jsx_runtime18.jsx)("line", { x1: "6", y1: "6", x2: "18", y2: "18" })
1136
1438
  ]
1137
1439
  }
1138
1440
  )
@@ -1140,52 +1442,51 @@ var Header2 = ({ image, title, subtitle, onClose }) => {
1140
1442
  )
1141
1443
  ] });
1142
1444
  };
1143
- var Header_default = Header2;
1445
+ var Header_default2 = Header2;
1144
1446
 
1145
- // src/components/SiteChatComponentNew/Footer/Footer.tsx
1146
- var import_react9 = require("react");
1447
+ // src/components/SiteChatComponentNewErc/Footer/Footer.tsx
1448
+ var import_react7 = require("react");
1147
1449
 
1148
- // src/components/SiteChatComponentNew/Footer/Footer.css
1149
- if (typeof document !== "undefined" && !document.getElementById("jrapps-style-ebcf221d")) {
1450
+ // src/components/SiteChatComponentNewErc/Footer/Footer.css
1451
+ if (typeof document !== "undefined" && !document.getElementById("jrapps-style-c86a5c82")) {
1150
1452
  const s = document.createElement("style");
1151
- s.id = "jrapps-style-ebcf221d";
1152
- s.textContent = ".cw-footer {\n display: flex;\n align-items: flex-end;\n gap: 8px;\n padding: 10px 12px;\n background-color: var(--cw-background);\n border-top: 1px solid var(--cw-border);\n flex-shrink: 0;\n}\n\n.cw-footer__input {\n flex: 1;\n resize: none;\n border: 1px solid var(--cw-input-border);\n border-radius: var(--cw-button-radius);\n background-color: var(--cw-input-background);\n font-family: var(--cw-font-family);\n font-size: var(--cw-font-size);\n color: inherit;\n padding: 8px 12px;\n line-height: 1.5;\n min-height: 38px;\n max-height: 120px;\n overflow-y: auto;\n transition: border-color 0.15s ease;\n}\n\n.cw-footer__input:focus {\n outline: none;\n border-color: var(--cw-primary);\n box-shadow: 0 0 0 2px color-mix(in srgb, var(--cw-primary) 20%, transparent);\n}\n\n.cw-footer__input:disabled {\n opacity: 0.5;\n cursor: not-allowed;\n}\n\n.cw-footer__attach-btn,\n.cw-footer__send-btn {\n background: none;\n border: none;\n cursor: pointer;\n display: flex;\n align-items: center;\n justify-content: center;\n padding: 8px;\n border-radius: 50%;\n flex-shrink: 0;\n transition: background-color 0.15s ease, color 0.15s ease;\n color: var(--cw-primary);\n margin-bottom: 1px;\n}\n\n.cw-footer__attach-btn:hover,\n.cw-footer__send-btn:not(.cw-footer__send-btn--disabled):hover {\n background-color: color-mix(in srgb, var(--cw-primary) 10%, transparent);\n}\n\n.cw-footer__attach-btn:focus-visible,\n.cw-footer__send-btn:focus-visible {\n outline: 2px solid var(--cw-primary);\n outline-offset: 2px;\n}\n\n.cw-footer__attach-btn:disabled {\n opacity: 0.4;\n cursor: not-allowed;\n}\n\n.cw-footer__send-btn--disabled {\n opacity: 0.35;\n cursor: not-allowed;\n}\n\n.cw-footer__file-input {\n display: none;\n}\n";
1453
+ s.id = "jrapps-style-c86a5c82";
1454
+ s.textContent = ".cw-footer {\n display: flex;\n flex-direction: column;\n gap: 6px;\n padding: 10px 12px;\n background-color: var(--cw-background);\n border-top: 1px solid var(--cw-border);\n flex-shrink: 0;\n}\n\n.cw-footer__controls {\n display: flex;\n align-items: flex-end;\n gap: 8px;\n}\n\n/* \u2500\u2500\u2500 Staged file chips \u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500 */\n\n.cw-footer__file-list {\n list-style: none;\n margin: 0;\n padding: 0;\n display: flex;\n flex-wrap: wrap;\n gap: 6px;\n}\n\n.cw-footer__file-chip {\n display: flex;\n align-items: center;\n gap: 4px;\n background-color: color-mix(in srgb, var(--cw-primary) 12%, transparent);\n border: 1px solid color-mix(in srgb, var(--cw-primary) 30%, transparent);\n border-radius: 999px;\n padding: 3px 8px 3px 10px;\n font-size: 12px;\n color: var(--cw-primary);\n max-width: 200px;\n}\n\n.cw-footer__file-chip-name {\n overflow: hidden;\n text-overflow: ellipsis;\n white-space: nowrap;\n}\n\n.cw-footer__file-chip-remove {\n background: none;\n border: none;\n cursor: pointer;\n padding: 2px;\n display: flex;\n align-items: center;\n justify-content: center;\n color: inherit;\n border-radius: 50%;\n flex-shrink: 0;\n opacity: 0.7;\n transition: opacity 0.15s ease, background-color 0.15s ease;\n}\n\n.cw-footer__file-chip-remove:hover {\n opacity: 1;\n background-color: color-mix(in srgb, var(--cw-primary) 15%, transparent);\n}\n\n.cw-footer__file-chip-remove:focus-visible {\n outline: 2px solid var(--cw-primary);\n outline-offset: 1px;\n}\n\n.cw-footer__input {\n flex: 1;\n resize: none;\n border: 1px solid var(--cw-input-border);\n border-radius: var(--cw-button-radius);\n background-color: var(--cw-input-background);\n font-family: var(--cw-font-family);\n font-size: var(--cw-font-size);\n color: inherit;\n padding: 8px 12px;\n line-height: 1.5;\n min-height: 38px;\n max-height: 120px;\n overflow-y: auto;\n transition: border-color 0.15s ease;\n}\n\n.cw-footer__input:focus {\n outline: none;\n border-color: var(--cw-primary);\n box-shadow: 0 0 0 2px color-mix(in srgb, var(--cw-primary) 20%, transparent);\n}\n\n.cw-footer__input:disabled {\n opacity: 0.5;\n cursor: not-allowed;\n}\n\n.cw-footer__attach-btn,\n.cw-footer__send-btn {\n background: none;\n border: none;\n cursor: pointer;\n display: flex;\n align-items: center;\n justify-content: center;\n padding: 8px;\n border-radius: 50%;\n flex-shrink: 0;\n transition: background-color 0.15s ease, color 0.15s ease;\n color: var(--cw-primary);\n margin-bottom: 1px;\n}\n\n.cw-footer__attach-btn:hover,\n.cw-footer__send-btn:not(.cw-footer__send-btn--disabled):hover {\n background-color: color-mix(in srgb, var(--cw-primary) 10%, transparent);\n}\n\n.cw-footer__attach-btn:focus-visible,\n.cw-footer__send-btn:focus-visible {\n outline: 2px solid var(--cw-primary);\n outline-offset: 2px;\n}\n\n.cw-footer__attach-btn:disabled {\n opacity: 0.4;\n cursor: not-allowed;\n}\n\n.cw-footer__send-btn--disabled {\n opacity: 0.35;\n cursor: not-allowed;\n}\n\n.cw-footer__file-input {\n display: none;\n}\n";
1153
1455
  document.head.appendChild(s);
1154
1456
  }
1155
1457
 
1156
- // src/components/SiteChatComponentNew/Footer/Footer.tsx
1157
- var import_jsx_runtime12 = require("react/jsx-runtime");
1158
- var Footer2 = ({ onSend, onAttachment, disabled }) => {
1159
- const [text, setText] = (0, import_react9.useState)("");
1160
- const fileInputRef = (0, import_react9.useRef)(null);
1161
- const textareaRef = (0, import_react9.useRef)(null);
1162
- const isEmpty = text.trim().length === 0;
1163
- const handleKeyDown = (0, import_react9.useCallback)(
1164
- (e) => {
1165
- if (e.key === "Enter" && !e.shiftKey) {
1166
- e.preventDefault();
1167
- if (!isEmpty && !disabled) {
1168
- onSend(text.trim());
1169
- setText("");
1170
- if (textareaRef.current) {
1171
- textareaRef.current.style.height = "auto";
1172
- }
1173
- }
1174
- }
1175
- },
1176
- [isEmpty, disabled, onSend, text]
1177
- );
1178
- const handleSend = (0, import_react9.useCallback)(() => {
1458
+ // src/components/SiteChatComponentNewErc/Footer/Footer.tsx
1459
+ var import_jsx_runtime19 = require("react/jsx-runtime");
1460
+ var Footer2 = ({ onSend, onAttachment, disabled, ercClasses }) => {
1461
+ const [text, setText] = (0, import_react7.useState)("");
1462
+ const [stagedFiles, setStagedFiles] = (0, import_react7.useState)([]);
1463
+ const fileInputRef = (0, import_react7.useRef)(null);
1464
+ const textareaRef = (0, import_react7.useRef)(null);
1465
+ const isEmpty = text.trim().length === 0 && stagedFiles.length === 0;
1466
+ const handleSend = (0, import_react7.useCallback)(() => {
1179
1467
  if (!isEmpty && !disabled) {
1180
- onSend(text.trim());
1181
- setText("");
1468
+ if (text.trim().length > 0) {
1469
+ onSend(text.trim());
1470
+ setText("");
1471
+ }
1472
+ stagedFiles.forEach((file) => onAttachment(file));
1473
+ setStagedFiles([]);
1182
1474
  if (textareaRef.current) {
1183
1475
  textareaRef.current.style.height = "auto";
1184
1476
  textareaRef.current.focus();
1185
1477
  }
1186
1478
  }
1187
- }, [isEmpty, disabled, onSend, text]);
1188
- const handleChange = (0, import_react9.useCallback)(
1479
+ }, [isEmpty, disabled, onSend, text, stagedFiles, onAttachment]);
1480
+ const handleKeyDown = (0, import_react7.useCallback)(
1481
+ (e) => {
1482
+ if (e.key === "Enter" && !e.shiftKey) {
1483
+ e.preventDefault();
1484
+ handleSend();
1485
+ }
1486
+ },
1487
+ [handleSend]
1488
+ );
1489
+ const handleChange = (0, import_react7.useCallback)(
1189
1490
  (e) => {
1190
1491
  setText(e.target.value);
1191
1492
  const el = e.target;
@@ -1194,107 +1495,130 @@ var Footer2 = ({ onSend, onAttachment, disabled }) => {
1194
1495
  },
1195
1496
  []
1196
1497
  );
1197
- const handleAttachmentClick = (0, import_react9.useCallback)(() => {
1498
+ const handleAttachmentClick = (0, import_react7.useCallback)(() => {
1198
1499
  var _a;
1199
1500
  (_a = fileInputRef.current) == null ? void 0 : _a.click();
1200
1501
  }, []);
1201
- const handleFileChange = (0, import_react9.useCallback)(
1502
+ const handleFileChange = (0, import_react7.useCallback)(
1202
1503
  (e) => {
1203
1504
  var _a;
1204
- const file = (_a = e.target.files) == null ? void 0 : _a[0];
1205
- if (file) {
1206
- onAttachment(file);
1505
+ const files = Array.from((_a = e.target.files) != null ? _a : []);
1506
+ if (files.length > 0) {
1507
+ setStagedFiles((prev) => [...prev, ...files]);
1207
1508
  }
1208
1509
  if (fileInputRef.current) {
1209
1510
  fileInputRef.current.value = "";
1210
1511
  }
1211
1512
  },
1212
- [onAttachment]
1513
+ []
1213
1514
  );
1214
- return /* @__PURE__ */ (0, import_jsx_runtime12.jsxs)("footer", { className: "cw-footer", role: "contentinfo", children: [
1215
- /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(
1216
- "button",
1217
- {
1218
- className: "cw-footer__attach-btn",
1219
- onClick: handleAttachmentClick,
1220
- "aria-label": "Attach file",
1221
- type: "button",
1222
- disabled,
1223
- children: /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(
1224
- "svg",
1225
- {
1226
- xmlns: "http://www.w3.org/2000/svg",
1227
- width: "20",
1228
- height: "20",
1229
- viewBox: "0 0 24 24",
1230
- fill: "none",
1231
- stroke: "currentColor",
1232
- strokeWidth: "2",
1233
- strokeLinecap: "round",
1234
- strokeLinejoin: "round",
1235
- "aria-hidden": "true",
1236
- children: /* @__PURE__ */ (0, import_jsx_runtime12.jsx)("path", { d: "M21.44 11.05l-9.19 9.19a6 6 0 0 1-8.49-8.49l9.19-9.19a4 4 0 0 1 5.66 5.66l-9.2 9.19a2 2 0 0 1-2.83-2.83l8.49-8.48" })
1237
- }
1238
- )
1239
- }
1240
- ),
1241
- /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(
1242
- "textarea",
1243
- {
1244
- ref: textareaRef,
1245
- className: "cw-footer__input",
1246
- value: text,
1247
- onChange: handleChange,
1248
- onKeyDown: handleKeyDown,
1249
- placeholder: "Type a message\u2026",
1250
- "aria-label": "Message input",
1251
- rows: 1,
1252
- disabled
1253
- }
1254
- ),
1255
- /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(
1256
- "button",
1257
- {
1258
- className: `cw-footer__send-btn${isEmpty || disabled ? " cw-footer__send-btn--disabled" : ""}`,
1259
- onClick: handleSend,
1260
- "aria-label": "Send message",
1261
- type: "button",
1262
- disabled: isEmpty || disabled,
1263
- children: /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(
1264
- "svg",
1265
- {
1266
- xmlns: "http://www.w3.org/2000/svg",
1267
- width: "20",
1268
- height: "20",
1269
- viewBox: "0 0 24 24",
1270
- fill: "currentColor",
1271
- "aria-hidden": "true",
1272
- children: /* @__PURE__ */ (0, import_jsx_runtime12.jsx)("path", { d: "M2.01 21L23 12 2.01 3 2 10l15 2-15 2z" })
1273
- }
1274
- )
1275
- }
1276
- ),
1277
- /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(
1278
- "input",
1279
- {
1280
- ref: fileInputRef,
1281
- type: "file",
1282
- className: "cw-footer__file-input",
1283
- onChange: handleFileChange,
1284
- "aria-hidden": "true",
1285
- tabIndex: -1
1286
- }
1287
- )
1515
+ const handleRemoveStagedFile = (0, import_react7.useCallback)((index) => {
1516
+ setStagedFiles((prev) => prev.filter((_, i) => i !== index));
1517
+ }, []);
1518
+ return /* @__PURE__ */ (0, import_jsx_runtime19.jsxs)("footer", { className: ["cw-footer", ercClasses == null ? void 0 : ercClasses.footerClassName].filter(Boolean).join(" "), role: "contentinfo", children: [
1519
+ stagedFiles.length > 0 && /* @__PURE__ */ (0, import_jsx_runtime19.jsx)("ul", { className: "cw-footer__file-list", "aria-label": "Files to send", children: stagedFiles.map((file, i) => /* @__PURE__ */ (0, import_jsx_runtime19.jsxs)("li", { className: "cw-footer__file-chip", children: [
1520
+ /* @__PURE__ */ (0, import_jsx_runtime19.jsx)("span", { className: "cw-footer__file-chip-name", title: file.name, children: file.name }),
1521
+ /* @__PURE__ */ (0, import_jsx_runtime19.jsx)(
1522
+ "button",
1523
+ {
1524
+ className: "cw-footer__file-chip-remove",
1525
+ onClick: () => handleRemoveStagedFile(i),
1526
+ "aria-label": `Remove ${file.name}`,
1527
+ type: "button",
1528
+ children: /* @__PURE__ */ (0, import_jsx_runtime19.jsx)("svg", { xmlns: "http://www.w3.org/2000/svg", width: "12", height: "12", viewBox: "0 0 24 24", fill: "currentColor", "aria-hidden": "true", children: /* @__PURE__ */ (0, import_jsx_runtime19.jsx)("path", { d: "M19 6.41L17.59 5 12 10.59 6.41 5 5 6.41 10.59 12 5 17.59 6.41 19 12 13.41 17.59 19 19 17.59 13.41 12z" }) })
1529
+ }
1530
+ )
1531
+ ] }, `${file.name}-${i}`)) }),
1532
+ /* @__PURE__ */ (0, import_jsx_runtime19.jsxs)("div", { className: "cw-footer__controls", children: [
1533
+ /* @__PURE__ */ (0, import_jsx_runtime19.jsx)(
1534
+ "button",
1535
+ {
1536
+ className: ["cw-footer__attach-btn", ercClasses == null ? void 0 : ercClasses.attachmentButtonClassName].filter(Boolean).join(" "),
1537
+ onClick: handleAttachmentClick,
1538
+ "aria-label": "Attach file",
1539
+ type: "button",
1540
+ disabled,
1541
+ children: /* @__PURE__ */ (0, import_jsx_runtime19.jsx)(
1542
+ "svg",
1543
+ {
1544
+ xmlns: "http://www.w3.org/2000/svg",
1545
+ width: "20",
1546
+ height: "20",
1547
+ viewBox: "0 0 24 24",
1548
+ fill: "none",
1549
+ stroke: "currentColor",
1550
+ strokeWidth: "2",
1551
+ strokeLinecap: "round",
1552
+ strokeLinejoin: "round",
1553
+ "aria-hidden": "true",
1554
+ children: /* @__PURE__ */ (0, import_jsx_runtime19.jsx)("path", { d: "M21.44 11.05l-9.19 9.19a6 6 0 0 1-8.49-8.49l9.19-9.19a4 4 0 0 1 5.66 5.66l-9.2 9.19a2 2 0 0 1-2.83-2.83l8.49-8.48" })
1555
+ }
1556
+ )
1557
+ }
1558
+ ),
1559
+ /* @__PURE__ */ (0, import_jsx_runtime19.jsx)(
1560
+ "textarea",
1561
+ {
1562
+ ref: textareaRef,
1563
+ className: ["cw-footer__input", ercClasses == null ? void 0 : ercClasses.inputClassName].filter(Boolean).join(" "),
1564
+ value: text,
1565
+ onChange: handleChange,
1566
+ onKeyDown: handleKeyDown,
1567
+ placeholder: "Type a message\u2026",
1568
+ "aria-label": "Message input",
1569
+ rows: 1,
1570
+ disabled
1571
+ }
1572
+ ),
1573
+ /* @__PURE__ */ (0, import_jsx_runtime19.jsx)(
1574
+ "button",
1575
+ {
1576
+ className: [
1577
+ "cw-footer__send-btn",
1578
+ isEmpty || disabled ? "cw-footer__send-btn--disabled" : "",
1579
+ ercClasses == null ? void 0 : ercClasses.sendButtonClassName
1580
+ ].filter(Boolean).join(" "),
1581
+ onClick: handleSend,
1582
+ "aria-label": "Send message",
1583
+ type: "button",
1584
+ disabled: isEmpty || disabled,
1585
+ children: /* @__PURE__ */ (0, import_jsx_runtime19.jsx)(
1586
+ "svg",
1587
+ {
1588
+ xmlns: "http://www.w3.org/2000/svg",
1589
+ width: "20",
1590
+ height: "20",
1591
+ viewBox: "0 0 24 24",
1592
+ fill: "currentColor",
1593
+ "aria-hidden": "true",
1594
+ children: /* @__PURE__ */ (0, import_jsx_runtime19.jsx)("path", { d: "M2.01 21L23 12 2.01 3 2 10l15 2-15 2z" })
1595
+ }
1596
+ )
1597
+ }
1598
+ ),
1599
+ /* @__PURE__ */ (0, import_jsx_runtime19.jsx)(
1600
+ "input",
1601
+ {
1602
+ ref: fileInputRef,
1603
+ type: "file",
1604
+ className: "cw-footer__file-input",
1605
+ onChange: handleFileChange,
1606
+ "aria-hidden": "true",
1607
+ tabIndex: -1,
1608
+ multiple: true
1609
+ }
1610
+ )
1611
+ ] })
1288
1612
  ] });
1289
1613
  };
1290
- var Footer_default = Footer2;
1614
+ var Footer_default2 = Footer2;
1291
1615
 
1292
- // src/components/SiteChatComponentNew/hooks/useAutoScroll.ts
1293
- var import_react10 = require("react");
1294
- function useAutoScroll(dependency) {
1295
- const ref = (0, import_react10.useRef)(null);
1296
- const userScrolledUp = (0, import_react10.useRef)(false);
1297
- (0, import_react10.useEffect)(() => {
1616
+ // src/components/SiteChatComponentNewErc/hooks/useAutoScroll.ts
1617
+ var import_react8 = require("react");
1618
+ function useAutoScroll2(dependency) {
1619
+ const ref = (0, import_react8.useRef)(null);
1620
+ const userScrolledUp = (0, import_react8.useRef)(false);
1621
+ (0, import_react8.useEffect)(() => {
1298
1622
  const el = ref.current;
1299
1623
  if (!el) return;
1300
1624
  const handleScroll = () => {
@@ -1304,7 +1628,7 @@ function useAutoScroll(dependency) {
1304
1628
  el.addEventListener("scroll", handleScroll, { passive: true });
1305
1629
  return () => el.removeEventListener("scroll", handleScroll);
1306
1630
  }, []);
1307
- (0, import_react10.useEffect)(() => {
1631
+ (0, import_react8.useEffect)(() => {
1308
1632
  const el = ref.current;
1309
1633
  if (!el || userScrolledUp.current) return;
1310
1634
  el.scrollTo({ top: el.scrollHeight, behavior: "smooth" });
@@ -1312,9 +1636,9 @@ function useAutoScroll(dependency) {
1312
1636
  return ref;
1313
1637
  }
1314
1638
 
1315
- // src/components/SiteChatComponentNew/hooks/useOfflineForm.ts
1316
- var import_react11 = require("react");
1317
- function validateField(field, value) {
1639
+ // src/components/SiteChatComponentNewErc/hooks/useOfflineForm.ts
1640
+ var import_react9 = require("react");
1641
+ function validateField2(field, value) {
1318
1642
  if (field.required) {
1319
1643
  if (field.type === "checkbox" && !value) {
1320
1644
  return `${field.label} is required.`;
@@ -1337,39 +1661,39 @@ function validateField(field, value) {
1337
1661
  }
1338
1662
  return "";
1339
1663
  }
1340
- function useOfflineForm(schema) {
1664
+ function useOfflineForm2(schema) {
1341
1665
  const initialValues = {};
1342
1666
  for (const field of schema.fields) {
1343
1667
  initialValues[field.id] = field.type === "checkbox" ? false : "";
1344
1668
  }
1345
- const [values, setValues] = (0, import_react11.useState)(initialValues);
1346
- const [errors, setErrors] = (0, import_react11.useState)({});
1347
- const [submitted, setSubmitted] = (0, import_react11.useState)(false);
1348
- const setValue = (0, import_react11.useCallback)(
1669
+ const [values, setValues] = (0, import_react9.useState)(initialValues);
1670
+ const [errors, setErrors] = (0, import_react9.useState)({});
1671
+ const [submitted, setSubmitted] = (0, import_react9.useState)(false);
1672
+ const setValue = (0, import_react9.useCallback)(
1349
1673
  (id, value) => {
1350
1674
  setValues((prev) => ({ ...prev, [id]: value }));
1351
1675
  if (submitted) {
1352
1676
  const field = schema.fields.find((f) => f.id === id);
1353
1677
  if (field) {
1354
- const error = validateField(field, value);
1678
+ const error = validateField2(field, value);
1355
1679
  setErrors((prev) => ({ ...prev, [id]: error }));
1356
1680
  }
1357
1681
  }
1358
1682
  },
1359
1683
  [schema.fields, submitted]
1360
1684
  );
1361
- const validate = (0, import_react11.useCallback)(() => {
1685
+ const validate = (0, import_react9.useCallback)(() => {
1362
1686
  const newErrors = {};
1363
1687
  let valid = true;
1364
1688
  for (const field of schema.fields) {
1365
- const error = validateField(field, values[field.id]);
1689
+ const error = validateField2(field, values[field.id]);
1366
1690
  newErrors[field.id] = error;
1367
1691
  if (error) valid = false;
1368
1692
  }
1369
1693
  setErrors(newErrors);
1370
1694
  return valid;
1371
1695
  }, [schema.fields, values]);
1372
- const handleSubmit = (0, import_react11.useCallback)(
1696
+ const handleSubmit = (0, import_react9.useCallback)(
1373
1697
  (onSubmit) => {
1374
1698
  setSubmitted(true);
1375
1699
  if (validate()) {
@@ -1378,7 +1702,7 @@ function useOfflineForm(schema) {
1378
1702
  },
1379
1703
  [validate, values]
1380
1704
  );
1381
- const reset = (0, import_react11.useCallback)(() => {
1705
+ const reset = (0, import_react9.useCallback)(() => {
1382
1706
  setValues(initialValues);
1383
1707
  setErrors({});
1384
1708
  setSubmitted(false);
@@ -1386,35 +1710,35 @@ function useOfflineForm(schema) {
1386
1710
  return { values, errors, setValue, handleSubmit, reset };
1387
1711
  }
1388
1712
 
1389
- // src/components/SiteChatComponentNew/Messages/UserMessage.css
1390
- if (typeof document !== "undefined" && !document.getElementById("jrapps-style-aed321e0")) {
1713
+ // src/components/SiteChatComponentNewErc/Messages/UserMessage.css
1714
+ if (typeof document !== "undefined" && !document.getElementById("jrapps-style-488069e4")) {
1391
1715
  const s = document.createElement("style");
1392
- s.id = "jrapps-style-aed321e0";
1716
+ s.id = "jrapps-style-488069e4";
1393
1717
  s.textContent = ".cw-user-message {\n display: flex;\n flex-direction: column;\n align-items: flex-end;\n max-width: 75%;\n align-self: flex-end;\n gap: 3px;\n}\n\n.cw-user-message__bubble {\n background-color: var(--cw-user-bubble);\n color: var(--cw-user-text);\n padding: 10px 14px;\n border-radius: 18px 18px 4px 18px;\n font-size: var(--cw-font-size);\n line-height: 1.5;\n word-break: break-word;\n white-space: pre-wrap;\n}\n\n.cw-user-message__time {\n font-size: 11px;\n color: var(--cw-system-text);\n padding-right: 2px;\n}\n";
1394
1718
  document.head.appendChild(s);
1395
1719
  }
1396
1720
 
1397
- // src/components/SiteChatComponentNew/Messages/UserMessage.tsx
1398
- var import_jsx_runtime13 = require("react/jsx-runtime");
1399
- var UserMessage = ({ message }) => {
1400
- return /* @__PURE__ */ (0, import_jsx_runtime13.jsxs)("div", { className: "cw-user-message", role: "listitem", "aria-label": "Your message", children: [
1401
- /* @__PURE__ */ (0, import_jsx_runtime13.jsx)("div", { className: "cw-user-message__bubble", children: message.message }),
1402
- message.timestamp !== void 0 && /* @__PURE__ */ (0, import_jsx_runtime13.jsx)("span", { className: "cw-user-message__time", children: formatTime(message.timestamp) })
1721
+ // src/components/SiteChatComponentNewErc/Messages/UserMessage.tsx
1722
+ var import_jsx_runtime20 = require("react/jsx-runtime");
1723
+ var UserMessage2 = ({ message, ercClassName }) => {
1724
+ return /* @__PURE__ */ (0, import_jsx_runtime20.jsxs)("div", { className: ["cw-user-message", ercClassName].filter(Boolean).join(" "), role: "listitem", "aria-label": "Your message", children: [
1725
+ /* @__PURE__ */ (0, import_jsx_runtime20.jsx)("div", { className: "cw-user-message__bubble", children: message.message }),
1726
+ message.timestamp !== void 0 && /* @__PURE__ */ (0, import_jsx_runtime20.jsx)("span", { className: "cw-user-message__time", children: formatTime2(message.timestamp) })
1403
1727
  ] });
1404
1728
  };
1405
- var UserMessage_default = UserMessage;
1729
+ var UserMessage_default2 = UserMessage2;
1406
1730
 
1407
- // src/components/SiteChatComponentNew/Shared/Avatar.css
1408
- if (typeof document !== "undefined" && !document.getElementById("jrapps-style-ce14fbec")) {
1731
+ // src/components/SiteChatComponentNewErc/Shared/Avatar.css
1732
+ if (typeof document !== "undefined" && !document.getElementById("jrapps-style-ad01373e")) {
1409
1733
  const s = document.createElement("style");
1410
- s.id = "jrapps-style-ce14fbec";
1734
+ s.id = "jrapps-style-ad01373e";
1411
1735
  s.textContent = ".cw-avatar {\n border-radius: 50%;\n flex-shrink: 0;\n display: inline-flex;\n align-items: center;\n justify-content: center;\n}\n\n.cw-avatar--image {\n object-fit: cover;\n}\n\n.cw-avatar--initials {\n background-color: var(--cw-primary);\n color: #ffffff;\n font-weight: 600;\n user-select: none;\n}\n";
1412
1736
  document.head.appendChild(s);
1413
1737
  }
1414
1738
 
1415
- // src/components/SiteChatComponentNew/Shared/Avatar.tsx
1416
- var import_jsx_runtime14 = require("react/jsx-runtime");
1417
- function getInitials(name) {
1739
+ // src/components/SiteChatComponentNewErc/Shared/Avatar.tsx
1740
+ var import_jsx_runtime21 = require("react/jsx-runtime");
1741
+ function getInitials2(name) {
1418
1742
  return name.split(" ").slice(0, 2).map((w) => w[0]).join("").toUpperCase();
1419
1743
  }
1420
1744
  var Avatar2 = ({ src, name, size = 32 }) => {
@@ -1424,7 +1748,7 @@ var Avatar2 = ({ src, name, size = 32 }) => {
1424
1748
  fontSize: `${Math.round(size * 0.38)}px`
1425
1749
  };
1426
1750
  if (src) {
1427
- return /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(
1751
+ return /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(
1428
1752
  "img",
1429
1753
  {
1430
1754
  src,
@@ -1434,29 +1758,29 @@ var Avatar2 = ({ src, name, size = 32 }) => {
1434
1758
  }
1435
1759
  );
1436
1760
  }
1437
- return /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(
1761
+ return /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(
1438
1762
  "span",
1439
1763
  {
1440
1764
  className: "cw-avatar cw-avatar--initials",
1441
1765
  "aria-label": name ? `${name} avatar` : "Agent avatar",
1442
1766
  style,
1443
- children: name ? getInitials(name) : "A"
1767
+ children: name ? getInitials2(name) : "A"
1444
1768
  }
1445
1769
  );
1446
1770
  };
1447
- var Avatar_default = Avatar2;
1771
+ var Avatar_default2 = Avatar2;
1448
1772
 
1449
- // src/components/SiteChatComponentNew/Shared/Button.css
1450
- if (typeof document !== "undefined" && !document.getElementById("jrapps-style-2aa106ea")) {
1773
+ // src/components/SiteChatComponentNewErc/Shared/Button.css
1774
+ if (typeof document !== "undefined" && !document.getElementById("jrapps-style-0aa71f6d")) {
1451
1775
  const s = document.createElement("style");
1452
- s.id = "jrapps-style-2aa106ea";
1776
+ s.id = "jrapps-style-0aa71f6d";
1453
1777
  s.textContent = ".cw-button {\n display: inline-flex;\n align-items: center;\n justify-content: center;\n gap: 8px;\n padding: 10px 20px;\n border: none;\n border-radius: var(--cw-button-radius);\n font-family: var(--cw-font-family);\n font-size: var(--cw-font-size);\n font-weight: 600;\n cursor: pointer;\n transition: opacity 0.15s ease, transform 0.1s ease;\n white-space: nowrap;\n}\n\n.cw-button:focus-visible {\n outline: 2px solid var(--cw-primary);\n outline-offset: 3px;\n}\n\n.cw-button:active:not(:disabled) {\n transform: scale(0.98);\n}\n\n.cw-button:disabled {\n opacity: 0.45;\n cursor: not-allowed;\n}\n\n.cw-button--primary {\n background-color: var(--cw-primary);\n color: #ffffff;\n}\n\n.cw-button--primary:hover:not(:disabled) {\n opacity: 0.88;\n}\n\n.cw-button--secondary {\n background-color: var(--cw-surface);\n color: var(--cw-primary);\n border: 1px solid var(--cw-border);\n}\n\n.cw-button--secondary:hover:not(:disabled) {\n background-color: var(--cw-border);\n}\n\n.cw-button--full {\n width: 100%;\n}\n";
1454
1778
  document.head.appendChild(s);
1455
1779
  }
1456
1780
 
1457
- // src/components/SiteChatComponentNew/Shared/Button.tsx
1458
- var import_jsx_runtime15 = require("react/jsx-runtime");
1459
- var Button = ({
1781
+ // src/components/SiteChatComponentNewErc/Shared/Button.tsx
1782
+ var import_jsx_runtime22 = require("react/jsx-runtime");
1783
+ var Button2 = ({
1460
1784
  children,
1461
1785
  onClick,
1462
1786
  variant = "primary",
@@ -1465,7 +1789,7 @@ var Button = ({
1465
1789
  fullWidth = false,
1466
1790
  ariaLabel
1467
1791
  }) => {
1468
- return /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(
1792
+ return /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(
1469
1793
  "button",
1470
1794
  {
1471
1795
  className: `cw-button cw-button--${variant}${fullWidth ? " cw-button--full" : ""}`,
@@ -1477,94 +1801,94 @@ var Button = ({
1477
1801
  }
1478
1802
  );
1479
1803
  };
1480
- var Button_default = Button;
1804
+ var Button_default2 = Button2;
1481
1805
 
1482
- // src/components/SiteChatComponentNew/Messages/AgentMessage.css
1483
- if (typeof document !== "undefined" && !document.getElementById("jrapps-style-5df522b1")) {
1806
+ // src/components/SiteChatComponentNewErc/Messages/AgentMessage.css
1807
+ if (typeof document !== "undefined" && !document.getElementById("jrapps-style-f5aad44b")) {
1484
1808
  const s = document.createElement("style");
1485
- s.id = "jrapps-style-5df522b1";
1809
+ s.id = "jrapps-style-f5aad44b";
1486
1810
  s.textContent = ".cw-agent-message {\n display: flex;\n align-items: flex-end;\n gap: 8px;\n max-width: 75%;\n align-self: flex-start;\n}\n\n.cw-agent-message__content {\n display: flex;\n flex-direction: column;\n gap: 3px;\n}\n\n.cw-agent-message__name {\n font-size: 11px;\n font-weight: 600;\n color: var(--cw-system-text);\n padding-left: 2px;\n}\n\n.cw-agent-message__bubble {\n background-color: var(--cw-agent-bubble);\n color: var(--cw-agent-text);\n padding: 10px 14px;\n border-radius: 18px 18px 18px 4px;\n font-size: var(--cw-font-size);\n line-height: 1.5;\n word-break: break-word;\n white-space: pre-wrap;\n}\n\n.cw-agent-message__time {\n font-size: 11px;\n color: var(--cw-system-text);\n padding-left: 2px;\n}\n";
1487
1811
  document.head.appendChild(s);
1488
1812
  }
1489
1813
 
1490
- // src/components/SiteChatComponentNew/Messages/AgentMessage.tsx
1491
- var import_jsx_runtime16 = require("react/jsx-runtime");
1492
- var AgentMessage = ({ message }) => {
1814
+ // src/components/SiteChatComponentNewErc/Messages/AgentMessage.tsx
1815
+ var import_jsx_runtime23 = require("react/jsx-runtime");
1816
+ var AgentMessage2 = ({ message, ercClassName }) => {
1493
1817
  var _a;
1494
- return /* @__PURE__ */ (0, import_jsx_runtime16.jsxs)(
1818
+ return /* @__PURE__ */ (0, import_jsx_runtime23.jsxs)(
1495
1819
  "div",
1496
1820
  {
1497
- className: "cw-agent-message",
1821
+ className: ["cw-agent-message", ercClassName].filter(Boolean).join(" "),
1498
1822
  role: "listitem",
1499
1823
  "aria-label": `Message from ${(_a = message.senderName) != null ? _a : "Agent"}`,
1500
1824
  children: [
1501
- /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(Avatar_default, { name: message.senderName, size: 32 }),
1502
- /* @__PURE__ */ (0, import_jsx_runtime16.jsxs)("div", { className: "cw-agent-message__content", children: [
1503
- message.senderName && /* @__PURE__ */ (0, import_jsx_runtime16.jsx)("span", { className: "cw-agent-message__name", children: message.senderName }),
1504
- /* @__PURE__ */ (0, import_jsx_runtime16.jsx)("div", { className: "cw-agent-message__bubble", children: message.message }),
1505
- message.timestamp !== void 0 && /* @__PURE__ */ (0, import_jsx_runtime16.jsx)("span", { className: "cw-agent-message__time", children: formatTime(message.timestamp) })
1825
+ /* @__PURE__ */ (0, import_jsx_runtime23.jsx)(Avatar_default2, { name: message.senderName, size: 32 }),
1826
+ /* @__PURE__ */ (0, import_jsx_runtime23.jsxs)("div", { className: "cw-agent-message__content", children: [
1827
+ message.senderName && /* @__PURE__ */ (0, import_jsx_runtime23.jsx)("span", { className: "cw-agent-message__name", children: message.senderName }),
1828
+ /* @__PURE__ */ (0, import_jsx_runtime23.jsx)("div", { className: "cw-agent-message__bubble", children: message.message }),
1829
+ message.timestamp !== void 0 && /* @__PURE__ */ (0, import_jsx_runtime23.jsx)("span", { className: "cw-agent-message__time", children: formatTime2(message.timestamp) })
1506
1830
  ] })
1507
1831
  ]
1508
1832
  }
1509
1833
  );
1510
1834
  };
1511
- var AgentMessage_default = AgentMessage;
1835
+ var AgentMessage_default2 = AgentMessage2;
1512
1836
 
1513
- // src/components/SiteChatComponentNew/Messages/SystemMessage.css
1514
- if (typeof document !== "undefined" && !document.getElementById("jrapps-style-464a3601")) {
1837
+ // src/components/SiteChatComponentNewErc/Messages/SystemMessage.css
1838
+ if (typeof document !== "undefined" && !document.getElementById("jrapps-style-631d733c")) {
1515
1839
  const s = document.createElement("style");
1516
- s.id = "jrapps-style-464a3601";
1840
+ s.id = "jrapps-style-631d733c";
1517
1841
  s.textContent = ".cw-system-message {\n display: flex;\n align-items: center;\n gap: 10px;\n align-self: stretch;\n padding: 4px 8px;\n}\n\n.cw-system-message__line {\n flex: 1;\n border-top: 1px dashed var(--cw-border);\n}\n\n.cw-system-message__text {\n font-size: 11px;\n color: var(--cw-system-text);\n white-space: nowrap;\n flex-shrink: 0;\n font-style: italic;\n}\n";
1518
1842
  document.head.appendChild(s);
1519
1843
  }
1520
1844
 
1521
- // src/components/SiteChatComponentNew/Messages/SystemMessage.tsx
1522
- var import_jsx_runtime17 = require("react/jsx-runtime");
1523
- var SystemMessage = ({ message }) => {
1845
+ // src/components/SiteChatComponentNewErc/Messages/SystemMessage.tsx
1846
+ var import_jsx_runtime24 = require("react/jsx-runtime");
1847
+ var SystemMessage2 = ({ message, ercClassName }) => {
1524
1848
  var _a;
1525
- const label = message.message ? getSystemLabel(message.message) : (_a = message.message) != null ? _a : "";
1526
- return /* @__PURE__ */ (0, import_jsx_runtime17.jsxs)(
1849
+ const label = message.message ? getSystemLabel2(message.message) : (_a = message.message) != null ? _a : "";
1850
+ return /* @__PURE__ */ (0, import_jsx_runtime24.jsxs)(
1527
1851
  "div",
1528
1852
  {
1529
- className: "cw-system-message",
1853
+ className: ["cw-system-message", ercClassName].filter(Boolean).join(" "),
1530
1854
  role: "listitem",
1531
1855
  "aria-label": `System notification: ${label}`,
1532
1856
  children: [
1533
- /* @__PURE__ */ (0, import_jsx_runtime17.jsx)("span", { className: "cw-system-message__line", "aria-hidden": "true" }),
1534
- /* @__PURE__ */ (0, import_jsx_runtime17.jsx)("span", { className: "cw-system-message__text", children: label }),
1535
- /* @__PURE__ */ (0, import_jsx_runtime17.jsx)("span", { className: "cw-system-message__line", "aria-hidden": "true" })
1857
+ /* @__PURE__ */ (0, import_jsx_runtime24.jsx)("span", { className: "cw-system-message__line", "aria-hidden": "true" }),
1858
+ /* @__PURE__ */ (0, import_jsx_runtime24.jsx)("span", { className: "cw-system-message__text", children: label }),
1859
+ /* @__PURE__ */ (0, import_jsx_runtime24.jsx)("span", { className: "cw-system-message__line", "aria-hidden": "true" })
1536
1860
  ]
1537
1861
  }
1538
1862
  );
1539
1863
  };
1540
- var SystemMessage_default = SystemMessage;
1864
+ var SystemMessage_default2 = SystemMessage2;
1541
1865
 
1542
- // src/components/SiteChatComponentNew/Messages/AttachmentMessage.css
1543
- if (typeof document !== "undefined" && !document.getElementById("jrapps-style-dd846dee")) {
1866
+ // src/components/SiteChatComponentNewErc/Messages/AttachmentMessage.css
1867
+ if (typeof document !== "undefined" && !document.getElementById("jrapps-style-daabdc64")) {
1544
1868
  const s = document.createElement("style");
1545
- s.id = "jrapps-style-dd846dee";
1869
+ s.id = "jrapps-style-daabdc64";
1546
1870
  s.textContent = ".cw-attachment-message {\n display: flex;\n flex-direction: column;\n gap: 3px;\n align-self: flex-start;\n max-width: 80%;\n}\n\n.cw-attachment-message--user {\n align-self: flex-end;\n align-items: flex-end;\n}\n\n.cw-attachment-message__card {\n display: flex;\n align-items: center;\n gap: 10px;\n background-color: var(--cw-agent-bubble);\n border: 1px solid var(--cw-border);\n border-radius: 12px;\n padding: 10px 14px;\n}\n\n.cw-attachment-message--user .cw-attachment-message__card {\n background-color: var(--cw-user-bubble);\n border-color: transparent;\n color: var(--cw-user-text);\n}\n\n.cw-attachment-message__icon {\n flex-shrink: 0;\n opacity: 0.75;\n display: flex;\n align-items: center;\n}\n\n.cw-attachment-message__info {\n display: flex;\n flex-direction: column;\n min-width: 0;\n flex: 1;\n}\n\n.cw-attachment-message__name {\n font-size: 13px;\n font-weight: 600;\n white-space: nowrap;\n overflow: hidden;\n text-overflow: ellipsis;\n}\n\n.cw-attachment-message__label {\n font-size: 11px;\n opacity: 0.65;\n}\n\n.cw-attachment-message__open-btn {\n background-color: var(--cw-primary);\n color: #ffffff;\n border: none;\n border-radius: 6px;\n padding: 5px 12px;\n font-family: var(--cw-font-family);\n font-size: 12px;\n font-weight: 600;\n cursor: pointer;\n flex-shrink: 0;\n transition: opacity 0.15s ease;\n}\n\n.cw-attachment-message--user .cw-attachment-message__open-btn {\n background-color: rgba(255, 255, 255, 0.25);\n color: #ffffff;\n}\n\n.cw-attachment-message__open-btn:hover {\n opacity: 0.85;\n}\n\n.cw-attachment-message__open-btn:focus-visible {\n outline: 2px solid var(--cw-primary);\n outline-offset: 2px;\n}\n\n.cw-attachment-message__time {\n font-size: 11px;\n color: var(--cw-system-text);\n padding-left: 2px;\n}\n\n.cw-attachment-message__time--right {\n padding-left: 0;\n padding-right: 2px;\n align-self: flex-end;\n}\n";
1547
1871
  document.head.appendChild(s);
1548
1872
  }
1549
1873
 
1550
- // src/components/SiteChatComponentNew/Messages/AttachmentMessage.tsx
1551
- var import_jsx_runtime18 = require("react/jsx-runtime");
1552
- var AttachmentMessage = ({ message }) => {
1874
+ // src/components/SiteChatComponentNewErc/Messages/AttachmentMessage.tsx
1875
+ var import_jsx_runtime25 = require("react/jsx-runtime");
1876
+ var AttachmentMessage2 = ({ message }) => {
1553
1877
  var _a;
1554
1878
  const attachment = (_a = message.item) != null ? _a : message.attachment;
1555
1879
  if (!attachment) return null;
1556
1880
  const handleOpen = () => {
1557
1881
  window.open(attachment.url, "_blank", "noopener,noreferrer");
1558
1882
  };
1559
- return /* @__PURE__ */ (0, import_jsx_runtime18.jsxs)(
1883
+ return /* @__PURE__ */ (0, import_jsx_runtime25.jsxs)(
1560
1884
  "div",
1561
1885
  {
1562
1886
  className: `cw-attachment-message${message.senderType === "user" ? " cw-attachment-message--user" : ""}`,
1563
1887
  role: "listitem",
1564
1888
  "aria-label": `Attachment: ${attachment.name}`,
1565
1889
  children: [
1566
- /* @__PURE__ */ (0, import_jsx_runtime18.jsxs)("div", { className: "cw-attachment-message__card", children: [
1567
- /* @__PURE__ */ (0, import_jsx_runtime18.jsx)("div", { className: "cw-attachment-message__icon", "aria-hidden": "true", children: /* @__PURE__ */ (0, import_jsx_runtime18.jsxs)(
1890
+ /* @__PURE__ */ (0, import_jsx_runtime25.jsxs)("div", { className: "cw-attachment-message__card", children: [
1891
+ /* @__PURE__ */ (0, import_jsx_runtime25.jsx)("div", { className: "cw-attachment-message__icon", "aria-hidden": "true", children: /* @__PURE__ */ (0, import_jsx_runtime25.jsxs)(
1568
1892
  "svg",
1569
1893
  {
1570
1894
  xmlns: "http://www.w3.org/2000/svg",
@@ -1577,16 +1901,16 @@ var AttachmentMessage = ({ message }) => {
1577
1901
  strokeLinecap: "round",
1578
1902
  strokeLinejoin: "round",
1579
1903
  children: [
1580
- /* @__PURE__ */ (0, import_jsx_runtime18.jsx)("path", { d: "M14 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V8z" }),
1581
- /* @__PURE__ */ (0, import_jsx_runtime18.jsx)("polyline", { points: "14 2 14 8 20 8" })
1904
+ /* @__PURE__ */ (0, import_jsx_runtime25.jsx)("path", { d: "M14 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V8z" }),
1905
+ /* @__PURE__ */ (0, import_jsx_runtime25.jsx)("polyline", { points: "14 2 14 8 20 8" })
1582
1906
  ]
1583
1907
  }
1584
1908
  ) }),
1585
- /* @__PURE__ */ (0, import_jsx_runtime18.jsxs)("div", { className: "cw-attachment-message__info", children: [
1586
- /* @__PURE__ */ (0, import_jsx_runtime18.jsx)("span", { className: "cw-attachment-message__name", children: attachment.name }),
1587
- /* @__PURE__ */ (0, import_jsx_runtime18.jsx)("span", { className: "cw-attachment-message__label", children: "Attachment" })
1909
+ /* @__PURE__ */ (0, import_jsx_runtime25.jsxs)("div", { className: "cw-attachment-message__info", children: [
1910
+ /* @__PURE__ */ (0, import_jsx_runtime25.jsx)("span", { className: "cw-attachment-message__name", children: attachment.name }),
1911
+ /* @__PURE__ */ (0, import_jsx_runtime25.jsx)("span", { className: "cw-attachment-message__label", children: "Attachment" })
1588
1912
  ] }),
1589
- /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(
1913
+ /* @__PURE__ */ (0, import_jsx_runtime25.jsx)(
1590
1914
  "button",
1591
1915
  {
1592
1916
  className: "cw-attachment-message__open-btn",
@@ -1597,65 +1921,66 @@ var AttachmentMessage = ({ message }) => {
1597
1921
  }
1598
1922
  )
1599
1923
  ] }),
1600
- message.timestamp !== void 0 && /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(
1924
+ message.timestamp !== void 0 && /* @__PURE__ */ (0, import_jsx_runtime25.jsx)(
1601
1925
  "span",
1602
1926
  {
1603
1927
  className: `cw-attachment-message__time${message.senderType === "user" ? " cw-attachment-message__time--right" : ""}`,
1604
- children: formatTime(message.timestamp)
1928
+ children: formatTime2(message.timestamp)
1605
1929
  }
1606
1930
  )
1607
1931
  ]
1608
1932
  }
1609
1933
  );
1610
1934
  };
1611
- var AttachmentMessage_default = AttachmentMessage;
1935
+ var AttachmentMessage_default2 = AttachmentMessage2;
1612
1936
 
1613
- // src/components/SiteChatComponentNew/Messages/MessageRenderer.tsx
1614
- var import_jsx_runtime19 = require("react/jsx-runtime");
1615
- var MessageRenderer = ({ message }) => {
1937
+ // src/components/SiteChatComponentNewErc/Messages/MessageRenderer.tsx
1938
+ var import_jsx_runtime26 = require("react/jsx-runtime");
1939
+ var MessageRenderer2 = ({ message, ercClasses }) => {
1616
1940
  if (message.messageType === "ATTACHMENT") {
1617
- return /* @__PURE__ */ (0, import_jsx_runtime19.jsx)(AttachmentMessage_default, { message });
1941
+ return /* @__PURE__ */ (0, import_jsx_runtime26.jsx)(AttachmentMessage_default2, { message });
1618
1942
  }
1619
1943
  switch (message.senderType) {
1620
1944
  case "user":
1621
- return /* @__PURE__ */ (0, import_jsx_runtime19.jsx)(UserMessage_default, { message });
1945
+ return /* @__PURE__ */ (0, import_jsx_runtime26.jsx)(UserMessage_default2, { message, ercClassName: ercClasses == null ? void 0 : ercClasses.userMessageClassName });
1622
1946
  case "agent":
1623
- return /* @__PURE__ */ (0, import_jsx_runtime19.jsx)(AgentMessage_default, { message });
1947
+ return /* @__PURE__ */ (0, import_jsx_runtime26.jsx)(AgentMessage_default2, { message, ercClassName: ercClasses == null ? void 0 : ercClasses.agentMessageClassName });
1624
1948
  case "system":
1625
- return /* @__PURE__ */ (0, import_jsx_runtime19.jsx)(SystemMessage_default, { message });
1949
+ return /* @__PURE__ */ (0, import_jsx_runtime26.jsx)(SystemMessage_default2, { message, ercClassName: ercClasses == null ? void 0 : ercClasses.systemMessageClassName });
1626
1950
  default:
1627
1951
  return null;
1628
1952
  }
1629
1953
  };
1630
- var MessageRenderer_default = MessageRenderer;
1954
+ var MessageRenderer_default2 = MessageRenderer2;
1631
1955
 
1632
- // src/components/SiteChatComponentNew/Messages/MessageList.css
1633
- if (typeof document !== "undefined" && !document.getElementById("jrapps-style-15ae1a6b")) {
1956
+ // src/components/SiteChatComponentNewErc/Messages/MessageList.css
1957
+ if (typeof document !== "undefined" && !document.getElementById("jrapps-style-0408335f")) {
1634
1958
  const s = document.createElement("style");
1635
- s.id = "jrapps-style-15ae1a6b";
1959
+ s.id = "jrapps-style-0408335f";
1636
1960
  s.textContent = ".cw-message-list {\n flex: 1;\n display: flex;\n flex-direction: column;\n gap: 10px;\n overflow-y: auto;\n padding: 16px;\n background-color: var(--cw-background);\n scroll-behavior: smooth;\n}\n\n/* Scrollbar styling */\n.cw-message-list::-webkit-scrollbar {\n width: 5px;\n}\n\n.cw-message-list::-webkit-scrollbar-track {\n background: transparent;\n}\n\n.cw-message-list::-webkit-scrollbar-thumb {\n background-color: var(--cw-border);\n border-radius: 10px;\n}\n";
1637
1961
  document.head.appendChild(s);
1638
1962
  }
1639
1963
 
1640
- // src/components/SiteChatComponentNew/Messages/MessageList.tsx
1641
- var import_jsx_runtime20 = require("react/jsx-runtime");
1642
- var MessageList = ({ messages }) => {
1643
- const scrollRef = useAutoScroll(messages);
1644
- return /* @__PURE__ */ (0, import_jsx_runtime20.jsx)(
1964
+ // src/components/SiteChatComponentNewErc/Messages/MessageList.tsx
1965
+ var import_jsx_runtime27 = require("react/jsx-runtime");
1966
+ var MessageList2 = ({ messages, ercClasses }) => {
1967
+ const scrollRef = useAutoScroll2(messages);
1968
+ return /* @__PURE__ */ (0, import_jsx_runtime27.jsx)(
1645
1969
  "div",
1646
1970
  {
1647
1971
  ref: scrollRef,
1648
- className: "cw-message-list",
1972
+ className: ["cw-message-list", ercClasses == null ? void 0 : ercClasses.messageListClassName].filter(Boolean).join(" "),
1649
1973
  role: "list",
1650
1974
  "aria-label": "Chat messages",
1651
1975
  "aria-live": "polite",
1652
1976
  "aria-relevant": "additions",
1653
1977
  children: messages.map((msg, index) => {
1654
1978
  var _a, _b;
1655
- return /* @__PURE__ */ (0, import_jsx_runtime20.jsx)(
1656
- MessageRenderer_default,
1979
+ return /* @__PURE__ */ (0, import_jsx_runtime27.jsx)(
1980
+ MessageRenderer_default2,
1657
1981
  {
1658
- message: msg
1982
+ message: msg,
1983
+ ercClasses
1659
1984
  },
1660
1985
  (_b = msg._id) != null ? _b : `${(_a = msg.timestamp) != null ? _a : index}-${index}`
1661
1986
  );
@@ -1663,70 +1988,70 @@ var MessageList = ({ messages }) => {
1663
1988
  }
1664
1989
  );
1665
1990
  };
1666
- var MessageList_default = MessageList;
1991
+ var MessageList_default2 = MessageList2;
1667
1992
 
1668
- // src/components/SiteChatComponentNew/Messages/TypingIndicator.css
1669
- if (typeof document !== "undefined" && !document.getElementById("jrapps-style-4b0ca05b")) {
1993
+ // src/components/SiteChatComponentNewErc/Messages/TypingIndicator.css
1994
+ if (typeof document !== "undefined" && !document.getElementById("jrapps-style-0a740655")) {
1670
1995
  const s = document.createElement("style");
1671
- s.id = "jrapps-style-4b0ca05b";
1996
+ s.id = "jrapps-style-0a740655";
1672
1997
  s.textContent = "@keyframes cw-bounce {\n 0%, 60%, 100% {\n transform: translateY(0);\n }\n 30% {\n transform: translateY(-6px);\n }\n}\n\n.cw-typing-indicator {\n align-self: flex-start;\n}\n\n.cw-typing-indicator__bubble {\n display: inline-flex;\n align-items: center;\n gap: 4px;\n background-color: var(--cw-agent-bubble);\n border-radius: 18px 18px 18px 4px;\n padding: 10px 14px;\n}\n\n.cw-typing-indicator__dot {\n display: block;\n width: 7px;\n height: 7px;\n border-radius: 50%;\n background-color: var(--cw-system-text);\n animation: cw-bounce 1.2s infinite ease-in-out;\n}\n\n.cw-typing-indicator__dot:nth-child(2) {\n animation-delay: 0.2s;\n}\n\n.cw-typing-indicator__dot:nth-child(3) {\n animation-delay: 0.4s;\n}\n";
1673
1998
  document.head.appendChild(s);
1674
1999
  }
1675
2000
 
1676
- // src/components/SiteChatComponentNew/Messages/TypingIndicator.tsx
1677
- var import_jsx_runtime21 = require("react/jsx-runtime");
2001
+ // src/components/SiteChatComponentNewErc/Messages/TypingIndicator.tsx
2002
+ var import_jsx_runtime28 = require("react/jsx-runtime");
1678
2003
 
1679
- // src/components/SiteChatComponentNew/States/LoadingState.css
1680
- if (typeof document !== "undefined" && !document.getElementById("jrapps-style-7a5a4f05")) {
2004
+ // src/components/SiteChatComponentNewErc/States/LoadingState.css
2005
+ if (typeof document !== "undefined" && !document.getElementById("jrapps-style-7bd88a9a")) {
1681
2006
  const s = document.createElement("style");
1682
- s.id = "jrapps-style-7a5a4f05";
2007
+ s.id = "jrapps-style-7bd88a9a";
1683
2008
  s.textContent = "@keyframes cw-spin {\n to {\n transform: rotate(360deg);\n }\n}\n\n.cw-loading-state {\n flex: 1;\n display: flex;\n flex-direction: column;\n align-items: center;\n justify-content: center;\n padding: 32px;\n background-color: var(--cw-background);\n text-align: center;\n gap: 12px;\n}\n\n.cw-loading-state__spinner {\n width: 48px;\n height: 48px;\n}\n\n.cw-loading-state__spinner-ring {\n width: 48px;\n height: 48px;\n border-radius: 50%;\n border: 3px solid var(--cw-border);\n border-top-color: var(--cw-primary);\n animation: cw-spin 0.8s linear infinite;\n}\n\n.cw-loading-state__title {\n font-size: 16px;\n font-weight: 600;\n color: var(--cw-agent-text);\n margin: 0;\n}\n\n.cw-loading-state__subtitle {\n font-size: 13px;\n color: var(--cw-system-text);\n margin: 0;\n max-width: 240px;\n line-height: 1.5;\n}\n";
1684
2009
  document.head.appendChild(s);
1685
2010
  }
1686
2011
 
1687
- // src/components/SiteChatComponentNew/States/LoadingState.tsx
1688
- var import_jsx_runtime22 = require("react/jsx-runtime");
1689
- var LoadingState = () => {
1690
- return /* @__PURE__ */ (0, import_jsx_runtime22.jsxs)(
2012
+ // src/components/SiteChatComponentNewErc/States/LoadingState.tsx
2013
+ var import_jsx_runtime29 = require("react/jsx-runtime");
2014
+ var LoadingState2 = () => {
2015
+ return /* @__PURE__ */ (0, import_jsx_runtime29.jsxs)(
1691
2016
  "div",
1692
2017
  {
1693
2018
  className: "cw-loading-state",
1694
2019
  role: "status",
1695
2020
  "aria-label": "Connecting to chat",
1696
2021
  children: [
1697
- /* @__PURE__ */ (0, import_jsx_runtime22.jsx)("div", { className: "cw-loading-state__spinner", "aria-hidden": "true", children: /* @__PURE__ */ (0, import_jsx_runtime22.jsx)("div", { className: "cw-loading-state__spinner-ring" }) }),
1698
- /* @__PURE__ */ (0, import_jsx_runtime22.jsx)("p", { className: "cw-loading-state__title", children: "Connecting\u2026" }),
1699
- /* @__PURE__ */ (0, import_jsx_runtime22.jsx)("p", { className: "cw-loading-state__subtitle", children: "Please wait while we connect you to an available agent." })
2022
+ /* @__PURE__ */ (0, import_jsx_runtime29.jsx)("div", { className: "cw-loading-state__spinner", "aria-hidden": "true", children: /* @__PURE__ */ (0, import_jsx_runtime29.jsx)("div", { className: "cw-loading-state__spinner-ring" }) }),
2023
+ /* @__PURE__ */ (0, import_jsx_runtime29.jsx)("p", { className: "cw-loading-state__title", children: "Connecting\u2026" }),
2024
+ /* @__PURE__ */ (0, import_jsx_runtime29.jsx)("p", { className: "cw-loading-state__subtitle", children: "Please wait while we connect you to an available agent." })
1700
2025
  ]
1701
2026
  }
1702
2027
  );
1703
2028
  };
1704
- var LoadingState_default = LoadingState;
2029
+ var LoadingState_default2 = LoadingState2;
1705
2030
 
1706
- // src/components/SiteChatComponentNew/States/StartChatState.css
1707
- if (typeof document !== "undefined" && !document.getElementById("jrapps-style-3e05ef30")) {
2031
+ // src/components/SiteChatComponentNewErc/States/StartChatState.css
2032
+ if (typeof document !== "undefined" && !document.getElementById("jrapps-style-f1f33df7")) {
1708
2033
  const s = document.createElement("style");
1709
- s.id = "jrapps-style-3e05ef30";
2034
+ s.id = "jrapps-style-f1f33df7";
1710
2035
  s.textContent = ".cw-start-chat-state {\n flex: 1;\n display: flex;\n flex-direction: column;\n align-items: center;\n justify-content: center;\n padding: 32px 24px;\n background-color: var(--cw-background);\n text-align: center;\n gap: 14px;\n}\n\n.cw-start-chat-state__image {\n width: 80px;\n height: 80px;\n object-fit: contain;\n border-radius: 50%;\n margin-bottom: 4px;\n}\n\n.cw-start-chat-state__title {\n font-size: 20px;\n font-weight: 700;\n color: var(--cw-agent-text);\n margin: 0;\n}\n\n.cw-start-chat-state__description {\n font-size: 14px;\n color: var(--cw-system-text);\n margin: 0;\n max-width: 260px;\n line-height: 1.6;\n}\n";
1711
2036
  document.head.appendChild(s);
1712
2037
  }
1713
2038
 
1714
- // src/components/SiteChatComponentNew/States/StartChatState.tsx
1715
- var import_jsx_runtime23 = require("react/jsx-runtime");
1716
- var StartChatState = ({
2039
+ // src/components/SiteChatComponentNewErc/States/StartChatState.tsx
2040
+ var import_jsx_runtime30 = require("react/jsx-runtime");
2041
+ var StartChatState2 = ({
1717
2042
  image,
1718
2043
  title,
1719
2044
  description,
1720
2045
  onStart
1721
2046
  }) => {
1722
- return /* @__PURE__ */ (0, import_jsx_runtime23.jsxs)(
2047
+ return /* @__PURE__ */ (0, import_jsx_runtime30.jsxs)(
1723
2048
  "div",
1724
2049
  {
1725
2050
  className: "cw-start-chat-state",
1726
2051
  role: "main",
1727
2052
  "aria-label": "Start a chat",
1728
2053
  children: [
1729
- image && /* @__PURE__ */ (0, import_jsx_runtime23.jsx)(
2054
+ image && /* @__PURE__ */ (0, import_jsx_runtime30.jsx)(
1730
2055
  "img",
1731
2056
  {
1732
2057
  src: image,
@@ -1734,19 +2059,19 @@ var StartChatState = ({
1734
2059
  className: "cw-start-chat-state__image"
1735
2060
  }
1736
2061
  ),
1737
- /* @__PURE__ */ (0, import_jsx_runtime23.jsx)("h2", { className: "cw-start-chat-state__title", children: title }),
1738
- description && /* @__PURE__ */ (0, import_jsx_runtime23.jsx)("p", { className: "cw-start-chat-state__description", children: description }),
1739
- /* @__PURE__ */ (0, import_jsx_runtime23.jsx)(Button_default, { onClick: onStart, ariaLabel: "Start chat", children: "Start Chat" })
2062
+ /* @__PURE__ */ (0, import_jsx_runtime30.jsx)("h2", { className: "cw-start-chat-state__title", children: title }),
2063
+ description && /* @__PURE__ */ (0, import_jsx_runtime30.jsx)("p", { className: "cw-start-chat-state__description", children: description }),
2064
+ /* @__PURE__ */ (0, import_jsx_runtime30.jsx)(Button_default2, { onClick: onStart, ariaLabel: "Start chat", children: "Start Chat" })
1740
2065
  ]
1741
2066
  }
1742
2067
  );
1743
2068
  };
1744
- var StartChatState_default = StartChatState;
2069
+ var StartChatState_default2 = StartChatState2;
1745
2070
 
1746
- // src/components/SiteChatComponentNew/OfflineForm/OfflineForm.css
1747
- if (typeof document !== "undefined" && !document.getElementById("jrapps-style-d9ff3956")) {
2071
+ // src/components/SiteChatComponentNewErc/OfflineForm/OfflineForm.css
2072
+ if (typeof document !== "undefined" && !document.getElementById("jrapps-style-a7711cdc")) {
1748
2073
  const s = document.createElement("style");
1749
- s.id = "jrapps-style-d9ff3956";
2074
+ s.id = "jrapps-style-a7711cdc";
1750
2075
  s.textContent = `.cw-offline-form {
1751
2076
  display: flex;
1752
2077
  flex-direction: column;
@@ -1904,9 +2229,9 @@ if (typeof document !== "undefined" && !document.getElementById("jrapps-style-d9
1904
2229
  document.head.appendChild(s);
1905
2230
  }
1906
2231
 
1907
- // src/components/SiteChatComponentNew/OfflineForm/OfflineForm.tsx
1908
- var import_jsx_runtime24 = require("react/jsx-runtime");
1909
- var FieldRenderer = ({
2232
+ // src/components/SiteChatComponentNewErc/OfflineForm/OfflineForm.tsx
2233
+ var import_jsx_runtime31 = require("react/jsx-runtime");
2234
+ var FieldRenderer2 = ({
1910
2235
  field,
1911
2236
  value,
1912
2237
  error,
@@ -1924,15 +2249,15 @@ var FieldRenderer = ({
1924
2249
  required: field.required
1925
2250
  };
1926
2251
  if (field.type === "textarea") {
1927
- return /* @__PURE__ */ (0, import_jsx_runtime24.jsxs)("div", { className: "cw-offline-form__field", children: [
1928
- /* @__PURE__ */ (0, import_jsx_runtime24.jsxs)("label", { htmlFor: fieldId, className: "cw-offline-form__label", children: [
2252
+ return /* @__PURE__ */ (0, import_jsx_runtime31.jsxs)("div", { className: "cw-offline-form__field", children: [
2253
+ /* @__PURE__ */ (0, import_jsx_runtime31.jsxs)("label", { htmlFor: fieldId, className: "cw-offline-form__label", children: [
1929
2254
  field.label,
1930
- field.required && /* @__PURE__ */ (0, import_jsx_runtime24.jsxs)("span", { className: "cw-offline-form__required", "aria-hidden": "true", children: [
2255
+ field.required && /* @__PURE__ */ (0, import_jsx_runtime31.jsxs)("span", { className: "cw-offline-form__required", "aria-hidden": "true", children: [
1931
2256
  " ",
1932
2257
  "*"
1933
2258
  ] })
1934
2259
  ] }),
1935
- /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(
2260
+ /* @__PURE__ */ (0, import_jsx_runtime31.jsx)(
1936
2261
  "textarea",
1937
2262
  {
1938
2263
  ...commonProps,
@@ -1943,19 +2268,19 @@ var FieldRenderer = ({
1943
2268
  className: `cw-offline-form__textarea${hasError ? " cw-offline-form__textarea--error" : ""}`
1944
2269
  }
1945
2270
  ),
1946
- hasError && /* @__PURE__ */ (0, import_jsx_runtime24.jsx)("span", { id: errorId, className: "cw-offline-form__error", role: "alert", children: error })
2271
+ hasError && /* @__PURE__ */ (0, import_jsx_runtime31.jsx)("span", { id: errorId, className: "cw-offline-form__error", role: "alert", children: error })
1947
2272
  ] });
1948
2273
  }
1949
2274
  if (field.type === "select") {
1950
- return /* @__PURE__ */ (0, import_jsx_runtime24.jsxs)("div", { className: "cw-offline-form__field", children: [
1951
- /* @__PURE__ */ (0, import_jsx_runtime24.jsxs)("label", { htmlFor: fieldId, className: "cw-offline-form__label", children: [
2275
+ return /* @__PURE__ */ (0, import_jsx_runtime31.jsxs)("div", { className: "cw-offline-form__field", children: [
2276
+ /* @__PURE__ */ (0, import_jsx_runtime31.jsxs)("label", { htmlFor: fieldId, className: "cw-offline-form__label", children: [
1952
2277
  field.label,
1953
- field.required && /* @__PURE__ */ (0, import_jsx_runtime24.jsxs)("span", { className: "cw-offline-form__required", "aria-hidden": "true", children: [
2278
+ field.required && /* @__PURE__ */ (0, import_jsx_runtime31.jsxs)("span", { className: "cw-offline-form__required", "aria-hidden": "true", children: [
1954
2279
  " ",
1955
2280
  "*"
1956
2281
  ] })
1957
2282
  ] }),
1958
- /* @__PURE__ */ (0, import_jsx_runtime24.jsxs)(
2283
+ /* @__PURE__ */ (0, import_jsx_runtime31.jsxs)(
1959
2284
  "select",
1960
2285
  {
1961
2286
  ...commonProps,
@@ -1963,18 +2288,18 @@ var FieldRenderer = ({
1963
2288
  onChange: (e) => onChange(field.id, e.target.value),
1964
2289
  className: `cw-offline-form__select${hasError ? " cw-offline-form__select--error" : ""}`,
1965
2290
  children: [
1966
- /* @__PURE__ */ (0, import_jsx_runtime24.jsx)("option", { value: "", children: (_a = field.placeholder) != null ? _a : `Select ${field.label}` }),
1967
- (_b = field.options) == null ? void 0 : _b.map((opt) => /* @__PURE__ */ (0, import_jsx_runtime24.jsx)("option", { value: opt.value, children: opt.label }, opt.value))
2291
+ /* @__PURE__ */ (0, import_jsx_runtime31.jsx)("option", { value: "", children: (_a = field.placeholder) != null ? _a : `Select ${field.label}` }),
2292
+ (_b = field.options) == null ? void 0 : _b.map((opt) => /* @__PURE__ */ (0, import_jsx_runtime31.jsx)("option", { value: opt.value, children: opt.label }, opt.value))
1968
2293
  ]
1969
2294
  }
1970
2295
  ),
1971
- hasError && /* @__PURE__ */ (0, import_jsx_runtime24.jsx)("span", { id: errorId, className: "cw-offline-form__error", role: "alert", children: error })
2296
+ hasError && /* @__PURE__ */ (0, import_jsx_runtime31.jsx)("span", { id: errorId, className: "cw-offline-form__error", role: "alert", children: error })
1972
2297
  ] });
1973
2298
  }
1974
2299
  if (field.type === "checkbox") {
1975
- return /* @__PURE__ */ (0, import_jsx_runtime24.jsxs)("div", { className: "cw-offline-form__field cw-offline-form__field--checkbox", children: [
1976
- /* @__PURE__ */ (0, import_jsx_runtime24.jsxs)("label", { className: "cw-offline-form__checkbox-label", htmlFor: fieldId, children: [
1977
- /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(
2300
+ return /* @__PURE__ */ (0, import_jsx_runtime31.jsxs)("div", { className: "cw-offline-form__field cw-offline-form__field--checkbox", children: [
2301
+ /* @__PURE__ */ (0, import_jsx_runtime31.jsxs)("label", { className: "cw-offline-form__checkbox-label", htmlFor: fieldId, children: [
2302
+ /* @__PURE__ */ (0, import_jsx_runtime31.jsx)(
1978
2303
  "input",
1979
2304
  {
1980
2305
  type: "checkbox",
@@ -1987,26 +2312,26 @@ var FieldRenderer = ({
1987
2312
  required: field.required
1988
2313
  }
1989
2314
  ),
1990
- /* @__PURE__ */ (0, import_jsx_runtime24.jsxs)("span", { className: "cw-offline-form__checkbox-text", children: [
2315
+ /* @__PURE__ */ (0, import_jsx_runtime31.jsxs)("span", { className: "cw-offline-form__checkbox-text", children: [
1991
2316
  field.label,
1992
- field.required && /* @__PURE__ */ (0, import_jsx_runtime24.jsxs)("span", { className: "cw-offline-form__required", "aria-hidden": "true", children: [
2317
+ field.required && /* @__PURE__ */ (0, import_jsx_runtime31.jsxs)("span", { className: "cw-offline-form__required", "aria-hidden": "true", children: [
1993
2318
  " ",
1994
2319
  "*"
1995
2320
  ] })
1996
2321
  ] })
1997
2322
  ] }),
1998
- hasError && /* @__PURE__ */ (0, import_jsx_runtime24.jsx)("span", { id: errorId, className: "cw-offline-form__error", role: "alert", children: error })
2323
+ hasError && /* @__PURE__ */ (0, import_jsx_runtime31.jsx)("span", { id: errorId, className: "cw-offline-form__error", role: "alert", children: error })
1999
2324
  ] });
2000
2325
  }
2001
- return /* @__PURE__ */ (0, import_jsx_runtime24.jsxs)("div", { className: "cw-offline-form__field", children: [
2002
- /* @__PURE__ */ (0, import_jsx_runtime24.jsxs)("label", { htmlFor: fieldId, className: "cw-offline-form__label", children: [
2326
+ return /* @__PURE__ */ (0, import_jsx_runtime31.jsxs)("div", { className: "cw-offline-form__field", children: [
2327
+ /* @__PURE__ */ (0, import_jsx_runtime31.jsxs)("label", { htmlFor: fieldId, className: "cw-offline-form__label", children: [
2003
2328
  field.label,
2004
- field.required && /* @__PURE__ */ (0, import_jsx_runtime24.jsxs)("span", { className: "cw-offline-form__required", "aria-hidden": "true", children: [
2329
+ field.required && /* @__PURE__ */ (0, import_jsx_runtime31.jsxs)("span", { className: "cw-offline-form__required", "aria-hidden": "true", children: [
2005
2330
  " ",
2006
2331
  "*"
2007
2332
  ] })
2008
2333
  ] }),
2009
- /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(
2334
+ /* @__PURE__ */ (0, import_jsx_runtime31.jsx)(
2010
2335
  "input",
2011
2336
  {
2012
2337
  ...commonProps,
@@ -2016,16 +2341,16 @@ var FieldRenderer = ({
2016
2341
  onChange: (e) => onChange(field.id, e.target.value)
2017
2342
  }
2018
2343
  ),
2019
- hasError && /* @__PURE__ */ (0, import_jsx_runtime24.jsx)("span", { id: errorId, className: "cw-offline-form__error", role: "alert", children: error })
2344
+ hasError && /* @__PURE__ */ (0, import_jsx_runtime31.jsx)("span", { id: errorId, className: "cw-offline-form__error", role: "alert", children: error })
2020
2345
  ] });
2021
2346
  };
2022
- var OfflineForm = ({ schema, onSubmit }) => {
2023
- const { values, errors, setValue, handleSubmit } = useOfflineForm(schema);
2347
+ var OfflineForm2 = ({ schema, onSubmit }) => {
2348
+ const { values, errors, setValue, handleSubmit } = useOfflineForm2(schema);
2024
2349
  const onFormSubmit = (e) => {
2025
2350
  e.preventDefault();
2026
2351
  handleSubmit(onSubmit);
2027
2352
  };
2028
- return /* @__PURE__ */ (0, import_jsx_runtime24.jsxs)(
2353
+ return /* @__PURE__ */ (0, import_jsx_runtime31.jsxs)(
2029
2354
  "form",
2030
2355
  {
2031
2356
  className: "cw-offline-form",
@@ -2033,11 +2358,11 @@ var OfflineForm = ({ schema, onSubmit }) => {
2033
2358
  "aria-label": schema.title,
2034
2359
  noValidate: true,
2035
2360
  children: [
2036
- /* @__PURE__ */ (0, import_jsx_runtime24.jsx)("h3", { className: "cw-offline-form__title", children: schema.title }),
2361
+ /* @__PURE__ */ (0, import_jsx_runtime31.jsx)("h3", { className: "cw-offline-form__title", children: schema.title }),
2037
2362
  schema.fields.map((field) => {
2038
2363
  var _a;
2039
- return /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(
2040
- FieldRenderer,
2364
+ return /* @__PURE__ */ (0, import_jsx_runtime31.jsx)(
2365
+ FieldRenderer2,
2041
2366
  {
2042
2367
  field,
2043
2368
  value: values[field.id],
@@ -2047,33 +2372,33 @@ var OfflineForm = ({ schema, onSubmit }) => {
2047
2372
  field.id
2048
2373
  );
2049
2374
  }),
2050
- /* @__PURE__ */ (0, import_jsx_runtime24.jsx)("div", { className: "cw-offline-form__actions", children: /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(Button_default, { type: "submit", fullWidth: true, children: schema.submitButtonText }) })
2375
+ /* @__PURE__ */ (0, import_jsx_runtime31.jsx)("div", { className: "cw-offline-form__actions", children: /* @__PURE__ */ (0, import_jsx_runtime31.jsx)(Button_default2, { type: "submit", fullWidth: true, children: schema.submitButtonText }) })
2051
2376
  ]
2052
2377
  }
2053
2378
  );
2054
2379
  };
2055
- var OfflineForm_default = OfflineForm;
2380
+ var OfflineForm_default2 = OfflineForm2;
2056
2381
 
2057
- // src/components/SiteChatComponentNew/States/OfflineState.css
2058
- if (typeof document !== "undefined" && !document.getElementById("jrapps-style-8b15ae78")) {
2382
+ // src/components/SiteChatComponentNewErc/States/OfflineState.css
2383
+ if (typeof document !== "undefined" && !document.getElementById("jrapps-style-03b10f90")) {
2059
2384
  const s = document.createElement("style");
2060
- s.id = "jrapps-style-8b15ae78";
2385
+ s.id = "jrapps-style-03b10f90";
2061
2386
  s.textContent = ".cw-offline-state {\n flex: 1;\n display: flex;\n flex-direction: column;\n background-color: var(--cw-background);\n overflow-y: auto;\n}\n\n.cw-offline-state__header {\n display: flex;\n flex-direction: column;\n align-items: center;\n text-align: center;\n padding: 28px 24px 16px;\n gap: 8px;\n}\n\n.cw-offline-state__icon {\n width: 56px;\n height: 56px;\n border-radius: 50%;\n background-color: color-mix(in srgb, var(--cw-primary) 10%, transparent);\n color: var(--cw-primary);\n display: flex;\n align-items: center;\n justify-content: center;\n margin-bottom: 4px;\n}\n\n.cw-offline-state__title {\n font-size: 17px;\n font-weight: 700;\n color: var(--cw-agent-text);\n margin: 0;\n}\n\n.cw-offline-state__subtitle {\n font-size: 13px;\n color: var(--cw-system-text);\n margin: 0;\n line-height: 1.6;\n max-width: 280px;\n}\n\n.cw-offline-state__form-wrapper {\n padding: 0 16px 16px;\n}\n";
2062
2387
  document.head.appendChild(s);
2063
2388
  }
2064
2389
 
2065
- // src/components/SiteChatComponentNew/States/OfflineState.tsx
2066
- var import_jsx_runtime25 = require("react/jsx-runtime");
2067
- var OfflineState = ({ form, onSubmit }) => {
2068
- return /* @__PURE__ */ (0, import_jsx_runtime25.jsxs)(
2390
+ // src/components/SiteChatComponentNewErc/States/OfflineState.tsx
2391
+ var import_jsx_runtime32 = require("react/jsx-runtime");
2392
+ var OfflineState2 = ({ form, onSubmit }) => {
2393
+ return /* @__PURE__ */ (0, import_jsx_runtime32.jsxs)(
2069
2394
  "div",
2070
2395
  {
2071
2396
  className: "cw-offline-state",
2072
2397
  role: "main",
2073
2398
  "aria-label": "Business is offline",
2074
2399
  children: [
2075
- /* @__PURE__ */ (0, import_jsx_runtime25.jsxs)("div", { className: "cw-offline-state__header", children: [
2076
- /* @__PURE__ */ (0, import_jsx_runtime25.jsx)("div", { className: "cw-offline-state__icon", "aria-hidden": "true", children: /* @__PURE__ */ (0, import_jsx_runtime25.jsx)(
2400
+ /* @__PURE__ */ (0, import_jsx_runtime32.jsxs)("div", { className: "cw-offline-state__header", children: [
2401
+ /* @__PURE__ */ (0, import_jsx_runtime32.jsx)("div", { className: "cw-offline-state__icon", "aria-hidden": "true", children: /* @__PURE__ */ (0, import_jsx_runtime32.jsx)(
2077
2402
  "svg",
2078
2403
  {
2079
2404
  xmlns: "http://www.w3.org/2000/svg",
@@ -2085,38 +2410,38 @@ var OfflineState = ({ form, onSubmit }) => {
2085
2410
  strokeWidth: "2",
2086
2411
  strokeLinecap: "round",
2087
2412
  strokeLinejoin: "round",
2088
- children: /* @__PURE__ */ (0, import_jsx_runtime25.jsx)("path", { d: "M20.84 4.61a5.5 5.5 0 0 0-7.78 0L12 5.67l-1.06-1.06a5.5 5.5 0 0 0-7.78 7.78l1.06 1.06L12 21.23l7.78-7.78 1.06-1.06a5.5 5.5 0 0 0 0-7.78z" })
2413
+ children: /* @__PURE__ */ (0, import_jsx_runtime32.jsx)("path", { d: "M20.84 4.61a5.5 5.5 0 0 0-7.78 0L12 5.67l-1.06-1.06a5.5 5.5 0 0 0-7.78 7.78l1.06 1.06L12 21.23l7.78-7.78 1.06-1.06a5.5 5.5 0 0 0 0-7.78z" })
2089
2414
  }
2090
2415
  ) }),
2091
- /* @__PURE__ */ (0, import_jsx_runtime25.jsx)("h2", { className: "cw-offline-state__title", children: "We're currently offline" }),
2092
- /* @__PURE__ */ (0, import_jsx_runtime25.jsx)("p", { className: "cw-offline-state__subtitle", children: "Please leave us a message and we'll get back to you as soon as possible." })
2416
+ /* @__PURE__ */ (0, import_jsx_runtime32.jsx)("h2", { className: "cw-offline-state__title", children: "We're currently offline" }),
2417
+ /* @__PURE__ */ (0, import_jsx_runtime32.jsx)("p", { className: "cw-offline-state__subtitle", children: "Please leave us a message and we'll get back to you as soon as possible." })
2093
2418
  ] }),
2094
- form && /* @__PURE__ */ (0, import_jsx_runtime25.jsx)("div", { className: "cw-offline-state__form-wrapper", children: /* @__PURE__ */ (0, import_jsx_runtime25.jsx)(OfflineForm_default, { schema: form, onSubmit }) })
2419
+ form && /* @__PURE__ */ (0, import_jsx_runtime32.jsx)("div", { className: "cw-offline-state__form-wrapper", children: /* @__PURE__ */ (0, import_jsx_runtime32.jsx)(OfflineForm_default2, { schema: form, onSubmit }) })
2095
2420
  ]
2096
2421
  }
2097
2422
  );
2098
2423
  };
2099
- var OfflineState_default = OfflineState;
2424
+ var OfflineState_default2 = OfflineState2;
2100
2425
 
2101
- // src/components/SiteChatComponentNew/States/ChatEndedState.css
2102
- if (typeof document !== "undefined" && !document.getElementById("jrapps-style-59a49fdf")) {
2426
+ // src/components/SiteChatComponentNewErc/States/ChatEndedState.css
2427
+ if (typeof document !== "undefined" && !document.getElementById("jrapps-style-dba39629")) {
2103
2428
  const s = document.createElement("style");
2104
- s.id = "jrapps-style-59a49fdf";
2429
+ s.id = "jrapps-style-dba39629";
2105
2430
  s.textContent = ".cw-chat-ended-state {\n flex: 1;\n display: flex;\n flex-direction: column;\n align-items: center;\n justify-content: center;\n padding: 32px 24px;\n background-color: var(--cw-background);\n text-align: center;\n gap: 12px;\n}\n\n.cw-chat-ended-state__icon {\n width: 56px;\n height: 56px;\n border-radius: 50%;\n background-color: color-mix(in srgb, var(--cw-primary) 10%, transparent);\n color: var(--cw-primary);\n display: flex;\n align-items: center;\n justify-content: center;\n}\n\n.cw-chat-ended-state__title {\n font-size: 17px;\n font-weight: 700;\n color: var(--cw-agent-text);\n margin: 0;\n}\n\n.cw-chat-ended-state__subtitle {\n font-size: 13px;\n color: var(--cw-system-text);\n margin: 0;\n max-width: 240px;\n line-height: 1.6;\n}\n";
2106
2431
  document.head.appendChild(s);
2107
2432
  }
2108
2433
 
2109
- // src/components/SiteChatComponentNew/States/ChatEndedState.tsx
2110
- var import_jsx_runtime26 = require("react/jsx-runtime");
2111
- var ChatEndedState = () => {
2112
- return /* @__PURE__ */ (0, import_jsx_runtime26.jsxs)(
2434
+ // src/components/SiteChatComponentNewErc/States/ChatEndedState.tsx
2435
+ var import_jsx_runtime33 = require("react/jsx-runtime");
2436
+ var ChatEndedState2 = () => {
2437
+ return /* @__PURE__ */ (0, import_jsx_runtime33.jsxs)(
2113
2438
  "div",
2114
2439
  {
2115
2440
  className: "cw-chat-ended-state",
2116
2441
  role: "status",
2117
2442
  "aria-label": "Chat has ended",
2118
2443
  children: [
2119
- /* @__PURE__ */ (0, import_jsx_runtime26.jsx)("div", { className: "cw-chat-ended-state__icon", "aria-hidden": "true", children: /* @__PURE__ */ (0, import_jsx_runtime26.jsx)(
2444
+ /* @__PURE__ */ (0, import_jsx_runtime33.jsx)("div", { className: "cw-chat-ended-state__icon", "aria-hidden": "true", children: /* @__PURE__ */ (0, import_jsx_runtime33.jsx)(
2120
2445
  "svg",
2121
2446
  {
2122
2447
  xmlns: "http://www.w3.org/2000/svg",
@@ -2128,28 +2453,28 @@ var ChatEndedState = () => {
2128
2453
  strokeWidth: "2",
2129
2454
  strokeLinecap: "round",
2130
2455
  strokeLinejoin: "round",
2131
- children: /* @__PURE__ */ (0, import_jsx_runtime26.jsx)("polyline", { points: "20 6 9 17 4 12" })
2456
+ children: /* @__PURE__ */ (0, import_jsx_runtime33.jsx)("polyline", { points: "20 6 9 17 4 12" })
2132
2457
  }
2133
2458
  ) }),
2134
- /* @__PURE__ */ (0, import_jsx_runtime26.jsx)("p", { className: "cw-chat-ended-state__title", children: "Chat Ended" }),
2135
- /* @__PURE__ */ (0, import_jsx_runtime26.jsx)("p", { className: "cw-chat-ended-state__subtitle", children: "Your chat session has ended. Thank you for reaching out!" })
2459
+ /* @__PURE__ */ (0, import_jsx_runtime33.jsx)("p", { className: "cw-chat-ended-state__title", children: "Chat Ended" }),
2460
+ /* @__PURE__ */ (0, import_jsx_runtime33.jsx)("p", { className: "cw-chat-ended-state__subtitle", children: "Your chat session has ended. Thank you for reaching out!" })
2136
2461
  ]
2137
2462
  }
2138
2463
  );
2139
2464
  };
2140
- var ChatEndedState_default = ChatEndedState;
2465
+ var ChatEndedState_default2 = ChatEndedState2;
2141
2466
 
2142
- // src/components/SiteChatComponentNew/SiteChatComponentNew.css
2143
- if (typeof document !== "undefined" && !document.getElementById("jrapps-style-871af89c")) {
2467
+ // src/components/SiteChatComponentNewErc/SiteChatComponentNewErc.css
2468
+ if (typeof document !== "undefined" && !document.getElementById("jrapps-style-6b6fcb3b")) {
2144
2469
  const s = document.createElement("style");
2145
- s.id = "jrapps-style-871af89c";
2146
- s.textContent = "/* \u2500\u2500\u2500 Root container \u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\n * Fixed to bottom-right by default so it works out-of-the-box.\n * Override with your own positioning class if embedding differently.\n * \u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500 */\n.cw-root {\n position: fixed;\n bottom: max(24px, env(safe-area-inset-bottom));\n right: max(24px, env(safe-area-inset-right));\n display: flex;\n flex-direction: column;\n align-items: flex-end;\n gap: 12px;\n z-index: 9999;\n /* Scope CSS vars and stacking context */\n isolation: isolate;\n font-family: var(--cw-font-family);\n font-size: var(--cw-font-size);\n}\n\n/* \u2500\u2500\u2500 Widget Panel \u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500 */\n\n.cw-widget {\n display: flex;\n flex-direction: column;\n width: var(--cw-width);\n height: var(--cw-height);\n /* Clamp so it never overflows the viewport on small screens */\n max-width: calc(100vw - 48px);\n max-height: calc(100dvh - 96px);\n background-color: var(--cw-background);\n border-radius: var(--cw-border-radius);\n box-shadow: var(--cw-shadow);\n overflow: hidden;\n /* Entry animation */\n animation: cw-panel-in 0.22s ease;\n transform-origin: bottom right;\n}\n\n@keyframes cw-panel-in {\n from {\n opacity: 0;\n transform: scale(0.92) translateY(10px);\n }\n to {\n opacity: 1;\n transform: scale(1) translateY(0);\n }\n}\n\n.cw-widget__body {\n display: flex;\n flex-direction: column;\n flex: 1;\n overflow: hidden;\n}\n\n/* \u2500\u2500\u2500 Launcher Button \u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500 */\n\n.cw-launcher {\n width: 56px;\n height: 56px;\n border-radius: 50%;\n border: none;\n background-color: var(--cw-primary);\n color: #ffffff;\n cursor: pointer;\n display: flex;\n align-items: center;\n justify-content: center;\n box-shadow: 0 4px 16px rgba(0, 0, 0, 0.2);\n flex-shrink: 0;\n transition: transform 0.15s ease, box-shadow 0.15s ease;\n}\n\n.cw-launcher:hover {\n transform: scale(1.07);\n box-shadow: 0 6px 20px rgba(0, 0, 0, 0.26);\n}\n\n.cw-launcher:focus-visible {\n outline: 3px solid var(--cw-primary);\n outline-offset: 3px;\n}\n\n.cw-launcher:active {\n transform: scale(0.96);\n}\n\n/* \u2500\u2500\u2500 Tablet (481px \u2013 768px): panel floats, slightly narrower margin \u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500 */\n\n@media (min-width: 481px) and (max-width: 768px) {\n .cw-root {\n bottom: max(16px, env(safe-area-inset-bottom));\n right: max(16px, env(safe-area-inset-right));\n }\n\n .cw-widget {\n max-width: calc(100vw - 32px);\n max-height: calc(100dvh - 80px);\n }\n}\n\n/* \u2500\u2500\u2500 Mobile (\u2264 480px): full-screen panel, launcher stays fixed \u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500 */\n\n@media (max-width: 480px) {\n .cw-root {\n bottom: 0;\n right: 0;\n gap: 0;\n }\n\n .cw-root > .cw-launcher {\n position: fixed;\n bottom: max(20px, env(safe-area-inset-bottom));\n right: max(20px, env(safe-area-inset-right));\n }\n\n .cw-widget {\n width: 100vw;\n max-width: 100vw;\n height: 100dvh;\n max-height: 100dvh;\n border-radius: 0;\n transform-origin: bottom center;\n }\n}\n";
2470
+ s.id = "jrapps-style-6b6fcb3b";
2471
+ s.textContent = "/* \u2500\u2500\u2500 Root container \u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\n * Fixed to bottom-right by default so it works out-of-the-box.\n * Override with your own positioning class if embedding differently.\n * \u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500 */\n.cw-root {\n position: fixed;\n bottom: max(24px, env(safe-area-inset-bottom));\n right: max(24px, env(safe-area-inset-right));\n display: flex;\n flex-direction: column;\n align-items: flex-end;\n gap: 12px;\n z-index: 9999;\n /* Scope CSS vars and stacking context */\n isolation: isolate;\n font-family: var(--cw-font-family);\n font-size: var(--cw-font-size);\n}\n\n/* \u2500\u2500\u2500 Editor React Component root \u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\n * Fills the container provided by the Wix editor. No fixed positioning,\n * no launcher button. Width & height are managed by the editor itself.\n * \u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500 */\n.cw-erc-root {\n display: flex;\n flex-direction: column;\n width: 100%;\n height: 100%;\n background-color: var(--cw-background, #ffffff);\n font-family: var(--cw-font-family, -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, sans-serif);\n font-size: var(--cw-font-size, 14px);\n overflow: hidden;\n}\n\n/* Widget body fills remaining space between header and footer */\n.cw-erc-root .cw-widget__body {\n flex: 1;\n display: flex;\n flex-direction: column;\n overflow: hidden;\n}\n\n/* \u2500\u2500\u2500 Widget Panel \u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500 */\n\n.cw-widget {\n display: flex;\n flex-direction: column;\n width: var(--cw-width);\n height: var(--cw-height);\n /* Clamp so it never overflows the viewport on small screens */\n max-width: calc(100vw - 48px);\n max-height: calc(100dvh - 96px);\n background-color: var(--cw-background);\n border-radius: var(--cw-border-radius);\n box-shadow: var(--cw-shadow);\n overflow: hidden;\n /* Entry animation */\n animation: cw-panel-in 0.22s ease;\n transform-origin: bottom right;\n}\n\n@keyframes cw-panel-in {\n from {\n opacity: 0;\n transform: scale(0.92) translateY(10px);\n }\n to {\n opacity: 1;\n transform: scale(1) translateY(0);\n }\n}\n\n.cw-widget__body {\n display: flex;\n flex-direction: column;\n flex: 1;\n overflow: hidden;\n}\n\n/* \u2500\u2500\u2500 Launcher Button \u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500 */\n\n.cw-launcher {\n width: 56px;\n height: 56px;\n border-radius: 50%;\n border: none;\n background-color: var(--cw-primary);\n color: #ffffff;\n cursor: pointer;\n display: flex;\n align-items: center;\n justify-content: center;\n box-shadow: 0 4px 16px rgba(0, 0, 0, 0.2);\n flex-shrink: 0;\n transition: transform 0.15s ease, box-shadow 0.15s ease;\n}\n\n.cw-launcher:hover {\n transform: scale(1.07);\n box-shadow: 0 6px 20px rgba(0, 0, 0, 0.26);\n}\n\n.cw-launcher:focus-visible {\n outline: 3px solid var(--cw-primary);\n outline-offset: 3px;\n}\n\n.cw-launcher:active {\n transform: scale(0.96);\n}\n\n/* \u2500\u2500\u2500 Tablet (481px \u2013 768px): panel floats, slightly narrower margin \u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500 */\n\n@media (min-width: 481px) and (max-width: 768px) {\n .cw-root {\n bottom: max(16px, env(safe-area-inset-bottom));\n right: max(16px, env(safe-area-inset-right));\n }\n\n .cw-widget {\n max-width: calc(100vw - 32px);\n max-height: calc(100dvh - 80px);\n }\n}\n\n/* \u2500\u2500\u2500 Mobile (\u2264 480px): full-screen panel, launcher stays fixed \u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500 */\n\n@media (max-width: 480px) {\n .cw-root {\n bottom: 0;\n right: 0;\n gap: 0;\n }\n\n .cw-root > .cw-launcher {\n position: fixed;\n bottom: max(20px, env(safe-area-inset-bottom));\n right: max(20px, env(safe-area-inset-right));\n }\n\n .cw-widget {\n width: 100vw;\n max-width: 100vw;\n height: 100dvh;\n max-height: 100dvh;\n border-radius: 0;\n transform-origin: bottom center;\n }\n}\n";
2147
2472
  document.head.appendChild(s);
2148
2473
  }
2149
2474
 
2150
- // src/components/SiteChatComponentNew/SiteChatComponentNew.tsx
2151
- var import_jsx_runtime27 = require("react/jsx-runtime");
2152
- var SiteChatComponentNew = import_react12.default.forwardRef(({
2475
+ // src/components/SiteChatComponentNewErc/SiteChatComponentNewErc.tsx
2476
+ var import_jsx_runtime34 = require("react/jsx-runtime");
2477
+ var SiteChatComponentNewErc = import_react10.default.forwardRef(({
2153
2478
  title,
2154
2479
  subtitle,
2155
2480
  image,
@@ -2164,24 +2489,26 @@ var SiteChatComponentNew = import_react12.default.forwardRef(({
2164
2489
  onSend,
2165
2490
  onAttachment,
2166
2491
  onOfflineSubmit,
2167
- onClose
2492
+ onClose,
2493
+ isEditorReactComponent = false,
2494
+ editorReactComponentThemeProps
2168
2495
  }, ref) => {
2169
- const { open, openWidget, closeWidget } = useSiteChatComponentNew(defaultOpen);
2170
- const themeVars = buildThemeVars(theme, width, height);
2496
+ const { open, openWidget, closeWidget } = useSiteChatComponentNewErc(defaultOpen);
2497
+ const themeVars = buildThemeVars2(theme, width, height);
2171
2498
  const handleClose = () => {
2172
2499
  closeWidget();
2173
2500
  onClose == null ? void 0 : onClose();
2174
2501
  };
2175
- const renderBody = () => {
2502
+ const renderBody = (convClasses, footerClasses) => {
2176
2503
  if (loading) {
2177
- return /* @__PURE__ */ (0, import_jsx_runtime27.jsx)(LoadingState_default, {});
2504
+ return /* @__PURE__ */ (0, import_jsx_runtime34.jsx)(LoadingState_default2, {});
2178
2505
  }
2179
2506
  if (offlineForm) {
2180
- return /* @__PURE__ */ (0, import_jsx_runtime27.jsx)(OfflineState_default, { form: offlineForm, onSubmit: onOfflineSubmit });
2507
+ return /* @__PURE__ */ (0, import_jsx_runtime34.jsx)(OfflineState_default2, { form: offlineForm, onSubmit: onOfflineSubmit });
2181
2508
  }
2182
2509
  if (messages.length === 0) {
2183
- return /* @__PURE__ */ (0, import_jsx_runtime27.jsx)(
2184
- StartChatState_default,
2510
+ return /* @__PURE__ */ (0, import_jsx_runtime34.jsx)(
2511
+ StartChatState_default2,
2185
2512
  {
2186
2513
  image,
2187
2514
  title,
@@ -2190,13 +2517,40 @@ var SiteChatComponentNew = import_react12.default.forwardRef(({
2190
2517
  }
2191
2518
  );
2192
2519
  }
2193
- return /* @__PURE__ */ (0, import_jsx_runtime27.jsxs)(import_jsx_runtime27.Fragment, { children: [
2194
- /* @__PURE__ */ (0, import_jsx_runtime27.jsx)(MessageList_default, { messages }),
2195
- chatEnded ? /* @__PURE__ */ (0, import_jsx_runtime27.jsx)(ChatEndedState_default, {}) : /* @__PURE__ */ (0, import_jsx_runtime27.jsx)(Footer_default, { onSend, onAttachment })
2520
+ return /* @__PURE__ */ (0, import_jsx_runtime34.jsxs)(import_jsx_runtime34.Fragment, { children: [
2521
+ /* @__PURE__ */ (0, import_jsx_runtime34.jsx)(MessageList_default2, { messages, ercClasses: convClasses }),
2522
+ chatEnded ? /* @__PURE__ */ (0, import_jsx_runtime34.jsx)(ChatEndedState_default2, {}) : /* @__PURE__ */ (0, import_jsx_runtime34.jsx)(Footer_default2, { onSend, onAttachment, ercClasses: footerClasses })
2196
2523
  ] });
2197
2524
  };
2198
- return /* @__PURE__ */ (0, import_jsx_runtime27.jsxs)("div", { ref, className: "cw-root", style: themeVars, children: [
2199
- open && /* @__PURE__ */ (0, import_jsx_runtime27.jsxs)(
2525
+ if (isEditorReactComponent) {
2526
+ const ercTheme = editorReactComponentThemeProps;
2527
+ const ercStyle = ercTheme ? void 0 : buildThemeVars2(theme);
2528
+ return /* @__PURE__ */ (0, import_jsx_runtime34.jsxs)("div", { ref, className: "cw-erc-root", style: ercStyle, children: [
2529
+ /* @__PURE__ */ (0, import_jsx_runtime34.jsx)(
2530
+ Header_default2,
2531
+ {
2532
+ image,
2533
+ title,
2534
+ subtitle,
2535
+ onClose: onClose != null ? onClose : (() => {
2536
+ }),
2537
+ ercClasses: ercTheme == null ? void 0 : ercTheme.header
2538
+ }
2539
+ ),
2540
+ /* @__PURE__ */ (0, import_jsx_runtime34.jsx)(
2541
+ "div",
2542
+ {
2543
+ className: [
2544
+ "cw-widget__body",
2545
+ ercTheme == null ? void 0 : ercTheme.conversation.conversationClassName
2546
+ ].filter(Boolean).join(" "),
2547
+ children: renderBody(ercTheme == null ? void 0 : ercTheme.conversation, ercTheme == null ? void 0 : ercTheme.footer)
2548
+ }
2549
+ )
2550
+ ] });
2551
+ }
2552
+ return /* @__PURE__ */ (0, import_jsx_runtime34.jsxs)("div", { ref, className: "cw-root", style: themeVars, children: [
2553
+ open && /* @__PURE__ */ (0, import_jsx_runtime34.jsxs)(
2200
2554
  "div",
2201
2555
  {
2202
2556
  className: "cw-widget",
@@ -2204,8 +2558,8 @@ var SiteChatComponentNew = import_react12.default.forwardRef(({
2204
2558
  "aria-modal": "true",
2205
2559
  "aria-label": `${title} chat widget`,
2206
2560
  children: [
2207
- /* @__PURE__ */ (0, import_jsx_runtime27.jsx)(
2208
- Header_default,
2561
+ /* @__PURE__ */ (0, import_jsx_runtime34.jsx)(
2562
+ Header_default2,
2209
2563
  {
2210
2564
  image,
2211
2565
  title,
@@ -2213,11 +2567,11 @@ var SiteChatComponentNew = import_react12.default.forwardRef(({
2213
2567
  onClose: handleClose
2214
2568
  }
2215
2569
  ),
2216
- /* @__PURE__ */ (0, import_jsx_runtime27.jsx)("div", { className: "cw-widget__body", children: renderBody() })
2570
+ /* @__PURE__ */ (0, import_jsx_runtime34.jsx)("div", { className: "cw-widget__body", children: renderBody() })
2217
2571
  ]
2218
2572
  }
2219
2573
  ),
2220
- !open && /* @__PURE__ */ (0, import_jsx_runtime27.jsx)(
2574
+ !open && /* @__PURE__ */ (0, import_jsx_runtime34.jsx)(
2221
2575
  "button",
2222
2576
  {
2223
2577
  className: "cw-launcher",
@@ -2225,7 +2579,7 @@ var SiteChatComponentNew = import_react12.default.forwardRef(({
2225
2579
  "aria-label": "Open chat",
2226
2580
  "aria-haspopup": "dialog",
2227
2581
  type: "button",
2228
- children: /* @__PURE__ */ (0, import_jsx_runtime27.jsx)(
2582
+ children: /* @__PURE__ */ (0, import_jsx_runtime34.jsx)(
2229
2583
  "svg",
2230
2584
  {
2231
2585
  xmlns: "http://www.w3.org/2000/svg",
@@ -2234,12 +2588,12 @@ var SiteChatComponentNew = import_react12.default.forwardRef(({
2234
2588
  viewBox: "0 0 24 24",
2235
2589
  fill: "currentColor",
2236
2590
  "aria-hidden": "true",
2237
- children: /* @__PURE__ */ (0, import_jsx_runtime27.jsx)("path", { d: "M20 2H4c-1.1 0-2 .9-2 2v18l4-4h14c1.1 0 2-.9 2-2V4c0-1.1-.9-2-2-2z" })
2591
+ children: /* @__PURE__ */ (0, import_jsx_runtime34.jsx)("path", { d: "M20 2H4c-1.1 0-2 .9-2 2v18l4-4h14c1.1 0 2-.9 2-2V4c0-1.1-.9-2-2-2z" })
2238
2592
  }
2239
2593
  )
2240
2594
  }
2241
2595
  )
2242
2596
  ] });
2243
2597
  });
2244
- SiteChatComponentNew.displayName = "SiteChatComponentNew";
2598
+ SiteChatComponentNewErc.displayName = "SiteChatComponentNewErc";
2245
2599
  //# sourceMappingURL=index.js.map