@cuekit-ai/react 1.3.4 → 1.4.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.ts CHANGED
@@ -129,25 +129,15 @@ interface ServerConfig {
129
129
  token_ttl_seconds: number;
130
130
  server_version: string;
131
131
  }
132
+ interface AIIntentData {
133
+ actionType: 'navigate' | 'click' | 'input' | 'scroll';
134
+ routeName?: string;
135
+ elementId?: string;
136
+ }
132
137
  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;
138
+ type: 'ai_intent';
150
139
  timestamp?: number;
140
+ data: AIIntentData;
151
141
  }
152
142
  declare function sendData(data: string, reliable?: boolean): Promise<void>;
153
143
  declare function sendScreenStatus(screenData: any): Promise<void>;
@@ -254,20 +244,13 @@ declare const initWebRTCWithDeployedBackend: (apiKey: string, customConfig?: Par
254
244
  */
255
245
  declare const initWebRTC: (apiKey: string) => WebRTCServerConfig;
256
246
 
257
- interface InteractiveElementDto {
258
- testID: string;
259
- type: string;
260
- textContent: string;
261
- tags: string[];
262
- }
247
+ type InteractiveElement = {
248
+ [btnId: string]: string[];
249
+ };
263
250
  interface DOMStructurePayload {
264
- components: InteractiveElementDto[];
251
+ components: InteractiveElement;
265
252
  }
266
253
 
267
- /**
268
- * Capture the full DOM structure as a flat list of interactive elements
269
- */
270
- declare function captureFullDOMStructure(): DOMStructurePayload;
271
254
  interface ElementAction {
272
255
  action_type: 'click' | 'navigate' | 'input' | 'focus' | 'toggle';
273
256
  target_element?: string;
@@ -275,7 +258,23 @@ interface ElementAction {
275
258
  instruction?: string;
276
259
  }
277
260
  declare function executeAction(action: ElementAction): boolean;
278
- declare function getFullDOMStructure(): DOMStructurePayload;
261
+ /**
262
+ * Captures ALL interactive elements on the page.
263
+ * Uses pre-assigned IDs (data-ansyr-static, data-ansyr-dynamic) when available,
264
+ * otherwise calculates stable DOM IDs for elements without pre-assigned IDs.
265
+ *
266
+ * This ensures comprehensive coverage of all interactive elements for AI interaction.
267
+ */
268
+ declare function captureAllInteractiveElements(): DOMStructurePayload;
269
+ /**
270
+ * Clears the element cache. Call this when the DOM structure changes significantly.
271
+ */
272
+ declare function clearElementCache(): void;
273
+ /**
274
+ * Validates dynamic elements in development mode.
275
+ * Checks for duplicate IDs and provides warnings.
276
+ */
277
+ declare function validateDynamicElements(): void;
279
278
 
280
279
  /**
281
280
  * Generates a stable, unique 8-character ID for an interactive element.
@@ -287,4 +286,15 @@ declare function getFullDOMStructure(): DOMStructurePayload;
287
286
  */
288
287
  declare function generateDynamicId(routePath: string, elementIdentifier: string): string;
289
288
 
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 };
289
+ /**
290
+ * Extracts route parameters from the current URL path.
291
+ * For routes like /form/:id, extracts { id: "123" } from /form/123
292
+ */
293
+ declare function getCurrentPathParams(): Record<string, string>;
294
+ /**
295
+ * Resolves a route path with parameters.
296
+ * Example: resolveRoutePath('/form/:id', { id: '123' }) -> '/form/123'
297
+ */
298
+ declare function resolveRoutePath(routePath: string, params: Record<string, string>): string;
299
+
300
+ export { BorderGlow, ChatPopup, type ChatPopupProps, CuekitProvider, type DOMStructurePayload, type ElementAction, InitCuekit, type InteractiveElement, MicButton, type MicButtonProps, type MicState$1 as MicState, 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 };