hanc-webrtc-widgets 2.6.13 → 2.6.16
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/hanc-webrtc-widgets.es.js +121 -97
- package/dist/hanc-webrtc-widgets.umd.js +6 -6
- package/dist/src/components/form-overlay/form-overlay.d.ts +34 -0
- package/dist/src/components/form-overlay/form-overlay.styles.d.ts +1 -0
- package/dist/src/components/form-overlay/index.d.ts +1 -0
- package/dist/src/core/livekit-call-manager.d.ts +28 -0
- package/dist/src/orb/components/HancAiWidget.d.ts +5 -1
- package/dist/src/orb/core/LiveKitManager.d.ts +4 -0
- package/package.json +1 -1
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
import { LitElement, nothing } from 'lit';
|
|
2
|
+
export interface FormField {
|
|
3
|
+
name: string;
|
|
4
|
+
type: 'text' | 'number' | 'boolean' | 'selector' | 'email' | 'phone';
|
|
5
|
+
label: string;
|
|
6
|
+
placeholder?: string;
|
|
7
|
+
required?: boolean;
|
|
8
|
+
options?: string[];
|
|
9
|
+
}
|
|
10
|
+
export interface FormSubmitEvent {
|
|
11
|
+
requestId: string;
|
|
12
|
+
data: Record<string, string>;
|
|
13
|
+
}
|
|
14
|
+
export declare class FormOverlay extends LitElement {
|
|
15
|
+
static styles: import('lit').CSSResult;
|
|
16
|
+
requestId: string;
|
|
17
|
+
fields: FormField[];
|
|
18
|
+
visible: boolean;
|
|
19
|
+
private _values;
|
|
20
|
+
private _errors;
|
|
21
|
+
private _submitted;
|
|
22
|
+
private _animateIn;
|
|
23
|
+
updated(changed: Map<string, unknown>): void;
|
|
24
|
+
private _onInput;
|
|
25
|
+
private _validate;
|
|
26
|
+
private _onSubmit;
|
|
27
|
+
private _renderField;
|
|
28
|
+
render(): import('lit').TemplateResult<1> | typeof nothing;
|
|
29
|
+
}
|
|
30
|
+
declare global {
|
|
31
|
+
interface HTMLElementTagNameMap {
|
|
32
|
+
'form-overlay': FormOverlay;
|
|
33
|
+
}
|
|
34
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare const formOverlayStyles: import('lit').CSSResult;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { FormOverlay, type FormField, type FormSubmitEvent } from './form-overlay';
|
|
@@ -38,11 +38,35 @@ export interface LiveKitCallManagerEvents {
|
|
|
38
38
|
'microphone-disabled': Event;
|
|
39
39
|
'audio-enabled': Event;
|
|
40
40
|
'call-ended': Event;
|
|
41
|
+
transcription: CustomEvent<{
|
|
42
|
+
speaker: string;
|
|
43
|
+
text: string;
|
|
44
|
+
timestamp: number;
|
|
45
|
+
}>;
|
|
46
|
+
'agent-command': CustomEvent<AgentCommand>;
|
|
41
47
|
disconnected: Event;
|
|
42
48
|
error: CustomEvent<{
|
|
43
49
|
error: string | null;
|
|
44
50
|
}>;
|
|
45
51
|
}
|
|
52
|
+
export interface AgentCommand {
|
|
53
|
+
type: 'change_color' | 'set_emotion' | 'agent_state' | 'end_call' | 'show_form' | 'hide_form';
|
|
54
|
+
payload?: {
|
|
55
|
+
color?: string;
|
|
56
|
+
emotion?: 'neutral' | 'joy' | 'thinking' | 'interrupted';
|
|
57
|
+
state?: 'idle' | 'listening' | 'thinking' | 'speaking';
|
|
58
|
+
request_id?: string;
|
|
59
|
+
fields?: FormFieldDef[];
|
|
60
|
+
};
|
|
61
|
+
}
|
|
62
|
+
export interface FormFieldDef {
|
|
63
|
+
name: string;
|
|
64
|
+
type: 'text' | 'number' | 'boolean' | 'selector' | 'email' | 'phone';
|
|
65
|
+
label: string;
|
|
66
|
+
placeholder?: string;
|
|
67
|
+
required?: boolean;
|
|
68
|
+
options?: string[];
|
|
69
|
+
}
|
|
46
70
|
export declare class LiveKitCallManager extends EventTarget {
|
|
47
71
|
private room;
|
|
48
72
|
private callStatus;
|
|
@@ -92,6 +116,10 @@ export declare class LiveKitCallManager extends EventTarget {
|
|
|
92
116
|
/** Tear down Web Audio chain and clear references. */
|
|
93
117
|
private cleanupFadeContext;
|
|
94
118
|
enableAudio(): Promise<void>;
|
|
119
|
+
/**
|
|
120
|
+
* Send a JSON message to the agent via data channel.
|
|
121
|
+
*/
|
|
122
|
+
sendDataToAgent(data: Record<string, unknown>): Promise<void>;
|
|
95
123
|
hangUp(): Promise<void>;
|
|
96
124
|
}
|
|
97
125
|
export {};
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { OrbColors, OrbConfig } from '../core/OrbRenderer';
|
|
2
|
-
import { CallState, CallStartEvent, CallEndEvent } from '../core/LiveKitManager';
|
|
2
|
+
import { CallState, CallStartEvent, CallEndEvent, AgentCommand } from '../core/LiveKitManager';
|
|
3
3
|
export type WidgetMode = 'inline' | 'float' | 'pill';
|
|
4
4
|
export type WidgetState = CallState;
|
|
5
5
|
export interface HancAiWidgetConfig {
|
|
@@ -19,6 +19,7 @@ export interface HancAiWidgetConfig {
|
|
|
19
19
|
onCallEnd?: (event: CallEndEvent) => void;
|
|
20
20
|
onStateChange?: (state: CallState, previousState: CallState) => void;
|
|
21
21
|
onError?: (error: Error) => void;
|
|
22
|
+
onAgentCommand?: (command: AgentCommand) => void;
|
|
22
23
|
}
|
|
23
24
|
export declare class HancAiWidget {
|
|
24
25
|
private container;
|
|
@@ -30,6 +31,7 @@ export declare class HancAiWidget {
|
|
|
30
31
|
private audioAnalyzer;
|
|
31
32
|
private liveKitManager;
|
|
32
33
|
private soundManager;
|
|
34
|
+
private formOverlayEl;
|
|
33
35
|
private config;
|
|
34
36
|
private state;
|
|
35
37
|
private animationId;
|
|
@@ -39,6 +41,8 @@ export declare class HancAiWidget {
|
|
|
39
41
|
constructor(container: HTMLElement | string, config?: HancAiWidgetConfig);
|
|
40
42
|
private initializeLiveKit;
|
|
41
43
|
private dispatchEvent;
|
|
44
|
+
private handleAgentCommand;
|
|
45
|
+
private createFormOverlay;
|
|
42
46
|
private createWidget;
|
|
43
47
|
private getFloatOffsets;
|
|
44
48
|
private createStandardWidget;
|
|
@@ -1,3 +1,5 @@
|
|
|
1
|
+
import { AgentCommand } from '../../core/livekit-call-manager';
|
|
2
|
+
export type { AgentCommand };
|
|
1
3
|
export type CallState = 'idle' | 'connecting' | 'active' | 'ending' | 'error';
|
|
2
4
|
export interface CallStartEvent {
|
|
3
5
|
agentId: string;
|
|
@@ -18,6 +20,7 @@ export interface LiveKitManagerCallbacks {
|
|
|
18
20
|
onCallStart?: (event: CallStartEvent) => void;
|
|
19
21
|
onCallEnd?: (event: CallEndEvent) => void;
|
|
20
22
|
onAudioTrack?: (stream: MediaStream) => void;
|
|
23
|
+
onAgentCommand?: (command: AgentCommand) => void;
|
|
21
24
|
onError?: (error: Error) => void;
|
|
22
25
|
}
|
|
23
26
|
export declare class LiveKitManager {
|
|
@@ -36,6 +39,7 @@ export declare class LiveKitManager {
|
|
|
36
39
|
isConnected(): boolean;
|
|
37
40
|
connect(): Promise<void>;
|
|
38
41
|
disconnect(reason?: CallEndEvent['reason']): Promise<void>;
|
|
42
|
+
sendData(data: Record<string, unknown>): Promise<void>;
|
|
39
43
|
destroy(): void;
|
|
40
44
|
private attachEventHandlers;
|
|
41
45
|
private detachEventHandlers;
|