@jrapps/my_tickets_chat_ui 0.2.3 → 0.3.2

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 (129) hide show
  1. package/dist/cjs/components/SiteChatComponentNewErc/index.js +1334 -0
  2. package/dist/cjs/components/SiteChatComponentNewErc/index.js.map +7 -0
  3. package/dist/cjs/index.js +1505 -1169
  4. package/dist/cjs/index.js.map +4 -4
  5. package/dist/esm/chunks/chunk-364KVRPG.mjs +1302 -0
  6. package/dist/esm/chunks/chunk-364KVRPG.mjs.map +7 -0
  7. package/dist/esm/chunks/{chunk-QGWQSJDB.js → chunk-54X5DYPJ.mjs} +1 -1
  8. package/dist/esm/components/SiteChatComponentNew/{index.js → index.mjs} +2 -2
  9. package/dist/esm/components/SiteChatComponentNewErc/index.mjs +9 -0
  10. package/dist/esm/index.mjs +15 -0
  11. package/dist/types/components/SiteChatComponentNewErc/Footer/Footer.d.ts +6 -0
  12. package/dist/types/components/SiteChatComponentNewErc/Footer/Footer.d.ts.map +1 -0
  13. package/dist/types/components/SiteChatComponentNewErc/Footer/index.d.ts +2 -0
  14. package/dist/types/components/SiteChatComponentNewErc/Footer/index.d.ts.map +1 -0
  15. package/dist/types/components/SiteChatComponentNewErc/Header/Header.d.ts +6 -0
  16. package/dist/types/components/SiteChatComponentNewErc/Header/Header.d.ts.map +1 -0
  17. package/dist/types/components/SiteChatComponentNewErc/Header/index.d.ts +2 -0
  18. package/dist/types/components/SiteChatComponentNewErc/Header/index.d.ts.map +1 -0
  19. package/dist/types/components/SiteChatComponentNewErc/Messages/AgentMessage.d.ts +10 -0
  20. package/dist/types/components/SiteChatComponentNewErc/Messages/AgentMessage.d.ts.map +1 -0
  21. package/dist/types/components/SiteChatComponentNewErc/Messages/AttachmentMessage.d.ts +9 -0
  22. package/dist/types/components/SiteChatComponentNewErc/Messages/AttachmentMessage.d.ts.map +1 -0
  23. package/dist/types/components/SiteChatComponentNewErc/Messages/MessageList.d.ts +10 -0
  24. package/dist/types/components/SiteChatComponentNewErc/Messages/MessageList.d.ts.map +1 -0
  25. package/dist/types/components/SiteChatComponentNewErc/Messages/MessageRenderer.d.ts +9 -0
  26. package/dist/types/components/SiteChatComponentNewErc/Messages/MessageRenderer.d.ts.map +1 -0
  27. package/dist/types/components/SiteChatComponentNewErc/Messages/SystemMessage.d.ts +10 -0
  28. package/dist/types/components/SiteChatComponentNewErc/Messages/SystemMessage.d.ts.map +1 -0
  29. package/dist/types/components/SiteChatComponentNewErc/Messages/TypingIndicator.d.ts +5 -0
  30. package/dist/types/components/SiteChatComponentNewErc/Messages/TypingIndicator.d.ts.map +1 -0
  31. package/dist/types/components/SiteChatComponentNewErc/Messages/UserMessage.d.ts +10 -0
  32. package/dist/types/components/SiteChatComponentNewErc/Messages/UserMessage.d.ts.map +1 -0
  33. package/dist/types/components/SiteChatComponentNewErc/Messages/index.d.ts +8 -0
  34. package/dist/types/components/SiteChatComponentNewErc/Messages/index.d.ts.map +1 -0
  35. package/dist/types/components/SiteChatComponentNewErc/OfflineForm/OfflineForm.d.ts +10 -0
  36. package/dist/types/components/SiteChatComponentNewErc/OfflineForm/OfflineForm.d.ts.map +1 -0
  37. package/dist/types/components/SiteChatComponentNewErc/OfflineForm/index.d.ts +2 -0
  38. package/dist/types/components/SiteChatComponentNewErc/OfflineForm/index.d.ts.map +1 -0
  39. package/dist/types/components/SiteChatComponentNewErc/Shared/Avatar.d.ts +10 -0
  40. package/dist/types/components/SiteChatComponentNewErc/Shared/Avatar.d.ts.map +1 -0
  41. package/dist/types/components/SiteChatComponentNewErc/Shared/Button.d.ts +14 -0
  42. package/dist/types/components/SiteChatComponentNewErc/Shared/Button.d.ts.map +1 -0
  43. package/dist/types/components/SiteChatComponentNewErc/Shared/index.d.ts +3 -0
  44. package/dist/types/components/SiteChatComponentNewErc/Shared/index.d.ts.map +1 -0
  45. package/dist/types/components/SiteChatComponentNewErc/SiteChatComponentNewErc.d.ts +5 -0
  46. package/dist/types/components/SiteChatComponentNewErc/SiteChatComponentNewErc.d.ts.map +1 -0
  47. package/dist/types/components/SiteChatComponentNewErc/SiteChatComponentNewErc.types.d.ts +146 -0
  48. package/dist/types/components/SiteChatComponentNewErc/SiteChatComponentNewErc.types.d.ts.map +1 -0
  49. package/dist/types/components/SiteChatComponentNewErc/States/ChatEndedState.d.ts +5 -0
  50. package/dist/types/components/SiteChatComponentNewErc/States/ChatEndedState.d.ts.map +1 -0
  51. package/dist/types/components/SiteChatComponentNewErc/States/LoadingState.d.ts +5 -0
  52. package/dist/types/components/SiteChatComponentNewErc/States/LoadingState.d.ts.map +1 -0
  53. package/dist/types/components/SiteChatComponentNewErc/States/OfflineState.d.ts +10 -0
  54. package/dist/types/components/SiteChatComponentNewErc/States/OfflineState.d.ts.map +1 -0
  55. package/dist/types/components/SiteChatComponentNewErc/States/StartChatState.d.ts +11 -0
  56. package/dist/types/components/SiteChatComponentNewErc/States/StartChatState.d.ts.map +1 -0
  57. package/dist/types/components/SiteChatComponentNewErc/States/index.d.ts +5 -0
  58. package/dist/types/components/SiteChatComponentNewErc/States/index.d.ts.map +1 -0
  59. package/dist/types/components/SiteChatComponentNewErc/hooks/index.d.ts +3 -0
  60. package/dist/types/components/SiteChatComponentNewErc/hooks/index.d.ts.map +1 -0
  61. package/dist/types/components/SiteChatComponentNewErc/hooks/useAutoScroll.d.ts +15 -0
  62. package/dist/types/components/SiteChatComponentNewErc/hooks/useAutoScroll.d.ts.map +1 -0
  63. package/dist/types/components/SiteChatComponentNewErc/hooks/useOfflineForm.d.ts +12 -0
  64. package/dist/types/components/SiteChatComponentNewErc/hooks/useOfflineForm.d.ts.map +1 -0
  65. package/dist/types/components/SiteChatComponentNewErc/index.d.ts +4 -0
  66. package/dist/types/components/SiteChatComponentNewErc/index.d.ts.map +1 -0
  67. package/dist/types/components/SiteChatComponentNewErc/useSiteChatComponentNewErc.d.ts +3 -0
  68. package/dist/types/components/SiteChatComponentNewErc/useSiteChatComponentNewErc.d.ts.map +1 -0
  69. package/dist/types/components/SiteChatComponentNewErc/utils/classNames.d.ts +28 -0
  70. package/dist/types/components/SiteChatComponentNewErc/utils/classNames.d.ts.map +1 -0
  71. package/dist/types/components/SiteChatComponentNewErc/utils/format.d.ts +9 -0
  72. package/dist/types/components/SiteChatComponentNewErc/utils/format.d.ts.map +1 -0
  73. package/dist/types/components/SiteChatComponentNewErc/utils/index.d.ts +4 -0
  74. package/dist/types/components/SiteChatComponentNewErc/utils/index.d.ts.map +1 -0
  75. package/dist/types/components/SiteChatComponentNewErc/utils/systemMessages.d.ts +4 -0
  76. package/dist/types/components/SiteChatComponentNewErc/utils/systemMessages.d.ts.map +1 -0
  77. package/dist/types/components/SiteChatComponentNewErc/utils/theme.d.ts +8 -0
  78. package/dist/types/components/SiteChatComponentNewErc/utils/theme.d.ts.map +1 -0
  79. package/dist/types/components/index.d.ts +1 -1
  80. package/dist/types/components/index.d.ts.map +1 -1
  81. package/package.json +4 -7
  82. package/dist/cjs/components/SiteChatComponent/index.js +0 -998
  83. package/dist/cjs/components/SiteChatComponent/index.js.map +0 -7
  84. package/dist/esm/chunks/chunk-QPJPV2T3.js +0 -971
  85. package/dist/esm/chunks/chunk-QPJPV2T3.js.map +0 -7
  86. package/dist/esm/components/SiteChatComponent/index.js +0 -7
  87. package/dist/esm/index.js +0 -13
  88. package/dist/types/components/SiteChatComponent/FabButton/FabButton.d.ts +0 -4
  89. package/dist/types/components/SiteChatComponent/FabButton/FabButton.d.ts.map +0 -1
  90. package/dist/types/components/SiteChatComponent/FabButton/FabButton.types.d.ts +0 -8
  91. package/dist/types/components/SiteChatComponent/FabButton/FabButton.types.d.ts.map +0 -1
  92. package/dist/types/components/SiteChatComponent/Footer/Footer.d.ts +0 -4
  93. package/dist/types/components/SiteChatComponent/Footer/Footer.d.ts.map +0 -1
  94. package/dist/types/components/SiteChatComponent/Footer/Footer.types.d.ts +0 -45
  95. package/dist/types/components/SiteChatComponent/Footer/Footer.types.d.ts.map +0 -1
  96. package/dist/types/components/SiteChatComponent/Footer/attachment-list/attachment-list.d.ts +0 -5
  97. package/dist/types/components/SiteChatComponent/Footer/attachment-list/attachment-list.d.ts.map +0 -1
  98. package/dist/types/components/SiteChatComponent/Footer/message-input/message-input.d.ts +0 -18
  99. package/dist/types/components/SiteChatComponent/Footer/message-input/message-input.d.ts.map +0 -1
  100. package/dist/types/components/SiteChatComponent/Footer/message-input/open-file-picker.d.ts +0 -10
  101. package/dist/types/components/SiteChatComponent/Footer/message-input/open-file-picker.d.ts.map +0 -1
  102. package/dist/types/components/SiteChatComponent/Footer/send-button/send-button.d.ts +0 -10
  103. package/dist/types/components/SiteChatComponent/Footer/send-button/send-button.d.ts.map +0 -1
  104. package/dist/types/components/SiteChatComponent/Header/Header.d.ts +0 -4
  105. package/dist/types/components/SiteChatComponent/Header/Header.d.ts.map +0 -1
  106. package/dist/types/components/SiteChatComponent/Header/Header.types.d.ts +0 -8
  107. package/dist/types/components/SiteChatComponent/Header/Header.types.d.ts.map +0 -1
  108. package/dist/types/components/SiteChatComponent/MessageContainer/MessageContainer.d.ts +0 -4
  109. package/dist/types/components/SiteChatComponent/MessageContainer/MessageContainer.d.ts.map +0 -1
  110. package/dist/types/components/SiteChatComponent/MessageContainer/MessageContainer.types.d.ts +0 -7
  111. package/dist/types/components/SiteChatComponent/MessageContainer/MessageContainer.types.d.ts.map +0 -1
  112. package/dist/types/components/SiteChatComponent/MessageContainer/messages/attachment.d.ts +0 -5
  113. package/dist/types/components/SiteChatComponent/MessageContainer/messages/attachment.d.ts.map +0 -1
  114. package/dist/types/components/SiteChatComponent/MessageContainer/messages/messages-wrapper.d.ts +0 -5
  115. package/dist/types/components/SiteChatComponent/MessageContainer/messages/messages-wrapper.d.ts.map +0 -1
  116. package/dist/types/components/SiteChatComponent/SiteChatComponent.d.ts +0 -11
  117. package/dist/types/components/SiteChatComponent/SiteChatComponent.d.ts.map +0 -1
  118. package/dist/types/components/SiteChatComponent/SiteChatComponent.types.d.ts +0 -10
  119. package/dist/types/components/SiteChatComponent/SiteChatComponent.types.d.ts.map +0 -1
  120. package/dist/types/components/SiteChatComponent/index.d.ts +0 -6
  121. package/dist/types/components/SiteChatComponent/index.d.ts.map +0 -1
  122. package/dist/types/components/SiteChatComponent/useSiteChatComponent.d.ts +0 -8
  123. package/dist/types/components/SiteChatComponent/useSiteChatComponent.d.ts.map +0 -1
  124. package/dist/types/test/test.d.ts +0 -8
  125. package/dist/types/test/test.d.ts.map +0 -1
  126. /package/dist/esm/chunks/{chunk-QGWQSJDB.js.map → chunk-54X5DYPJ.mjs.map} +0 -0
  127. /package/dist/esm/components/{SiteChatComponent/index.js.map → SiteChatComponentNew/index.mjs.map} +0 -0
  128. /package/dist/esm/components/{SiteChatComponentNew/index.js.map → SiteChatComponentNewErc/index.mjs.map} +0 -0
  129. /package/dist/esm/{index.js.map → index.mjs.map} +0 -0
