@cuekit-ai/react 1.3.4 → 1.5.0

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/index.d.mts CHANGED
@@ -62,47 +62,6 @@ type MicButtonProps = {
62
62
 
63
63
  declare const MicButton: React__default.FC<MicButtonProps>;
64
64
 
65
- interface ChatPopupProps {
66
- isOpen: boolean;
67
- isMinimized: boolean;
68
- onClose: () => void;
69
- onMinimize: () => void;
70
- onRestore: () => void;
71
- onSendText: (text: string) => Promise<any>;
72
- onEndCall?: () => Promise<void>;
73
- messages: Array<{
74
- text: string;
75
- sender: 'user' | 'assistant';
76
- }>;
77
- isConnected: boolean;
78
- micState: string;
79
- participants: string[];
80
- error?: string | null;
81
- currentTheme?: 'light' | 'dark';
82
- onThemeToggle?: (theme: 'light' | 'dark') => void;
83
- status?: string;
84
- anchor?: {
85
- position: 'bottom-right' | 'bottom-left' | 'bottom-center';
86
- bottom: number;
87
- size: number;
88
- };
89
- }
90
- declare const ChatPopup: React__default.FC<ChatPopupProps>;
91
-
92
- interface BorderGlowProps {
93
- isActive: boolean;
94
- }
95
- declare const BorderGlow: ({ isActive }: BorderGlowProps) => React__default.JSX.Element | null;
96
-
97
- interface VoiceIntensityVisualizerProps {
98
- isActive: boolean;
99
- barCount?: number;
100
- minHeight?: number;
101
- className?: string;
102
- buttonSize?: number;
103
- }
104
- declare const VoiceIntensityVisualizer: React__default.FC<VoiceIntensityVisualizerProps>;
105
-
106
65
  interface AuthResponse {
107
66
  session_id: string;
108
67
  api_key: string;
@@ -129,25 +88,15 @@ interface ServerConfig {
129
88
  token_ttl_seconds: number;
130
89
  server_version: string;
131
90
  }
91
+ interface AIIntentData {
92
+ actionType: 'navigate' | 'click' | 'input' | 'scroll';
93
+ routeName?: string;
94
+ elementId?: string;
95
+ }
132
96
  interface NavigationCommand {
133
- type: 'static_data_ready' | 'ai_intent' | 'user_speech_text' | 'ai_speech_text';
134
- data?: {
135
- app_id?: string;
136
- components?: any[];
137
- intents?: any[];
138
- pages_count?: number;
139
- elements_count?: number;
140
- };
141
- intent?: string;
142
- actionType?: string;
143
- text?: string;
144
- confidence?: number;
145
- target_element?: string;
146
- current_page?: string;
147
- user_input?: string;
148
- speaker?: 'user' | 'ai';
149
- duration?: number;
97
+ type: 'ai_intent';
150
98
  timestamp?: number;
99
+ data: AIIntentData;
151
100
  }
152
101
  declare function sendData(data: string, reliable?: boolean): Promise<void>;
153
102
  declare function sendScreenStatus(screenData: any): Promise<void>;
@@ -170,6 +119,10 @@ interface ChatMessage {
170
119
  timestamp: string;
171
120
  }
172
121
  type MicState = 'idle' | 'listening' | 'thinking' | 'replying';
122
+ interface MuteState {
123
+ isMuted: boolean;
124
+ canMute: boolean;
125
+ }
173
126
  declare const useCuekit: (options?: {
174
127
  onNavigationCommand?: (command: NavigationCommand) => void;
175
128
  onConnectionStateChange?: (state: ConnectionState) => void;
@@ -185,6 +138,10 @@ declare const useCuekit: (options?: {
185
138
  setStatus: React.Dispatch<React.SetStateAction<string>>;
186
139
  connect: (identity: string, apiKey?: string, appId?: string) => Promise<void>;
187
140
  disconnect: () => Promise<void>;
141
+ muteState: MuteState;
142
+ toggleMute: () => Promise<void>;
143
+ setMute: (muted: boolean) => Promise<void>;
144
+ sendChatMessage: (message: string) => Promise<void>;
188
145
  isConnected: boolean;
189
146
  isConnecting: boolean;
190
147
  connectionState: ConnectionState | null;
@@ -199,6 +156,49 @@ declare const useCuekit: (options?: {
199
156
  audioContainerRef: React.RefObject<HTMLDivElement>;
200
157
  };
201
158
 
159
+ interface ChatPopupProps {
160
+ isOpen: boolean;
161
+ isMinimized: boolean;
162
+ onClose: () => void;
163
+ onMinimize: () => void;
164
+ onRestore: () => void;
165
+ onSendText: (text: string) => Promise<any>;
166
+ onEndCall?: () => Promise<void>;
167
+ messages: Array<{
168
+ text: string;
169
+ sender: 'user' | 'assistant';
170
+ }>;
171
+ isConnected: boolean;
172
+ micState: string;
173
+ participants: string[];
174
+ error?: string | null;
175
+ currentTheme?: 'light' | 'dark';
176
+ onThemeToggle?: (theme: 'light' | 'dark') => void;
177
+ status?: string;
178
+ anchor?: {
179
+ position: 'bottom-right' | 'bottom-left' | 'bottom-center';
180
+ bottom: number;
181
+ size: number;
182
+ };
183
+ muteState?: MuteState;
184
+ onToggleMute?: () => Promise<void>;
185
+ }
186
+ declare const ChatPopup: React__default.FC<ChatPopupProps>;
187
+
188
+ interface BorderGlowProps {
189
+ isActive: boolean;
190
+ }
191
+ declare const BorderGlow: ({ isActive }: BorderGlowProps) => React__default.JSX.Element | null;
192
+
193
+ interface VoiceIntensityVisualizerProps {
194
+ isActive: boolean;
195
+ barCount?: number;
196
+ minHeight?: number;
197
+ className?: string;
198
+ buttonSize?: number;
199
+ }
200
+ declare const VoiceIntensityVisualizer: React__default.FC<VoiceIntensityVisualizerProps>;
201
+
202
202
  declare const useWebRTC: (options?: {
203
203
  onNavigationCommand?: (command: NavigationCommand) => void;
204
204
  onConnectionStateChange?: (state: ConnectionState) => void;
@@ -254,20 +254,13 @@ declare const initWebRTCWithDeployedBackend: (apiKey: string, customConfig?: Par
254
254
  */
255
255
  declare const initWebRTC: (apiKey: string) => WebRTCServerConfig;
256
256
 
257
- interface InteractiveElementDto {
258
- testID: string;
259
- type: string;
260
- textContent: string;
261
- tags: string[];
262
- }
257
+ type InteractiveElement = {
258
+ [btnId: string]: string[];
259
+ };
263
260
  interface DOMStructurePayload {
264
- components: InteractiveElementDto[];
261
+ components: InteractiveElement;
265
262
  }
266
263
 
267
- /**
268
- * Capture the full DOM structure as a flat list of interactive elements
269
- */
270
- declare function captureFullDOMStructure(): DOMStructurePayload;
271
264
  interface ElementAction {
272
265
  action_type: 'click' | 'navigate' | 'input' | 'focus' | 'toggle';
273
266
  target_element?: string;
@@ -275,7 +268,23 @@ interface ElementAction {
275
268
  instruction?: string;
276
269
  }
277
270
  declare function executeAction(action: ElementAction): boolean;
278
- declare function getFullDOMStructure(): DOMStructurePayload;
271
+ /**
272
+ * Captures ALL interactive elements on the page.
273
+ * Uses pre-assigned IDs (data-ansyr-static, data-ansyr-dynamic) when available,
274
+ * otherwise calculates stable DOM IDs for elements without pre-assigned IDs.
275
+ *
276
+ * This ensures comprehensive coverage of all interactive elements for AI interaction.
277
+ */
278
+ declare function captureAllInteractiveElements(): DOMStructurePayload;
279
+ /**
280
+ * Clears the element cache. Call this when the DOM structure changes significantly.
281
+ */
282
+ declare function clearElementCache(): void;
283
+ /**
284
+ * Validates dynamic elements in development mode.
285
+ * Checks for duplicate IDs and provides warnings.
286
+ */
287
+ declare function validateDynamicElements(): void;
279
288
 
280
289
  /**
281
290
  * Generates a stable, unique 8-character ID for an interactive element.
@@ -287,4 +296,15 @@ declare function getFullDOMStructure(): DOMStructurePayload;
287
296
  */
288
297
  declare function generateDynamicId(routePath: string, elementIdentifier: string): string;
289
298
 
290
- export { BorderGlow, ChatPopup, type ChatPopupProps, CuekitProvider, type DOMStructurePayload, type ElementAction, InitCuekit, type InteractiveElementDto, MicButton, type MicButtonProps, type MicState$1 as MicState, type NavigationCommand, type ServerConfig, type TokenRequest, type TokenResponse, VoiceIntensityVisualizer, type WebRTCServerConfig, captureFullDOMStructure, configureWebRTCServer, executeAction, generateDynamicId, getFullDOMStructure, getWebRTCServerConfig, initWebRTC, initWebRTCWithDeployedBackend, useCuekit, useQubeContext, useWebRTC };
299
+ /**
300
+ * Extracts route parameters from the current URL path.
301
+ * For routes like /form/:id, extracts { id: "123" } from /form/123
302
+ */
303
+ declare function getCurrentPathParams(): Record<string, string>;
304
+ /**
305
+ * Resolves a route path with parameters.
306
+ * Example: resolveRoutePath('/form/:id', { id: '123' }) -> '/form/123'
307
+ */
308
+ declare function resolveRoutePath(routePath: string, params: Record<string, string>): string;
309
+
310
+ export { BorderGlow, ChatPopup, type ChatPopupProps, CuekitProvider, type DOMStructurePayload, type ElementAction, InitCuekit, type InteractiveElement, MicButton, type MicButtonProps, type MicState$1 as MicState, type MuteState, type NavigationCommand, type ServerConfig, type TokenRequest, type TokenResponse, VoiceIntensityVisualizer, type WebRTCServerConfig, captureAllInteractiveElements, clearElementCache, configureWebRTCServer, executeAction, generateDynamicId, getCurrentPathParams, getWebRTCServerConfig, initWebRTC, initWebRTCWithDeployedBackend, resolveRoutePath, useCuekit, useQubeContext, useWebRTC, validateDynamicElements };
package/dist/index.d.ts CHANGED
@@ -62,47 +62,6 @@ type MicButtonProps = {
62
62
 
63
63
  declare const MicButton: React__default.FC<MicButtonProps>;
64
64
 
65
- interface ChatPopupProps {
66
- isOpen: boolean;
67
- isMinimized: boolean;
68
- onClose: () => void;
69
- onMinimize: () => void;
70
- onRestore: () => void;
71
- onSendText: (text: string) => Promise<any>;
72
- onEndCall?: () => Promise<void>;
73
- messages: Array<{
74
- text: string;
75
- sender: 'user' | 'assistant';
76
- }>;
77
- isConnected: boolean;
78
- micState: string;
79
- participants: string[];
80
- error?: string | null;
81
- currentTheme?: 'light' | 'dark';
82
- onThemeToggle?: (theme: 'light' | 'dark') => void;
83
- status?: string;
84
- anchor?: {
85
- position: 'bottom-right' | 'bottom-left' | 'bottom-center';
86
- bottom: number;
87
- size: number;
88
- };
89
- }
90
- declare const ChatPopup: React__default.FC<ChatPopupProps>;
91
-
92
- interface BorderGlowProps {
93
- isActive: boolean;
94
- }
95
- declare const BorderGlow: ({ isActive }: BorderGlowProps) => React__default.JSX.Element | null;
96
-
97
- interface VoiceIntensityVisualizerProps {
98
- isActive: boolean;
99
- barCount?: number;
100
- minHeight?: number;
101
- className?: string;
102
- buttonSize?: number;
103
- }
104
- declare const VoiceIntensityVisualizer: React__default.FC<VoiceIntensityVisualizerProps>;
105
-
106
65
  interface AuthResponse {
107
66
  session_id: string;
108
67
  api_key: string;
@@ -129,25 +88,15 @@ interface ServerConfig {
129
88
  token_ttl_seconds: number;
130
89
  server_version: string;
131
90
  }
91
+ interface AIIntentData {
92
+ actionType: 'navigate' | 'click' | 'input' | 'scroll';
93
+ routeName?: string;
94
+ elementId?: string;
95
+ }
132
96
  interface NavigationCommand {
133
- type: 'static_data_ready' | 'ai_intent' | 'user_speech_text' | 'ai_speech_text';
134
- data?: {
135
- app_id?: string;
136
- components?: any[];
137
- intents?: any[];
138
- pages_count?: number;
139
- elements_count?: number;
140
- };
141
- intent?: string;
142
- actionType?: string;
143
- text?: string;
144
- confidence?: number;
145
- target_element?: string;
146
- current_page?: string;
147
- user_input?: string;
148
- speaker?: 'user' | 'ai';
149
- duration?: number;
97
+ type: 'ai_intent';
150
98
  timestamp?: number;
99
+ data: AIIntentData;
151
100
  }
152
101
  declare function sendData(data: string, reliable?: boolean): Promise<void>;
153
102
  declare function sendScreenStatus(screenData: any): Promise<void>;
@@ -170,6 +119,10 @@ interface ChatMessage {
170
119
  timestamp: string;
171
120
  }
172
121
  type MicState = 'idle' | 'listening' | 'thinking' | 'replying';
122
+ interface MuteState {
123
+ isMuted: boolean;
124
+ canMute: boolean;
125
+ }
173
126
  declare const useCuekit: (options?: {
174
127
  onNavigationCommand?: (command: NavigationCommand) => void;
175
128
  onConnectionStateChange?: (state: ConnectionState) => void;
@@ -185,6 +138,10 @@ declare const useCuekit: (options?: {
185
138
  setStatus: React.Dispatch<React.SetStateAction<string>>;
186
139
  connect: (identity: string, apiKey?: string, appId?: string) => Promise<void>;
187
140
  disconnect: () => Promise<void>;
141
+ muteState: MuteState;
142
+ toggleMute: () => Promise<void>;
143
+ setMute: (muted: boolean) => Promise<void>;
144
+ sendChatMessage: (message: string) => Promise<void>;
188
145
  isConnected: boolean;
189
146
  isConnecting: boolean;
190
147
  connectionState: ConnectionState | null;
@@ -199,6 +156,49 @@ declare const useCuekit: (options?: {
199
156
  audioContainerRef: React.RefObject<HTMLDivElement>;
200
157
  };
201
158
 
159
+ interface ChatPopupProps {
160
+ isOpen: boolean;
161
+ isMinimized: boolean;
162
+ onClose: () => void;
163
+ onMinimize: () => void;
164
+ onRestore: () => void;
165
+ onSendText: (text: string) => Promise<any>;
166
+ onEndCall?: () => Promise<void>;
167
+ messages: Array<{
168
+ text: string;
169
+ sender: 'user' | 'assistant';
170
+ }>;
171
+ isConnected: boolean;
172
+ micState: string;
173
+ participants: string[];
174
+ error?: string | null;
175
+ currentTheme?: 'light' | 'dark';
176
+ onThemeToggle?: (theme: 'light' | 'dark') => void;
177
+ status?: string;
178
+ anchor?: {
179
+ position: 'bottom-right' | 'bottom-left' | 'bottom-center';
180
+ bottom: number;
181
+ size: number;
182
+ };
183
+ muteState?: MuteState;
184
+ onToggleMute?: () => Promise<void>;
185
+ }
186
+ declare const ChatPopup: React__default.FC<ChatPopupProps>;
187
+
188
+ interface BorderGlowProps {
189
+ isActive: boolean;
190
+ }
191
+ declare const BorderGlow: ({ isActive }: BorderGlowProps) => React__default.JSX.Element | null;
192
+
193
+ interface VoiceIntensityVisualizerProps {
194
+ isActive: boolean;
195
+ barCount?: number;
196
+ minHeight?: number;
197
+ className?: string;
198
+ buttonSize?: number;
199
+ }
200
+ declare const VoiceIntensityVisualizer: React__default.FC<VoiceIntensityVisualizerProps>;
201
+
202
202
  declare const useWebRTC: (options?: {
203
203
  onNavigationCommand?: (command: NavigationCommand) => void;
204
204
  onConnectionStateChange?: (state: ConnectionState) => void;
@@ -254,20 +254,13 @@ declare const initWebRTCWithDeployedBackend: (apiKey: string, customConfig?: Par
254
254
  */
255
255
  declare const initWebRTC: (apiKey: string) => WebRTCServerConfig;
256
256
 
257
- interface InteractiveElementDto {
258
- testID: string;
259
- type: string;
260
- textContent: string;
261
- tags: string[];
262
- }
257
+ type InteractiveElement = {
258
+ [btnId: string]: string[];
259
+ };
263
260
  interface DOMStructurePayload {
264
- components: InteractiveElementDto[];
261
+ components: InteractiveElement;
265
262
  }
266
263
 
267
- /**
268
- * Capture the full DOM structure as a flat list of interactive elements
269
- */
270
- declare function captureFullDOMStructure(): DOMStructurePayload;
271
264
  interface ElementAction {
272
265
  action_type: 'click' | 'navigate' | 'input' | 'focus' | 'toggle';
273
266
  target_element?: string;
@@ -275,7 +268,23 @@ interface ElementAction {
275
268
  instruction?: string;
276
269
  }
277
270
  declare function executeAction(action: ElementAction): boolean;
278
- declare function getFullDOMStructure(): DOMStructurePayload;
271
+ /**
272
+ * Captures ALL interactive elements on the page.
273
+ * Uses pre-assigned IDs (data-ansyr-static, data-ansyr-dynamic) when available,
274
+ * otherwise calculates stable DOM IDs for elements without pre-assigned IDs.
275
+ *
276
+ * This ensures comprehensive coverage of all interactive elements for AI interaction.
277
+ */
278
+ declare function captureAllInteractiveElements(): DOMStructurePayload;
279
+ /**
280
+ * Clears the element cache. Call this when the DOM structure changes significantly.
281
+ */
282
+ declare function clearElementCache(): void;
283
+ /**
284
+ * Validates dynamic elements in development mode.
285
+ * Checks for duplicate IDs and provides warnings.
286
+ */
287
+ declare function validateDynamicElements(): void;
279
288
 
280
289
  /**
281
290
  * Generates a stable, unique 8-character ID for an interactive element.
@@ -287,4 +296,15 @@ declare function getFullDOMStructure(): DOMStructurePayload;
287
296
  */
288
297
  declare function generateDynamicId(routePath: string, elementIdentifier: string): string;
289
298
 
290
- export { BorderGlow, ChatPopup, type ChatPopupProps, CuekitProvider, type DOMStructurePayload, type ElementAction, InitCuekit, type InteractiveElementDto, MicButton, type MicButtonProps, type MicState$1 as MicState, type NavigationCommand, type ServerConfig, type TokenRequest, type TokenResponse, VoiceIntensityVisualizer, type WebRTCServerConfig, captureFullDOMStructure, configureWebRTCServer, executeAction, generateDynamicId, getFullDOMStructure, getWebRTCServerConfig, initWebRTC, initWebRTCWithDeployedBackend, useCuekit, useQubeContext, useWebRTC };
299
+ /**
300
+ * Extracts route parameters from the current URL path.
301
+ * For routes like /form/:id, extracts { id: "123" } from /form/123
302
+ */
303
+ declare function getCurrentPathParams(): Record<string, string>;
304
+ /**
305
+ * Resolves a route path with parameters.
306
+ * Example: resolveRoutePath('/form/:id', { id: '123' }) -> '/form/123'
307
+ */
308
+ declare function resolveRoutePath(routePath: string, params: Record<string, string>): string;
309
+
310
+ export { BorderGlow, ChatPopup, type ChatPopupProps, CuekitProvider, type DOMStructurePayload, type ElementAction, InitCuekit, type InteractiveElement, MicButton, type MicButtonProps, type MicState$1 as MicState, type MuteState, type NavigationCommand, type ServerConfig, type TokenRequest, type TokenResponse, VoiceIntensityVisualizer, type WebRTCServerConfig, captureAllInteractiveElements, clearElementCache, configureWebRTCServer, executeAction, generateDynamicId, getCurrentPathParams, getWebRTCServerConfig, initWebRTC, initWebRTCWithDeployedBackend, resolveRoutePath, useCuekit, useQubeContext, useWebRTC, validateDynamicElements };