@w0nna_dev/lina-widget 1.1.2 → 1.2.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Binary file
Binary file
@@ -1,6 +1,6 @@
1
1
  import { LitElement } from 'lit';
2
2
  import { HancAiWidgetConfig, WidgetMode } from '../orb/components';
3
- type ColorPreset = 'indigo' | 'cyan' | 'emerald' | 'rose' | 'amber';
3
+ type ColorPreset = 'indigo' | 'cyan' | 'emerald' | 'rose' | 'amber' | 'purple' | 'blue' | 'pink' | 'orange' | 'teal' | 'violet' | 'red' | 'gold' | 'lime' | 'sky';
4
4
  type ThemeMode = 'auto' | 'dark' | 'light';
5
5
  export declare class HancAiOrbElement extends LitElement {
6
6
  static styles: import('lit').CSSResult[];
@@ -23,10 +23,23 @@ export declare class HancAiOrbElement extends LitElement {
23
23
  colorPreset: ColorPreset;
24
24
  private orbContainer?;
25
25
  private currentState;
26
+ private customColor;
26
27
  private widget;
27
28
  private themeQuery;
28
29
  connectedCallback(): void;
29
30
  disconnectedCallback(): void;
31
+ /**
32
+ * Handle agent commands received via data channel
33
+ */
34
+ private handleAgentCommand;
35
+ /**
36
+ * Set a custom color for the orb (persists to localStorage)
37
+ */
38
+ setCustomColor(color: string): void;
39
+ /**
40
+ * Reset to default color preset (clears custom color)
41
+ */
42
+ resetColor(): void;
30
43
  firstUpdated(): void;
31
44
  protected updated(changedProperties: Map<string | number | symbol, unknown>): void;
32
45
  render(): import('lit-html').TemplateResult<1>;
@@ -4,7 +4,7 @@ interface MakeCallOptions {
4
4
  agentId: string;
5
5
  }
6
6
  export interface AgentCommand {
7
- type: 'change_color' | 'set_emotion' | 'agent_state';
7
+ type: 'change_color' | 'set_emotion' | 'agent_state' | 'end_call';
8
8
  payload?: {
9
9
  color?: string;
10
10
  emotion?: 'neutral' | 'joy' | 'thinking' | 'interrupted';
@@ -1,15 +1,23 @@
1
1
  /**
2
- * SoundManager - Programmatic melodic sound generation for call events
3
- * Uses Web Audio API for zero-dependency sound synthesis
2
+ * SoundManager - Sound effects for call events
3
+ * Uses MP3 files for connect/disconnect sounds with Web Audio API fallback
4
4
  */
5
5
  export interface SoundConfig {
6
6
  enabled: boolean;
7
7
  volume: number;
8
+ connectSoundUrl?: string;
9
+ disconnectSoundUrl?: string;
8
10
  }
9
11
  export declare class SoundManager {
10
12
  private audioContext;
11
13
  private config;
14
+ private connectAudio;
15
+ private disconnectAudio;
12
16
  constructor(config?: Partial<SoundConfig>);
17
+ /**
18
+ * Preload audio files for instant playback
19
+ */
20
+ private preloadAudio;
13
21
  /**
14
22
  * Initialize audio context (must be called from user interaction)
15
23
  */
@@ -20,17 +28,27 @@ export declare class SoundManager {
20
28
  */
21
29
  prewarm(): Promise<void>;
22
30
  /**
23
- * Create an oscillator with envelope
31
+ * Play MP3 audio element
32
+ */
33
+ private playAudioElement;
34
+ /**
35
+ * Create a synthesized tone (fallback)
24
36
  */
25
37
  private createTone;
26
38
  /**
27
- * Play pleasant notification sound for call start
28
- * Two-tone ascending melody like messenger notifications
39
+ * Synthesized fallback for call start sound
40
+ */
41
+ private playSynthesizedStartSound;
42
+ /**
43
+ * Synthesized fallback for call end sound
44
+ */
45
+ private playSynthesizedEndSound;
46
+ /**
47
+ * Play call start sound (MP3 with synthesized fallback)
29
48
  */
30
49
  playCallStartSound(): Promise<void>;
31
50
  /**
32
- * Play gentle descending sound for call end
33
- * Single soft tone
51
+ * Play call end sound (MP3 with synthesized fallback)
34
52
  */
35
53
  playCallEndSound(): Promise<void>;
36
54
  /**
@@ -8,6 +8,7 @@ export declare class LinaWidget extends LitElement {
8
8
  private audioSimPhase;
9
9
  private animationId;
10
10
  private callManager;
11
+ private soundManager;
11
12
  size: number;
12
13
  headerLogo: string;
13
14
  headerTitle: string;
@@ -13,11 +13,20 @@ export interface LiveKitConfig {
13
13
  agentId: string;
14
14
  voiceServiceUrl: string;
15
15
  }
16
+ export interface AgentCommand {
17
+ type: 'change_color' | 'set_emotion' | 'agent_state';
18
+ payload?: {
19
+ color?: string;
20
+ emotion?: 'neutral' | 'joy' | 'thinking' | 'interrupted';
21
+ state?: 'idle' | 'listening' | 'thinking' | 'speaking';
22
+ };
23
+ }
16
24
  export interface LiveKitManagerCallbacks {
17
25
  onStateChange?: (state: CallState, previousState: CallState) => void;
18
26
  onCallStart?: (event: CallStartEvent) => void;
19
27
  onCallEnd?: (event: CallEndEvent) => void;
20
28
  onAudioTrack?: (stream: MediaStream) => void;
29
+ onAgentCommand?: (command: AgentCommand) => void;
21
30
  onError?: (error: Error) => void;
22
31
  }
23
32
  export declare class LiveKitManager {
package/package.json CHANGED
@@ -1,7 +1,10 @@
1
1
  {
2
2
  "name": "@w0nna_dev/lina-widget",
3
- "version": "1.1.2",
3
+ "version": "1.2.1",
4
4
  "private": false,
5
+ "publishConfig": {
6
+ "access": "public"
7
+ },
5
8
  "type": "module",
6
9
  "main": "dist/lina-widget.umd.js",
7
10
  "module": "dist/lina-widget.es.js",
@@ -10,9 +13,6 @@
10
13
  "dist",
11
14
  "README.md"
12
15
  ],
13
- "publishConfig": {
14
- "access": "restricted"
15
- },
16
16
  "scripts": {
17
17
  "dev": "vite",
18
18
  "build": "tsc && vite build",