package/dist/cjs/index.js CHANGED
@@ -30,994 +30,1296 @@ 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");
40
+ // src/components/SiteChatComponentNew/SiteChatComponentNew.tsx
41
+ var import_react5 = __toESM(require("react"));
42
+
43
+ // src/components/SiteChatComponentNew/useSiteChatComponentNew.ts
44
+ var import_react = require("react");
45
+ function useSiteChatComponentNew(defaultOpen = 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), []);
49
+ return { open, openWidget, closeWidget };
50
+ }
51
+
52
+ // src/components/SiteChatComponentNew/utils/theme.ts
53
+ var FONT_FAMILY = "-apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, sans-serif";
54
+ var FONT_SIZE = "14px";
55
+ var SHADOW = "0 4px 24px rgba(0,0,0,0.12)";
56
+ var WIDTH = "400px";
57
+ var HEIGHT = "600px";
58
+ var HEADER_HEIGHT = "64px";
59
+ var defaultTheme = {
60
+ primary: "#4f46e5",
61
+ background: "#ffffff",
62
+ surface: "#f9fafb",
63
+ border: "#e5e7eb",
64
+ userBubble: "#4f46e5",
65
+ userText: "#ffffff",
66
+ agentBubble: "#f3f4f6",
67
+ agentText: "#111827",
68
+ systemText: "#6b7280",
69
+ inputBackground: "#ffffff",
70
+ inputBorder: "#d1d5db",
71
+ buttonRadius: 8,
72
+ borderRadius: 12
73
+ };
74
+ function buildThemeVars(partial, width, height) {
75
+ const theme = { ...defaultTheme, ...partial };
76
+ return {
77
+ // Colours
78
+ "--cw-primary": theme.primary,
79
+ "--cw-background": theme.background,
80
+ "--cw-surface": theme.surface,
81
+ "--cw-border": theme.border,
82
+ "--cw-user-bubble": theme.userBubble,
83
+ "--cw-user-text": theme.userText,
84
+ "--cw-agent-bubble": theme.agentBubble,
85
+ "--cw-agent-text": theme.agentText,
86
+ "--cw-system-text": theme.systemText,
87
+ "--cw-input-background": theme.inputBackground,
88
+ "--cw-input-border": theme.inputBorder,
89
+ // Border radii
90
+ "--cw-button-radius": `${theme.buttonRadius}px`,
91
+ "--cw-border-radius": `${theme.borderRadius}px`,
92
+ // Fixed constants — not exposed as theme props
93
+ "--cw-font-family": FONT_FAMILY,
94
+ "--cw-font-size": FONT_SIZE,
95
+ "--cw-shadow": SHADOW,
96
+ "--cw-width": width !== void 0 ? typeof width === "number" ? `${width}px` : width : WIDTH,
97
+ "--cw-height": height !== void 0 ? typeof height === "number" ? `${height}px` : height : HEIGHT,
98
+ "--cw-header-height": HEADER_HEIGHT
99
+ };
100
+ }
101
+
102
+ // src/components/SiteChatComponentNew/utils/systemMessages.ts
103
+ var systemEventLabels = {
104
+ AGENT_JOINED: "Agent joined",
105
+ AGENT_LEFT: "Agent left",
106
+ USER_JOINED: "You joined",
107
+ USER_LEFT: "You left",
108
+ CHAT_ENDED: "Chat ended",
109
+ CHAT_REOPENED: "Chat reopened",
110
+ CHAT_TRANSFERRED: "Chat transferred",
111
+ WAITING_FOR_AGENT: "Waiting for an agent"
112
+ };
113
+ function getSystemLabel(event) {
114
+ var _a;
115
+ return (_a = systemEventLabels[event]) != null ? _a : event;
116
+ }
117
+
118
+ // src/components/SiteChatComponentNew/utils/format.ts
119
+ function formatTime(timestamp) {
120
+ return new Date(timestamp).toLocaleTimeString([], {
121
+ hour: "2-digit",
122
+ minute: "2-digit"
123
+ });
124
+ }
125
+
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
+ }
43
445
 
44
- // src/components/SiteChatComponent/useSiteChatComponent.ts
45
- function useSiteChatComponent() {
46
- return {};
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);
47
452
  }
48
453
 
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",
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",
66
486
  {
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
- ]
487
+ src,
488
+ alt: name ? `${name} avatar` : "Agent avatar",
489
+ className: "cw-avatar cw-avatar--image",
490
+ style
74
491
  }
75
- ) });
492
+ );
76
493
  }
77
- );
78
- FabButton.displayName = "SiteChatComponent.FabButton";
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;
79
505
 
80
- // src/components/SiteChatComponent/Footer/Footer.tsx
81
- var import_react3 = __toESM(require("react"));
82
- var import_design_system4 = require("@wix/design-system");
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
+ }
83
513
 
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 = "",
514
+ // src/components/SiteChatComponentNew/Shared/Button.tsx
515
+ var import_jsx_runtime5 = require("react/jsx-runtime");
516
+ var Button = ({
517
+ children,
89
518
  onClick,
90
- disabled = false
519
+ variant = "primary",
520
+ disabled = false,
521
+ type = "button",
522
+ fullWidth = false,
523
+ ariaLabel
91
524
  }) => {
92
- return /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(
525
+ return /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(
93
526
  "button",
94
527
  {
95
- className: `site-chat-component-footer-my-tickets-chat-widget-send-button ${className}`,
528
+ className: `cw-button cw-button--${variant}${fullWidth ? " cw-button--full" : ""}`,
96
529
  onClick,
97
530
  disabled,
98
- children: text
531
+ type,
532
+ "aria-label": ariaLabel,
533
+ children
99
534
  }
100
535
  );
101
536
  };
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;
537
+ var Button_default = Button;
133
538
 
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");
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
+ }
137
546
 
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) => {
547
+ // src/components/SiteChatComponentNew/Messages/AgentMessage.tsx
548
+ var import_jsx_runtime6 = require("react/jsx-runtime");
549
+ var AgentMessage = ({ message }) => {
142
550
  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;
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
+ ]
181
565
  }
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
- }
566
+ );
191
567
  };
568
+ var AgentMessage_default = AgentMessage;
192
569
 
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);
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
+ ]
214
594
  }
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
- ] });
595
+ );
231
596
  };
