@salla.sa/ui-ai-kit-core 2.2.0 → 2.2.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.
- package/dist/cjs/ai-agent-error.cjs.entry.js +2 -2
- package/dist/cjs/ai-card.cjs.entry.js +3 -3
- package/dist/cjs/ai-chat-container.cjs.entry.js +29 -3
- package/dist/cjs/ai-chat-header.cjs.entry.js +73 -11
- package/dist/cjs/ai-chat-message.cjs.entry.js +1 -1
- package/dist/cjs/ai-conversation-list.cjs.entry.js +11 -5
- package/dist/cjs/ai-conversation-summary.cjs.entry.js +1 -1
- package/dist/cjs/ai-icon.cjs.entry.js +1 -1
- package/dist/cjs/ai-in-chat-browser.cjs.entry.js +5 -23
- package/dist/cjs/ai-link.cjs.entry.js +2 -2
- package/dist/cjs/ai-loading.cjs.entry.js +2 -2
- package/dist/cjs/ai-message-input.cjs.entry.js +1 -1
- package/dist/cjs/ai-rating.cjs.entry.js +1 -1
- package/dist/cjs/ai-route-decision.cjs.entry.js +2 -2
- package/dist/cjs/ai-suggestion.cjs.entry.js +3 -3
- package/dist/cjs/ai-voice-input.cjs.entry.js +2 -2
- package/dist/cjs/{index-BQ8Az7-D.js → index-Cc05u4ND.js} +15 -0
- package/dist/cjs/loader.cjs.js +2 -2
- package/dist/cjs/ui-ai-kit.cjs.js +2 -2
- package/dist/collection/collection-manifest.json +1 -1
- package/dist/collection/components/ai-agent-error/ai-agent-error.js +1 -1
- package/dist/collection/components/ai-card/ai-card.js +2 -2
- package/dist/collection/components/ai-chat-container/ai-chat-container.js +110 -7
- package/dist/collection/components/ai-chat-header/ai-chat-header.js +204 -33
- package/dist/collection/components/ai-conversation-list/ai-conversation-list.css +20 -0
- package/dist/collection/components/ai-conversation-list/ai-conversation-list.js +29 -3
- package/dist/collection/components/ai-in-chat-browser/ai-in-chat-browser.css +0 -10
- package/dist/collection/components/ai-in-chat-browser/ai-in-chat-browser.js +5 -74
- package/dist/collection/components/ai-link/ai-link.js +1 -1
- package/dist/collection/components/ai-loading/ai-loading.js +1 -1
- package/dist/collection/components/ai-route-decision/ai-route-decision.js +1 -1
- package/dist/collection/components/ai-suggestion/ai-suggestion.js +2 -2
- package/dist/collection/components/ai-voice-input/ai-voice-input.js +1 -1
- package/dist/components/ai-agent-error.js +1 -1
- package/dist/components/ai-card.js +1 -1
- 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 +2 -2
- package/dist/components/ai-conversation-list.js +1 -1
- package/dist/components/ai-conversation-summary.js +1 -1
- package/dist/components/ai-icon.js +1 -1
- package/dist/components/ai-in-chat-browser.js +1 -1
- package/dist/components/ai-link.js +1 -1
- package/dist/components/ai-loading.js +1 -1
- package/dist/components/ai-message-input.js +1 -1
- package/dist/components/ai-rating.js +1 -1
- package/dist/components/ai-route-decision.js +1 -1
- package/dist/components/ai-suggestion.js +1 -1
- package/dist/components/ai-voice-input.js +1 -1
- package/dist/components/index.js +1 -1
- package/dist/components/{p-CXJ3iEt8.js → p-BPkf7wZg.js} +1 -1
- package/dist/components/{p-B3gdcdCK.js → p-Ba0urr6Q.js} +1 -1
- package/dist/components/p-CFSr3KcL.js +1 -0
- package/dist/components/{p-C2LB8D3t.js → p-DZuBxUde.js} +1 -1
- package/dist/components/{p-NKAwri_g.js → p-bGFmyIp1.js} +1 -1
- package/dist/esm/ai-agent-error.entry.js +2 -2
- package/dist/esm/ai-card.entry.js +3 -3
- package/dist/esm/ai-chat-container.entry.js +29 -3
- package/dist/esm/ai-chat-header.entry.js +73 -11
- package/dist/esm/ai-chat-message.entry.js +1 -1
- package/dist/esm/ai-conversation-list.entry.js +11 -5
- package/dist/esm/ai-conversation-summary.entry.js +1 -1
- package/dist/esm/ai-icon.entry.js +1 -1
- package/dist/esm/ai-in-chat-browser.entry.js +5 -23
- package/dist/esm/ai-link.entry.js +2 -2
- package/dist/esm/ai-loading.entry.js +2 -2
- package/dist/esm/ai-message-input.entry.js +1 -1
- package/dist/esm/ai-rating.entry.js +1 -1
- package/dist/esm/ai-route-decision.entry.js +2 -2
- package/dist/esm/ai-suggestion.entry.js +3 -3
- package/dist/esm/ai-voice-input.entry.js +2 -2
- package/dist/esm/{index-BSQ0GkzI.js → index-VMEwYfaX.js} +15 -0
- package/dist/esm/loader.js +3 -3
- package/dist/esm/ui-ai-kit.js +3 -3
- package/dist/types/components/ai-chat-container/ai-chat-container.d.ts +21 -1
- package/dist/types/components/ai-chat-header/ai-chat-header.d.ts +28 -3
- package/dist/types/components/ai-conversation-list/ai-conversation-list.d.ts +2 -0
- package/dist/types/components/ai-in-chat-browser/ai-in-chat-browser.d.ts +1 -10
- package/dist/types/components.d.ts +107 -53
- package/dist/types/index.d.ts +1 -0
- package/dist/ui-ai-kit/{p-1e8e6440.entry.js → p-062cad02.entry.js} +1 -1
- package/dist/ui-ai-kit/p-17e5d542.entry.js +1 -0
- package/dist/ui-ai-kit/{p-b88808a4.entry.js → p-187db371.entry.js} +1 -1
- package/dist/ui-ai-kit/p-1b247096.entry.js +1 -0
- package/dist/ui-ai-kit/p-278895fd.entry.js +1 -0
- package/dist/ui-ai-kit/{p-39a2d4c3.entry.js → p-338d55d3.entry.js} +1 -1
- package/dist/ui-ai-kit/{p-dac67692.entry.js → p-4359a116.entry.js} +1 -1
- package/dist/ui-ai-kit/{p-3a86919b.entry.js → p-5f005ec5.entry.js} +1 -1
- package/dist/ui-ai-kit/{p-849cd7e2.entry.js → p-6a4b66ed.entry.js} +1 -1
- package/dist/ui-ai-kit/{p-47797619.entry.js → p-6b644d32.entry.js} +1 -1
- package/dist/ui-ai-kit/{p-658d8b24.entry.js → p-6bd54e29.entry.js} +1 -1
- package/dist/ui-ai-kit/{p-eb40ffd0.entry.js → p-83f46030.entry.js} +2 -2
- package/dist/ui-ai-kit/{p-c9dca99e.entry.js → p-8fabdbe8.entry.js} +1 -1
- package/dist/ui-ai-kit/{p-BSQ0GkzI.js → p-VMEwYfaX.js} +2 -2
- package/dist/ui-ai-kit/{p-73cbb80b.entry.js → p-cae762e0.entry.js} +1 -1
- package/dist/ui-ai-kit/p-d02f2db5.entry.js +1 -0
- package/dist/ui-ai-kit/{p-78fb4ceb.entry.js → p-e6236df2.entry.js} +1 -1
- package/dist/ui-ai-kit/ui-ai-kit.esm.js +1 -1
- package/package.json +1 -1
- package/dist/components/p-D4mVoP6B.js +0 -1
- package/dist/components/p-DKsh1ZQX.js +0 -1
- package/dist/ui-ai-kit/p-29d84924.entry.js +0 -1
- package/dist/ui-ai-kit/p-77ef8015.entry.js +0 -1
- package/dist/ui-ai-kit/p-8cb807f3.entry.js +0 -1
- package/dist/ui-ai-kit/p-abd68089.entry.js +0 -1
package/dist/esm/ui-ai-kit.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { p as promiseResolve, g as globalScripts, b as bootstrapLazy } from './index-
|
|
2
|
-
export { s as setNonce } from './index-
|
|
1
|
+
import { p as promiseResolve, g as globalScripts, b as bootstrapLazy } from './index-VMEwYfaX.js';
|
|
2
|
+
export { s as setNonce } from './index-VMEwYfaX.js';
|
|
3
3
|
|
|
4
4
|
/*
|
|
5
5
|
Stencil Client Patch Browser v4.43.2 | MIT Licensed | https://stenciljs.com
|
|
@@ -16,5 +16,5 @@ var patchBrowser = () => {
|
|
|
16
16
|
|
|
17
17
|
patchBrowser().then(async (options) => {
|
|
18
18
|
await globalScripts();
|
|
19
|
-
return bootstrapLazy([["ai-
|
|
19
|
+
return bootstrapLazy([["ai-message-input",[[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",[[513,"ai-rating",{"question":[1],"subtitle":[1],"successMessage":[1,"success-message"],"value":[1026],"disabled":[4],"hovered":[32],"submitted":[32]}]]],["ai-chat-header",[[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",[[513,"ai-agent-error",{"headline":[1],"message":[1],"errorCode":[1,"error-code"],"retryable":[4],"retryLabel":[1,"retry-label"],"dismissible":[4]}]]],["ai-chat-container",[[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",[[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",[[769,"ai-conversation-summary",{"conversation":[1],"summary":[1],"messageCount":[2,"message-count"],"language":[1]}]]],["ai-in-chat-browser",[[513,"ai-in-chat-browser",{"url":[1],"pageTitle":[1,"page-title"],"isLoading":[32],"hasError":[32]},null,{"url":[{"onUrlChange":0}]}]]],["ai-link",[[769,"ai-link",{"label":[1],"href":[1],"target":[1],"rel":[1]}]]],["ai-loading",[[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",[[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",[[769,"ai-suggestion",{"label":[1],"disabled":[4]}]]],["ai-voice-input",[[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",[[769,"ai-card",{"noPadding":[4,"no-padding"],"noShadow":[4,"no-shadow"]}]]],["ai-conversation-list",[[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",[[513,"ai-icon",{"name":[1],"size":[2]}]]]], options);
|
|
20
20
|
});
|
|
@@ -1,10 +1,11 @@
|
|
|
1
1
|
import { EventEmitter } from '../../stencil-public-runtime';
|
|
2
|
+
export type ChatPosition = 'left' | 'right' | 'float';
|
|
2
3
|
export declare class ChatContainer {
|
|
3
4
|
el: HTMLElement;
|
|
4
5
|
/** Controls visibility of the chat panel */
|
|
5
6
|
isOpen: boolean;
|
|
6
7
|
/** Position of the panel: 'left', 'right', or 'float' */
|
|
7
|
-
position:
|
|
8
|
+
position: ChatPosition;
|
|
8
9
|
/** Width of the panel (CSS value, e.g., '400px', '30%', '28rem') */
|
|
9
10
|
width: string;
|
|
10
11
|
/** Enable/disable auto-scroll to latest message */
|
|
@@ -23,8 +24,16 @@ export declare class ChatContainer {
|
|
|
23
24
|
errorText: string;
|
|
24
25
|
/** Retry button label */
|
|
25
26
|
retryLabel: string;
|
|
27
|
+
/**
|
|
28
|
+
* Layout direction set by the host app.
|
|
29
|
+
* - `'rtl'` → valid docked position is `left`; cycle order: left ↔ float
|
|
30
|
+
* - `'ltr'` → valid docked position is `right`; cycle order: right ↔ float
|
|
31
|
+
*/
|
|
32
|
+
direction: 'rtl' | 'ltr';
|
|
26
33
|
/** Event emitted when the retry button is clicked */
|
|
27
34
|
retryClick: EventEmitter<void>;
|
|
35
|
+
/** Fired when the position changes (via cyclePosition or the header button) */
|
|
36
|
+
positionChange: EventEmitter<ChatPosition>;
|
|
28
37
|
isMobile: boolean;
|
|
29
38
|
floatLeft: string;
|
|
30
39
|
floatTop: string;
|
|
@@ -34,6 +43,11 @@ export declare class ChatContainer {
|
|
|
34
43
|
private mutationObserver;
|
|
35
44
|
private resizeObserver;
|
|
36
45
|
private dragListener;
|
|
46
|
+
/**
|
|
47
|
+
* Listen for the composed headerPositionClick event fired by ai-chat-header.
|
|
48
|
+
* Automatically cycles the position so the host app doesn't need to wire it manually.
|
|
49
|
+
*/
|
|
50
|
+
handleHeaderPositionClick(): void;
|
|
37
51
|
componentWillLoad(): void;
|
|
38
52
|
componentDidLoad(): void;
|
|
39
53
|
isOpenChanged(newVal: boolean): void;
|
|
@@ -41,6 +55,12 @@ export declare class ChatContainer {
|
|
|
41
55
|
disconnectedCallback(): void;
|
|
42
56
|
/** Programmatically scroll the messages area to the bottom */
|
|
43
57
|
scrollToBottom(): Promise<void>;
|
|
58
|
+
/**
|
|
59
|
+
* Cycle to the next valid position based on the current direction.
|
|
60
|
+
* - RTL: left ↔ float
|
|
61
|
+
* - LTR: right ↔ float
|
|
62
|
+
*/
|
|
63
|
+
cyclePosition(): Promise<void>;
|
|
44
64
|
private handleWindowResize;
|
|
45
65
|
private checkMobile;
|
|
46
66
|
/** Re-clamp float position so the panel never ends up off-screen after resize */
|
|
@@ -14,7 +14,6 @@ export declare class AiChatHeader {
|
|
|
14
14
|
agentAvatar: string;
|
|
15
15
|
/** Human mode: show the back button */
|
|
16
16
|
showBack: boolean;
|
|
17
|
-
isDraggable: boolean;
|
|
18
17
|
/** Human mode: status indicator variant */
|
|
19
18
|
statusIndicator: 'online' | 'offline' | 'busy' | 'away';
|
|
20
19
|
/** Browser mode: page title shown in the header */
|
|
@@ -27,18 +26,36 @@ export declare class AiChatHeader {
|
|
|
27
26
|
conversationActiveId: string;
|
|
28
27
|
/** Conversation list: show skeleton loading state */
|
|
29
28
|
conversationLoading: boolean;
|
|
29
|
+
/** Conversation list: show error state */
|
|
30
|
+
conversationError: boolean;
|
|
31
|
+
/** Conversation list: error message text */
|
|
32
|
+
conversationErrorText: string;
|
|
33
|
+
/** Conversation list: retry button label */
|
|
34
|
+
conversationRetryLabel: string;
|
|
35
|
+
/** Conversation list: empty state label */
|
|
36
|
+
conversationEmptyText: string;
|
|
37
|
+
/** Conversation list: ID of the conversation currently being deleted — shows a spinner on that item */
|
|
38
|
+
conversationDeletingId: string;
|
|
30
39
|
/** Show a shimmer skeleton in place of the conversation title (e.g. while loading conversation) */
|
|
31
40
|
titleLoading: boolean;
|
|
32
41
|
private avatarError;
|
|
33
42
|
private dropdownOpen;
|
|
43
|
+
/** Internally managed — true when the parent ai-chat-container has position="float" */
|
|
44
|
+
private isFloating;
|
|
45
|
+
private parentPositionObserver;
|
|
34
46
|
/** Cancel / close button */
|
|
35
47
|
closeClick: EventEmitter<void>;
|
|
36
48
|
/** Pencil-edit button (agent mode) */
|
|
37
|
-
|
|
49
|
+
newChatClick: EventEmitter<void>;
|
|
38
50
|
/** Title / chevron click → open conversation list (agent mode) */
|
|
39
51
|
dropdownClick: EventEmitter<void>;
|
|
40
|
-
/** More options button */
|
|
52
|
+
/** More options button — also fires a composed event so ai-chat-container can auto-cycle position */
|
|
41
53
|
positionClick: EventEmitter<void>;
|
|
54
|
+
/**
|
|
55
|
+
* Composed + bubbling event that ai-chat-container listens to internally
|
|
56
|
+
* to automatically cycle its position. Fires alongside positionClick.
|
|
57
|
+
*/
|
|
58
|
+
headerPositionClick: EventEmitter<void>;
|
|
42
59
|
/** Back-arrow button (human mode) */
|
|
43
60
|
backClick: EventEmitter<void>;
|
|
44
61
|
/**
|
|
@@ -55,12 +72,20 @@ export declare class AiChatHeader {
|
|
|
55
72
|
conversationSelect: EventEmitter<string>;
|
|
56
73
|
/** Fired when a conversation delete button is clicked */
|
|
57
74
|
conversationDelete: EventEmitter<string>;
|
|
75
|
+
/** Fired when the retry button is clicked in the conversation list error state */
|
|
76
|
+
conversationRetry: EventEmitter<void>;
|
|
58
77
|
handleDocumentClick(event: Event): void;
|
|
78
|
+
connectedCallback(): void;
|
|
79
|
+
componentDidLoad(): void;
|
|
80
|
+
disconnectedCallback(): void;
|
|
81
|
+
private observeParentPosition;
|
|
82
|
+
private syncFloatingState;
|
|
59
83
|
private renderIcon;
|
|
60
84
|
private renderAvatar;
|
|
61
85
|
private renderDragBtn;
|
|
62
86
|
private handleConversationSelect;
|
|
63
87
|
private handleConversationDelete;
|
|
88
|
+
private handleConversationRetry;
|
|
64
89
|
private renderConversationDropdown;
|
|
65
90
|
private renderAgentMode;
|
|
66
91
|
private renderHumanMode;
|
|
@@ -21,6 +21,8 @@ export declare class AiConversationList {
|
|
|
21
21
|
errorText: string;
|
|
22
22
|
/** Retry button label for error state */
|
|
23
23
|
retryLabel: string;
|
|
24
|
+
/** ID of the conversation currently being deleted — shows a spinner on that item */
|
|
25
|
+
deletingId: string;
|
|
24
26
|
conversationSelect: EventEmitter<string>;
|
|
25
27
|
conversationDelete: EventEmitter<string>;
|
|
26
28
|
retryClick: EventEmitter<void>;
|
|
@@ -1,22 +1,13 @@
|
|
|
1
|
-
import { EventEmitter } from '../../stencil-public-runtime';
|
|
2
1
|
export declare class AiInChatBrowser {
|
|
3
2
|
/** The URL to display inside the in-chat browser iframe */
|
|
4
3
|
url: string;
|
|
5
|
-
/** Page title
|
|
4
|
+
/** Page title used as the iframe's accessible title. Defaults to the URL hostname when empty. */
|
|
6
5
|
pageTitle: string;
|
|
7
|
-
/** Show the drag handle in the header (for floating containers) */
|
|
8
|
-
isDraggable: boolean;
|
|
9
|
-
/** Fired when the user clicks the back / close button to dismiss the browser */
|
|
10
|
-
browserClose: EventEmitter<void>;
|
|
11
|
-
/** Fired when the user clicks the external-link button */
|
|
12
|
-
browserOpenExternal: EventEmitter<string>;
|
|
13
6
|
private isLoading;
|
|
14
7
|
private hasError;
|
|
15
8
|
onUrlChange(): void;
|
|
16
9
|
private getDisplayTitle;
|
|
17
10
|
private handleIframeLoad;
|
|
18
11
|
private handleIframeError;
|
|
19
|
-
private handleBack;
|
|
20
|
-
private handleOpenExternal;
|
|
21
12
|
render(): any;
|
|
22
13
|
}
|
|
@@ -5,11 +5,13 @@
|
|
|
5
5
|
* It contains typing information for all components that exist in this project.
|
|
6
6
|
*/
|
|
7
7
|
import { HTMLStencilElement, JSXBase } from "./stencil-public-runtime";
|
|
8
|
+
import { ChatPosition } from "./components/ai-chat-container/ai-chat-container";
|
|
8
9
|
import { ConversationItem } from "./components/ai-conversation-list/ai-conversation-list";
|
|
9
10
|
import { ConversationItem as ConversationItem1 } from "./components/ai-conversation-list/ai-conversation-list";
|
|
10
11
|
import { IconName } from "./utils/icon-registry";
|
|
11
12
|
import { LoadingStep } from "./components/ai-loading/ai-loading";
|
|
12
13
|
import { RatingValue } from "./components/ai-rating/ai-rating";
|
|
14
|
+
export { ChatPosition } from "./components/ai-chat-container/ai-chat-container";
|
|
13
15
|
export { ConversationItem } from "./components/ai-conversation-list/ai-conversation-list";
|
|
14
16
|
export { ConversationItem as ConversationItem1 } from "./components/ai-conversation-list/ai-conversation-list";
|
|
15
17
|
export { IconName } from "./utils/icon-registry";
|
|
@@ -66,6 +68,15 @@ export namespace Components {
|
|
|
66
68
|
* @default true
|
|
67
69
|
*/
|
|
68
70
|
"autoScroll": boolean;
|
|
71
|
+
/**
|
|
72
|
+
* Cycle to the next valid position based on the current direction. - RTL: left ↔ float - LTR: right ↔ float
|
|
73
|
+
*/
|
|
74
|
+
"cyclePosition": () => Promise<void>;
|
|
75
|
+
/**
|
|
76
|
+
* Layout direction set by the host app. - `'rtl'` → valid docked position is `left`; cycle order: left ↔ float - `'ltr'` → valid docked position is `right`; cycle order: right ↔ float
|
|
77
|
+
* @default 'rtl'
|
|
78
|
+
*/
|
|
79
|
+
"direction": 'rtl' | 'ltr';
|
|
69
80
|
/**
|
|
70
81
|
* Show error state (e.g. failed to load conversation)
|
|
71
82
|
* @default false
|
|
@@ -93,9 +104,9 @@ export namespace Components {
|
|
|
93
104
|
"loading": boolean;
|
|
94
105
|
/**
|
|
95
106
|
* Position of the panel: 'left', 'right', or 'float'
|
|
96
|
-
* @default '
|
|
107
|
+
* @default 'left'
|
|
97
108
|
*/
|
|
98
|
-
"position":
|
|
109
|
+
"position": ChatPosition;
|
|
99
110
|
/**
|
|
100
111
|
* Retry button label
|
|
101
112
|
* @default 'إعادة المحاولة'
|
|
@@ -147,6 +158,26 @@ export namespace Components {
|
|
|
147
158
|
* @default ''
|
|
148
159
|
*/
|
|
149
160
|
"conversationActiveId": string;
|
|
161
|
+
/**
|
|
162
|
+
* Conversation list: ID of the conversation currently being deleted — shows a spinner on that item
|
|
163
|
+
* @default ''
|
|
164
|
+
*/
|
|
165
|
+
"conversationDeletingId": string;
|
|
166
|
+
/**
|
|
167
|
+
* Conversation list: empty state label
|
|
168
|
+
* @default 'لا توجد محادثات'
|
|
169
|
+
*/
|
|
170
|
+
"conversationEmptyText": string;
|
|
171
|
+
/**
|
|
172
|
+
* Conversation list: show error state
|
|
173
|
+
* @default false
|
|
174
|
+
*/
|
|
175
|
+
"conversationError": boolean;
|
|
176
|
+
/**
|
|
177
|
+
* Conversation list: error message text
|
|
178
|
+
* @default 'تعذّر تحميل المحادثات'
|
|
179
|
+
*/
|
|
180
|
+
"conversationErrorText": string;
|
|
150
181
|
/**
|
|
151
182
|
* Conversation list: items to display in the dropdown panel
|
|
152
183
|
* @default []
|
|
@@ -158,9 +189,10 @@ export namespace Components {
|
|
|
158
189
|
*/
|
|
159
190
|
"conversationLoading": boolean;
|
|
160
191
|
/**
|
|
161
|
-
*
|
|
192
|
+
* Conversation list: retry button label
|
|
193
|
+
* @default 'إعادة المحاولة'
|
|
162
194
|
*/
|
|
163
|
-
"
|
|
195
|
+
"conversationRetryLabel": string;
|
|
164
196
|
/**
|
|
165
197
|
* Layout variant
|
|
166
198
|
* @default 'agent'
|
|
@@ -232,6 +264,11 @@ export namespace Components {
|
|
|
232
264
|
* @default ''
|
|
233
265
|
*/
|
|
234
266
|
"activeId": string;
|
|
267
|
+
/**
|
|
268
|
+
* ID of the conversation currently being deleted — shows a spinner on that item
|
|
269
|
+
* @default ''
|
|
270
|
+
*/
|
|
271
|
+
"deletingId": string;
|
|
235
272
|
/**
|
|
236
273
|
* Text shown when the list is empty
|
|
237
274
|
* @default 'لا توجد محادثات'
|
|
@@ -298,12 +335,7 @@ export namespace Components {
|
|
|
298
335
|
}
|
|
299
336
|
interface AiInChatBrowser {
|
|
300
337
|
/**
|
|
301
|
-
*
|
|
302
|
-
* @default false
|
|
303
|
-
*/
|
|
304
|
-
"isDraggable": boolean;
|
|
305
|
-
/**
|
|
306
|
-
* Page title shown in the browser header. Defaults to the URL hostname when empty.
|
|
338
|
+
* Page title used as the iframe's accessible title. Defaults to the URL hostname when empty.
|
|
307
339
|
* @default ''
|
|
308
340
|
*/
|
|
309
341
|
"pageTitle": string;
|
|
@@ -532,10 +564,6 @@ export interface AiConversationListCustomEvent<T> extends CustomEvent<T> {
|
|
|
532
564
|
detail: T;
|
|
533
565
|
target: HTMLAiConversationListElement;
|
|
534
566
|
}
|
|
535
|
-
export interface AiInChatBrowserCustomEvent<T> extends CustomEvent<T> {
|
|
536
|
-
detail: T;
|
|
537
|
-
target: HTMLAiInChatBrowserElement;
|
|
538
|
-
}
|
|
539
567
|
export interface AiLoadingCustomEvent<T> extends CustomEvent<T> {
|
|
540
568
|
detail: T;
|
|
541
569
|
target: HTMLAiLoadingElement;
|
|
@@ -587,6 +615,7 @@ declare global {
|
|
|
587
615
|
};
|
|
588
616
|
interface HTMLAiChatContainerElementEventMap {
|
|
589
617
|
"retryClick": void;
|
|
618
|
+
"positionChange": ChatPosition;
|
|
590
619
|
}
|
|
591
620
|
interface HTMLAiChatContainerElement extends Components.AiChatContainer, HTMLStencilElement {
|
|
592
621
|
addEventListener<K extends keyof HTMLAiChatContainerElementEventMap>(type: K, listener: (this: HTMLAiChatContainerElement, ev: AiChatContainerCustomEvent<HTMLAiChatContainerElementEventMap[K]>) => any, options?: boolean | AddEventListenerOptions): void;
|
|
@@ -604,14 +633,16 @@ declare global {
|
|
|
604
633
|
};
|
|
605
634
|
interface HTMLAiChatHeaderElementEventMap {
|
|
606
635
|
"closeClick": void;
|
|
607
|
-
"
|
|
636
|
+
"newChatClick": void;
|
|
608
637
|
"dropdownClick": void;
|
|
609
638
|
"positionClick": void;
|
|
639
|
+
"headerPositionClick": void;
|
|
610
640
|
"backClick": void;
|
|
611
641
|
"headerDragStart": { clientX: number; clientY: number };
|
|
612
642
|
"openExternal": string;
|
|
613
643
|
"conversationSelect": string;
|
|
614
644
|
"conversationDelete": string;
|
|
645
|
+
"conversationRetry": void;
|
|
615
646
|
}
|
|
616
647
|
interface HTMLAiChatHeaderElement extends Components.AiChatHeader, HTMLStencilElement {
|
|
617
648
|
addEventListener<K extends keyof HTMLAiChatHeaderElementEventMap>(type: K, listener: (this: HTMLAiChatHeaderElement, ev: AiChatHeaderCustomEvent<HTMLAiChatHeaderElementEventMap[K]>) => any, options?: boolean | AddEventListenerOptions): void;
|
|
@@ -677,19 +708,7 @@ declare global {
|
|
|
677
708
|
prototype: HTMLAiIconElement;
|
|
678
709
|
new (): HTMLAiIconElement;
|
|
679
710
|
};
|
|
680
|
-
interface HTMLAiInChatBrowserElementEventMap {
|
|
681
|
-
"browserClose": void;
|
|
682
|
-
"browserOpenExternal": string;
|
|
683
|
-
}
|
|
684
711
|
interface HTMLAiInChatBrowserElement extends Components.AiInChatBrowser, HTMLStencilElement {
|
|
685
|
-
addEventListener<K extends keyof HTMLAiInChatBrowserElementEventMap>(type: K, listener: (this: HTMLAiInChatBrowserElement, ev: AiInChatBrowserCustomEvent<HTMLAiInChatBrowserElementEventMap[K]>) => any, options?: boolean | AddEventListenerOptions): void;
|
|
686
|
-
addEventListener<K extends keyof DocumentEventMap>(type: K, listener: (this: Document, ev: DocumentEventMap[K]) => any, options?: boolean | AddEventListenerOptions): void;
|
|
687
|
-
addEventListener<K extends keyof HTMLElementEventMap>(type: K, listener: (this: HTMLElement, ev: HTMLElementEventMap[K]) => any, options?: boolean | AddEventListenerOptions): void;
|
|
688
|
-
addEventListener(type: string, listener: EventListenerOrEventListenerObject, options?: boolean | AddEventListenerOptions): void;
|
|
689
|
-
removeEventListener<K extends keyof HTMLAiInChatBrowserElementEventMap>(type: K, listener: (this: HTMLAiInChatBrowserElement, ev: AiInChatBrowserCustomEvent<HTMLAiInChatBrowserElementEventMap[K]>) => any, options?: boolean | EventListenerOptions): void;
|
|
690
|
-
removeEventListener<K extends keyof DocumentEventMap>(type: K, listener: (this: Document, ev: DocumentEventMap[K]) => any, options?: boolean | EventListenerOptions): void;
|
|
691
|
-
removeEventListener<K extends keyof HTMLElementEventMap>(type: K, listener: (this: HTMLElement, ev: HTMLElementEventMap[K]) => any, options?: boolean | EventListenerOptions): void;
|
|
692
|
-
removeEventListener(type: string, listener: EventListenerOrEventListenerObject, options?: boolean | EventListenerOptions): void;
|
|
693
712
|
}
|
|
694
713
|
var HTMLAiInChatBrowserElement: {
|
|
695
714
|
prototype: HTMLAiInChatBrowserElement;
|
|
@@ -878,6 +897,11 @@ declare namespace LocalJSX {
|
|
|
878
897
|
* @default true
|
|
879
898
|
*/
|
|
880
899
|
"autoScroll"?: boolean;
|
|
900
|
+
/**
|
|
901
|
+
* Layout direction set by the host app. - `'rtl'` → valid docked position is `left`; cycle order: left ↔ float - `'ltr'` → valid docked position is `right`; cycle order: right ↔ float
|
|
902
|
+
* @default 'rtl'
|
|
903
|
+
*/
|
|
904
|
+
"direction"?: 'rtl' | 'ltr';
|
|
881
905
|
/**
|
|
882
906
|
* Show error state (e.g. failed to load conversation)
|
|
883
907
|
* @default false
|
|
@@ -903,15 +927,19 @@ declare namespace LocalJSX {
|
|
|
903
927
|
* @default false
|
|
904
928
|
*/
|
|
905
929
|
"loading"?: boolean;
|
|
930
|
+
/**
|
|
931
|
+
* Fired when the position changes (via cyclePosition or the header button)
|
|
932
|
+
*/
|
|
933
|
+
"onPositionChange"?: (event: AiChatContainerCustomEvent<ChatPosition>) => void;
|
|
906
934
|
/**
|
|
907
935
|
* Event emitted when the retry button is clicked
|
|
908
936
|
*/
|
|
909
937
|
"onRetryClick"?: (event: AiChatContainerCustomEvent<void>) => void;
|
|
910
938
|
/**
|
|
911
939
|
* Position of the panel: 'left', 'right', or 'float'
|
|
912
|
-
* @default '
|
|
940
|
+
* @default 'left'
|
|
913
941
|
*/
|
|
914
|
-
"position"?:
|
|
942
|
+
"position"?: ChatPosition;
|
|
915
943
|
/**
|
|
916
944
|
* Retry button label
|
|
917
945
|
* @default 'إعادة المحاولة'
|
|
@@ -959,6 +987,26 @@ declare namespace LocalJSX {
|
|
|
959
987
|
* @default ''
|
|
960
988
|
*/
|
|
961
989
|
"conversationActiveId"?: string;
|
|
990
|
+
/**
|
|
991
|
+
* Conversation list: ID of the conversation currently being deleted — shows a spinner on that item
|
|
992
|
+
* @default ''
|
|
993
|
+
*/
|
|
994
|
+
"conversationDeletingId"?: string;
|
|
995
|
+
/**
|
|
996
|
+
* Conversation list: empty state label
|
|
997
|
+
* @default 'لا توجد محادثات'
|
|
998
|
+
*/
|
|
999
|
+
"conversationEmptyText"?: string;
|
|
1000
|
+
/**
|
|
1001
|
+
* Conversation list: show error state
|
|
1002
|
+
* @default false
|
|
1003
|
+
*/
|
|
1004
|
+
"conversationError"?: boolean;
|
|
1005
|
+
/**
|
|
1006
|
+
* Conversation list: error message text
|
|
1007
|
+
* @default 'تعذّر تحميل المحادثات'
|
|
1008
|
+
*/
|
|
1009
|
+
"conversationErrorText"?: string;
|
|
962
1010
|
/**
|
|
963
1011
|
* Conversation list: items to display in the dropdown panel
|
|
964
1012
|
* @default []
|
|
@@ -970,9 +1018,10 @@ declare namespace LocalJSX {
|
|
|
970
1018
|
*/
|
|
971
1019
|
"conversationLoading"?: boolean;
|
|
972
1020
|
/**
|
|
973
|
-
*
|
|
1021
|
+
* Conversation list: retry button label
|
|
1022
|
+
* @default 'إعادة المحاولة'
|
|
974
1023
|
*/
|
|
975
|
-
"
|
|
1024
|
+
"conversationRetryLabel"?: string;
|
|
976
1025
|
/**
|
|
977
1026
|
* Layout variant
|
|
978
1027
|
* @default 'agent'
|
|
@@ -990,6 +1039,10 @@ declare namespace LocalJSX {
|
|
|
990
1039
|
* Fired when a conversation delete button is clicked
|
|
991
1040
|
*/
|
|
992
1041
|
"onConversationDelete"?: (event: AiChatHeaderCustomEvent<string>) => void;
|
|
1042
|
+
/**
|
|
1043
|
+
* Fired when the retry button is clicked in the conversation list error state
|
|
1044
|
+
*/
|
|
1045
|
+
"onConversationRetry"?: (event: AiChatHeaderCustomEvent<void>) => void;
|
|
993
1046
|
/**
|
|
994
1047
|
* Fired when a conversation is selected from the dropdown list
|
|
995
1048
|
*/
|
|
@@ -998,20 +1051,24 @@ declare namespace LocalJSX {
|
|
|
998
1051
|
* Title / chevron click → open conversation list (agent mode)
|
|
999
1052
|
*/
|
|
1000
1053
|
"onDropdownClick"?: (event: AiChatHeaderCustomEvent<void>) => void;
|
|
1001
|
-
/**
|
|
1002
|
-
* Pencil-edit button (agent mode)
|
|
1003
|
-
*/
|
|
1004
|
-
"onEditClick"?: (event: AiChatHeaderCustomEvent<void>) => void;
|
|
1005
1054
|
/**
|
|
1006
1055
|
* Fired on pointerdown of the drag handle. Composed + bubbling so ai-chat-container can receive it across shadow roots.
|
|
1007
1056
|
*/
|
|
1008
1057
|
"onHeaderDragStart"?: (event: AiChatHeaderCustomEvent<{ clientX: number; clientY: number }>) => void;
|
|
1058
|
+
/**
|
|
1059
|
+
* Composed + bubbling event that ai-chat-container listens to internally to automatically cycle its position. Fires alongside positionClick.
|
|
1060
|
+
*/
|
|
1061
|
+
"onHeaderPositionClick"?: (event: AiChatHeaderCustomEvent<void>) => void;
|
|
1062
|
+
/**
|
|
1063
|
+
* Pencil-edit button (agent mode)
|
|
1064
|
+
*/
|
|
1065
|
+
"onNewChatClick"?: (event: AiChatHeaderCustomEvent<void>) => void;
|
|
1009
1066
|
/**
|
|
1010
1067
|
* Open-external button (browser mode)
|
|
1011
1068
|
*/
|
|
1012
1069
|
"onOpenExternal"?: (event: AiChatHeaderCustomEvent<string>) => void;
|
|
1013
1070
|
/**
|
|
1014
|
-
* More options button
|
|
1071
|
+
* More options button — also fires a composed event so ai-chat-container can auto-cycle position
|
|
1015
1072
|
*/
|
|
1016
1073
|
"onPositionClick"?: (event: AiChatHeaderCustomEvent<void>) => void;
|
|
1017
1074
|
/**
|
|
@@ -1083,6 +1140,11 @@ declare namespace LocalJSX {
|
|
|
1083
1140
|
* @default ''
|
|
1084
1141
|
*/
|
|
1085
1142
|
"activeId"?: string;
|
|
1143
|
+
/**
|
|
1144
|
+
* ID of the conversation currently being deleted — shows a spinner on that item
|
|
1145
|
+
* @default ''
|
|
1146
|
+
*/
|
|
1147
|
+
"deletingId"?: string;
|
|
1086
1148
|
/**
|
|
1087
1149
|
* Text shown when the list is empty
|
|
1088
1150
|
* @default 'لا توجد محادثات'
|
|
@@ -1152,20 +1214,7 @@ declare namespace LocalJSX {
|
|
|
1152
1214
|
}
|
|
1153
1215
|
interface AiInChatBrowser {
|
|
1154
1216
|
/**
|
|
1155
|
-
*
|
|
1156
|
-
* @default false
|
|
1157
|
-
*/
|
|
1158
|
-
"isDraggable"?: boolean;
|
|
1159
|
-
/**
|
|
1160
|
-
* Fired when the user clicks the back / close button to dismiss the browser
|
|
1161
|
-
*/
|
|
1162
|
-
"onBrowserClose"?: (event: AiInChatBrowserCustomEvent<void>) => void;
|
|
1163
|
-
/**
|
|
1164
|
-
* Fired when the user clicks the external-link button
|
|
1165
|
-
*/
|
|
1166
|
-
"onBrowserOpenExternal"?: (event: AiInChatBrowserCustomEvent<string>) => void;
|
|
1167
|
-
/**
|
|
1168
|
-
* Page title shown in the browser header. Defaults to the URL hostname when empty.
|
|
1217
|
+
* Page title used as the iframe's accessible title. Defaults to the URL hostname when empty.
|
|
1169
1218
|
* @default ''
|
|
1170
1219
|
*/
|
|
1171
1220
|
"pageTitle"?: string;
|
|
@@ -1405,7 +1454,7 @@ declare namespace LocalJSX {
|
|
|
1405
1454
|
}
|
|
1406
1455
|
interface AiChatContainerAttributes {
|
|
1407
1456
|
"isOpen": boolean;
|
|
1408
|
-
"position":
|
|
1457
|
+
"position": ChatPosition;
|
|
1409
1458
|
"width": string;
|
|
1410
1459
|
"autoScroll": boolean;
|
|
1411
1460
|
"showWatermark": boolean;
|
|
@@ -1415,6 +1464,7 @@ declare namespace LocalJSX {
|
|
|
1415
1464
|
"error": boolean;
|
|
1416
1465
|
"errorText": string;
|
|
1417
1466
|
"retryLabel": string;
|
|
1467
|
+
"direction": 'rtl' | 'ltr';
|
|
1418
1468
|
}
|
|
1419
1469
|
interface AiChatHeaderAttributes {
|
|
1420
1470
|
"mode": 'agent' | 'human' | 'browser';
|
|
@@ -1423,12 +1473,16 @@ declare namespace LocalJSX {
|
|
|
1423
1473
|
"agentStatus": string;
|
|
1424
1474
|
"agentAvatar": string;
|
|
1425
1475
|
"showBack": boolean;
|
|
1426
|
-
"isDraggable": boolean;
|
|
1427
1476
|
"statusIndicator": 'online' | 'offline' | 'busy' | 'away';
|
|
1428
1477
|
"pageTitle": string;
|
|
1429
1478
|
"pageUrl": string;
|
|
1430
1479
|
"conversationActiveId": string;
|
|
1431
1480
|
"conversationLoading": boolean;
|
|
1481
|
+
"conversationError": boolean;
|
|
1482
|
+
"conversationErrorText": string;
|
|
1483
|
+
"conversationRetryLabel": string;
|
|
1484
|
+
"conversationEmptyText": string;
|
|
1485
|
+
"conversationDeletingId": string;
|
|
1432
1486
|
"titleLoading": boolean;
|
|
1433
1487
|
}
|
|
1434
1488
|
interface AiChatMessageAttributes {
|
|
@@ -1448,6 +1502,7 @@ declare namespace LocalJSX {
|
|
|
1448
1502
|
"error": boolean;
|
|
1449
1503
|
"errorText": string;
|
|
1450
1504
|
"retryLabel": string;
|
|
1505
|
+
"deletingId": string;
|
|
1451
1506
|
}
|
|
1452
1507
|
interface AiConversationSummaryAttributes {
|
|
1453
1508
|
"conversation": string;
|
|
@@ -1462,7 +1517,6 @@ declare namespace LocalJSX {
|
|
|
1462
1517
|
interface AiInChatBrowserAttributes {
|
|
1463
1518
|
"url": string;
|
|
1464
1519
|
"pageTitle": string;
|
|
1465
|
-
"isDraggable": boolean;
|
|
1466
1520
|
}
|
|
1467
1521
|
interface AiLinkAttributes {
|
|
1468
1522
|
"label": string;
|
package/dist/types/index.d.ts
CHANGED
|
@@ -10,4 +10,5 @@
|
|
|
10
10
|
export { format } from './utils/utils';
|
|
11
11
|
export type * from './components.d.ts';
|
|
12
12
|
export type { LoadingStep } from './components/ai-loading/ai-loading';
|
|
13
|
+
export type { ChatPosition } from './components/ai-chat-container/ai-chat-container';
|
|
13
14
|
export type { IconName } from './utils/icon-registry';
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{r as i,c as e,h as a,H as s}from"./p-
|
|
1
|
+
import{r as i,c as e,h as a,H as s}from"./p-VMEwYfaX.js";const t=class{constructor(a){i(this,a),this.suggestionClick=e(this,"suggestionClick")}label="";disabled=!1;suggestionClick;handleClick(){this.disabled||this.suggestionClick.emit(this.label)}render(){return a(s,{key:"510e649f8778e2298270d320f0555c4d960fb056"},a("button",{key:"a4ee17cbd432596804279d8a852635608125452a",class:{chip:!0,"chip--disabled":this.disabled},disabled:this.disabled,onClick:()=>this.handleClick()},a("span",{key:"cb2d97459b0dd6effe83bbfb81a0af9144759477",class:"chip__label"},this.label,a("slot",{key:"ce84f07883f24c216c45da9266af5160baea9cdc"}))))}};t.style=":host{--ai-suggestion-border:1px solid var(--ai-accent);--ai-suggestion-border-hover:1px solid var(--ai-accent);--ai-suggestion-radius:9999px;--ai-suggestion-padding:8px 12px;--ai-suggestion-gap:4px;--ai-suggestion-font-size:14px;--ai-suggestion-line-height:20px;display:inline-block}.chip{display:inline-flex;align-items:center;justify-content:center;gap:var(--ai-suggestion-gap);background:var(--ai-bg-card);border:var(--ai-suggestion-border);border-radius:var(--ai-suggestion-radius);padding:var(--ai-suggestion-padding);color:var(--ai-accent-dark);font-size:var(--ai-suggestion-font-size);font-weight:400;line-height:var(--ai-suggestion-line-height);font-family:inherit;white-space:nowrap;cursor:pointer;transition:background 0.15s ease, border-color 0.15s ease;outline:none;text-align:start}.chip:hover:not(:disabled){background:var(--ai-accent-bg);border:var(--ai-suggestion-border-hover)}.chip:active:not(:disabled){background:var(--ai-accent-bg)}.chip:focus-visible{outline:2px solid var(--ai-accent);outline-offset:2px}.chip--disabled,.chip:disabled{opacity:0.45;cursor:not-allowed;pointer-events:none}.chip__label{display:inline-flex;align-items:center;gap:var(--ai-suggestion-gap)}";export{t as ai_suggestion}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{r as e,c as t,h as i,H as r}from"./p-VMEwYfaX.js";import{i as a}from"./p-DlD8m3rf.js";const n=class{constructor(i){e(this,i),this.conversationSelect=t(this,"conversationSelect"),this.conversationDelete=t(this,"conversationDelete"),this.retryClick=t(this,"retryClick")}items=[];activeId="";loading=!1;emptyText="لا توجد محادثات";error=!1;errorText="تعذّر تحميل المحادثات";retryLabel="إعادة المحاولة";deletingId="";conversationSelect;conversationDelete;retryClick;renderIcon(e,t,r){const n=a[e];return n?i("span",{class:"icon-wrap",innerHTML:`<svg width="${t}" height="${r}" viewBox="${n.viewBox}" fill="none" xmlns="http://www.w3.org/2000/svg">${n.content}</svg>`}):null}formatRelativeTime(e){if(!e)return"";try{const t=new Date(e);if(isNaN(t.getTime()))return e;const i=Date.now()-t.getTime(),r=Math.floor(i/6e4),a=Math.floor(r/60),n=Math.floor(a/24),s="undefined"!=typeof document&&document.documentElement.lang||"ar",o=new Intl.RelativeTimeFormat(s,{numeric:"auto"});return r<1?o.format(0,"second"):r<60?o.format(-r,"minute"):a<24?o.format(-a,"hour"):o.format(-n,"day")}catch{return e}}renderRatingDots(e){return i("div",{class:"rating-dots","aria-label":e?`تقييم ${e} من 5`:void 0},Array.from({length:5},((t,r)=>i("span",{class:"rating-dot "+(r<(e??0)?"rating-dot--filled":"")}))))}renderSkeleton(){return i("div",{class:"skeleton-list"},[1,2,3,4].map((e=>i("div",{key:e,class:"skeleton-item"},i("div",{class:"skeleton-line skeleton-line--title"}),i("div",{class:"skeleton-line skeleton-line--preview"}),i("div",{class:"skeleton-line skeleton-line--meta"})))))}renderEmpty(){return i("div",{class:"empty-state"},i("div",{class:"empty-state__icon"},this.renderIcon("list",24,24)),i("p",{class:"empty-state__text"},this.emptyText))}renderError(){return i("div",{class:"error-state"},i("div",{class:"error-state__icon"},this.renderIcon("wifi-off",24,24)),i("p",{class:"error-state__text"},this.errorText),i("button",{class:"error-state__retry",onClick:()=>this.retryClick.emit()},this.renderIcon("reload",14,14),i("span",null,this.retryLabel)))}render(){const e=!this.loading&&!this.error&&0===this.items.length;return i(r,{key:"8cf17cedd5c41f0d6ffd2d06e557dc370041d1aa"},i("div",{key:"50f5eeb57228f55d72acf517ed5eeb5d79e13a4b",class:"conversation-list"},i("div",{key:"763f7cb557fb9abea75e08379d0ea9090b00ac1e",class:"list-scroll",role:"list"},this.loading?this.renderSkeleton():this.error?this.renderError():e?this.renderEmpty():this.items.map((e=>{const t=e.id===this.activeId;return i("div",{key:e.id,class:{"conv-item":!0,"conv-item--active":t},role:"listitem","aria-current":t?"true":void 0,onClick:()=>this.conversationSelect.emit(e.id)},i("div",{class:"conv-item__body"},i("p",{class:"conv-item__title"},e.title),i("p",{class:"conv-item__preview"},e.preview),i("div",{class:"conv-item__meta"},i("span",{class:"conv-item__time"},this.formatRelativeTime(e.timestamp)),null!=e.rating&&this.renderRatingDots(e.rating))),i("button",{class:{"delete-btn":!0,"delete-btn--deleting":this.deletingId===e.id},"aria-label":"حذف المحادثة",disabled:this.deletingId===e.id,onClick:t=>{t.stopPropagation(),this.deletingId!==e.id&&this.conversationDelete.emit(e.id)}},this.deletingId===e.id?i("span",{class:"delete-spinner","aria-label":"جاري الحذف"}):this.renderIcon("cancel",14,14)))})))))}};n.style=":host{display:flex;flex-direction:column;height:100%;min-height:0;overflow:hidden}.conversation-list{display:flex;flex-direction:column;gap:8px;flex:1;min-height:0;background:var(--ai-bg-surface)}.list-scroll{flex:1;min-height:0;overflow-y:auto;padding:0 8px 12px;scrollbar-width:thin;scrollbar-color:var(--ai-scrollbar-thumb) transparent}.list-scroll::-webkit-scrollbar{width:3px}.list-scroll::-webkit-scrollbar-track{background:transparent}.list-scroll::-webkit-scrollbar-thumb{background:var(--ai-scrollbar-thumb);border-radius:99px}.list-scroll::-webkit-scrollbar-thumb:hover{background:var(--ai-scrollbar-thumb-hover)}.conv-item{display:flex;align-items:flex-start;gap:6px;margin-top:6px;padding:10px 10px 10px 6px;border-radius:10px;cursor:pointer;transition:background 0.15s;position:relative}.conv-item:hover{background:var(--ai-bg-card)}.conv-item--active{background:var(--ai-bg-card);box-shadow:var(--ai-shadow-sm)}.conv-item__body{flex:1;min-width:0}.conv-item__title{margin:0 0 3px;font-size:13px;font-weight:600;color:var(--ai-text-primary);white-space:nowrap;overflow:hidden;text-overflow:ellipsis}.conv-item__preview{margin:0 0 5px;font-size:12px;color:var(--ai-text-muted);line-height:1.45;display:-webkit-box;-webkit-line-clamp:2;line-clamp:2;-webkit-box-orient:vertical;overflow:hidden}.conv-item__meta{display:flex;align-items:center;gap:8px}.conv-item__time{font-size:11px;color:var(--ai-text-muted);flex-shrink:0}.rating-dots{display:flex;align-items:center;gap:3px}.rating-dot{width:6px;height:6px;border-radius:50%;background:var(--ai-border-default);transition:background 0.15s}.rating-dot--filled{background:var(--ai-accent-warning, #ffaf44)}.delete-btn{flex-shrink:0;display:flex;align-items:center;justify-content:center;width:24px;height:24px;padding:0;background:transparent;border:none;border-radius:6px;cursor:pointer;color:var(--ai-text-muted);opacity:0;transition:opacity 0.15s, background 0.15s, color 0.15s;margin-block-start:2px}.conv-item:hover .delete-btn,.conv-item--active .delete-btn{opacity:1}.delete-btn:hover{background:var(--ai-status-danger-bg, rgba(239, 68, 68, 0.1));color:var(--ai-status-danger, #ef4444)}.delete-btn .icon-wrap{display:inline-flex;align-items:center;line-height:0}.delete-btn--deleting{opacity:1;cursor:default;pointer-events:none}.delete-spinner{display:block;width:12px;height:12px;border:2px solid var(--ai-border-default);border-top-color:var(--ai-text-muted);border-radius:50%;animation:delete-spin 0.7s linear infinite}@keyframes delete-spin{to{transform:rotate(360deg)}}.empty-state{display:flex;flex-direction:column;align-items:center;justify-content:center;gap:8px;padding:40px 16px;text-align:center}.empty-state__icon{display:flex;align-items:center;justify-content:center;width:40px;height:40px;border-radius:10px;background:var(--ai-bg-card);color:var(--ai-text-muted);line-height:0}.empty-state__icon .icon-wrap{display:inline-flex;align-items:center;line-height:0}.empty-state__text{margin:0;font-size:13px;color:var(--ai-text-muted);line-height:1.4}.error-state{display:flex;flex-direction:column;align-items:center;justify-content:center;gap:8px;padding:40px 16px;text-align:center}.error-state__icon{display:flex;align-items:center;justify-content:center;width:40px;height:40px;border-radius:10px;background:var(--ai-status-danger-bg, rgba(239, 68, 68, 0.1));color:var(--ai-status-danger, #ef4444);line-height:0}.error-state__icon .icon-wrap{display:inline-flex;align-items:center;line-height:0}.error-state__text{margin:0;font-size:13px;color:var(--ai-text-muted);line-height:1.4}.error-state__retry{display:inline-flex;align-items:center;gap:4px;margin-top:4px;padding:6px 14px;font-size:12px;font-weight:600;color:var(--ai-text-primary);background:var(--ai-bg-card);border:1px solid var(--ai-border-default);border-radius:8px;cursor:pointer;transition:background 0.15s, box-shadow 0.15s}.error-state__retry:hover{box-shadow:var(--ai-shadow-sm)}.error-state__retry .icon-wrap{display:inline-flex;align-items:center;line-height:0}.skeleton-list{display:flex;flex-direction:column;gap:4px}.skeleton-item{padding:10px;border-radius:10px;display:flex;flex-direction:column;gap:6px}.skeleton-line{border-radius:6px;background:var(--ai-shimmer-gradient, linear-gradient(90deg, rgba(0, 0, 0, 0.06) 25%, rgba(0, 0, 0, 0.1) 50%, rgba(0, 0, 0, 0.06) 75%));background-size:200% 100%;animation:shimmer 2s linear infinite;height:12px}.skeleton-line--title{width:65%;height:13px}.skeleton-line--preview{width:100%}.skeleton-line--meta{width:35%;height:10px}@keyframes shimmer{0%{background-position:200% 0}100%{background-position:-200% 0}}";export{n as ai_conversation_list}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{r as i,c as t,a as e,h as r,H as a}from"./p-
|
|
1
|
+
import{r as i,c as t,a as e,h as r,H as a}from"./p-VMEwYfaX.js";const o=class{constructor(e){i(this,e),this.audioRecorded=t(this,"audioRecorded"),this.recordingCancel=t(this,"recordingCancel")}get el(){return e(this)}disabled=!1;showWaveform=!0;autoStart=!1;errorText="";waveformColor="";state="idle";error=null;recordingDuration=0;submitPulse=!1;audioRecorded;recordingCancel;streamRef=null;audioContextRef=null;analyserRef=null;mediaRecorderRef=null;audioChunks=[];recordingStartTime=0;recordingTimer=null;maxTimeoutRef=null;canvasRef;animationFrameId=0;prevHeights=[];componentDidLoad(){this.autoStart&&!this.disabled&&this.startRecording()}disconnectedCallback(){this.cleanup()}cleanup=()=>{this.recordingTimer&&(clearInterval(this.recordingTimer),this.recordingTimer=null),this.maxTimeoutRef&&(clearTimeout(this.maxTimeoutRef),this.maxTimeoutRef=null),this.animationFrameId&&(cancelAnimationFrame(this.animationFrameId),this.animationFrameId=0),this.mediaRecorderRef&&"inactive"!==this.mediaRecorderRef.state&&(this.mediaRecorderRef.stop(),this.mediaRecorderRef=null),this.audioContextRef&&(this.audioContextRef.close(),this.audioContextRef=null),this.analyserRef&&(this.analyserRef=null),this.streamRef&&(this.streamRef.getTracks().forEach((i=>i.stop())),this.streamRef=null)};getErrorText(){return this.errorText?this.errorText:"en"===document.documentElement.lang?"Microphone access denied":"تعذّر الوصول للميكروفون"}startRecording=async()=>{try{this.error=null,this.audioChunks=[];const i=await navigator.mediaDevices.getUserMedia({audio:{echoCancellation:!0,noiseSuppression:!0,autoGainControl:!0}});this.streamRef=i;const t=new AudioContext;if(this.audioContextRef=t,this.showWaveform){const e=t.createAnalyser();e.fftSize=256,e.smoothingTimeConstant=.8,this.analyserRef=e,t.createMediaStreamSource(i).connect(e)}this.setupMediaRecorder(i),this.recordingStartTime=Date.now(),this.recordingDuration=0,this.prevHeights=[],this.state="recording",this.showWaveform&&requestAnimationFrame((()=>{this.drawWaveform()})),this.recordingTimer=window.setInterval((()=>{this.recordingDuration=Math.floor((Date.now()-this.recordingStartTime)/1e3)}),1e3),this.maxTimeoutRef=window.setTimeout((()=>{this.stopRecording()}),6e4)}catch(i){console.error("Error starting recording:",i),this.error=this.getErrorText(),this.state="idle"}};setupMediaRecorder=i=>{const t=MediaRecorder.isTypeSupported("audio/webm")?"audio/webm":MediaRecorder.isTypeSupported("audio/ogg")?"audio/ogg":"",e=new MediaRecorder(i,t?{mimeType:t}:{});e.ondataavailable=i=>{i.data.size>0&&this.audioChunks.push(i.data)},e.onstop=()=>{const i=new Blob(this.audioChunks,{type:t||"audio/mp4"});this.audioRecorded.emit({blob:i,duration:this.recordingDuration})},this.mediaRecorderRef=e,e.start(100)};stopRecording=()=>{if(this.recordingDuration<1)return this.submitPulse=!0,void setTimeout((()=>{this.submitPulse=!1}),400);this.recordingTimer&&(clearInterval(this.recordingTimer),this.recordingTimer=null),this.maxTimeoutRef&&(clearTimeout(this.maxTimeoutRef),this.maxTimeoutRef=null),this.cleanup(),this.state="idle"};cancelRecording=()=>{this.mediaRecorderRef&&"inactive"!==this.mediaRecorderRef.state&&(this.mediaRecorderRef.ondataavailable=null,this.mediaRecorderRef.onstop=null),this.cleanup(),this.state="idle",this.recordingCancel.emit()};drawWaveform=()=>{if(!this.canvasRef||!this.analyserRef)return;const i=this.canvasRef,t=i.getContext("2d");if(!t)return;const e=this.analyserRef.frequencyBinCount,r=new Uint8Array(e),a=this.waveformColor||getComputedStyle(this.el).getPropertyValue("--ai-waveform-color").trim()||"#9ca3af",o=(i,e,r,a,o)=>{if(t.beginPath(),"function"==typeof t.roundRect)t.roundRect(i,e,r,a,o);else{const s=Math.min(o,r/2,a/2);t.moveTo(i+s,e),t.lineTo(i+r-s,e),t.arcTo(i+r,e,i+r,e+s,s),t.lineTo(i+r,e+a-s),t.arcTo(i+r,e+a,i+r-s,e+a,s),t.lineTo(i+s,e+a),t.arcTo(i,e+a,i,e+a-s,s),t.lineTo(i,e+s),t.arcTo(i,e,i+s,e,s),t.closePath()}},s=()=>{if("recording"!==this.state)return;this.animationFrameId=requestAnimationFrame(s);const n=i.offsetWidth;n>0&&i.width!==n&&(i.width=n);const c=Math.min(100,Math.floor(i.width/3)),d=Math.max(1,Math.floor(e/c));this.prevHeights.length!==c&&(this.prevHeights=new Array(c).fill(4)),this.analyserRef.getByteFrequencyData(r),t.clearRect(0,0,i.width,i.height);const l=i.height/2,h=(i.width-3*c)/2,u=i.height-4;for(let i=0;i<c;i++){let s=0;for(let t=0;t<d;t++){const a=i*d+t;a<e&&(s+=r[a])}const n=Math.min(1,s/d/255);this.prevHeights[i]=.7*this.prevHeights[i]+.3*(4+n*(u-4));const c=this.prevHeights[i],p=h+3*i,b=l-c/2;t.fillStyle=a,o(p,b,1,c,.5),t.fill()}};s()};formatDuration=i=>`${Math.floor(i/60)}:${(i%60).toString().padStart(2,"0")}`;render(){const i=60-this.recordingDuration;return r(a,{key:"93565ead1262f192811d4783ac4567b8eb7d59de"},r("div",{key:"9317e2a24533435e5ac967f3eddaad3d1f6c4613",class:"wrapper"},r("div",{key:"35631eb88e495be9b2bdabf1b8f15d237d327c4b",class:"glow"+("recording"===this.state?" visible":""),"aria-hidden":"true"}),r("div",{key:"c65050758e58402c5b341c8d24a0ca58f9f53361",class:"input-container"},"idle"===this.state?r("div",{class:"recording-row"},r("button",{type:"button",class:"submit-button",onClick:this.startRecording,disabled:this.disabled,"aria-label":"Start recording"},r("ai-icon",{name:"mic",size:16})),this.error&&r("div",{class:"error-message",role:"alert"},this.error)):r("div",{class:"recording-row"},r("button",{type:"button",class:"cancel-button",onClick:this.cancelRecording,"aria-label":"Cancel"},r("ai-icon",{name:"cancel",size:14})),r("div",{class:"timer"+(i<=5?" warning":"")},this.formatDuration(this.recordingDuration)),this.showWaveform&&r("canvas",{ref:i=>this.canvasRef=i,class:"waveform",height:"32"}),r("button",{type:"button",class:"submit-button"+(this.submitPulse?" pulse":""),onClick:this.stopRecording,"aria-label":"Send"},r("ai-icon",{name:"arrow-up",size:14}))))))}};o.style=":host{display:block;width:100%}.wrapper{position:relative;padding:var(--Spacing-Sizes-lg, 12px)}.glow{position:absolute;bottom:20px;left:39px;right:39px;height:29px;border-radius:9999px;background:var(--ai-input-glow);filter:blur(20px);opacity:0;pointer-events:none;transition:opacity 0.2s ease}.glow.visible{opacity:0.9}.input-container{position:relative;background-color:var(--ai-bg-input);border-radius:var(--ai-input-border-radius, 9999px);border:1px solid var(--ai-border-default);box-shadow:var(--ai-shadow-sm);padding:var(--ai-input-padding, 12px);overflow:hidden}.recording-row{display:flex;align-items:center;gap:var(--ai-input-gap, 10px)}.cancel-button{display:inline-flex;align-items:center;justify-content:center;gap:4px;min-height:32px;max-height:32px;padding:4px 8px;border-radius:32px;border:2px solid var(--ai-border-default);background-color:var(--ai-border-default);color:var(--ai-text-secondary);cursor:pointer;flex-shrink:0;transition:background-color 0.2s ease, border-color 0.2s ease, color 0.2s ease}.cancel-button:hover{background-color:var(--ai-bg-surface);border-color:var(--ai-bg-surface)}.submit-button{display:inline-flex;align-items:center;justify-content:center;height:32px;width:32px;min-width:32px;padding:4px 8px;border-radius:32px;border:2px solid var(--ai-send-button-active-border, var(--ai-accent));background-color:var(--ai-send-button-active-bg, var(--ai-accent));color:var(--ai-accent-text);cursor:pointer;flex-shrink:0;transition:background-color 0.2s ease, border-color 0.2s ease, color 0.2s ease}.submit-button:hover{background-color:var(--ai-send-button-active-hover-bg, var(--ai-accent));border-color:var(--ai-send-button-active-hover-border, var(--ai-accent))}@keyframes pulse-once{0%{transform:scale(1)}40%{transform:scale(1.18)}100%{transform:scale(1)}}.submit-button.pulse{animation:pulse-once 0.35s ease}.timer{font-size:13px;font-weight:500;color:var(--ai-text-secondary);min-width:36px;text-align:center;flex-shrink:0}.timer.warning{color:var(--ai-voice-timer-warning-color, var(--ai-danger-text))}.waveform{flex:1;min-width:0;height:32px}.error-message{position:absolute;bottom:-40px;left:50%;transform:translateX(-50%);background:var(--ai-voice-error-bg, var(--ai-danger-bg));color:var(--ai-voice-error-color, var(--ai-danger-text));font-size:11px;padding:6px 12px;border-radius:6px;white-space:nowrap;box-shadow:var(--ai-shadow-error);border:1px solid var(--ai-voice-error-border, var(--ai-danger-border));z-index:10}";export{o as ai_voice_input}
|