@salla.sa/ui-ai-kit-core 2.2.3 → 2.2.5
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/cjs/ai-chat-container.cjs.entry.js +2 -2
- package/dist/cjs/ai-chat-header.cjs.entry.js +32 -13
- package/dist/cjs/ai-chat-message.cjs.entry.js +1 -1
- package/dist/cjs/ai-rating.cjs.entry.js +4 -4
- package/dist/cjs/loader.cjs.js +1 -1
- package/dist/cjs/ui-ai-kit.cjs.js +1 -1
- package/dist/collection/components/ai-chat-container/ai-chat-container.js +2 -2
- package/dist/collection/components/ai-chat-header/ai-chat-header.js +74 -14
- package/dist/collection/components/ai-chat-message/ai-chat-message.css +0 -10
- package/dist/collection/components/ai-rating/ai-rating.css +9 -1
- package/dist/collection/components/ai-rating/ai-rating.js +3 -3
- package/dist/components/ai-chat-container.js +1 -1
- package/dist/components/ai-chat-header.js +1 -1
- package/dist/components/ai-chat-message.js +1 -1
- package/dist/components/ai-rating.js +1 -1
- package/dist/esm/ai-chat-container.entry.js +2 -2
- package/dist/esm/ai-chat-header.entry.js +32 -13
- package/dist/esm/ai-chat-message.entry.js +1 -1
- package/dist/esm/ai-rating.entry.js +4 -4
- package/dist/esm/loader.js +1 -1
- package/dist/esm/ui-ai-kit.js +1 -1
- package/dist/types/components/ai-chat-container/ai-chat-container.d.ts +1 -1
- package/dist/types/components/ai-chat-header/ai-chat-header.d.ts +8 -0
- package/dist/types/components.d.ts +22 -0
- package/dist/ui-ai-kit/p-3007f89b.entry.js +1 -0
- package/dist/ui-ai-kit/{p-a1ee6005.entry.js → p-8b1d056d.entry.js} +1 -1
- package/dist/ui-ai-kit/p-efb68380.entry.js +1 -0
- package/dist/ui-ai-kit/p-f645c832.entry.js +1 -0
- package/dist/ui-ai-kit/ui-ai-kit.esm.js +1 -1
- package/package.json +1 -1
- package/dist/ui-ai-kit/p-1b247096.entry.js +0 -1
- package/dist/ui-ai-kit/p-2fd7529e.entry.js +0 -1
- package/dist/ui-ai-kit/p-338d55d3.entry.js +0 -1
|
@@ -140,6 +140,7 @@ const ChatContainer = class {
|
|
|
140
140
|
if (newVal === 'float') {
|
|
141
141
|
this.setupDrag();
|
|
142
142
|
}
|
|
143
|
+
this.positionChange.emit(newVal);
|
|
143
144
|
}
|
|
144
145
|
disconnectedCallback() {
|
|
145
146
|
if (typeof window !== 'undefined') {
|
|
@@ -163,7 +164,6 @@ const ChatContainer = class {
|
|
|
163
164
|
async cyclePosition() {
|
|
164
165
|
const docked = this.direction === 'rtl' ? 'left' : 'right';
|
|
165
166
|
this.position = this.position === 'float' ? docked : 'float';
|
|
166
|
-
this.positionChange.emit(this.position);
|
|
167
167
|
}
|
|
168
168
|
handleWindowResize = () => {
|
|
169
169
|
this.checkMobile();
|
|
@@ -235,7 +235,7 @@ const ChatContainer = class {
|
|
|
235
235
|
return (index.h("div", { class: "error-state", role: "alert" }, index.h("svg", { class: "error-icon", width: "48", height: "48", viewBox: "0 0 24 24", fill: "none", xmlns: "http://www.w3.org/2000/svg" }, index.h("circle", { cx: "12", cy: "12", r: "10", stroke: "currentColor", "stroke-width": "1.5" }), index.h("path", { d: "M12 7v6", stroke: "currentColor", "stroke-width": "1.5", "stroke-linecap": "round" }), index.h("circle", { cx: "12", cy: "16.5", r: "0.75", fill: "currentColor" })), index.h("p", { class: "error-text" }, this.errorText), index.h("button", { class: "error-retry-btn", type: "button", onClick: () => this.retryClick.emit() }, this.retryLabel)));
|
|
236
236
|
}
|
|
237
237
|
render() {
|
|
238
|
-
return (index.h(index.Host, { key: '
|
|
238
|
+
return (index.h(index.Host, { key: '1213110dce6a44b37c4a7b1f6a584368951964d2', class: { dark: this.isDark() } }, index.h("div", { key: 'df0df824b4ef271aae37dee7aa2fc85037ef647a', class: this.getContainerClasses(), style: this.getContainerStyle(), ref: el => (this.containerRef = el) }, this.showWatermark && !this.loading && !this.error && (index.h("div", { key: '168fd1510d8910f234331c03d4d549d0a9586472', class: "watermark" }, index.h("svg", { key: 'fde35527192a8501b190462bfdf66ae7d739742c', class: "watermark-circle-svg", width: "133", height: "133", viewBox: "0 0 133 133", fill: "none", xmlns: "http://www.w3.org/2000/svg" }, index.h("g", { key: '63c94c35e3adafac862c39cda04d05d75199bae0', filter: "url(#wm_circle_shadow)" }, index.h("circle", { key: '8e8e304ae2132ad36855457a7755b2ba20770038', cx: "66.415", cy: "66.415", r: "66.415", class: "watermark-circle" })), index.h("defs", { key: 'c571edd0fb6a68bf9e62530398ba01e482f5755e' }, index.h("filter", { key: 'c63ab4c6c16db9eac63d944c481564af4667f493', id: "wm_circle_shadow", x: "0", y: "0", width: "132.83", height: "135.83", filterUnits: "userSpaceOnUse", "color-interpolation-filters": "sRGB" }, index.h("feFlood", { key: '37105253941532ffc3136713df67e87b9ef123e5', "flood-opacity": "0", result: "BackgroundImageFix" }), index.h("feBlend", { key: 'ecde8a14cbc2a11125e548ebe412f00381aa561e', mode: "normal", in: "SourceGraphic", in2: "BackgroundImageFix", result: "shape" }), index.h("feColorMatrix", { key: '1001d9bf46d7df0f8788e46cfb311a90b5984f8d', in: "SourceAlpha", type: "matrix", values: "0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 127 0", result: "hardAlpha" }), index.h("feOffset", { key: '4ffa296814b3eeb49e56688f1d6a981ac7055a92', dy: "3" }), index.h("feGaussianBlur", { key: '91a6bf8600f4b30c24af6717d61a7549584240f7', stdDeviation: "3" }), index.h("feComposite", { key: '325b8156a7a3cc8dfa1855d687436d170dc83bbb', in2: "hardAlpha", operator: "arithmetic", k2: "-1", k3: "1" }), index.h("feColorMatrix", { key: '48da64c927a7c97e21b499576cc8a421445ffd61', type: "matrix", values: "0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0.06 0" }), index.h("feBlend", { key: '2c3fcf67f6769a6e6cee16ee4f7a6115a2aa3fbc', mode: "normal", in2: "shape", result: "effect1_innerShadow" })))), index.h("svg", { key: '25669b41c62a83760adb26129d4547ece7d5f6d9', class: "watermark-star-svg", width: "78", height: "78", viewBox: "0 0 78 78", fill: "none", xmlns: "http://www.w3.org/2000/svg" }, index.h("g", { key: 'e1347f63fe1b5b57c1be6d4958817c2682745972', filter: "url(#wm_star_shadow)" }, index.h("path", { key: '12ca3bbc4dcca07dbd4cc9e5b0227c2a4b5eeb98', d: "M38.7421 0C39.5691 0 40.2689 0.286272 40.8414 0.858815C41.414 1.43136 41.7002 2.13113 41.7002 2.95814C41.7002 8.87442 43.1952 14.3772 46.1851 19.4665C49.1115 24.4285 53.0557 28.3727 58.0177 31.299C63.107 34.289 68.6097 35.7839 74.526 35.7839C75.353 35.7839 76.0528 36.0702 76.6254 36.6428C77.1979 37.2153 77.4842 37.9151 77.4842 38.7421C77.4842 39.5691 77.1979 40.2689 76.6254 40.8414C76.0528 41.414 75.353 41.7002 74.526 41.7002C68.6097 41.7002 63.107 43.1952 58.0177 46.1851C53.0557 49.1115 49.1115 53.0557 46.1851 58.0177C43.1952 63.107 41.7002 68.6097 41.7002 74.526C41.7002 75.353 41.414 76.0528 40.8414 76.6254C40.2689 77.1979 39.5691 77.4842 38.7421 77.4842C37.9151 77.4842 37.2153 77.1979 36.6428 76.6254C36.0702 76.0528 35.7839 75.353 35.7839 74.526C35.7839 68.6097 34.289 63.107 31.299 58.0177C28.3727 53.0557 24.4285 49.1115 19.4665 46.1851C14.3772 43.1952 8.87442 41.7002 2.95814 41.7002C2.13113 41.7002 1.43136 41.414 0.858815 40.8414C0.286272 40.2689 0 39.5691 0 38.7421C0 37.9151 0.286272 37.2153 0.858815 36.6428C1.43136 36.0702 2.13113 35.7839 2.95814 35.7839C8.87442 35.7839 14.3772 34.289 19.4665 31.299C24.4285 28.3727 28.3727 24.4285 31.299 19.4665C34.289 14.3772 35.7839 8.87442 35.7839 2.95814C35.7839 2.13113 36.0702 1.43136 36.6428 0.858815C37.2153 0.286272 37.9151 0 38.7421 0Z", class: "watermark-star" })), index.h("defs", { key: '6118bbae343ffc6cdc52df3d2062b63dd655f96d' }, index.h("filter", { key: 'ac762ad5983155b7122e4e1466dcaa9230d2ad4f', id: "wm_star_shadow", x: "0", y: "0", width: "77.4844", height: "79.4841", filterUnits: "userSpaceOnUse", "color-interpolation-filters": "sRGB" }, index.h("feFlood", { key: '452561901594c49f607f2a5a0dd149edab297703', "flood-opacity": "0", result: "BackgroundImageFix" }), index.h("feBlend", { key: 'bd77b4ec605953eff1b83d63b152f6bc0cf757f9', mode: "normal", in: "SourceGraphic", in2: "BackgroundImageFix", result: "shape" }), index.h("feColorMatrix", { key: '55215acb177fe0a8d7bf454244d1eec0a52657d9', in: "SourceAlpha", type: "matrix", values: "0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 127 0", result: "hardAlpha" }), index.h("feOffset", { key: '2079610df4ddb703dffdb0ba26a83262b28ddb8e', dy: "2" }), index.h("feGaussianBlur", { key: 'b42acf138ed8ed2c51ce3a51eb774f8ccb3932a5', stdDeviation: "2" }), index.h("feComposite", { key: '6b2439a1f50c1355851333431d1745d864fd4a68', in2: "hardAlpha", operator: "arithmetic", k2: "-1", k3: "1" }), index.h("feColorMatrix", { key: 'da9900a125e3e0df5f3bb383382b949d0c967d9c', type: "matrix", values: "0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0.06 0" }), index.h("feBlend", { key: '579851be42d902cbd9939df09ba996b11210181f', mode: "normal", in2: "shape", result: "effect1_innerShadow" })))))), index.h("slot", { key: 'e2ef3a4097ff512ac2e9638fef4725b55cd4ea24', name: "header" }), index.h("div", { key: '46dac73e46b2eac797c88ed826497e4d6063f2d3', class: "messages-area", ref: el => (this.messagesAreaRef = el) }, this.loading ? this.renderSkeleton() : this.error ? this.renderError() : index.h("slot", null)), index.h("slot", { key: 'ff2cf3628bbab90bd0cdce07df6c08ae597867ba', name: "footer" }))));
|
|
239
239
|
}
|
|
240
240
|
static get watchers() { return {
|
|
241
241
|
"isOpen": [{
|
|
@@ -57,11 +57,18 @@ const AiChatHeader = class {
|
|
|
57
57
|
conversationDeletingId = '';
|
|
58
58
|
/** Show a shimmer skeleton in place of the conversation title (e.g. while loading conversation) */
|
|
59
59
|
titleLoading = false;
|
|
60
|
+
/** Hide the new-chat (pencil-edit) button */
|
|
61
|
+
disableNewChat = false;
|
|
62
|
+
/** Hide the conversation-list dropdown trigger (title chevron) */
|
|
63
|
+
disableConversationList = false;
|
|
60
64
|
avatarError = false;
|
|
61
65
|
dropdownOpen = false;
|
|
62
66
|
/** Internally managed — true when the parent ai-chat-container has position="float" */
|
|
63
67
|
isFloating = false;
|
|
68
|
+
/** Internally managed — true when viewport width < 768px (matches ai-chat-container logic) */
|
|
69
|
+
isMobile = false;
|
|
64
70
|
parentPositionObserver = null;
|
|
71
|
+
handleWindowResize = () => this.checkMobile();
|
|
65
72
|
/** Cancel / close button */
|
|
66
73
|
closeClick;
|
|
67
74
|
/** Pencil-edit button (agent mode) */
|
|
@@ -96,7 +103,7 @@ const AiChatHeader = class {
|
|
|
96
103
|
}
|
|
97
104
|
}
|
|
98
105
|
connectedCallback() {
|
|
99
|
-
|
|
106
|
+
this.checkMobile();
|
|
100
107
|
}
|
|
101
108
|
componentDidLoad() {
|
|
102
109
|
// By this point, the element is fully in the DOM and parent relationships are established
|
|
@@ -105,10 +112,21 @@ const AiChatHeader = class {
|
|
|
105
112
|
this.syncFloatingState();
|
|
106
113
|
this.observeParentPosition();
|
|
107
114
|
});
|
|
115
|
+
if (typeof window !== 'undefined') {
|
|
116
|
+
window.addEventListener('resize', this.handleWindowResize);
|
|
117
|
+
}
|
|
108
118
|
}
|
|
109
119
|
disconnectedCallback() {
|
|
110
120
|
this.parentPositionObserver?.disconnect();
|
|
111
121
|
this.parentPositionObserver = null;
|
|
122
|
+
if (typeof window !== 'undefined') {
|
|
123
|
+
window.removeEventListener('resize', this.handleWindowResize);
|
|
124
|
+
}
|
|
125
|
+
}
|
|
126
|
+
checkMobile() {
|
|
127
|
+
if (typeof window !== 'undefined') {
|
|
128
|
+
this.isMobile = window.innerWidth < 768;
|
|
129
|
+
}
|
|
112
130
|
}
|
|
113
131
|
observeParentPosition() {
|
|
114
132
|
if (this.parentPositionObserver)
|
|
@@ -149,7 +167,7 @@ const AiChatHeader = class {
|
|
|
149
167
|
} }));
|
|
150
168
|
}
|
|
151
169
|
renderDragBtn() {
|
|
152
|
-
return (this.isFloating && (index.h("button", { class: "action-btn drag-btn", "aria-label": "\u0633\u062D\u0628 / Drag", onPointerDown: (e) => {
|
|
170
|
+
return (this.isFloating && !this.isMobile && (index.h("button", { class: "action-btn drag-btn", "aria-label": "\u0633\u062D\u0628 / Drag", onPointerDown: (e) => {
|
|
153
171
|
e.preventDefault();
|
|
154
172
|
this.headerDragStart.emit({ clientX: e.clientX, clientY: e.clientY });
|
|
155
173
|
} }, this.renderIcon('drag', 11, 15))));
|
|
@@ -168,38 +186,39 @@ const AiChatHeader = class {
|
|
|
168
186
|
this.conversationRetry.emit();
|
|
169
187
|
};
|
|
170
188
|
renderConversationDropdown() {
|
|
171
|
-
if (!this.dropdownOpen || this.mode !== 'agent')
|
|
189
|
+
if (!this.dropdownOpen || this.mode !== 'agent' || this.disableConversationList)
|
|
172
190
|
return null;
|
|
173
191
|
return (index.h("div", { class: "conversation-dropdown" }, index.h("ai-conversation-list", { items: this.conversationItems, activeId: this.conversationActiveId, loading: this.conversationLoading, error: this.conversationError, errorText: this.conversationErrorText, retryLabel: this.conversationRetryLabel, emptyText: this.conversationEmptyText, deletingId: this.conversationDeletingId, onConversationSelect: this.handleConversationSelect, onConversationDelete: this.handleConversationDelete, onRetryClick: this.handleConversationRetry })));
|
|
174
192
|
}
|
|
175
193
|
renderAgentMode() {
|
|
194
|
+
const titleContent = this.disableConversationList ? (index.h("div", { class: "content agent" }, this.titleLoading ? (index.h("span", { class: "title-skeleton", "aria-busy": "true", "aria-label": "\u062C\u0627\u0631\u064A \u0627\u0644\u062A\u062D\u0645\u064A\u0644" })) : (index.h("span", { class: "title" }, this.conversation)))) : (index.h("div", { class: "content agent dropdown-trigger", role: "button", onClick: () => {
|
|
195
|
+
if (this.titleLoading)
|
|
196
|
+
return;
|
|
197
|
+
this.dropdownOpen = !this.dropdownOpen;
|
|
198
|
+
this.dropdownClick.emit();
|
|
199
|
+
}, "aria-haspopup": "listbox", "aria-expanded": this.dropdownOpen, "aria-label": `${this.conversation}, افتح قائمة المحادثات` }, this.titleLoading ? (index.h("span", { class: "title-skeleton", "aria-busy": "true", "aria-label": "\u062C\u0627\u0631\u064A \u0627\u0644\u062A\u062D\u0645\u064A\u0644" })) : (index.h("span", { class: "title" }, this.conversation)), !this.titleLoading && (index.h("span", { class: `dropdown-chevron${this.dropdownOpen ? ' open' : ''}` }, this.renderIcon('chevron-down', 24, 24)))));
|
|
176
200
|
return [
|
|
177
201
|
this.renderDragBtn(),
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
return;
|
|
181
|
-
this.dropdownOpen = !this.dropdownOpen;
|
|
182
|
-
this.dropdownClick.emit();
|
|
183
|
-
}, "aria-haspopup": "listbox", "aria-expanded": this.dropdownOpen, "aria-label": `${this.conversation}, افتح قائمة المحادثات` }, this.titleLoading ? (index.h("span", { class: "title-skeleton", "aria-busy": "true", "aria-label": "\u062C\u0627\u0631\u064A \u0627\u0644\u062A\u062D\u0645\u064A\u0644" })) : (index.h("span", { class: "title" }, this.conversation)), !this.titleLoading && (index.h("span", { class: `dropdown-chevron${this.dropdownOpen ? ' open' : ''}` }, this.renderIcon('chevron-down', 24, 24)))),
|
|
184
|
-
index.h("div", { class: "actions" }, index.h("button", { class: "action-btn", "aria-label": "\u0645\u062D\u0627\u062F\u062B\u0629 \u062C\u062F\u064A\u062F\u0629 / New Chat", onClick: () => this.newChatClick.emit() }, this.renderIcon('pencil-edit', 22, 22)), index.h("button", { class: "action-btn", "aria-label": "\u0627\u0644\u0639\u0631\u0636 / Position", onClick: () => { this.positionClick.emit(); this.headerPositionClick.emit(); } }, this.renderIcon('hand', 22, 22)), index.h("button", { class: "action-btn", "aria-label": "\u0625\u063A\u0644\u0627\u0642 / Close", onClick: () => this.closeClick.emit() }, this.renderIcon('cancel', 22, 22))),
|
|
202
|
+
titleContent,
|
|
203
|
+
index.h("div", { class: "actions" }, !this.disableNewChat && (index.h("button", { class: "action-btn", "aria-label": "\u0645\u062D\u0627\u062F\u062B\u0629 \u062C\u062F\u064A\u062F\u0629 / New Chat", onClick: () => this.newChatClick.emit() }, this.renderIcon('pencil-edit', 22, 22))), !this.isMobile && (index.h("button", { class: "action-btn", "aria-label": "\u0627\u0644\u0639\u0631\u0636 / Position", onClick: () => { this.positionClick.emit(); this.headerPositionClick.emit(); } }, this.renderIcon('hand', 22, 22))), index.h("button", { class: "action-btn", "aria-label": "\u0625\u063A\u0644\u0627\u0642 / Close", onClick: () => this.closeClick.emit() }, this.renderIcon('cancel', 22, 22))),
|
|
185
204
|
];
|
|
186
205
|
}
|
|
187
206
|
renderHumanMode() {
|
|
188
207
|
return [
|
|
189
208
|
this.renderDragBtn(),
|
|
190
209
|
index.h("div", { class: "content human" }, this.showBack && (index.h("button", { class: "back-btn", "aria-label": "\u0631\u062C\u0648\u0639 / Back", onClick: () => this.backClick.emit() }, this.renderIcon('arrow-right', 24, 24))), index.h("div", { class: "avatar-wrapper" }, this.renderAvatar(), index.h("span", { class: `online-dot status-${this.statusIndicator}` }, this.renderIcon('online-dot', 10, 10))), index.h("div", { class: "text-block" }, index.h("span", { class: "agent-name" }, this.agentName), this.agentStatus && index.h("span", { class: "agent-status" }, this.agentStatus))),
|
|
191
|
-
index.h("div", { class: "actions" }, index.h("button", { class: "action-btn", "aria-label": "\u0627\u0644\u0639\u0631\u0636 / Position", onClick: () => { this.positionClick.emit(); this.headerPositionClick.emit(); } }, this.renderIcon('hand', 22, 22)), index.h("button", { class: "action-btn", "aria-label": "\u0625\u063A\u0644\u0627\u0642 / Close", onClick: () => this.closeClick.emit() }, this.renderIcon('cancel', 22, 22))),
|
|
210
|
+
index.h("div", { class: "actions" }, !this.isMobile && (index.h("button", { class: "action-btn", "aria-label": "\u0627\u0644\u0639\u0631\u0636 / Position", onClick: () => { this.positionClick.emit(); this.headerPositionClick.emit(); } }, this.renderIcon('hand', 22, 22))), index.h("button", { class: "action-btn", "aria-label": "\u0625\u063A\u0644\u0627\u0642 / Close", onClick: () => this.closeClick.emit() }, this.renderIcon('cancel', 22, 22))),
|
|
192
211
|
];
|
|
193
212
|
}
|
|
194
213
|
renderBrowserMode() {
|
|
195
214
|
return [
|
|
196
215
|
this.renderDragBtn(),
|
|
197
216
|
index.h("div", { class: "content browser" }, index.h("button", { class: "back-btn", "aria-label": "\u0631\u062C\u0648\u0639 / Back", onClick: () => this.backClick.emit() }, this.renderIcon('arrow-right', 24, 24)), index.h("span", { class: "browser-title" }, this.pageTitle), index.h("button", { class: "browser-link-btn", "aria-label": "\u0641\u062A\u062D \u0641\u064A \u0646\u0627\u0641\u0630\u0629 \u062C\u062F\u064A\u062F\u0629 / Open externally", onClick: () => this.openExternal.emit(this.pageUrl) }, this.renderIcon('link', 14, 14))),
|
|
198
|
-
index.h("div", { class: "actions" }, index.h("button", { class: "action-btn", "aria-label": "\u0627\u0644\u0639\u0631\u0636 / Position", onClick: () => { this.positionClick.emit(); this.headerPositionClick.emit(); } }, this.renderIcon('hand', 22, 22)), index.h("button", { class: "action-btn", "aria-label": "\u0625\u063A\u0644\u0627\u0642 / Close", onClick: () => this.closeClick.emit() }, this.renderIcon('cancel', 22, 22))),
|
|
217
|
+
index.h("div", { class: "actions" }, !this.isMobile && (index.h("button", { class: "action-btn", "aria-label": "\u0627\u0644\u0639\u0631\u0636 / Position", onClick: () => { this.positionClick.emit(); this.headerPositionClick.emit(); } }, this.renderIcon('hand', 22, 22))), index.h("button", { class: "action-btn", "aria-label": "\u0625\u063A\u0644\u0627\u0642 / Close", onClick: () => this.closeClick.emit() }, this.renderIcon('cancel', 22, 22))),
|
|
199
218
|
];
|
|
200
219
|
}
|
|
201
220
|
render() {
|
|
202
|
-
return (index.h(index.Host, { key: '
|
|
221
|
+
return (index.h(index.Host, { key: '4c51abf7f5fb572ec62191c0b097a4fdf9b218c3' }, index.h("div", { key: 'c05febe2f984bad8e80b9f0d9f2ceeebc812a9b4', class: "header-wrapper" }, index.h("div", { key: '927c606ae5452a9a5c1e19edd2145f9e1ee42d2c', class: "header-container" }, this.mode === 'agent' ? this.renderAgentMode() : this.mode === 'human' ? this.renderHumanMode() : this.renderBrowserMode()), this.renderConversationDropdown())));
|
|
203
222
|
}
|
|
204
223
|
};
|
|
205
224
|
AiChatHeader.style = aiChatHeaderCss();
|
|
@@ -1389,7 +1389,7 @@ function createDOMPurify() {
|
|
|
1389
1389
|
}
|
|
1390
1390
|
var purify = createDOMPurify();
|
|
1391
1391
|
|
|
1392
|
-
const aiChatMessageCss = () => `:host{--ai-msg-user-bg:var(--ai-user-bubble-bg);--ai-msg-user-border:1px solid var(--ai-border-default);--ai-msg-agent-bg:var(--ai-agent-bubble-bg);--ai-msg-agent-border:1px solid var(--ai-border-default);--ai-msg-border-radius:16px;--ai-msg-padding:16px;--ai-msg-font-size:14px;--ai-msg-action-active-bg:var(--ai-accent);--ai-user-msg-max-width:80%;--ai-agent-msg-max-width:80%;display:block}.message-row{display:flex}.user-row{flex-direction:column;align-items:flex-end}.user-bubble{background:var(--ai-msg-user-bg);color:var(--ai-text-primary);border:var(--ai-msg-user-border);border-radius:var(--ai-msg-border-radius);padding:var(--ai-msg-padding);font-size:var(--ai-msg-font-size);max-width:var(--ai-user-msg-max-width);line-height:1.5;word-break:break-word;box-shadow:var(--ai-shadow-sm)}.user-row .timestamp{font-size:12px;color:var(--ai-text-secondary);margin-top:4px}.agent-row{flex-direction:row;justify-content:flex-start}.agent-bubble-wrapper{display:flex;flex-direction:column;gap:6px;width:100%;max-width:var(--ai-msg-agent-max-width);min-width:0}.agent-bubble{background:var(--ai-msg-agent-bg);color:var(--ai-text-primary);border:var(--ai-msg-agent-border);border-radius:var(--ai-msg-border-radius);padding:var(--ai-msg-padding);font-size:var(--ai-msg-font-size);line-height:1.6;word-break:break-word;box-shadow:var(--ai-shadow-sm);display:flex;flex-direction:column;gap:12px}.message-content{white-space:pre-wrap}.message-content p{margin:0 0 8px 0}.message-content p:last-child{margin-bottom:0}.message-content h2{font-size:16px;font-weight:700;margin:0 0 8px 0}.message-content h3{font-size:15px;font-weight:600;margin:0 0 6px 0}.message-content strong{font-weight:700}.message-content em{font-style:italic}.message-content code{background:var(--ai-bg-surface);border-radius:4px;padding:1px 5px;font-family:var(--ai-font-family-mono);font-size:13px;color:var(--ai-text-primary)}.message-content pre{background:var(--ai-bg-surface);border-radius:8px;padding:10px 12px;overflow-x:auto;margin:8px 0}.message-content pre code{background:none;padding:0;font-size:13px}.message-content ul,.message-content ol{padding-inline-start:20px;margin:4px 0 8px 0}.message-content li{margin-bottom:3px}.actions-bar{display:flex;flex-direction:row;align-items:center;justify-content:flex-start;gap:6px;height:
|
|
1392
|
+
const aiChatMessageCss = () => `:host{--ai-msg-user-bg:var(--ai-user-bubble-bg);--ai-msg-user-border:1px solid var(--ai-border-default);--ai-msg-agent-bg:var(--ai-agent-bubble-bg);--ai-msg-agent-border:1px solid var(--ai-border-default);--ai-msg-border-radius:16px;--ai-msg-padding:16px;--ai-msg-font-size:14px;--ai-msg-action-active-bg:var(--ai-accent);--ai-user-msg-max-width:80%;--ai-agent-msg-max-width:80%;display:block}.message-row{display:flex}.user-row{flex-direction:column;align-items:flex-end}.user-bubble{background:var(--ai-msg-user-bg);color:var(--ai-text-primary);border:var(--ai-msg-user-border);border-radius:var(--ai-msg-border-radius);padding:var(--ai-msg-padding);font-size:var(--ai-msg-font-size);max-width:var(--ai-user-msg-max-width);line-height:1.5;word-break:break-word;box-shadow:var(--ai-shadow-sm)}.user-row .timestamp{font-size:12px;color:var(--ai-text-secondary);margin-top:4px}.agent-row{flex-direction:row;justify-content:flex-start}.agent-bubble-wrapper{display:flex;flex-direction:column;gap:6px;width:100%;max-width:var(--ai-msg-agent-max-width);min-width:0}.agent-bubble{background:var(--ai-msg-agent-bg);color:var(--ai-text-primary);border:var(--ai-msg-agent-border);border-radius:var(--ai-msg-border-radius);padding:var(--ai-msg-padding);font-size:var(--ai-msg-font-size);line-height:1.6;word-break:break-word;box-shadow:var(--ai-shadow-sm);display:flex;flex-direction:column;gap:12px}.message-content{white-space:pre-wrap}.message-content p{margin:0 0 8px 0}.message-content p:last-child{margin-bottom:0}.message-content h2{font-size:16px;font-weight:700;margin:0 0 8px 0}.message-content h3{font-size:15px;font-weight:600;margin:0 0 6px 0}.message-content strong{font-weight:700}.message-content em{font-style:italic}.message-content code{background:var(--ai-bg-surface);border-radius:4px;padding:1px 5px;font-family:var(--ai-font-family-mono);font-size:13px;color:var(--ai-text-primary)}.message-content pre{background:var(--ai-bg-surface);border-radius:8px;padding:10px 12px;overflow-x:auto;margin:8px 0}.message-content pre code{background:none;padding:0;font-size:13px}.message-content ul,.message-content ol{padding-inline-start:20px;margin:4px 0 8px 0}.message-content li{margin-bottom:3px}.actions-bar{display:flex;flex-direction:row;align-items:center;justify-content:flex-start;gap:6px;height:32px}.action-btn{display:flex;align-items:center;justify-content:center;width:32px;height:32px;border-radius:8px;background:var(--ai-bg-card);border:1px solid var(--ai-border-default);cursor:pointer;color:var(--ai-text-primary);transition:background 0.15s, color 0.15s;padding:0;flex-shrink:0}.action-btn:hover{background:var(--ai-bg-surface)}.action-btn.copy-success{background:var(--ai-msg-action-active-bg);color:var(--ai-accent-text);border-color:var(--ai-accent)}.feedback-group{display:flex;align-items:center;border:1px solid var(--ai-border-default);border-radius:8px;overflow:hidden;background:var(--ai-bg-card)}.feedback-btn{display:flex;align-items:center;justify-content:center;height:32px;padding:0 8px;background:var(--ai-bg-card);border:none;border-inline-start:1px solid var(--ai-border-default);cursor:pointer;color:var(--ai-text-primary);transition:background 0.15s, color 0.15s}.feedback-btn:first-child{border-inline-start:none}.feedback-btn:hover{background:var(--ai-bg-surface)}.feedback-btn.active{background:var(--ai-msg-action-active-bg);color:var(--ai-accent-text)}.icon-wrap{display:flex;align-items:center;justify-content:center;line-height:0}.agent-info{display:flex;flex-direction:row;align-items:center;justify-content:flex-start;gap:6px;color:var(--ai-text-muted)}.agent-info-name,.agent-info-time{font-size:12px;color:inherit;line-height:16px;white-space:nowrap}.agent-info .icon-wrap{display:flex;align-items:center;color:inherit;opacity:0.6;flex-shrink:0}.typing-indicator{display:flex;align-items:center;gap:5px;padding:4px 2px}.typing-dot{width:8px;height:8px;border-radius:50%;background:var(--ai-text-muted);animation:typingBounce 1.2s ease-in-out infinite}.typing-dot:nth-child(2){animation-delay:0.2s}.typing-dot:nth-child(3){animation-delay:0.4s}@keyframes typingBounce{0%,60%,100%{transform:translateY(0)}30%{transform:translateY(-6px)}}.streaming-cursor{display:inline-block;width:2px;height:1em;background:currentColor;vertical-align:text-bottom;margin-inline-start:2px;animation:cursorBlink 0.8s step-start infinite}@keyframes cursorBlink{0%,100%{opacity:1}50%{opacity:0}}`;
|
|
1393
1393
|
|
|
1394
1394
|
const SANITIZE_CONFIG = {
|
|
1395
1395
|
ALLOWED_TAGS: ['p', 'br', 'strong', 'em', 'del', 'code', 'pre', 'ul', 'ol', 'li', 'h2', 'h3', 'a', 'blockquote', 'table', 'thead', 'tbody', 'tr', 'th', 'td'],
|
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
var index = require('./index-Cc05u4ND.js');
|
|
4
4
|
var iconRegistry = require('./icon-registry-D-m8GW4D.js');
|
|
5
5
|
|
|
6
|
-
const aiRatingCss = () => `:host{--ai-rating-question-size:16px;--ai-rating-subtitle-size:14px;--ai-rating-gap:8px;--ai-rating-emoji-size:24px;--ai-rating-btn-padding:6px;--ai-rating-btn-border:1px solid var(--ai-border-light);--ai-rating-btn-radius:9999px;--ai-rating-btn-bg-hover:var(--ai-bg-surface);--ai-rating-btn-border-hover:1px solid var(--ai-border-default);--ai-rating-btn-bg-active:var(--ai-warning-bg);--ai-rating-btn-border-active:1px solid var(--ai-warning-border);--ai-rating-btn-shadow-active:var(--ai-shadow-active);--ai-rating-label-size:16px;display:block}.rating{display:flex;flex-direction:column;align-items:center;gap:var(--ai-rating-gap);width:100%}.rating__text{display:flex;flex-direction:column;align-items:center;gap:2px;width:100%;text-align:center}.rating__question{margin:0;font-size:var(--ai-rating-question-size);font-weight:500;line-height:24px;color:var(--ai-text-primary)}.rating__subtitle{margin:0;font-size:var(--ai-rating-subtitle-size);font-weight:400;line-height:20px;color:var(--ai-text-secondary)}.rating__icons{display:flex;align-items:center;justify-content:center;gap:10px;width:100%;flex-wrap:wrap}.emoji-btn{display:inline-flex;align-items:center;justify-content:center;padding:var(--ai-rating-btn-padding);border:var(--ai-rating-btn-border);border-radius:var(--ai-rating-btn-radius);background:transparent;cursor:pointer;transition:background 0.15s ease, border-color 0.15s ease, box-shadow 0.15s ease, transform 0.15s ease;outline:none}.emoji-btn:focus-visible{outline:2px solid var(--ai-warning-border);outline-offset:2px}.emoji-btn:hover:not(:disabled),.emoji-btn--hovered{background:var(--ai-rating-btn-bg-hover);border:var(--ai-rating-btn-border-hover);transform:scale(1.1)}.emoji-btn--active{background:var(--ai-rating-btn-bg-active) !important;border:var(--ai-rating-btn-border-active) !important;box-shadow:var(--ai-rating-btn-shadow-active);transform:scale(1.18) !important}.emoji-btn--disabled{opacity:0.45;cursor:not-allowed;pointer-events:none}.emoji-btn__icon{font-size:var(--ai-rating-emoji-size);line-height:1;display:inline-flex;align-items:center;justify-content:center;width:var(--ai-rating-emoji-size);height:var(--ai-rating-emoji-size);pointer-events:none}.rating__hover-label{margin:0;font-size:var(--ai-rating-label-size);font-weight:500;line-height:24px;color:var(--ai-text-primary);text-align:center;width:100%;
|
|
6
|
+
const aiRatingCss = () => `:host{--ai-rating-question-size:16px;--ai-rating-subtitle-size:14px;--ai-rating-gap:8px;--ai-rating-emoji-size:24px;--ai-rating-btn-padding:6px;--ai-rating-btn-border:1px solid var(--ai-border-light);--ai-rating-btn-radius:9999px;--ai-rating-btn-bg-hover:var(--ai-bg-surface);--ai-rating-btn-border-hover:1px solid var(--ai-border-default);--ai-rating-btn-bg-active:var(--ai-warning-bg);--ai-rating-btn-border-active:1px solid var(--ai-warning-border);--ai-rating-btn-shadow-active:var(--ai-shadow-active);--ai-rating-label-size:16px;display:block}.rating{display:flex;flex-direction:column;align-items:center;gap:var(--ai-rating-gap);width:100%}.rating__text{display:flex;flex-direction:column;align-items:center;gap:2px;width:100%;text-align:center}.rating__question{margin:0;font-size:var(--ai-rating-question-size);font-weight:500;line-height:24px;color:var(--ai-text-primary)}.rating__subtitle{margin:0;font-size:var(--ai-rating-subtitle-size);font-weight:400;line-height:20px;color:var(--ai-text-secondary)}.rating__icons{display:flex;align-items:center;justify-content:center;gap:10px;width:100%;flex-wrap:wrap}.emoji-btn{display:inline-flex;align-items:center;justify-content:center;padding:var(--ai-rating-btn-padding);border:var(--ai-rating-btn-border);border-radius:var(--ai-rating-btn-radius);background:transparent;cursor:pointer;transition:background 0.15s ease, border-color 0.15s ease, box-shadow 0.15s ease, transform 0.15s ease;outline:none}.emoji-btn:focus-visible{outline:2px solid var(--ai-warning-border);outline-offset:2px}.emoji-btn:hover:not(:disabled),.emoji-btn--hovered{background:var(--ai-rating-btn-bg-hover);border:var(--ai-rating-btn-border-hover);transform:scale(1.1)}.emoji-btn--active{background:var(--ai-rating-btn-bg-active) !important;border:var(--ai-rating-btn-border-active) !important;box-shadow:var(--ai-rating-btn-shadow-active);transform:scale(1.18) !important}.emoji-btn--disabled{opacity:0.45;cursor:not-allowed;pointer-events:none}.emoji-btn__icon{font-size:var(--ai-rating-emoji-size);line-height:1;display:inline-flex;align-items:center;justify-content:center;width:var(--ai-rating-emoji-size);height:var(--ai-rating-emoji-size);pointer-events:none}.rating__hover-label{margin:0;font-size:var(--ai-rating-label-size);font-weight:500;line-height:24px;color:var(--ai-text-primary);text-align:center;width:100%;min-height:24px;opacity:0;visibility:hidden;transition:opacity 0.15s ease, visibility 0.15s ease}.rating__hover-label--visible{opacity:1;visibility:visible}.rating--success{display:flex;flex-direction:column;align-items:center;justify-content:center;gap:8px;padding:16px 0;animation:fadeIn 0.2s ease}.rating__success-message{margin:0;font-size:var(--ai-rating-question-size);font-weight:500;line-height:24px;color:var(--ai-text-primary);text-align:center}@keyframes fadeIn{from{opacity:0;transform:translateY(4px)}to{opacity:1;transform:translateY(0)}}`;
|
|
7
7
|
|
|
8
8
|
const EMOJI_OPTIONS = [
|
|
9
9
|
{ value: 1, icon: 'emoji-angry', label: 'سيئ جداً' },
|
|
@@ -47,7 +47,7 @@ const AiRating = class {
|
|
|
47
47
|
if (this.submitted) {
|
|
48
48
|
return (index.h(index.Host, null, index.h("ai-card", null, index.h("div", { class: "rating rating--success" }, index.h("ai-icon", { name: "check-circle", size: 32 }), index.h("p", { class: "rating__success-message" }, this.successMessage)))));
|
|
49
49
|
}
|
|
50
|
-
return (index.h(index.Host, null, index.h("ai-card", null, index.h("div", { class: "rating" }, index.h("div", { class: "rating__text" }, index.h("p", { class: "rating__question" }, this.question), index.h("p", { class: "rating__subtitle" }, this.subtitle)), index.h("div", { class: "rating__icons", role: "group", "aria-label": this.question }, EMOJI_OPTIONS.map(opt => {
|
|
50
|
+
return (index.h(index.Host, null, index.h("ai-card", null, index.h("div", { class: "rating" }, index.h("div", { class: "rating__text" }, index.h("p", { class: "rating__question" }, this.question), index.h("p", { class: "rating__subtitle" }, this.subtitle)), index.h("div", { class: "rating__icons", role: "group", "aria-label": this.question, onMouseLeave: () => (this.hovered = null) }, EMOJI_OPTIONS.map(opt => {
|
|
51
51
|
const isActive = this.value === opt.value;
|
|
52
52
|
const isHovered = this.hovered === opt.value;
|
|
53
53
|
const icon = iconRegistry.iconRegistry[opt.icon];
|
|
@@ -56,8 +56,8 @@ const AiRating = class {
|
|
|
56
56
|
'emoji-btn--active': isActive,
|
|
57
57
|
'emoji-btn--hovered': isHovered && !isActive,
|
|
58
58
|
'emoji-btn--disabled': this.disabled,
|
|
59
|
-
}, "aria-label": opt.label, "aria-pressed": isActive ? 'true' : 'false', disabled: this.disabled, onClick: () => this.select(opt.value), onMouseEnter: () => (this.hovered = opt.value)
|
|
60
|
-
})),
|
|
59
|
+
}, "aria-label": opt.label, "aria-pressed": isActive ? 'true' : 'false', disabled: this.disabled, onClick: () => this.select(opt.value), onMouseEnter: () => (this.hovered = opt.value) }, index.h("span", { class: "emoji-btn__icon", "aria-hidden": "true" }, index.h("svg", { width: 24, height: 24, viewBox: icon.viewBox, xmlns: "http://www.w3.org/2000/svg", ref: (el) => el && (el.innerHTML = icon.content) }))));
|
|
60
|
+
})), index.h("p", { class: { 'rating__hover-label': true, 'rating__hover-label--visible': label !== null } }, label ?? '\u00A0')))));
|
|
61
61
|
}
|
|
62
62
|
};
|
|
63
63
|
AiRating.style = aiRatingCss();
|
package/dist/cjs/loader.cjs.js
CHANGED
|
@@ -5,7 +5,7 @@ var index = require('./index-Cc05u4ND.js');
|
|
|
5
5
|
const defineCustomElements = async (win, options) => {
|
|
6
6
|
if (typeof window === 'undefined') return undefined;
|
|
7
7
|
await index.globalScripts();
|
|
8
|
-
return index.bootstrapLazy([["ai-message-input.cjs",[[513,"ai-message-input",{"placeholder":[1],"disabled":[4],"showVoiceButton":[4,"show-voice-button"],"maxLength":[2,"max-length"],"isRecording":[4,"is-recording"],"inputValue":[32],"showVoiceRecorder":[32],"isMultiline":[32],"setInputValue":[64]},null,{"isRecording":[{"onIsRecordingChange":0}]}]]],["ai-rating.cjs",[[513,"ai-rating",{"question":[1],"subtitle":[1],"successMessage":[1,"success-message"],"value":[1026],"disabled":[4],"hovered":[32],"submitted":[32]}]]],["ai-chat-header.cjs",[[513,"ai-chat-header",{"mode":[1],"conversation":[1],"agentName":[1,"agent-name"],"agentStatus":[1,"agent-status"],"agentAvatar":[1,"agent-avatar"],"showBack":[4,"show-back"],"statusIndicator":[1,"status-indicator"],"pageTitle":[1,"page-title"],"pageUrl":[1,"page-url"],"conversationItems":[16],"conversationActiveId":[1,"conversation-active-id"],"conversationLoading":[4,"conversation-loading"],"conversationError":[4,"conversation-error"],"conversationErrorText":[1,"conversation-error-text"],"conversationRetryLabel":[1,"conversation-retry-label"],"conversationEmptyText":[1,"conversation-empty-text"],"conversationDeletingId":[1,"conversation-deleting-id"],"titleLoading":[4,"title-loading"],"avatarError":[32],"dropdownOpen":[32],"isFloating":[32]},[[4,"click","handleDocumentClick"]]]]],["ai-agent-error.cjs",[[513,"ai-agent-error",{"headline":[1],"message":[1],"errorCode":[1,"error-code"],"retryable":[4],"retryLabel":[1,"retry-label"],"dismissible":[4]}]]],["ai-chat-container.cjs",[[769,"ai-chat-container",{"isOpen":[4,"is-open"],"position":[1537],"width":[1],"autoScroll":[4,"auto-scroll"],"showWatermark":[4,"show-watermark"],"floatHeight":[1,"float-height"],"theme":[1],"loading":[4],"error":[4],"errorText":[1,"error-text"],"retryLabel":[1,"retry-label"],"direction":[513],"isMobile":[32],"floatLeft":[32],"floatTop":[32],"scrollToBottom":[64],"cyclePosition":[64]},[[0,"headerPositionClick","handleHeaderPositionClick"]],{"isOpen":[{"isOpenChanged":0}],"position":[{"positionChanged":0}]}]]],["ai-chat-message.cjs",[[769,"ai-chat-message",{"role":[1],"content":[1],"format":[1],"agentName":[1,"agent-name"],"timestamp":[1],"showActions":[4,"show-actions"],"enableRegenerate":[4,"enable-regenerate"],"feedbackValue":[1025,"feedback-value"],"copySuccess":[32]}]]],["ai-conversation-summary.cjs",[[769,"ai-conversation-summary",{"conversation":[1],"summary":[1],"messageCount":[2,"message-count"],"language":[1]}]]],["ai-in-chat-browser.cjs",[[513,"ai-in-chat-browser",{"url":[1],"pageTitle":[1,"page-title"],"isLoading":[32],"hasError":[32]},null,{"url":[{"onUrlChange":0}]}]]],["ai-link.cjs",[[769,"ai-link",{"label":[1],"href":[1],"target":[1],"rel":[1]}]]],["ai-loading.cjs",[[513,"ai-loading",{"mode":[1],"statusText":[1,"status-text"],"thinkingSubtext":[1,"thinking-subtext"],"steps":[16],"headerTitle":[1,"header-title"],"currentAgent":[1,"current-agent"],"showAgentBadges":[4,"show-agent-badges"],"expanded":[1028],"collapsible":[4],"_expanded":[32]}]]],["ai-route-decision.cjs",[[513,"ai-route-decision",{"selectedAgent":[1,"selected-agent"],"agentIcon":[1,"agent-icon"],"reason":[1],"confidence":[2],"detectedLanguage":[1,"detected-language"],"expanded":[1028],"_expanded":[32]}]]],["ai-suggestion.cjs",[[769,"ai-suggestion",{"label":[1],"disabled":[4]}]]],["ai-voice-input.cjs",[[513,"ai-voice-input",{"disabled":[4],"showWaveform":[4,"show-waveform"],"autoStart":[4,"auto-start"],"errorText":[1,"error-text"],"waveformColor":[1,"waveform-color"],"state":[32],"error":[32],"recordingDuration":[32],"submitPulse":[32]}]]],["ai-card.cjs",[[769,"ai-card",{"noPadding":[4,"no-padding"],"noShadow":[4,"no-shadow"]}]]],["ai-conversation-list.cjs",[[513,"ai-conversation-list",{"items":[16],"activeId":[1,"active-id"],"loading":[4],"emptyText":[1,"empty-text"],"error":[4],"errorText":[1,"error-text"],"retryLabel":[1,"retry-label"],"deletingId":[1,"deleting-id"]}]]],["ai-icon.cjs",[[513,"ai-icon",{"name":[1],"size":[2]}]]]], options);
|
|
8
|
+
return index.bootstrapLazy([["ai-message-input.cjs",[[513,"ai-message-input",{"placeholder":[1],"disabled":[4],"showVoiceButton":[4,"show-voice-button"],"maxLength":[2,"max-length"],"isRecording":[4,"is-recording"],"inputValue":[32],"showVoiceRecorder":[32],"isMultiline":[32],"setInputValue":[64]},null,{"isRecording":[{"onIsRecordingChange":0}]}]]],["ai-rating.cjs",[[513,"ai-rating",{"question":[1],"subtitle":[1],"successMessage":[1,"success-message"],"value":[1026],"disabled":[4],"hovered":[32],"submitted":[32]}]]],["ai-chat-header.cjs",[[513,"ai-chat-header",{"mode":[1],"conversation":[1],"agentName":[1,"agent-name"],"agentStatus":[1,"agent-status"],"agentAvatar":[1,"agent-avatar"],"showBack":[4,"show-back"],"statusIndicator":[1,"status-indicator"],"pageTitle":[1,"page-title"],"pageUrl":[1,"page-url"],"conversationItems":[16],"conversationActiveId":[1,"conversation-active-id"],"conversationLoading":[4,"conversation-loading"],"conversationError":[4,"conversation-error"],"conversationErrorText":[1,"conversation-error-text"],"conversationRetryLabel":[1,"conversation-retry-label"],"conversationEmptyText":[1,"conversation-empty-text"],"conversationDeletingId":[1,"conversation-deleting-id"],"titleLoading":[4,"title-loading"],"disableNewChat":[4,"disable-new-chat"],"disableConversationList":[4,"disable-conversation-list"],"avatarError":[32],"dropdownOpen":[32],"isFloating":[32],"isMobile":[32]},[[4,"click","handleDocumentClick"]]]]],["ai-agent-error.cjs",[[513,"ai-agent-error",{"headline":[1],"message":[1],"errorCode":[1,"error-code"],"retryable":[4],"retryLabel":[1,"retry-label"],"dismissible":[4]}]]],["ai-chat-container.cjs",[[769,"ai-chat-container",{"isOpen":[4,"is-open"],"position":[1537],"width":[1],"autoScroll":[4,"auto-scroll"],"showWatermark":[4,"show-watermark"],"floatHeight":[1,"float-height"],"theme":[1],"loading":[4],"error":[4],"errorText":[1,"error-text"],"retryLabel":[1,"retry-label"],"direction":[513],"isMobile":[32],"floatLeft":[32],"floatTop":[32],"scrollToBottom":[64],"cyclePosition":[64]},[[0,"headerPositionClick","handleHeaderPositionClick"]],{"isOpen":[{"isOpenChanged":0}],"position":[{"positionChanged":0}]}]]],["ai-chat-message.cjs",[[769,"ai-chat-message",{"role":[1],"content":[1],"format":[1],"agentName":[1,"agent-name"],"timestamp":[1],"showActions":[4,"show-actions"],"enableRegenerate":[4,"enable-regenerate"],"feedbackValue":[1025,"feedback-value"],"copySuccess":[32]}]]],["ai-conversation-summary.cjs",[[769,"ai-conversation-summary",{"conversation":[1],"summary":[1],"messageCount":[2,"message-count"],"language":[1]}]]],["ai-in-chat-browser.cjs",[[513,"ai-in-chat-browser",{"url":[1],"pageTitle":[1,"page-title"],"isLoading":[32],"hasError":[32]},null,{"url":[{"onUrlChange":0}]}]]],["ai-link.cjs",[[769,"ai-link",{"label":[1],"href":[1],"target":[1],"rel":[1]}]]],["ai-loading.cjs",[[513,"ai-loading",{"mode":[1],"statusText":[1,"status-text"],"thinkingSubtext":[1,"thinking-subtext"],"steps":[16],"headerTitle":[1,"header-title"],"currentAgent":[1,"current-agent"],"showAgentBadges":[4,"show-agent-badges"],"expanded":[1028],"collapsible":[4],"_expanded":[32]}]]],["ai-route-decision.cjs",[[513,"ai-route-decision",{"selectedAgent":[1,"selected-agent"],"agentIcon":[1,"agent-icon"],"reason":[1],"confidence":[2],"detectedLanguage":[1,"detected-language"],"expanded":[1028],"_expanded":[32]}]]],["ai-suggestion.cjs",[[769,"ai-suggestion",{"label":[1],"disabled":[4]}]]],["ai-voice-input.cjs",[[513,"ai-voice-input",{"disabled":[4],"showWaveform":[4,"show-waveform"],"autoStart":[4,"auto-start"],"errorText":[1,"error-text"],"waveformColor":[1,"waveform-color"],"state":[32],"error":[32],"recordingDuration":[32],"submitPulse":[32]}]]],["ai-card.cjs",[[769,"ai-card",{"noPadding":[4,"no-padding"],"noShadow":[4,"no-shadow"]}]]],["ai-conversation-list.cjs",[[513,"ai-conversation-list",{"items":[16],"activeId":[1,"active-id"],"loading":[4],"emptyText":[1,"empty-text"],"error":[4],"errorText":[1,"error-text"],"retryLabel":[1,"retry-label"],"deletingId":[1,"deleting-id"]}]]],["ai-icon.cjs",[[513,"ai-icon",{"name":[1],"size":[2]}]]]], options);
|
|
9
9
|
};
|
|
10
10
|
|
|
11
11
|
exports.setNonce = index.setNonce;
|
|
@@ -18,7 +18,7 @@ var patchBrowser = () => {
|
|
|
18
18
|
|
|
19
19
|
patchBrowser().then(async (options) => {
|
|
20
20
|
await index.globalScripts();
|
|
21
|
-
return index.bootstrapLazy([["ai-message-input.cjs",[[513,"ai-message-input",{"placeholder":[1],"disabled":[4],"showVoiceButton":[4,"show-voice-button"],"maxLength":[2,"max-length"],"isRecording":[4,"is-recording"],"inputValue":[32],"showVoiceRecorder":[32],"isMultiline":[32],"setInputValue":[64]},null,{"isRecording":[{"onIsRecordingChange":0}]}]]],["ai-rating.cjs",[[513,"ai-rating",{"question":[1],"subtitle":[1],"successMessage":[1,"success-message"],"value":[1026],"disabled":[4],"hovered":[32],"submitted":[32]}]]],["ai-chat-header.cjs",[[513,"ai-chat-header",{"mode":[1],"conversation":[1],"agentName":[1,"agent-name"],"agentStatus":[1,"agent-status"],"agentAvatar":[1,"agent-avatar"],"showBack":[4,"show-back"],"statusIndicator":[1,"status-indicator"],"pageTitle":[1,"page-title"],"pageUrl":[1,"page-url"],"conversationItems":[16],"conversationActiveId":[1,"conversation-active-id"],"conversationLoading":[4,"conversation-loading"],"conversationError":[4,"conversation-error"],"conversationErrorText":[1,"conversation-error-text"],"conversationRetryLabel":[1,"conversation-retry-label"],"conversationEmptyText":[1,"conversation-empty-text"],"conversationDeletingId":[1,"conversation-deleting-id"],"titleLoading":[4,"title-loading"],"avatarError":[32],"dropdownOpen":[32],"isFloating":[32]},[[4,"click","handleDocumentClick"]]]]],["ai-agent-error.cjs",[[513,"ai-agent-error",{"headline":[1],"message":[1],"errorCode":[1,"error-code"],"retryable":[4],"retryLabel":[1,"retry-label"],"dismissible":[4]}]]],["ai-chat-container.cjs",[[769,"ai-chat-container",{"isOpen":[4,"is-open"],"position":[1537],"width":[1],"autoScroll":[4,"auto-scroll"],"showWatermark":[4,"show-watermark"],"floatHeight":[1,"float-height"],"theme":[1],"loading":[4],"error":[4],"errorText":[1,"error-text"],"retryLabel":[1,"retry-label"],"direction":[513],"isMobile":[32],"floatLeft":[32],"floatTop":[32],"scrollToBottom":[64],"cyclePosition":[64]},[[0,"headerPositionClick","handleHeaderPositionClick"]],{"isOpen":[{"isOpenChanged":0}],"position":[{"positionChanged":0}]}]]],["ai-chat-message.cjs",[[769,"ai-chat-message",{"role":[1],"content":[1],"format":[1],"agentName":[1,"agent-name"],"timestamp":[1],"showActions":[4,"show-actions"],"enableRegenerate":[4,"enable-regenerate"],"feedbackValue":[1025,"feedback-value"],"copySuccess":[32]}]]],["ai-conversation-summary.cjs",[[769,"ai-conversation-summary",{"conversation":[1],"summary":[1],"messageCount":[2,"message-count"],"language":[1]}]]],["ai-in-chat-browser.cjs",[[513,"ai-in-chat-browser",{"url":[1],"pageTitle":[1,"page-title"],"isLoading":[32],"hasError":[32]},null,{"url":[{"onUrlChange":0}]}]]],["ai-link.cjs",[[769,"ai-link",{"label":[1],"href":[1],"target":[1],"rel":[1]}]]],["ai-loading.cjs",[[513,"ai-loading",{"mode":[1],"statusText":[1,"status-text"],"thinkingSubtext":[1,"thinking-subtext"],"steps":[16],"headerTitle":[1,"header-title"],"currentAgent":[1,"current-agent"],"showAgentBadges":[4,"show-agent-badges"],"expanded":[1028],"collapsible":[4],"_expanded":[32]}]]],["ai-route-decision.cjs",[[513,"ai-route-decision",{"selectedAgent":[1,"selected-agent"],"agentIcon":[1,"agent-icon"],"reason":[1],"confidence":[2],"detectedLanguage":[1,"detected-language"],"expanded":[1028],"_expanded":[32]}]]],["ai-suggestion.cjs",[[769,"ai-suggestion",{"label":[1],"disabled":[4]}]]],["ai-voice-input.cjs",[[513,"ai-voice-input",{"disabled":[4],"showWaveform":[4,"show-waveform"],"autoStart":[4,"auto-start"],"errorText":[1,"error-text"],"waveformColor":[1,"waveform-color"],"state":[32],"error":[32],"recordingDuration":[32],"submitPulse":[32]}]]],["ai-card.cjs",[[769,"ai-card",{"noPadding":[4,"no-padding"],"noShadow":[4,"no-shadow"]}]]],["ai-conversation-list.cjs",[[513,"ai-conversation-list",{"items":[16],"activeId":[1,"active-id"],"loading":[4],"emptyText":[1,"empty-text"],"error":[4],"errorText":[1,"error-text"],"retryLabel":[1,"retry-label"],"deletingId":[1,"deleting-id"]}]]],["ai-icon.cjs",[[513,"ai-icon",{"name":[1],"size":[2]}]]]], options);
|
|
21
|
+
return index.bootstrapLazy([["ai-message-input.cjs",[[513,"ai-message-input",{"placeholder":[1],"disabled":[4],"showVoiceButton":[4,"show-voice-button"],"maxLength":[2,"max-length"],"isRecording":[4,"is-recording"],"inputValue":[32],"showVoiceRecorder":[32],"isMultiline":[32],"setInputValue":[64]},null,{"isRecording":[{"onIsRecordingChange":0}]}]]],["ai-rating.cjs",[[513,"ai-rating",{"question":[1],"subtitle":[1],"successMessage":[1,"success-message"],"value":[1026],"disabled":[4],"hovered":[32],"submitted":[32]}]]],["ai-chat-header.cjs",[[513,"ai-chat-header",{"mode":[1],"conversation":[1],"agentName":[1,"agent-name"],"agentStatus":[1,"agent-status"],"agentAvatar":[1,"agent-avatar"],"showBack":[4,"show-back"],"statusIndicator":[1,"status-indicator"],"pageTitle":[1,"page-title"],"pageUrl":[1,"page-url"],"conversationItems":[16],"conversationActiveId":[1,"conversation-active-id"],"conversationLoading":[4,"conversation-loading"],"conversationError":[4,"conversation-error"],"conversationErrorText":[1,"conversation-error-text"],"conversationRetryLabel":[1,"conversation-retry-label"],"conversationEmptyText":[1,"conversation-empty-text"],"conversationDeletingId":[1,"conversation-deleting-id"],"titleLoading":[4,"title-loading"],"disableNewChat":[4,"disable-new-chat"],"disableConversationList":[4,"disable-conversation-list"],"avatarError":[32],"dropdownOpen":[32],"isFloating":[32],"isMobile":[32]},[[4,"click","handleDocumentClick"]]]]],["ai-agent-error.cjs",[[513,"ai-agent-error",{"headline":[1],"message":[1],"errorCode":[1,"error-code"],"retryable":[4],"retryLabel":[1,"retry-label"],"dismissible":[4]}]]],["ai-chat-container.cjs",[[769,"ai-chat-container",{"isOpen":[4,"is-open"],"position":[1537],"width":[1],"autoScroll":[4,"auto-scroll"],"showWatermark":[4,"show-watermark"],"floatHeight":[1,"float-height"],"theme":[1],"loading":[4],"error":[4],"errorText":[1,"error-text"],"retryLabel":[1,"retry-label"],"direction":[513],"isMobile":[32],"floatLeft":[32],"floatTop":[32],"scrollToBottom":[64],"cyclePosition":[64]},[[0,"headerPositionClick","handleHeaderPositionClick"]],{"isOpen":[{"isOpenChanged":0}],"position":[{"positionChanged":0}]}]]],["ai-chat-message.cjs",[[769,"ai-chat-message",{"role":[1],"content":[1],"format":[1],"agentName":[1,"agent-name"],"timestamp":[1],"showActions":[4,"show-actions"],"enableRegenerate":[4,"enable-regenerate"],"feedbackValue":[1025,"feedback-value"],"copySuccess":[32]}]]],["ai-conversation-summary.cjs",[[769,"ai-conversation-summary",{"conversation":[1],"summary":[1],"messageCount":[2,"message-count"],"language":[1]}]]],["ai-in-chat-browser.cjs",[[513,"ai-in-chat-browser",{"url":[1],"pageTitle":[1,"page-title"],"isLoading":[32],"hasError":[32]},null,{"url":[{"onUrlChange":0}]}]]],["ai-link.cjs",[[769,"ai-link",{"label":[1],"href":[1],"target":[1],"rel":[1]}]]],["ai-loading.cjs",[[513,"ai-loading",{"mode":[1],"statusText":[1,"status-text"],"thinkingSubtext":[1,"thinking-subtext"],"steps":[16],"headerTitle":[1,"header-title"],"currentAgent":[1,"current-agent"],"showAgentBadges":[4,"show-agent-badges"],"expanded":[1028],"collapsible":[4],"_expanded":[32]}]]],["ai-route-decision.cjs",[[513,"ai-route-decision",{"selectedAgent":[1,"selected-agent"],"agentIcon":[1,"agent-icon"],"reason":[1],"confidence":[2],"detectedLanguage":[1,"detected-language"],"expanded":[1028],"_expanded":[32]}]]],["ai-suggestion.cjs",[[769,"ai-suggestion",{"label":[1],"disabled":[4]}]]],["ai-voice-input.cjs",[[513,"ai-voice-input",{"disabled":[4],"showWaveform":[4,"show-waveform"],"autoStart":[4,"auto-start"],"errorText":[1,"error-text"],"waveformColor":[1,"waveform-color"],"state":[32],"error":[32],"recordingDuration":[32],"submitPulse":[32]}]]],["ai-card.cjs",[[769,"ai-card",{"noPadding":[4,"no-padding"],"noShadow":[4,"no-shadow"]}]]],["ai-conversation-list.cjs",[[513,"ai-conversation-list",{"items":[16],"activeId":[1,"active-id"],"loading":[4],"emptyText":[1,"empty-text"],"error":[4],"errorText":[1,"error-text"],"retryLabel":[1,"retry-label"],"deletingId":[1,"deleting-id"]}]]],["ai-icon.cjs",[[513,"ai-icon",{"name":[1],"size":[2]}]]]], options);
|
|
22
22
|
});
|
|
23
23
|
|
|
24
24
|
exports.setNonce = index.setNonce;
|
|
@@ -130,6 +130,7 @@ export class ChatContainer {
|
|
|
130
130
|
if (newVal === 'float') {
|
|
131
131
|
this.setupDrag();
|
|
132
132
|
}
|
|
133
|
+
this.positionChange.emit(newVal);
|
|
133
134
|
}
|
|
134
135
|
disconnectedCallback() {
|
|
135
136
|
if (typeof window !== 'undefined') {
|
|
@@ -153,7 +154,6 @@ export class ChatContainer {
|
|
|
153
154
|
async cyclePosition() {
|
|
154
155
|
const docked = this.direction === 'rtl' ? 'left' : 'right';
|
|
155
156
|
this.position = this.position === 'float' ? docked : 'float';
|
|
156
|
-
this.positionChange.emit(this.position);
|
|
157
157
|
}
|
|
158
158
|
handleWindowResize = () => {
|
|
159
159
|
this.checkMobile();
|
|
@@ -225,7 +225,7 @@ export class ChatContainer {
|
|
|
225
225
|
return (h("div", { class: "error-state", role: "alert" }, h("svg", { class: "error-icon", width: "48", height: "48", viewBox: "0 0 24 24", fill: "none", xmlns: "http://www.w3.org/2000/svg" }, h("circle", { cx: "12", cy: "12", r: "10", stroke: "currentColor", "stroke-width": "1.5" }), h("path", { d: "M12 7v6", stroke: "currentColor", "stroke-width": "1.5", "stroke-linecap": "round" }), h("circle", { cx: "12", cy: "16.5", r: "0.75", fill: "currentColor" })), h("p", { class: "error-text" }, this.errorText), h("button", { class: "error-retry-btn", type: "button", onClick: () => this.retryClick.emit() }, this.retryLabel)));
|
|
226
226
|
}
|
|
227
227
|
render() {
|
|
228
|
-
return (h(Host, { key: '
|
|
228
|
+
return (h(Host, { key: '1213110dce6a44b37c4a7b1f6a584368951964d2', class: { dark: this.isDark() } }, h("div", { key: 'df0df824b4ef271aae37dee7aa2fc85037ef647a', class: this.getContainerClasses(), style: this.getContainerStyle(), ref: el => (this.containerRef = el) }, this.showWatermark && !this.loading && !this.error && (h("div", { key: '168fd1510d8910f234331c03d4d549d0a9586472', class: "watermark" }, h("svg", { key: 'fde35527192a8501b190462bfdf66ae7d739742c', class: "watermark-circle-svg", width: "133", height: "133", viewBox: "0 0 133 133", fill: "none", xmlns: "http://www.w3.org/2000/svg" }, h("g", { key: '63c94c35e3adafac862c39cda04d05d75199bae0', filter: "url(#wm_circle_shadow)" }, h("circle", { key: '8e8e304ae2132ad36855457a7755b2ba20770038', cx: "66.415", cy: "66.415", r: "66.415", class: "watermark-circle" })), h("defs", { key: 'c571edd0fb6a68bf9e62530398ba01e482f5755e' }, h("filter", { key: 'c63ab4c6c16db9eac63d944c481564af4667f493', id: "wm_circle_shadow", x: "0", y: "0", width: "132.83", height: "135.83", filterUnits: "userSpaceOnUse", "color-interpolation-filters": "sRGB" }, h("feFlood", { key: '37105253941532ffc3136713df67e87b9ef123e5', "flood-opacity": "0", result: "BackgroundImageFix" }), h("feBlend", { key: 'ecde8a14cbc2a11125e548ebe412f00381aa561e', mode: "normal", in: "SourceGraphic", in2: "BackgroundImageFix", result: "shape" }), h("feColorMatrix", { key: '1001d9bf46d7df0f8788e46cfb311a90b5984f8d', in: "SourceAlpha", type: "matrix", values: "0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 127 0", result: "hardAlpha" }), h("feOffset", { key: '4ffa296814b3eeb49e56688f1d6a981ac7055a92', dy: "3" }), h("feGaussianBlur", { key: '91a6bf8600f4b30c24af6717d61a7549584240f7', stdDeviation: "3" }), h("feComposite", { key: '325b8156a7a3cc8dfa1855d687436d170dc83bbb', in2: "hardAlpha", operator: "arithmetic", k2: "-1", k3: "1" }), h("feColorMatrix", { key: '48da64c927a7c97e21b499576cc8a421445ffd61', type: "matrix", values: "0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0.06 0" }), h("feBlend", { key: '2c3fcf67f6769a6e6cee16ee4f7a6115a2aa3fbc', mode: "normal", in2: "shape", result: "effect1_innerShadow" })))), h("svg", { key: '25669b41c62a83760adb26129d4547ece7d5f6d9', class: "watermark-star-svg", width: "78", height: "78", viewBox: "0 0 78 78", fill: "none", xmlns: "http://www.w3.org/2000/svg" }, h("g", { key: 'e1347f63fe1b5b57c1be6d4958817c2682745972', filter: "url(#wm_star_shadow)" }, h("path", { key: '12ca3bbc4dcca07dbd4cc9e5b0227c2a4b5eeb98', d: "M38.7421 0C39.5691 0 40.2689 0.286272 40.8414 0.858815C41.414 1.43136 41.7002 2.13113 41.7002 2.95814C41.7002 8.87442 43.1952 14.3772 46.1851 19.4665C49.1115 24.4285 53.0557 28.3727 58.0177 31.299C63.107 34.289 68.6097 35.7839 74.526 35.7839C75.353 35.7839 76.0528 36.0702 76.6254 36.6428C77.1979 37.2153 77.4842 37.9151 77.4842 38.7421C77.4842 39.5691 77.1979 40.2689 76.6254 40.8414C76.0528 41.414 75.353 41.7002 74.526 41.7002C68.6097 41.7002 63.107 43.1952 58.0177 46.1851C53.0557 49.1115 49.1115 53.0557 46.1851 58.0177C43.1952 63.107 41.7002 68.6097 41.7002 74.526C41.7002 75.353 41.414 76.0528 40.8414 76.6254C40.2689 77.1979 39.5691 77.4842 38.7421 77.4842C37.9151 77.4842 37.2153 77.1979 36.6428 76.6254C36.0702 76.0528 35.7839 75.353 35.7839 74.526C35.7839 68.6097 34.289 63.107 31.299 58.0177C28.3727 53.0557 24.4285 49.1115 19.4665 46.1851C14.3772 43.1952 8.87442 41.7002 2.95814 41.7002C2.13113 41.7002 1.43136 41.414 0.858815 40.8414C0.286272 40.2689 0 39.5691 0 38.7421C0 37.9151 0.286272 37.2153 0.858815 36.6428C1.43136 36.0702 2.13113 35.7839 2.95814 35.7839C8.87442 35.7839 14.3772 34.289 19.4665 31.299C24.4285 28.3727 28.3727 24.4285 31.299 19.4665C34.289 14.3772 35.7839 8.87442 35.7839 2.95814C35.7839 2.13113 36.0702 1.43136 36.6428 0.858815C37.2153 0.286272 37.9151 0 38.7421 0Z", class: "watermark-star" })), h("defs", { key: '6118bbae343ffc6cdc52df3d2062b63dd655f96d' }, h("filter", { key: 'ac762ad5983155b7122e4e1466dcaa9230d2ad4f', id: "wm_star_shadow", x: "0", y: "0", width: "77.4844", height: "79.4841", filterUnits: "userSpaceOnUse", "color-interpolation-filters": "sRGB" }, h("feFlood", { key: '452561901594c49f607f2a5a0dd149edab297703', "flood-opacity": "0", result: "BackgroundImageFix" }), h("feBlend", { key: 'bd77b4ec605953eff1b83d63b152f6bc0cf757f9', mode: "normal", in: "SourceGraphic", in2: "BackgroundImageFix", result: "shape" }), h("feColorMatrix", { key: '55215acb177fe0a8d7bf454244d1eec0a52657d9', in: "SourceAlpha", type: "matrix", values: "0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 127 0", result: "hardAlpha" }), h("feOffset", { key: '2079610df4ddb703dffdb0ba26a83262b28ddb8e', dy: "2" }), h("feGaussianBlur", { key: 'b42acf138ed8ed2c51ce3a51eb774f8ccb3932a5', stdDeviation: "2" }), h("feComposite", { key: '6b2439a1f50c1355851333431d1745d864fd4a68', in2: "hardAlpha", operator: "arithmetic", k2: "-1", k3: "1" }), h("feColorMatrix", { key: 'da9900a125e3e0df5f3bb383382b949d0c967d9c', type: "matrix", values: "0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0.06 0" }), h("feBlend", { key: '579851be42d902cbd9939df09ba996b11210181f', mode: "normal", in2: "shape", result: "effect1_innerShadow" })))))), h("slot", { key: 'e2ef3a4097ff512ac2e9638fef4725b55cd4ea24', name: "header" }), h("div", { key: '46dac73e46b2eac797c88ed826497e4d6063f2d3', class: "messages-area", ref: el => (this.messagesAreaRef = el) }, this.loading ? this.renderSkeleton() : this.error ? this.renderError() : h("slot", null)), h("slot", { key: 'ff2cf3628bbab90bd0cdce07df6c08ae597867ba', name: "footer" }))));
|
|
229
229
|
}
|
|
230
230
|
static get is() { return "ai-chat-container"; }
|
|
231
231
|
static get encapsulation() { return "shadow"; }
|
|
@@ -38,11 +38,18 @@ export class AiChatHeader {
|
|
|
38
38
|
conversationDeletingId = '';
|
|
39
39
|
/** Show a shimmer skeleton in place of the conversation title (e.g. while loading conversation) */
|
|
40
40
|
titleLoading = false;
|
|
41
|
+
/** Hide the new-chat (pencil-edit) button */
|
|
42
|
+
disableNewChat = false;
|
|
43
|
+
/** Hide the conversation-list dropdown trigger (title chevron) */
|
|
44
|
+
disableConversationList = false;
|
|
41
45
|
avatarError = false;
|
|
42
46
|
dropdownOpen = false;
|
|
43
47
|
/** Internally managed — true when the parent ai-chat-container has position="float" */
|
|
44
48
|
isFloating = false;
|
|
49
|
+
/** Internally managed — true when viewport width < 768px (matches ai-chat-container logic) */
|
|
50
|
+
isMobile = false;
|
|
45
51
|
parentPositionObserver = null;
|
|
52
|
+
handleWindowResize = () => this.checkMobile();
|
|
46
53
|
/** Cancel / close button */
|
|
47
54
|
closeClick;
|
|
48
55
|
/** Pencil-edit button (agent mode) */
|
|
@@ -77,7 +84,7 @@ export class AiChatHeader {
|
|
|
77
84
|
}
|
|
78
85
|
}
|
|
79
86
|
connectedCallback() {
|
|
80
|
-
|
|
87
|
+
this.checkMobile();
|
|
81
88
|
}
|
|
82
89
|
componentDidLoad() {
|
|
83
90
|
// By this point, the element is fully in the DOM and parent relationships are established
|
|
@@ -86,10 +93,21 @@ export class AiChatHeader {
|
|
|
86
93
|
this.syncFloatingState();
|
|
87
94
|
this.observeParentPosition();
|
|
88
95
|
});
|
|
96
|
+
if (typeof window !== 'undefined') {
|
|
97
|
+
window.addEventListener('resize', this.handleWindowResize);
|
|
98
|
+
}
|
|
89
99
|
}
|
|
90
100
|
disconnectedCallback() {
|
|
91
101
|
this.parentPositionObserver?.disconnect();
|
|
92
102
|
this.parentPositionObserver = null;
|
|
103
|
+
if (typeof window !== 'undefined') {
|
|
104
|
+
window.removeEventListener('resize', this.handleWindowResize);
|
|
105
|
+
}
|
|
106
|
+
}
|
|
107
|
+
checkMobile() {
|
|
108
|
+
if (typeof window !== 'undefined') {
|
|
109
|
+
this.isMobile = window.innerWidth < 768;
|
|
110
|
+
}
|
|
93
111
|
}
|
|
94
112
|
observeParentPosition() {
|
|
95
113
|
if (this.parentPositionObserver)
|
|
@@ -130,7 +148,7 @@ export class AiChatHeader {
|
|
|
130
148
|
} }));
|
|
131
149
|
}
|
|
132
150
|
renderDragBtn() {
|
|
133
|
-
return (this.isFloating && (h("button", { class: "action-btn drag-btn", "aria-label": "\u0633\u062D\u0628 / Drag", onPointerDown: (e) => {
|
|
151
|
+
return (this.isFloating && !this.isMobile && (h("button", { class: "action-btn drag-btn", "aria-label": "\u0633\u062D\u0628 / Drag", onPointerDown: (e) => {
|
|
134
152
|
e.preventDefault();
|
|
135
153
|
this.headerDragStart.emit({ clientX: e.clientX, clientY: e.clientY });
|
|
136
154
|
} }, this.renderIcon('drag', 11, 15))));
|
|
@@ -149,38 +167,39 @@ export class AiChatHeader {
|
|
|
149
167
|
this.conversationRetry.emit();
|
|
150
168
|
};
|
|
151
169
|
renderConversationDropdown() {
|
|
152
|
-
if (!this.dropdownOpen || this.mode !== 'agent')
|
|
170
|
+
if (!this.dropdownOpen || this.mode !== 'agent' || this.disableConversationList)
|
|
153
171
|
return null;
|
|
154
172
|
return (h("div", { class: "conversation-dropdown" }, h("ai-conversation-list", { items: this.conversationItems, activeId: this.conversationActiveId, loading: this.conversationLoading, error: this.conversationError, errorText: this.conversationErrorText, retryLabel: this.conversationRetryLabel, emptyText: this.conversationEmptyText, deletingId: this.conversationDeletingId, onConversationSelect: this.handleConversationSelect, onConversationDelete: this.handleConversationDelete, onRetryClick: this.handleConversationRetry })));
|
|
155
173
|
}
|
|
156
174
|
renderAgentMode() {
|
|
175
|
+
const titleContent = this.disableConversationList ? (h("div", { class: "content agent" }, this.titleLoading ? (h("span", { class: "title-skeleton", "aria-busy": "true", "aria-label": "\u062C\u0627\u0631\u064A \u0627\u0644\u062A\u062D\u0645\u064A\u0644" })) : (h("span", { class: "title" }, this.conversation)))) : (h("div", { class: "content agent dropdown-trigger", role: "button", onClick: () => {
|
|
176
|
+
if (this.titleLoading)
|
|
177
|
+
return;
|
|
178
|
+
this.dropdownOpen = !this.dropdownOpen;
|
|
179
|
+
this.dropdownClick.emit();
|
|
180
|
+
}, "aria-haspopup": "listbox", "aria-expanded": this.dropdownOpen, "aria-label": `${this.conversation}, افتح قائمة المحادثات` }, this.titleLoading ? (h("span", { class: "title-skeleton", "aria-busy": "true", "aria-label": "\u062C\u0627\u0631\u064A \u0627\u0644\u062A\u062D\u0645\u064A\u0644" })) : (h("span", { class: "title" }, this.conversation)), !this.titleLoading && (h("span", { class: `dropdown-chevron${this.dropdownOpen ? ' open' : ''}` }, this.renderIcon('chevron-down', 24, 24)))));
|
|
157
181
|
return [
|
|
158
182
|
this.renderDragBtn(),
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
return;
|
|
162
|
-
this.dropdownOpen = !this.dropdownOpen;
|
|
163
|
-
this.dropdownClick.emit();
|
|
164
|
-
}, "aria-haspopup": "listbox", "aria-expanded": this.dropdownOpen, "aria-label": `${this.conversation}, افتح قائمة المحادثات` }, this.titleLoading ? (h("span", { class: "title-skeleton", "aria-busy": "true", "aria-label": "\u062C\u0627\u0631\u064A \u0627\u0644\u062A\u062D\u0645\u064A\u0644" })) : (h("span", { class: "title" }, this.conversation)), !this.titleLoading && (h("span", { class: `dropdown-chevron${this.dropdownOpen ? ' open' : ''}` }, this.renderIcon('chevron-down', 24, 24)))),
|
|
165
|
-
h("div", { class: "actions" }, h("button", { class: "action-btn", "aria-label": "\u0645\u062D\u0627\u062F\u062B\u0629 \u062C\u062F\u064A\u062F\u0629 / New Chat", onClick: () => this.newChatClick.emit() }, this.renderIcon('pencil-edit', 22, 22)), h("button", { class: "action-btn", "aria-label": "\u0627\u0644\u0639\u0631\u0636 / Position", onClick: () => { this.positionClick.emit(); this.headerPositionClick.emit(); } }, this.renderIcon('hand', 22, 22)), h("button", { class: "action-btn", "aria-label": "\u0625\u063A\u0644\u0627\u0642 / Close", onClick: () => this.closeClick.emit() }, this.renderIcon('cancel', 22, 22))),
|
|
183
|
+
titleContent,
|
|
184
|
+
h("div", { class: "actions" }, !this.disableNewChat && (h("button", { class: "action-btn", "aria-label": "\u0645\u062D\u0627\u062F\u062B\u0629 \u062C\u062F\u064A\u062F\u0629 / New Chat", onClick: () => this.newChatClick.emit() }, this.renderIcon('pencil-edit', 22, 22))), !this.isMobile && (h("button", { class: "action-btn", "aria-label": "\u0627\u0644\u0639\u0631\u0636 / Position", onClick: () => { this.positionClick.emit(); this.headerPositionClick.emit(); } }, this.renderIcon('hand', 22, 22))), h("button", { class: "action-btn", "aria-label": "\u0625\u063A\u0644\u0627\u0642 / Close", onClick: () => this.closeClick.emit() }, this.renderIcon('cancel', 22, 22))),
|
|
166
185
|
];
|
|
167
186
|
}
|
|
168
187
|
renderHumanMode() {
|
|
169
188
|
return [
|
|
170
189
|
this.renderDragBtn(),
|
|
171
190
|
h("div", { class: "content human" }, this.showBack && (h("button", { class: "back-btn", "aria-label": "\u0631\u062C\u0648\u0639 / Back", onClick: () => this.backClick.emit() }, this.renderIcon('arrow-right', 24, 24))), h("div", { class: "avatar-wrapper" }, this.renderAvatar(), h("span", { class: `online-dot status-${this.statusIndicator}` }, this.renderIcon('online-dot', 10, 10))), h("div", { class: "text-block" }, h("span", { class: "agent-name" }, this.agentName), this.agentStatus && h("span", { class: "agent-status" }, this.agentStatus))),
|
|
172
|
-
h("div", { class: "actions" }, h("button", { class: "action-btn", "aria-label": "\u0627\u0644\u0639\u0631\u0636 / Position", onClick: () => { this.positionClick.emit(); this.headerPositionClick.emit(); } }, this.renderIcon('hand', 22, 22)), h("button", { class: "action-btn", "aria-label": "\u0625\u063A\u0644\u0627\u0642 / Close", onClick: () => this.closeClick.emit() }, this.renderIcon('cancel', 22, 22))),
|
|
191
|
+
h("div", { class: "actions" }, !this.isMobile && (h("button", { class: "action-btn", "aria-label": "\u0627\u0644\u0639\u0631\u0636 / Position", onClick: () => { this.positionClick.emit(); this.headerPositionClick.emit(); } }, this.renderIcon('hand', 22, 22))), h("button", { class: "action-btn", "aria-label": "\u0625\u063A\u0644\u0627\u0642 / Close", onClick: () => this.closeClick.emit() }, this.renderIcon('cancel', 22, 22))),
|
|
173
192
|
];
|
|
174
193
|
}
|
|
175
194
|
renderBrowserMode() {
|
|
176
195
|
return [
|
|
177
196
|
this.renderDragBtn(),
|
|
178
197
|
h("div", { class: "content browser" }, h("button", { class: "back-btn", "aria-label": "\u0631\u062C\u0648\u0639 / Back", onClick: () => this.backClick.emit() }, this.renderIcon('arrow-right', 24, 24)), h("span", { class: "browser-title" }, this.pageTitle), h("button", { class: "browser-link-btn", "aria-label": "\u0641\u062A\u062D \u0641\u064A \u0646\u0627\u0641\u0630\u0629 \u062C\u062F\u064A\u062F\u0629 / Open externally", onClick: () => this.openExternal.emit(this.pageUrl) }, this.renderIcon('link', 14, 14))),
|
|
179
|
-
h("div", { class: "actions" }, h("button", { class: "action-btn", "aria-label": "\u0627\u0644\u0639\u0631\u0636 / Position", onClick: () => { this.positionClick.emit(); this.headerPositionClick.emit(); } }, this.renderIcon('hand', 22, 22)), h("button", { class: "action-btn", "aria-label": "\u0625\u063A\u0644\u0627\u0642 / Close", onClick: () => this.closeClick.emit() }, this.renderIcon('cancel', 22, 22))),
|
|
198
|
+
h("div", { class: "actions" }, !this.isMobile && (h("button", { class: "action-btn", "aria-label": "\u0627\u0644\u0639\u0631\u0636 / Position", onClick: () => { this.positionClick.emit(); this.headerPositionClick.emit(); } }, this.renderIcon('hand', 22, 22))), h("button", { class: "action-btn", "aria-label": "\u0625\u063A\u0644\u0627\u0642 / Close", onClick: () => this.closeClick.emit() }, this.renderIcon('cancel', 22, 22))),
|
|
180
199
|
];
|
|
181
200
|
}
|
|
182
201
|
render() {
|
|
183
|
-
return (h(Host, { key: '
|
|
202
|
+
return (h(Host, { key: '4c51abf7f5fb572ec62191c0b097a4fdf9b218c3' }, h("div", { key: 'c05febe2f984bad8e80b9f0d9f2ceeebc812a9b4', class: "header-wrapper" }, h("div", { key: '927c606ae5452a9a5c1e19edd2145f9e1ee42d2c', class: "header-container" }, this.mode === 'agent' ? this.renderAgentMode() : this.mode === 'human' ? this.renderHumanMode() : this.renderBrowserMode()), this.renderConversationDropdown())));
|
|
184
203
|
}
|
|
185
204
|
static get is() { return "ai-chat-header"; }
|
|
186
205
|
static get encapsulation() { return "shadow"; }
|
|
@@ -560,6 +579,46 @@ export class AiChatHeader {
|
|
|
560
579
|
"reflect": false,
|
|
561
580
|
"attribute": "title-loading",
|
|
562
581
|
"defaultValue": "false"
|
|
582
|
+
},
|
|
583
|
+
"disableNewChat": {
|
|
584
|
+
"type": "boolean",
|
|
585
|
+
"mutable": false,
|
|
586
|
+
"complexType": {
|
|
587
|
+
"original": "boolean",
|
|
588
|
+
"resolved": "boolean",
|
|
589
|
+
"references": {}
|
|
590
|
+
},
|
|
591
|
+
"required": false,
|
|
592
|
+
"optional": false,
|
|
593
|
+
"docs": {
|
|
594
|
+
"tags": [],
|
|
595
|
+
"text": "Hide the new-chat (pencil-edit) button"
|
|
596
|
+
},
|
|
597
|
+
"getter": false,
|
|
598
|
+
"setter": false,
|
|
599
|
+
"reflect": false,
|
|
600
|
+
"attribute": "disable-new-chat",
|
|
601
|
+
"defaultValue": "false"
|
|
602
|
+
},
|
|
603
|
+
"disableConversationList": {
|
|
604
|
+
"type": "boolean",
|
|
605
|
+
"mutable": false,
|
|
606
|
+
"complexType": {
|
|
607
|
+
"original": "boolean",
|
|
608
|
+
"resolved": "boolean",
|
|
609
|
+
"references": {}
|
|
610
|
+
},
|
|
611
|
+
"required": false,
|
|
612
|
+
"optional": false,
|
|
613
|
+
"docs": {
|
|
614
|
+
"tags": [],
|
|
615
|
+
"text": "Hide the conversation-list dropdown trigger (title chevron)"
|
|
616
|
+
},
|
|
617
|
+
"getter": false,
|
|
618
|
+
"setter": false,
|
|
619
|
+
"reflect": false,
|
|
620
|
+
"attribute": "disable-conversation-list",
|
|
621
|
+
"defaultValue": "false"
|
|
563
622
|
}
|
|
564
623
|
};
|
|
565
624
|
}
|
|
@@ -567,7 +626,8 @@ export class AiChatHeader {
|
|
|
567
626
|
return {
|
|
568
627
|
"avatarError": {},
|
|
569
628
|
"dropdownOpen": {},
|
|
570
|
-
"isFloating": {}
|
|
629
|
+
"isFloating": {},
|
|
630
|
+
"isMobile": {}
|
|
571
631
|
};
|
|
572
632
|
}
|
|
573
633
|
static get events() {
|
|
@@ -149,17 +149,7 @@
|
|
|
149
149
|
align-items: center;
|
|
150
150
|
justify-content: flex-start;
|
|
151
151
|
gap: 6px;
|
|
152
|
-
height: 0;
|
|
153
|
-
overflow: hidden;
|
|
154
|
-
opacity: 0;
|
|
155
|
-
pointer-events: none;
|
|
156
|
-
transition: height 0.15s ease, opacity 0.15s ease;
|
|
157
|
-
}
|
|
158
|
-
|
|
159
|
-
.agent-bubble:hover .actions-bar {
|
|
160
152
|
height: 32px;
|
|
161
|
-
opacity: 1;
|
|
162
|
-
pointer-events: auto;
|
|
163
153
|
}
|
|
164
154
|
|
|
165
155
|
.action-btn {
|
|
@@ -130,7 +130,15 @@
|
|
|
130
130
|
color: var(--ai-text-primary);
|
|
131
131
|
text-align: center;
|
|
132
132
|
width: 100%;
|
|
133
|
-
|
|
133
|
+
min-height: 24px;
|
|
134
|
+
opacity: 0;
|
|
135
|
+
visibility: hidden;
|
|
136
|
+
transition: opacity 0.15s ease, visibility 0.15s ease;
|
|
137
|
+
}
|
|
138
|
+
|
|
139
|
+
.rating__hover-label--visible {
|
|
140
|
+
opacity: 1;
|
|
141
|
+
visibility: visible;
|
|
134
142
|
}
|
|
135
143
|
|
|
136
144
|
/* ─── Success state ──────────────────────────────────────────────────────── */
|