232
- var message_input_default = MessageInput;
597
+ var SystemMessage_default = SystemMessage;
233
598
 
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";
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
+ }
281
606
 
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)(
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)(
302
647
  "button",
303
648
  {
304
- onClick: onClose,
305
- "aria-label": "Close",
306
- className: "site-chat-component-header-close-button",
307
- children: "\u2715"
649
+ className: "cw-attachment-message__open-btn",
650
+ onClick: handleOpen,
651
+ "aria-label": `Open attachment ${attachment.name}`,
652
+ type: "button",
653
+ children: "Open"
308
654
  }
309
655
  )
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
- ] });
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
+ );
427
667
  };
428
- var messages_wrapper_default = MessagesWrapper;
668
+ var AttachmentMessage_default = AttachmentMessage;
429
669
 
430
- // src/components/SiteChatComponent/MessageContainer/MessageContainer.tsx
670
+ // src/components/SiteChatComponentNew/Messages/MessageRenderer.tsx
431
671
  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
- ] });
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;
445
685
  }
446
- );
447
- MessageContainer.displayName = "SiteChatComponent.MessageContainer";
686
+ };
687
+ var MessageRenderer_default = MessageRenderer;
448
688
 
449
- // src/components/SiteChatComponent/SiteChatComponent.css
450
- if (typeof document !== "undefined" && !document.getElementById("jrapps-style-3c48ccde")) {
689
+ // src/components/SiteChatComponentNew/Messages/MessageList.css
690
+ if (typeof document !== "undefined" && !document.getElementById("jrapps-style-15ae1a6b")) {
451
691
  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;
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);
497
695
  }
498
696
 
499
- /* ---------- Footer styles ---------- */
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;
500
724
 
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);
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);
506
731
  }
507
732
 
508
- .site-chat-component-footer-attachment-icon-button {
509
- width: 20px;
510
- height: 20px;
511
- }
733
+ // src/components/SiteChatComponentNew/Messages/TypingIndicator.tsx
734
+ var import_jsx_runtime11 = require("react/jsx-runtime");
512
735
 
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;
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);
521
742
  }
522
743
 
523
- .site-chat-component-footer-my-tickets-chat-widget-send-button:disabled {
524
- opacity: 0.5;
525
- cursor: default;
526
- }
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;
527
762
 
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;
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);
537
769
  }
538
770
 
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
- }
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;
550
802
 
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;
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 {
574
808
  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;
809
+ flex-direction: column;
810
+ gap: 14px;
603
811
  }
604
812
 
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;
813
+ .cw-offline-form__title {
814
+ font-size: 15px;
815
+ font-weight: 600;
816
+ color: var(--cw-agent-text);
817
+ margin: 0 0 4px;
615
818
  }
616
819
 
617
- .site-chat-component-message-container-messages-wrapper {
820
+ /* Field wrapper */
821
+ .cw-offline-form__field {
618
822
  display: flex;
619
823
  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);
824
+ gap: 5px;
631
825
  }
632
826
 
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;
827
+ .cw-offline-form__field--checkbox {
828
+ gap: 4px;
637
829
  }
638
830
 
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);
831
+ /* Label */
832
+ .cw-offline-form__label {
833
+ font-size: 13px;
642
834
  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);
835
+ color: var(--cw-agent-text);
659
836
  }
660
837
 
661
- .site-chat-component-message-container-user-message {
662
- font-size: var(--my-tickets-chat-widget-panel-messages-user-text-size);
838
+ .cw-offline-form__required {
839
+ color: #ef4444;
663
840
  }
664
841
 
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);
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;
670
854
  }
671
855
 
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);
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);
678
860
  }
679
861
 
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;
862
+ .cw-offline-form__input--error {
863
+ border-color: #ef4444;
686
864
  }
687
865
 
688
- /* System Messages */
689
-
690
- .site-chat-component-message-container-system-message {
691
- display: flex;
692
- justify-content: center;
693
- align-items: center;
866
+ /* Textarea */
867
+ .cw-offline-form__textarea {
694
868
  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;
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;
703
879
  }
704
880
 
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;
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);
711
885
  }
712
886
 
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;
887
+ .cw-offline-form__textarea--error {
888
+ border-color: #ef4444;
720
889
  }
721
890
 
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);
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;
726
909
  }
727
910
 
728
- .site-chat-component-message-container-loading-state {
729
- display: flex;
730
- flex: 1;
731
- align-items: center;
732
- justify-content: center;
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);
733
915
  }
734
916
 
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);
917
+ .cw-offline-form__select--error {
918
+ border-color: #ef4444;
739
919
  }
740
920
 
741
- .site-chat-component-message-container-in-chat-file-item-container {
921
+ /* Checkbox */
922
+ .cw-offline-form__checkbox-label {
742
923
  display: flex;
743
- align-items: center;
924
+ align-items: flex-start;
744
925
  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;
926
+ cursor: pointer;
927
+ font-size: 13px;
928
+ color: var(--cw-agent-text);
750
929
  }
751
930
 
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;
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;
763
938
  }
764
939
 
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));
940
+ .cw-offline-form__checkbox:focus-visible {
941
+ outline: 2px solid var(--cw-primary);
942
+ outline-offset: 2px;
772
943
  }
773
944
 
774
- .site-chat-component-message-container-in-chat-file-icon {
775
- fill: black !important;
945
+ .cw-offline-form__checkbox-text {
946
+ line-height: 1.4;
776
947
  }
777
948
 
778
- .site-chat-component-message-container-in-chat-file-names-container {
779
- display: flex;
780
- flex-direction: column;
781
- gap: 0px;
949
+ /* Error message */
950
+ .cw-offline-form__error {
951
+ font-size: 12px;
952
+ color: #ef4444;
953
+ font-weight: 500;
782
954
  }
783
955
 
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;
956
+ /* Actions */
957
+ .cw-offline-form__actions {
958
+ margin-top: 4px;
788
959
  }
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;
960
+ `;
961
+ document.head.appendChild(s);
794
962
  }
795
963
 
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;
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
+ ] });
935
1005
  }
936
-
937
- .site-chat-component-panel.open {
938
- top: 0;
939
- left: 0;
940
- right: 0;
941
- bottom: 0;
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
+ ] });
942
1030
  }
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;
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
+ ] });
951
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);
952
1120
  }
953
1121
 
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
- }
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);
961
1164
  }
962
- `;
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";
963
1204
  document.head.appendChild(s);
964
1205
  }
965
1206
 
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
- ] });
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
+ );
986
1249
  }
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 })
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 })
990
1253
  ] });
991
- }
992
- );
993
- SiteChatComponentRoot.displayName = "SiteChatComponent";
994
- var SiteChatComponent = Object.assign(SiteChatComponentRoot, {
995
- Header,
996
- MessageContainer,
997
- Footer,
998
- FabButton
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
+ ] });
999
1300
  });
1301
+ SiteChatComponentNew.displayName = "SiteChatComponentNew";
1000
1302
 
1001
- // src/components/SiteChatComponentNew/SiteChatComponentNew.tsx
1002
- var import_react12 = __toESM(require("react"));
1303
+ // src/components/SiteChatComponentNewErc/SiteChatComponentNewErc.tsx
1304
+ var import_react10 = __toESM(require("react"));
1003
1305
 
1004
- // src/components/SiteChatComponentNew/useSiteChatComponentNew.ts
1005
- var import_react8 = require("react");
1006
- 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), []);
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), []);
1010
1312
  return { open, openWidget, closeWidget };
1011
1313
  }
1012
1314
 
1013
- // src/components/SiteChatComponentNew/utils/theme.ts
1014
- var FONT_FAMILY = "-apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, sans-serif";
1015
- var FONT_SIZE = "14px";
1016
- var SHADOW = "0 4px 24px rgba(0,0,0,0.12)";
1017
- var WIDTH = "400px";
1018
- var HEIGHT = "600px";
1019
- var HEADER_HEIGHT = "64px";
1020
- var defaultTheme = {
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 = {
1021
1323
  primary: "#4f46e5",
1022
1324
  background: "#ffffff",
1023
1325
  surface: "#f9fafb",
@@ -1032,8 +1334,8 @@ var defaultTheme = {
1032
1334
  buttonRadius: 8,
1033
1335
  borderRadius: 12
1034
1336
  };
1035
- function buildThemeVars(partial, width, height) {
1036
- const theme = { ...defaultTheme, ...partial };
1337
+ function buildThemeVars2(partial, width, height) {
1338
+ const theme = { ...defaultTheme2, ...partial };
1037
1339
  return {
1038
1340
  // Colours
1039
1341
  "--cw-primary": theme.primary,
@@ -1051,17 +1353,17 @@ function buildThemeVars(partial, width, height) {
1051
1353
  "--cw-button-radius": `${theme.buttonRadius}px`,
1052
1354
  "--cw-border-radius": `${theme.borderRadius}px`,
1053
1355
  // Fixed constants — not exposed as theme props
1054
- "--cw-font-family": FONT_FAMILY,
1055
- "--cw-font-size": FONT_SIZE,
1056
- "--cw-shadow": SHADOW,
1057
- "--cw-width": width !== void 0 ? typeof width === "number" ? `${width}px` : width : WIDTH,
1058
- "--cw-height": height !== void 0 ? typeof height === "number" ? `${height}px` : height : HEIGHT,
1059
- "--cw-header-height": HEADER_HEIGHT
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
1060
1362
  };
1061
1363
  }
1062
1364
 
1063
- // src/components/SiteChatComponentNew/utils/systemMessages.ts
1064
- var systemEventLabels = {
1365
+ // src/components/SiteChatComponentNewErc/utils/systemMessages.ts
1366
+ var systemEventLabels2 = {
1065
1367
  AGENT_JOINED: "Agent joined",
1066
1368
  AGENT_LEFT: "Agent left",
1067
1369
  USER_JOINED: "You joined",
@@ -1071,53 +1373,53 @@ var systemEventLabels = {
1071
1373
  CHAT_TRANSFERRED: "Chat transferred",
1072
1374
  WAITING_FOR_AGENT: "Waiting for an agent"
1073
1375
  };
1074
- function getSystemLabel(event) {
1376
+ function getSystemLabel2(event) {
1075
1377
  var _a;
1076
- return (_a = systemEventLabels[event]) != null ? _a : event;
1378
+ return (_a = systemEventLabels2[event]) != null ? _a : event;
1077
1379
  }
1078
1380
 
1079
- // src/components/SiteChatComponentNew/utils/format.ts
1080
- function formatTime(timestamp) {
1381
+ // src/components/SiteChatComponentNewErc/utils/format.ts
1382
+ function formatTime2(timestamp) {
1081
1383
  return new Date(timestamp).toLocaleTimeString([], {
1082
1384
  hour: "2-digit",
1083
1385
  minute: "2-digit"
1084
1386
  });
1085
1387
  }
1086
1388
 
1087
- // src/components/SiteChatComponentNew/Header/Header.css
1088
- if (typeof document !== "undefined" && !document.getElementById("jrapps-style-45eba566")) {
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,28 +1442,28 @@ 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";
1453
+ s.id = "jrapps-style-c86a5c82";
1152
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 [stagedFiles, setStagedFiles] = (0, import_react9.useState)([]);
1161
- const fileInputRef = (0, import_react9.useRef)(null);
1162
- const textareaRef = (0, import_react9.useRef)(null);
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);
1163
1465
  const isEmpty = text.trim().length === 0 && stagedFiles.length === 0;
1164
- const handleSend = (0, import_react9.useCallback)(() => {
1466
+ const handleSend = (0, import_react7.useCallback)(() => {
1165
1467
  if (!isEmpty && !disabled) {
1166
1468
  if (text.trim().length > 0) {
1167
1469
  onSend(text.trim());
@@ -1175,7 +1477,7 @@ var Footer2 = ({ onSend, onAttachment, disabled }) => {
1175
1477
  }
1176
1478
  }
1177
1479
  }, [isEmpty, disabled, onSend, text, stagedFiles, onAttachment]);
1178
- const handleKeyDown = (0, import_react9.useCallback)(
1480
+ const handleKeyDown = (0, import_react7.useCallback)(
1179
1481
  (e) => {
1180
1482
  if (e.key === "Enter" && !e.shiftKey) {
1181
1483
  e.preventDefault();
@@ -1184,7 +1486,7 @@ var Footer2 = ({ onSend, onAttachment, disabled }) => {
1184
1486
  },
1185
1487
  [handleSend]
1186
1488
  );
1187
- const handleChange = (0, import_react9.useCallback)(
1489
+ const handleChange = (0, import_react7.useCallback)(
1188
1490
  (e) => {
1189
1491
  setText(e.target.value);
1190
1492
  const el = e.target;
@@ -1193,11 +1495,11 @@ var Footer2 = ({ onSend, onAttachment, disabled }) => {
1193
1495
  },
1194
1496
  []
1195
1497
  );
1196
- const handleAttachmentClick = (0, import_react9.useCallback)(() => {
1498
+ const handleAttachmentClick = (0, import_react7.useCallback)(() => {
1197
1499
  var _a;
1198
1500
  (_a = fileInputRef.current) == null ? void 0 : _a.click();
1199
1501
  }, []);
1200
- const handleFileChange = (0, import_react9.useCallback)(
1502
+ const handleFileChange = (0, import_react7.useCallback)(
1201
1503
  (e) => {
1202
1504
  var _a;
1203
1505
  const files = Array.from((_a = e.target.files) != null ? _a : []);
@@ -1210,33 +1512,33 @@ var Footer2 = ({ onSend, onAttachment, disabled }) => {
1210
1512
  },
1211
1513
  []
1212
1514
  );
1213
- const handleRemoveStagedFile = (0, import_react9.useCallback)((index) => {
1515
+ const handleRemoveStagedFile = (0, import_react7.useCallback)((index) => {
1214
1516
  setStagedFiles((prev) => prev.filter((_, i) => i !== index));
1215
1517
  }, []);
1216
- return /* @__PURE__ */ (0, import_jsx_runtime12.jsxs)("footer", { className: "cw-footer", role: "contentinfo", children: [
1217
- stagedFiles.length > 0 && /* @__PURE__ */ (0, import_jsx_runtime12.jsx)("ul", { className: "cw-footer__file-list", "aria-label": "Files to send", children: stagedFiles.map((file, i) => /* @__PURE__ */ (0, import_jsx_runtime12.jsxs)("li", { className: "cw-footer__file-chip", children: [
1218
- /* @__PURE__ */ (0, import_jsx_runtime12.jsx)("span", { className: "cw-footer__file-chip-name", title: file.name, children: file.name }),
1219
- /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(
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)(
1220
1522
  "button",
1221
1523
  {
1222
1524
  className: "cw-footer__file-chip-remove",
1223
1525
  onClick: () => handleRemoveStagedFile(i),
1224
1526
  "aria-label": `Remove ${file.name}`,
1225
1527
  type: "button",
1226
- children: /* @__PURE__ */ (0, import_jsx_runtime12.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_runtime12.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" }) })
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" }) })
1227
1529
  }
1228
1530
  )
1229
1531
  ] }, `${file.name}-${i}`)) }),
1230
- /* @__PURE__ */ (0, import_jsx_runtime12.jsxs)("div", { className: "cw-footer__controls", children: [
1231
- /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(
1532
+ /* @__PURE__ */ (0, import_jsx_runtime19.jsxs)("div", { className: "cw-footer__controls", children: [
1533
+ /* @__PURE__ */ (0, import_jsx_runtime19.jsx)(
1232
1534
  "button",
1233
1535
  {
1234
- className: "cw-footer__attach-btn",
1536
+ className: ["cw-footer__attach-btn", ercClasses == null ? void 0 : ercClasses.attachmentButtonClassName].filter(Boolean).join(" "),
1235
1537
  onClick: handleAttachmentClick,
1236
1538
  "aria-label": "Attach file",
1237
1539
  type: "button",
1238
1540
  disabled,
1239
- children: /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(
1541
+ children: /* @__PURE__ */ (0, import_jsx_runtime19.jsx)(
1240
1542
  "svg",
1241
1543
  {
1242
1544
  xmlns: "http://www.w3.org/2000/svg",
@@ -1249,16 +1551,16 @@ var Footer2 = ({ onSend, onAttachment, disabled }) => {
1249
1551
  strokeLinecap: "round",
1250
1552
  strokeLinejoin: "round",
1251
1553
  "aria-hidden": "true",
1252
- 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" })
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" })
1253
1555
  }
1254
1556
  )
1255
1557
  }
1256
1558
  ),
1257
- /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(
1559
+ /* @__PURE__ */ (0, import_jsx_runtime19.jsx)(
1258
1560
  "textarea",
1259
1561
  {
1260
1562
  ref: textareaRef,
1261
- className: "cw-footer__input",
1563
+ className: ["cw-footer__input", ercClasses == null ? void 0 : ercClasses.inputClassName].filter(Boolean).join(" "),
1262
1564
  value: text,
1263
1565
  onChange: handleChange,
1264
1566
  onKeyDown: handleKeyDown,
@@ -1268,15 +1570,19 @@ var Footer2 = ({ onSend, onAttachment, disabled }) => {
1268
1570
  disabled
1269
1571
  }
1270
1572
  ),
1271
- /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(
1573
+ /* @__PURE__ */ (0, import_jsx_runtime19.jsx)(
1272
1574
  "button",
1273
1575
  {
1274
- className: `cw-footer__send-btn${isEmpty || disabled ? " cw-footer__send-btn--disabled" : ""}`,
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(" "),
1275
1581
  onClick: handleSend,
1276
1582
  "aria-label": "Send message",
1277
1583
  type: "button",
1278
1584
  disabled: isEmpty || disabled,
1279
- children: /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(
1585
+ children: /* @__PURE__ */ (0, import_jsx_runtime19.jsx)(
1280
1586
  "svg",
1281
1587
  {
1282
1588
  xmlns: "http://www.w3.org/2000/svg",
@@ -1285,12 +1591,12 @@ var Footer2 = ({ onSend, onAttachment, disabled }) => {
1285
1591
  viewBox: "0 0 24 24",
1286
1592
  fill: "currentColor",
1287
1593
  "aria-hidden": "true",
1288
- children: /* @__PURE__ */ (0, import_jsx_runtime12.jsx)("path", { d: "M2.01 21L23 12 2.01 3 2 10l15 2-15 2z" })
1594
+ children: /* @__PURE__ */ (0, import_jsx_runtime19.jsx)("path", { d: "M2.01 21L23 12 2.01 3 2 10l15 2-15 2z" })
1289
1595
  }
1290
1596
  )
1291
1597
  }
1292
1598
  ),
1293
- /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(
1599
+ /* @__PURE__ */ (0, import_jsx_runtime19.jsx)(
1294
1600
  "input",
1295
1601
  {
1296
1602
  ref: fileInputRef,
@@ -1305,14 +1611,14 @@ var Footer2 = ({ onSend, onAttachment, disabled }) => {
1305
1611
  ] })
1306
1612
  ] });
1307
1613
  };
1308
- var Footer_default = Footer2;
1614
+ var Footer_default2 = Footer2;
1309
1615
 
1310
- // src/components/SiteChatComponentNew/hooks/useAutoScroll.ts
1311
- var import_react10 = require("react");
1312
- function useAutoScroll(dependency) {
1313
- const ref = (0, import_react10.useRef)(null);
1314
- const userScrolledUp = (0, import_react10.useRef)(false);
1315
- (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)(() => {
1316
1622
  const el = ref.current;
1317
1623
  if (!el) return;
1318
1624
  const handleScroll = () => {
@@ -1322,7 +1628,7 @@ function useAutoScroll(dependency) {
1322
1628
  el.addEventListener("scroll", handleScroll, { passive: true });
1323
1629
  return () => el.removeEventListener("scroll", handleScroll);
1324
1630
  }, []);
1325
- (0, import_react10.useEffect)(() => {
1631
+ (0, import_react8.useEffect)(() => {
1326
1632
  const el = ref.current;
1327
1633
  if (!el || userScrolledUp.current) return;
1328
1634
  el.scrollTo({ top: el.scrollHeight, behavior: "smooth" });
@@ -1330,9 +1636,9 @@ function useAutoScroll(dependency) {
1330
1636
  return ref;
1331
1637
  }
1332
1638
 
1333
- // src/components/SiteChatComponentNew/hooks/useOfflineForm.ts
1334
- var import_react11 = require("react");
1335
- function validateField(field, value) {
1639
+ // src/components/SiteChatComponentNewErc/hooks/useOfflineForm.ts
1640
+ var import_react9 = require("react");
1641
+ function validateField2(field, value) {
1336
1642
  if (field.required) {
1337
1643
  if (field.type === "checkbox" && !value) {
1338
1644
  return `${field.label} is required.`;
@@ -1355,39 +1661,39 @@ function validateField(field, value) {
1355
1661
  }
1356
1662
  return "";
1357
1663
  }
1358
- function useOfflineForm(schema) {
1664
+ function useOfflineForm2(schema) {
1359
1665
  const initialValues = {};
1360
1666
  for (const field of schema.fields) {
1361
1667
  initialValues[field.id] = field.type === "checkbox" ? false : "";
1362
1668
  }
1363
- const [values, setValues] = (0, import_react11.useState)(initialValues);
1364
- const [errors, setErrors] = (0, import_react11.useState)({});
1365
- const [submitted, setSubmitted] = (0, import_react11.useState)(false);
1366
- 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)(
1367
1673
  (id, value) => {
1368
1674
  setValues((prev) => ({ ...prev, [id]: value }));
1369
1675
  if (submitted) {
1370
1676
  const field = schema.fields.find((f) => f.id === id);
1371
1677
  if (field) {
1372
- const error = validateField(field, value);
1678
+ const error = validateField2(field, value);
1373
1679
  setErrors((prev) => ({ ...prev, [id]: error }));
1374
1680
  }
1375
1681
  }
1376
1682
  },
1377
1683
  [schema.fields, submitted]
1378
1684
  );
1379
- const validate = (0, import_react11.useCallback)(() => {
1685
+ const validate = (0, import_react9.useCallback)(() => {
1380
1686
  const newErrors = {};
1381
1687
  let valid = true;
1382
1688
  for (const field of schema.fields) {
1383
- const error = validateField(field, values[field.id]);
1689
+ const error = validateField2(field, values[field.id]);
1384
1690
  newErrors[field.id] = error;
1385
1691
  if (error) valid = false;
1386
1692
  }
1387
1693
  setErrors(newErrors);
1388
1694
  return valid;
1389
1695
  }, [schema.fields, values]);
1390
- const handleSubmit = (0, import_react11.useCallback)(
1696
+ const handleSubmit = (0, import_react9.useCallback)(
1391
1697
  (onSubmit) => {
1392
1698
  setSubmitted(true);
1393
1699
  if (validate()) {
@@ -1396,7 +1702,7 @@ function useOfflineForm(schema) {
1396
1702
  },
1397
1703
  [validate, values]
1398
1704
  );
1399
- const reset = (0, import_react11.useCallback)(() => {
1705
+ const reset = (0, import_react9.useCallback)(() => {
1400
1706
  setValues(initialValues);
1401
1707
  setErrors({});
1402
1708
  setSubmitted(false);
@@ -1404,35 +1710,35 @@ function useOfflineForm(schema) {
1404
1710
  return { values, errors, setValue, handleSubmit, reset };
1405
1711
  }
1406
1712
 
1407
- // src/components/SiteChatComponentNew/Messages/UserMessage.css
1408
- 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")) {
1409
1715
  const s = document.createElement("style");
1410
- s.id = "jrapps-style-aed321e0";
1716
+ s.id = "jrapps-style-488069e4";
1411
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";
1412
1718
  document.head.appendChild(s);
1413
1719
  }
1414
1720
 
1415
- // src/components/SiteChatComponentNew/Messages/UserMessage.tsx
1416
- var import_jsx_runtime13 = require("react/jsx-runtime");
1417
- var UserMessage = ({ message }) => {
1418
- return /* @__PURE__ */ (0, import_jsx_runtime13.jsxs)("div", { className: "cw-user-message", role: "listitem", "aria-label": "Your message", children: [
1419
- /* @__PURE__ */ (0, import_jsx_runtime13.jsx)("div", { className: "cw-user-message__bubble", children: message.message }),
1420
- 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) })
1421
1727
  ] });
1422
1728
  };
1423
- var UserMessage_default = UserMessage;
1729
+ var UserMessage_default2 = UserMessage2;
1424
1730
 
1425
- // src/components/SiteChatComponentNew/Shared/Avatar.css
1426
- 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")) {
1427
1733
  const s = document.createElement("style");
1428
- s.id = "jrapps-style-ce14fbec";
1734
+ s.id = "jrapps-style-ad01373e";
1429
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";
1430
1736
  document.head.appendChild(s);
1431
1737
  }
1432
1738
 
1433
- // src/components/SiteChatComponentNew/Shared/Avatar.tsx
1434
- var import_jsx_runtime14 = require("react/jsx-runtime");
1435
- function getInitials(name) {
1739
+ // src/components/SiteChatComponentNewErc/Shared/Avatar.tsx
1740
+ var import_jsx_runtime21 = require("react/jsx-runtime");
1741
+ function getInitials2(name) {
1436
1742
  return name.split(" ").slice(0, 2).map((w) => w[0]).join("").toUpperCase();
1437
1743
  }
1438
1744
  var Avatar2 = ({ src, name, size = 32 }) => {
@@ -1442,7 +1748,7 @@ var Avatar2 = ({ src, name, size = 32 }) => {
1442
1748
  fontSize: `${Math.round(size * 0.38)}px`
1443
1749
  };
1444
1750
  if (src) {
1445
- return /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(
1751
+ return /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(
1446
1752
  "img",
1447
1753
  {
1448
1754
  src,
@@ -1452,29 +1758,29 @@ var Avatar2 = ({ src, name, size = 32 }) => {
1452
1758
  }
1453
1759
  );
1454
1760
  }
1455
- return /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(
1761
+ return /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(
1456
1762
  "span",
1457
1763
  {
1458
1764
  className: "cw-avatar cw-avatar--initials",
1459
1765
  "aria-label": name ? `${name} avatar` : "Agent avatar",
1460
1766
  style,
1461
- children: name ? getInitials(name) : "A"
1767
+ children: name ? getInitials2(name) : "A"
1462
1768
  }
1463
1769
  );
1464
1770
  };
1465
- var Avatar_default = Avatar2;
1771
+ var Avatar_default2 = Avatar2;
1466
1772
 
1467
- // src/components/SiteChatComponentNew/Shared/Button.css
1468
- 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")) {
1469
1775
  const s = document.createElement("style");
1470
- s.id = "jrapps-style-2aa106ea";
1776
+ s.id = "jrapps-style-0aa71f6d";
1471
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";
1472
1778
  document.head.appendChild(s);
1473
1779
  }
1474
1780
 
1475
- // src/components/SiteChatComponentNew/Shared/Button.tsx
1476
- var import_jsx_runtime15 = require("react/jsx-runtime");
1477
- var Button = ({
1781
+ // src/components/SiteChatComponentNewErc/Shared/Button.tsx
1782
+ var import_jsx_runtime22 = require("react/jsx-runtime");
1783
+ var Button2 = ({
1478
1784
  children,
1479
1785
  onClick,
1480
1786
  variant = "primary",
@@ -1483,7 +1789,7 @@ var Button = ({
1483
1789
  fullWidth = false,
1484
1790
  ariaLabel
1485
1791
  }) => {
1486
- return /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(
1792
+ return /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(
1487
1793
  "button",
1488
1794
  {
1489
1795
  className: `cw-button cw-button--${variant}${fullWidth ? " cw-button--full" : ""}`,
@@ -1495,94 +1801,94 @@ var Button = ({
1495
1801
  }
1496
1802
  );
1497
1803
  };
1498
- var Button_default = Button;
1804
+ var Button_default2 = Button2;
1499
1805
 
1500
- // src/components/SiteChatComponentNew/Messages/AgentMessage.css
1501
- 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")) {
1502
1808
  const s = document.createElement("style");
1503
- s.id = "jrapps-style-5df522b1";
1809
+ s.id = "jrapps-style-f5aad44b";
1504
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";
1505
1811
  document.head.appendChild(s);
1506
1812
  }
1507
1813
 
1508
- // src/components/SiteChatComponentNew/Messages/AgentMessage.tsx
1509
- var import_jsx_runtime16 = require("react/jsx-runtime");
1510
- var AgentMessage = ({ message }) => {
1814
+ // src/components/SiteChatComponentNewErc/Messages/AgentMessage.tsx
1815
+ var import_jsx_runtime23 = require("react/jsx-runtime");
1816
+ var AgentMessage2 = ({ message, ercClassName }) => {
1511
1817
  var _a;
1512
- return /* @__PURE__ */ (0, import_jsx_runtime16.jsxs)(
1818
+ return /* @__PURE__ */ (0, import_jsx_runtime23.jsxs)(
1513
1819
  "div",
1514
1820
  {
1515
- className: "cw-agent-message",
1821
+ className: ["cw-agent-message", ercClassName].filter(Boolean).join(" "),
1516
1822
  role: "listitem",
1517
1823
  "aria-label": `Message from ${(_a = message.senderName) != null ? _a : "Agent"}`,
1518
1824
  children: [
1519
- /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(Avatar_default, { name: message.senderName, size: 32 }),
1520
- /* @__PURE__ */ (0, import_jsx_runtime16.jsxs)("div", { className: "cw-agent-message__content", children: [
1521
- message.senderName && /* @__PURE__ */ (0, import_jsx_runtime16.jsx)("span", { className: "cw-agent-message__name", children: message.senderName }),
1522
- /* @__PURE__ */ (0, import_jsx_runtime16.jsx)("div", { className: "cw-agent-message__bubble", children: message.message }),
1523
- 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) })
1524
1830
  ] })
1525
1831
  ]
1526
1832
  }
1527
1833
  );
1528
1834
  };
1529
- var AgentMessage_default = AgentMessage;
1835
+ var AgentMessage_default2 = AgentMessage2;
1530
1836
 
1531
- // src/components/SiteChatComponentNew/Messages/SystemMessage.css
1532
- 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")) {
1533
1839
  const s = document.createElement("style");
1534
- s.id = "jrapps-style-464a3601";
1840
+ s.id = "jrapps-style-631d733c";
1535
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";
1536
1842
  document.head.appendChild(s);
1537
1843
  }
1538
1844
 
1539
- // src/components/SiteChatComponentNew/Messages/SystemMessage.tsx
1540
- var import_jsx_runtime17 = require("react/jsx-runtime");
1541
- var SystemMessage = ({ message }) => {
1845
+ // src/components/SiteChatComponentNewErc/Messages/SystemMessage.tsx
1846
+ var import_jsx_runtime24 = require("react/jsx-runtime");
1847
+ var SystemMessage2 = ({ message, ercClassName }) => {
1542
1848
  var _a;
1543
- const label = message.message ? getSystemLabel(message.message) : (_a = message.message) != null ? _a : "";
1544
- 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)(
1545
1851
  "div",
1546
1852
  {
1547
- className: "cw-system-message",
1853
+ className: ["cw-system-message", ercClassName].filter(Boolean).join(" "),
1548
1854
  role: "listitem",
1549
1855
  "aria-label": `System notification: ${label}`,
1550
1856
  children: [
1551
- /* @__PURE__ */ (0, import_jsx_runtime17.jsx)("span", { className: "cw-system-message__line", "aria-hidden": "true" }),
1552
- /* @__PURE__ */ (0, import_jsx_runtime17.jsx)("span", { className: "cw-system-message__text", children: label }),
1553
- /* @__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" })
1554
1860
  ]
1555
1861
  }
1556
1862
  );
1557
1863
  };
1558
- var SystemMessage_default = SystemMessage;
1864
+ var SystemMessage_default2 = SystemMessage2;
1559
1865
 
1560
- // src/components/SiteChatComponentNew/Messages/AttachmentMessage.css
1561
- 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")) {
1562
1868
  const s = document.createElement("style");
1563
- s.id = "jrapps-style-dd846dee";
1869
+ s.id = "jrapps-style-daabdc64";
1564
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";
1565
1871
  document.head.appendChild(s);
1566
1872
  }
1567
1873
 
1568
- // src/components/SiteChatComponentNew/Messages/AttachmentMessage.tsx
1569
- var import_jsx_runtime18 = require("react/jsx-runtime");
1570
- var AttachmentMessage = ({ message }) => {
1874
+ // src/components/SiteChatComponentNewErc/Messages/AttachmentMessage.tsx
1875
+ var import_jsx_runtime25 = require("react/jsx-runtime");
1876
+ var AttachmentMessage2 = ({ message }) => {
1571
1877
  var _a;
1572
1878
  const attachment = (_a = message.item) != null ? _a : message.attachment;
1573
1879
  if (!attachment) return null;
1574
1880
  const handleOpen = () => {
1575
1881
  window.open(attachment.url, "_blank", "noopener,noreferrer");
1576
1882
  };
1577
- return /* @__PURE__ */ (0, import_jsx_runtime18.jsxs)(
1883
+ return /* @__PURE__ */ (0, import_jsx_runtime25.jsxs)(
1578
1884
  "div",
1579
1885
  {
1580
1886
  className: `cw-attachment-message${message.senderType === "user" ? " cw-attachment-message--user" : ""}`,
1581
1887
  role: "listitem",
1582
1888
  "aria-label": `Attachment: ${attachment.name}`,
1583
1889
  children: [
1584
- /* @__PURE__ */ (0, import_jsx_runtime18.jsxs)("div", { className: "cw-attachment-message__card", children: [
1585
- /* @__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)(
1586
1892
  "svg",
1587
1893
  {
1588
1894
  xmlns: "http://www.w3.org/2000/svg",
@@ -1595,16 +1901,16 @@ var AttachmentMessage = ({ message }) => {
1595
1901
  strokeLinecap: "round",
1596
1902
  strokeLinejoin: "round",
1597
1903
  children: [
1598
- /* @__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" }),
1599
- /* @__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" })
1600
1906
  ]
1601
1907
  }
1602
1908
  ) }),
1603
- /* @__PURE__ */ (0, import_jsx_runtime18.jsxs)("div", { className: "cw-attachment-message__info", children: [
1604
- /* @__PURE__ */ (0, import_jsx_runtime18.jsx)("span", { className: "cw-attachment-message__name", children: attachment.name }),
1605
- /* @__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" })
1606
1912
  ] }),
1607
- /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(
1913
+ /* @__PURE__ */ (0, import_jsx_runtime25.jsx)(
1608
1914
  "button",
1609
1915
  {
1610
1916
  className: "cw-attachment-message__open-btn",
@@ -1615,65 +1921,66 @@ var AttachmentMessage = ({ message }) => {
1615
1921
  }
1616
1922
  )
1617
1923
  ] }),
1618
- message.timestamp !== void 0 && /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(
1924
+ message.timestamp !== void 0 && /* @__PURE__ */ (0, import_jsx_runtime25.jsx)(
1619
1925
  "span",
1620
1926
  {
1621
1927
  className: `cw-attachment-message__time${message.senderType === "user" ? " cw-attachment-message__time--right" : ""}`,
1622
- children: formatTime(message.timestamp)
1928
+ children: formatTime2(message.timestamp)
1623
1929
  }
1624
1930
  )
1625
1931
  ]
1626
1932
  }
1627
1933
  );
1628
1934
  };
1629
- var AttachmentMessage_default = AttachmentMessage;
1935
+ var AttachmentMessage_default2 = AttachmentMessage2;
1630
1936
 
1631
- // src/components/SiteChatComponentNew/Messages/MessageRenderer.tsx
1632
- var import_jsx_runtime19 = require("react/jsx-runtime");
1633
- var MessageRenderer = ({ message }) => {
1937
+ // src/components/SiteChatComponentNewErc/Messages/MessageRenderer.tsx
1938
+ var import_jsx_runtime26 = require("react/jsx-runtime");
1939
+ var MessageRenderer2 = ({ message, ercClasses }) => {
1634
1940
  if (message.messageType === "ATTACHMENT") {
1635
- return /* @__PURE__ */ (0, import_jsx_runtime19.jsx)(AttachmentMessage_default, { message });
1941
+ return /* @__PURE__ */ (0, import_jsx_runtime26.jsx)(AttachmentMessage_default2, { message });
1636
1942
  }
1637
1943
  switch (message.senderType) {
1638
1944
  case "user":
1639
- 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 });
1640
1946
  case "agent":
1641
- 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 });
1642
1948
  case "system":
1643
- 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 });
1644
1950
  default:
1645
1951
  return null;
1646
1952
  }
1647
1953
  };
1648
- var MessageRenderer_default = MessageRenderer;
1954
+ var MessageRenderer_default2 = MessageRenderer2;
1649
1955
 
1650
- // src/components/SiteChatComponentNew/Messages/MessageList.css
1651
- 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")) {
1652
1958
  const s = document.createElement("style");
1653
- s.id = "jrapps-style-15ae1a6b";
1959
+ s.id = "jrapps-style-0408335f";
1654
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";
1655
1961
  document.head.appendChild(s);
1656
1962
  }
1657
1963
 
1658
- // src/components/SiteChatComponentNew/Messages/MessageList.tsx
1659
- var import_jsx_runtime20 = require("react/jsx-runtime");
1660
- var MessageList = ({ messages }) => {
1661
- const scrollRef = useAutoScroll(messages);
1662
- 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)(
1663
1969
  "div",
1664
1970
  {
1665
1971
  ref: scrollRef,
1666
- className: "cw-message-list",
1972
+ className: ["cw-message-list", ercClasses == null ? void 0 : ercClasses.messageListClassName].filter(Boolean).join(" "),
1667
1973
  role: "list",
1668
1974
  "aria-label": "Chat messages",
1669
1975
  "aria-live": "polite",
1670
1976
  "aria-relevant": "additions",
1671
1977
  children: messages.map((msg, index) => {
1672
1978
  var _a, _b;
1673
- return /* @__PURE__ */ (0, import_jsx_runtime20.jsx)(
1674
- MessageRenderer_default,
1979
+ return /* @__PURE__ */ (0, import_jsx_runtime27.jsx)(
1980
+ MessageRenderer_default2,
1675
1981
  {
1676
- message: msg
1982
+ message: msg,
1983
+ ercClasses
1677
1984
  },
1678
1985
  (_b = msg._id) != null ? _b : `${(_a = msg.timestamp) != null ? _a : index}-${index}`
1679
1986
  );
@@ -1681,70 +1988,70 @@ var MessageList = ({ messages }) => {
1681
1988
  }
1682
1989
  );
1683
1990
  };
1684
- var MessageList_default = MessageList;
1991
+ var MessageList_default2 = MessageList2;
1685
1992
 
1686
- // src/components/SiteChatComponentNew/Messages/TypingIndicator.css
1687
- 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")) {
1688
1995
  const s = document.createElement("style");
1689
- s.id = "jrapps-style-4b0ca05b";
1996
+ s.id = "jrapps-style-0a740655";
1690
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";
1691
1998
  document.head.appendChild(s);
1692
1999
  }
1693
2000
 
1694
- // src/components/SiteChatComponentNew/Messages/TypingIndicator.tsx
1695
- var import_jsx_runtime21 = require("react/jsx-runtime");
2001
+ // src/components/SiteChatComponentNewErc/Messages/TypingIndicator.tsx
2002
+ var import_jsx_runtime28 = require("react/jsx-runtime");
1696
2003
 
1697
- // src/components/SiteChatComponentNew/States/LoadingState.css
1698
- 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")) {
1699
2006
  const s = document.createElement("style");
1700
- s.id = "jrapps-style-7a5a4f05";
2007
+ s.id = "jrapps-style-7bd88a9a";
1701
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";
1702
2009
  document.head.appendChild(s);
1703
2010
  }
1704
2011
 
1705
- // src/components/SiteChatComponentNew/States/LoadingState.tsx
1706
- var import_jsx_runtime22 = require("react/jsx-runtime");
1707
- var LoadingState = () => {
1708
- 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)(
1709
2016
  "div",
1710
2017
  {
1711
2018
  className: "cw-loading-state",
1712
2019
  role: "status",
1713
2020
  "aria-label": "Connecting to chat",
1714
2021
  children: [
1715
- /* @__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" }) }),
1716
- /* @__PURE__ */ (0, import_jsx_runtime22.jsx)("p", { className: "cw-loading-state__title", children: "Connecting\u2026" }),
1717
- /* @__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." })
1718
2025
  ]
1719
2026
  }
1720
2027
  );
1721
2028
  };
1722
- var LoadingState_default = LoadingState;
2029
+ var LoadingState_default2 = LoadingState2;
1723
2030
 
1724
- // src/components/SiteChatComponentNew/States/StartChatState.css
1725
- 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")) {
1726
2033
  const s = document.createElement("style");
1727
- s.id = "jrapps-style-3e05ef30";
2034
+ s.id = "jrapps-style-f1f33df7";
1728
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";
1729
2036
  document.head.appendChild(s);
1730
2037
  }
1731
2038
 
1732
- // src/components/SiteChatComponentNew/States/StartChatState.tsx
1733
- var import_jsx_runtime23 = require("react/jsx-runtime");
1734
- var StartChatState = ({
2039
+ // src/components/SiteChatComponentNewErc/States/StartChatState.tsx
2040
+ var import_jsx_runtime30 = require("react/jsx-runtime");
2041
+ var StartChatState2 = ({
1735
2042
  image,
1736
2043
  title,
1737
2044
  description,
1738
2045
  onStart
1739
2046
  }) => {
1740
- return /* @__PURE__ */ (0, import_jsx_runtime23.jsxs)(
2047
+ return /* @__PURE__ */ (0, import_jsx_runtime30.jsxs)(
1741
2048
  "div",
1742
2049
  {
1743
2050
  className: "cw-start-chat-state",
1744
2051
  role: "main",
1745
2052
  "aria-label": "Start a chat",
1746
2053
  children: [
1747
- image && /* @__PURE__ */ (0, import_jsx_runtime23.jsx)(
2054
+ image && /* @__PURE__ */ (0, import_jsx_runtime30.jsx)(
1748
2055
  "img",
1749
2056
  {
1750
2057
  src: image,
@@ -1752,19 +2059,19 @@ var StartChatState = ({
1752
2059
  className: "cw-start-chat-state__image"
1753
2060
  }
1754
2061
  ),
1755
- /* @__PURE__ */ (0, import_jsx_runtime23.jsx)("h2", { className: "cw-start-chat-state__title", children: title }),
1756
- description && /* @__PURE__ */ (0, import_jsx_runtime23.jsx)("p", { className: "cw-start-chat-state__description", children: description }),
1757
- /* @__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" })
1758
2065
  ]
1759
2066
  }
1760
2067
  );
1761
2068
  };
1762
- var StartChatState_default = StartChatState;
2069
+ var StartChatState_default2 = StartChatState2;
1763
2070
 
1764
- // src/components/SiteChatComponentNew/OfflineForm/OfflineForm.css
1765
- 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")) {
1766
2073
  const s = document.createElement("style");
1767
- s.id = "jrapps-style-d9ff3956";
2074
+ s.id = "jrapps-style-a7711cdc";
1768
2075
  s.textContent = `.cw-offline-form {
1769
2076
  display: flex;
1770
2077
  flex-direction: column;
@@ -1922,9 +2229,9 @@ if (typeof document !== "undefined" && !document.getElementById("jrapps-style-d9
1922
2229
  document.head.appendChild(s);
1923
2230
  }
1924
2231
 
1925
- // src/components/SiteChatComponentNew/OfflineForm/OfflineForm.tsx
1926
- var import_jsx_runtime24 = require("react/jsx-runtime");
1927
- var FieldRenderer = ({
2232
+ // src/components/SiteChatComponentNewErc/OfflineForm/OfflineForm.tsx
2233
+ var import_jsx_runtime31 = require("react/jsx-runtime");
2234
+ var FieldRenderer2 = ({
1928
2235
  field,
1929
2236
  value,
1930
2237
  error,
@@ -1942,15 +2249,15 @@ var FieldRenderer = ({
1942
2249
  required: field.required
1943
2250
  };
1944
2251
  if (field.type === "textarea") {
1945
- return /* @__PURE__ */ (0, import_jsx_runtime24.jsxs)("div", { className: "cw-offline-form__field", children: [
1946
- /* @__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: [
1947
2254
  field.label,
1948
- 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: [
1949
2256
  " ",
1950
2257
  "*"
1951
2258
  ] })
1952
2259
  ] }),
1953
- /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(
2260
+ /* @__PURE__ */ (0, import_jsx_runtime31.jsx)(
1954
2261
  "textarea",
1955
2262
  {
1956
2263
  ...commonProps,
@@ -1961,19 +2268,19 @@ var FieldRenderer = ({
1961
2268
  className: `cw-offline-form__textarea${hasError ? " cw-offline-form__textarea--error" : ""}`
1962
2269
  }
1963
2270
  ),
1964
- 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 })
1965
2272
  ] });
1966
2273
  }
1967
2274
  if (field.type === "select") {
1968
- return /* @__PURE__ */ (0, import_jsx_runtime24.jsxs)("div", { className: "cw-offline-form__field", children: [
1969
- /* @__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: [
1970
2277
  field.label,
1971
- 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: [
1972
2279
  " ",
1973
2280
  "*"
1974
2281
  ] })
1975
2282
  ] }),
1976
- /* @__PURE__ */ (0, import_jsx_runtime24.jsxs)(
2283
+ /* @__PURE__ */ (0, import_jsx_runtime31.jsxs)(
1977
2284
  "select",
1978
2285
  {
1979
2286
  ...commonProps,
@@ -1981,18 +2288,18 @@ var FieldRenderer = ({
1981
2288
  onChange: (e) => onChange(field.id, e.target.value),
1982
2289
  className: `cw-offline-form__select${hasError ? " cw-offline-form__select--error" : ""}`,
1983
2290
  children: [
1984
- /* @__PURE__ */ (0, import_jsx_runtime24.jsx)("option", { value: "", children: (_a = field.placeholder) != null ? _a : `Select ${field.label}` }),
1985
- (_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))
1986
2293
  ]
1987
2294
  }
1988
2295
  ),
1989
- 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 })
1990
2297
  ] });
1991
2298
  }
1992
2299
  if (field.type === "checkbox") {
1993
- return /* @__PURE__ */ (0, import_jsx_runtime24.jsxs)("div", { className: "cw-offline-form__field cw-offline-form__field--checkbox", children: [
1994
- /* @__PURE__ */ (0, import_jsx_runtime24.jsxs)("label", { className: "cw-offline-form__checkbox-label", htmlFor: fieldId, children: [
1995
- /* @__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)(
1996
2303
  "input",
1997
2304
  {
1998
2305
  type: "checkbox",
@@ -2005,26 +2312,26 @@ var FieldRenderer = ({
2005
2312
  required: field.required
2006
2313
  }
2007
2314
  ),
2008
- /* @__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: [
2009
2316
  field.label,
2010
- 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: [
2011
2318
  " ",
2012
2319
  "*"
2013
2320
  ] })
2014
2321
  ] })
2015
2322
  ] }),
2016
- 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 })
2017
2324
  ] });
2018
2325
  }
2019
- return /* @__PURE__ */ (0, import_jsx_runtime24.jsxs)("div", { className: "cw-offline-form__field", children: [
2020
- /* @__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: [
2021
2328
  field.label,
2022
- 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: [
2023
2330
  " ",
2024
2331
  "*"
2025
2332
  ] })
2026
2333
  ] }),
2027
- /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(
2334
+ /* @__PURE__ */ (0, import_jsx_runtime31.jsx)(
2028
2335
  "input",
2029
2336
  {
2030
2337
  ...commonProps,
@@ -2034,16 +2341,16 @@ var FieldRenderer = ({
2034
2341
  onChange: (e) => onChange(field.id, e.target.value)
2035
2342
  }
2036
2343
  ),
2037
- 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 })
2038
2345
  ] });
2039
2346
  };
2040
- var OfflineForm = ({ schema, onSubmit }) => {
2041
- const { values, errors, setValue, handleSubmit } = useOfflineForm(schema);
2347
+ var OfflineForm2 = ({ schema, onSubmit }) => {
2348
+ const { values, errors, setValue, handleSubmit } = useOfflineForm2(schema);
2042
2349
  const onFormSubmit = (e) => {
2043
2350
  e.preventDefault();
2044
2351
  handleSubmit(onSubmit);
2045
2352
  };
2046
- return /* @__PURE__ */ (0, import_jsx_runtime24.jsxs)(
2353
+ return /* @__PURE__ */ (0, import_jsx_runtime31.jsxs)(
2047
2354
  "form",
2048
2355
  {
2049
2356
  className: "cw-offline-form",
@@ -2051,11 +2358,11 @@ var OfflineForm = ({ schema, onSubmit }) => {
2051
2358
  "aria-label": schema.title,
2052
2359
  noValidate: true,
2053
2360
  children: [
2054
- /* @__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 }),
2055
2362
  schema.fields.map((field) => {
2056
2363
  var _a;
2057
- return /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(
2058
- FieldRenderer,
2364
+ return /* @__PURE__ */ (0, import_jsx_runtime31.jsx)(
2365
+ FieldRenderer2,
2059
2366
  {
2060
2367
  field,
2061
2368
  value: values[field.id],
@@ -2065,33 +2372,33 @@ var OfflineForm = ({ schema, onSubmit }) => {
2065
2372
  field.id
2066
2373
  );
2067
2374
  }),
2068
- /* @__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 }) })
2069
2376
  ]
2070
2377
  }
2071
2378
  );
2072
2379
  };
2073
- var OfflineForm_default = OfflineForm;
2380
+ var OfflineForm_default2 = OfflineForm2;
2074
2381
 
2075
- // src/components/SiteChatComponentNew/States/OfflineState.css
2076
- 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")) {
2077
2384
  const s = document.createElement("style");
2078
- s.id = "jrapps-style-8b15ae78";
2385
+ s.id = "jrapps-style-03b10f90";
2079
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";
2080
2387
  document.head.appendChild(s);
2081
2388
  }
2082
2389
 
2083
- // src/components/SiteChatComponentNew/States/OfflineState.tsx
2084
- var import_jsx_runtime25 = require("react/jsx-runtime");
2085
- var OfflineState = ({ form, onSubmit }) => {
2086
- 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)(
2087
2394
  "div",
2088
2395
  {
2089
2396
  className: "cw-offline-state",
2090
2397
  role: "main",
2091
2398
  "aria-label": "Business is offline",
2092
2399
  children: [
2093
- /* @__PURE__ */ (0, import_jsx_runtime25.jsxs)("div", { className: "cw-offline-state__header", children: [
2094
- /* @__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)(
2095
2402
  "svg",
2096
2403
  {
2097
2404
  xmlns: "http://www.w3.org/2000/svg",
@@ -2103,38 +2410,38 @@ var OfflineState = ({ form, onSubmit }) => {
2103
2410
  strokeWidth: "2",
2104
2411
  strokeLinecap: "round",
2105
2412
  strokeLinejoin: "round",
2106
- 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" })
2107
2414
  }
2108
2415
  ) }),
2109
- /* @__PURE__ */ (0, import_jsx_runtime25.jsx)("h2", { className: "cw-offline-state__title", children: "We're currently offline" }),
2110
- /* @__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." })
2111
2418
  ] }),
2112
- 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 }) })
2113
2420
  ]
2114
2421
  }
2115
2422
  );
2116
2423
  };
2117
- var OfflineState_default = OfflineState;
2424
+ var OfflineState_default2 = OfflineState2;
2118
2425
 
2119
- // src/components/SiteChatComponentNew/States/ChatEndedState.css
2120
- 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")) {
2121
2428
  const s = document.createElement("style");
2122
- s.id = "jrapps-style-59a49fdf";
2429
+ s.id = "jrapps-style-dba39629";
2123
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";
2124
2431
  document.head.appendChild(s);
2125
2432
  }
2126
2433
 
2127
- // src/components/SiteChatComponentNew/States/ChatEndedState.tsx
2128
- var import_jsx_runtime26 = require("react/jsx-runtime");
2129
- var ChatEndedState = () => {
2130
- 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)(
2131
2438
  "div",
2132
2439
  {
2133
2440
  className: "cw-chat-ended-state",
2134
2441
  role: "status",
2135
2442
  "aria-label": "Chat has ended",
2136
2443
  children: [
2137
- /* @__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)(
2138
2445
  "svg",
2139
2446
  {
2140
2447
  xmlns: "http://www.w3.org/2000/svg",
@@ -2146,28 +2453,28 @@ var ChatEndedState = () => {
2146
2453
  strokeWidth: "2",
2147
2454
  strokeLinecap: "round",
2148
2455
  strokeLinejoin: "round",
2149
- 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" })
2150
2457
  }
2151
2458
  ) }),
2152
- /* @__PURE__ */ (0, import_jsx_runtime26.jsx)("p", { className: "cw-chat-ended-state__title", children: "Chat Ended" }),
2153
- /* @__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!" })
2154
2461
  ]
2155
2462
  }
2156
2463
  );
2157
2464
  };
2158
- var ChatEndedState_default = ChatEndedState;
2465
+ var ChatEndedState_default2 = ChatEndedState2;
2159
2466
 
2160
- // src/components/SiteChatComponentNew/SiteChatComponentNew.css
2161
- 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")) {
2162
2469
  const s = document.createElement("style");
2163
- s.id = "jrapps-style-871af89c";
2164
- 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";
2165
2472
  document.head.appendChild(s);
2166
2473
  }
2167
2474
 
2168
- // src/components/SiteChatComponentNew/SiteChatComponentNew.tsx
2169
- var import_jsx_runtime27 = require("react/jsx-runtime");
2170
- 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(({
2171
2478
  title,
2172
2479
  subtitle,
2173
2480
  image,
@@ -2182,24 +2489,26 @@ var SiteChatComponentNew = import_react12.default.forwardRef(({
2182
2489
  onSend,
2183
2490
  onAttachment,
2184
2491
  onOfflineSubmit,
2185
- onClose
2492
+ onClose,
2493
+ isEditorReactComponent = false,
2494
+ editorReactComponentThemeProps
2186
2495
  }, ref) => {
2187
- const { open, openWidget, closeWidget } = useSiteChatComponentNew(defaultOpen);
2188
- const themeVars = buildThemeVars(theme, width, height);
2496
+ const { open, openWidget, closeWidget } = useSiteChatComponentNewErc(defaultOpen);
2497
+ const themeVars = buildThemeVars2(theme, width, height);
2189
2498
  const handleClose = () => {
2190
2499
  closeWidget();
2191
2500
  onClose == null ? void 0 : onClose();
2192
2501
  };
2193
- const renderBody = () => {
2502
+ const renderBody = (convClasses, footerClasses) => {
2194
2503
  if (loading) {
2195
- return /* @__PURE__ */ (0, import_jsx_runtime27.jsx)(LoadingState_default, {});
2504
+ return /* @__PURE__ */ (0, import_jsx_runtime34.jsx)(LoadingState_default2, {});
2196
2505
  }
2197
2506
  if (offlineForm) {
2198
- 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 });
2199
2508
  }
2200
2509
  if (messages.length === 0) {
2201
- return /* @__PURE__ */ (0, import_jsx_runtime27.jsx)(
2202
- StartChatState_default,
2510
+ return /* @__PURE__ */ (0, import_jsx_runtime34.jsx)(
2511
+ StartChatState_default2,
2203
2512
  {
2204
2513
  image,
2205
2514
  title,
@@ -2208,13 +2517,40 @@ var SiteChatComponentNew = import_react12.default.forwardRef(({
2208
2517
  }
2209
2518
  );
2210
2519
  }
2211
- return /* @__PURE__ */ (0, import_jsx_runtime27.jsxs)(import_jsx_runtime27.Fragment, { children: [
2212
- /* @__PURE__ */ (0, import_jsx_runtime27.jsx)(MessageList_default, { messages }),
2213
- 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 })
2214
2523
  ] });
2215
2524
  };
2216
- return /* @__PURE__ */ (0, import_jsx_runtime27.jsxs)("div", { ref, className: "cw-root", style: themeVars, children: [
2217
- 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)(
2218
2554
  "div",
2219
2555
  {
2220
2556
  className: "cw-widget",
@@ -2222,8 +2558,8 @@ var SiteChatComponentNew = import_react12.default.forwardRef(({
2222
2558
  "aria-modal": "true",
2223
2559
  "aria-label": `${title} chat widget`,
2224
2560
  children: [
2225
- /* @__PURE__ */ (0, import_jsx_runtime27.jsx)(
2226
- Header_default,
2561
+ /* @__PURE__ */ (0, import_jsx_runtime34.jsx)(
2562
+ Header_default2,
2227
2563
  {
2228
2564
  image,
2229
2565
  title,
@@ -2231,11 +2567,11 @@ var SiteChatComponentNew = import_react12.default.forwardRef(({
2231
2567
  onClose: handleClose
2232
2568
  }
2233
2569
  ),
2234
- /* @__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() })
2235
2571
  ]
2236
2572
  }
2237
2573
  ),
2238
- !open && /* @__PURE__ */ (0, import_jsx_runtime27.jsx)(
2574
+ !open && /* @__PURE__ */ (0, import_jsx_runtime34.jsx)(
2239
2575
  "button",
2240
2576
  {
2241
2577
  className: "cw-launcher",
@@ -2243,7 +2579,7 @@ var SiteChatComponentNew = import_react12.default.forwardRef(({
2243
2579
  "aria-label": "Open chat",
2244
2580
  "aria-haspopup": "dialog",
2245
2581
  type: "button",
2246
- children: /* @__PURE__ */ (0, import_jsx_runtime27.jsx)(
2582
+ children: /* @__PURE__ */ (0, import_jsx_runtime34.jsx)(
2247
2583
  "svg",
2248
2584
  {
2249
2585
  xmlns: "http://www.w3.org/2000/svg",
@@ -2252,12 +2588,12 @@ var SiteChatComponentNew = import_react12.default.forwardRef(({
2252
2588
  viewBox: "0 0 24 24",
2253
2589
  fill: "currentColor",
2254
2590
  "aria-hidden": "true",
2255
- 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" })
2256
2592
  }
2257
2593
  )
2258
2594
  }
2259
2595
  )
2260
2596
  ] });
2261
2597
  });
2262
- SiteChatComponentNew.displayName = "SiteChatComponentNew";
2598
+ SiteChatComponentNewErc.displayName = "SiteChatComponentNewErc";
2263
2599
  //# sourceMappingURL=index.js.map