@cuekit-ai/react 1.6.1 → 1.6.3
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/{chunk-24V3WQXJ.mjs → chunk-A5SW5UJY.mjs} +73 -4
- package/dist/cuekit.css +0 -1
- package/dist/index.d.mts +4 -0
- package/dist/index.d.ts +4 -0
- package/dist/index.js +86 -5
- package/dist/index.mjs +15 -3
- package/dist/{webrtc-service-N76TYFI4.mjs → webrtc-service-L7VCVRGD.mjs} +1 -1
- package/package.json +1 -1
|
@@ -22994,7 +22994,7 @@ var setWebRTCConnectionState = (state) => {
|
|
|
22994
22994
|
};
|
|
22995
22995
|
|
|
22996
22996
|
// src/constants/index.ts
|
|
22997
|
-
var WEBRTC_BACKEND_SERVER_URL = "https://
|
|
22997
|
+
var WEBRTC_BACKEND_SERVER_URL = "https://ansyr-interview-be-dev-nlb-adb7e355084b6bb8.elb.ap-south-1.amazonaws.com";
|
|
22998
22998
|
|
|
22999
22999
|
// src/core/intent-store.ts
|
|
23000
23000
|
var store = {
|
|
@@ -23327,13 +23327,14 @@ function getImmediateText(element) {
|
|
|
23327
23327
|
}
|
|
23328
23328
|
function executeAction(action) {
|
|
23329
23329
|
console.log("\u{1F3AF} Executing element action:", action);
|
|
23330
|
-
const { action_type, target_element, target } = action;
|
|
23330
|
+
const { action_type, target_element, target, text, input_intent } = action;
|
|
23331
23331
|
switch (action_type) {
|
|
23332
23332
|
case "click":
|
|
23333
23333
|
return clickElement(target_element);
|
|
23334
23334
|
case "navigate":
|
|
23335
23335
|
return navigateToElement(target_element || target);
|
|
23336
23336
|
case "input":
|
|
23337
|
+
return inputElement(target_element, text, input_intent);
|
|
23337
23338
|
case "focus":
|
|
23338
23339
|
return focusElement(target_element);
|
|
23339
23340
|
case "toggle":
|
|
@@ -23343,6 +23344,35 @@ function executeAction(action) {
|
|
|
23343
23344
|
return false;
|
|
23344
23345
|
}
|
|
23345
23346
|
}
|
|
23347
|
+
function getElementType(element) {
|
|
23348
|
+
const tagName = element.tagName.toLowerCase();
|
|
23349
|
+
if (tagName === "input") {
|
|
23350
|
+
const inputType = element.type;
|
|
23351
|
+
return "input";
|
|
23352
|
+
}
|
|
23353
|
+
if (tagName === "textarea") {
|
|
23354
|
+
return "input";
|
|
23355
|
+
}
|
|
23356
|
+
if (tagName === "select") {
|
|
23357
|
+
return "input";
|
|
23358
|
+
}
|
|
23359
|
+
if (tagName === "button") {
|
|
23360
|
+
return "button";
|
|
23361
|
+
}
|
|
23362
|
+
if (element.getAttribute("role") === "button") {
|
|
23363
|
+
return "button";
|
|
23364
|
+
}
|
|
23365
|
+
if (tagName === "a") {
|
|
23366
|
+
return "link";
|
|
23367
|
+
}
|
|
23368
|
+
if (element.getAttribute("role") === "link") {
|
|
23369
|
+
return "link";
|
|
23370
|
+
}
|
|
23371
|
+
if (tagName === "form") {
|
|
23372
|
+
return "form";
|
|
23373
|
+
}
|
|
23374
|
+
return "button";
|
|
23375
|
+
}
|
|
23346
23376
|
function captureAllInteractiveElements() {
|
|
23347
23377
|
console.log("\u{1F333} Capturing ALL interactive elements for Cuekit...");
|
|
23348
23378
|
const interactiveElements = {};
|
|
@@ -23396,8 +23426,9 @@ function captureAllInteractiveElements() {
|
|
|
23396
23426
|
if (descriptionsMap.has(elementId)) {
|
|
23397
23427
|
tags.push(...descriptionsMap.get(elementId) || []);
|
|
23398
23428
|
}
|
|
23429
|
+
const elementType = getElementType(element);
|
|
23399
23430
|
const textContent = getImmediateText(element) || element.textContent?.trim() || "";
|
|
23400
|
-
interactiveElements[elementId] = [textContent, ...tags];
|
|
23431
|
+
interactiveElements[elementId] = [elementType, textContent, ...tags];
|
|
23401
23432
|
console.log("\u{1F333} Captured element:", {
|
|
23402
23433
|
id: elementId,
|
|
23403
23434
|
tagName: element.tagName,
|
|
@@ -23488,6 +23519,44 @@ function focusElement(elementId) {
|
|
|
23488
23519
|
return false;
|
|
23489
23520
|
}
|
|
23490
23521
|
}
|
|
23522
|
+
function inputElement(elementId, text, inputIntent) {
|
|
23523
|
+
console.log("\u2328\uFE0F inputElement called with:", { elementId, text, inputIntent });
|
|
23524
|
+
if (!elementId || !text) {
|
|
23525
|
+
console.log("\u2328\uFE0F inputElement: missing elementId or text");
|
|
23526
|
+
return false;
|
|
23527
|
+
}
|
|
23528
|
+
const domElement = findDOMElementById(elementId);
|
|
23529
|
+
if (!domElement) {
|
|
23530
|
+
console.log("\u2328\uFE0F inputElement: element not found");
|
|
23531
|
+
return false;
|
|
23532
|
+
}
|
|
23533
|
+
if (domElement instanceof HTMLInputElement || domElement instanceof HTMLTextAreaElement) {
|
|
23534
|
+
console.log("\u2328\uFE0F inputElement: found input element:", {
|
|
23535
|
+
tagName: domElement.tagName,
|
|
23536
|
+
type: domElement.type,
|
|
23537
|
+
currentValue: domElement.value
|
|
23538
|
+
});
|
|
23539
|
+
domElement.focus();
|
|
23540
|
+
if (inputIntent === "add") {
|
|
23541
|
+
domElement.value += text;
|
|
23542
|
+
} else {
|
|
23543
|
+
domElement.value = text;
|
|
23544
|
+
}
|
|
23545
|
+
domElement.dispatchEvent(new Event("input", { bubbles: true }));
|
|
23546
|
+
domElement.dispatchEvent(new Event("change", { bubbles: true }));
|
|
23547
|
+
console.log("\u2328\uFE0F inputElement: text set successfully:", {
|
|
23548
|
+
newValue: domElement.value,
|
|
23549
|
+
inputIntent
|
|
23550
|
+
});
|
|
23551
|
+
return true;
|
|
23552
|
+
} else {
|
|
23553
|
+
console.log("\u2328\uFE0F inputElement: element is not an input field:", {
|
|
23554
|
+
tagName: domElement.tagName,
|
|
23555
|
+
type: domElement.type
|
|
23556
|
+
});
|
|
23557
|
+
return false;
|
|
23558
|
+
}
|
|
23559
|
+
}
|
|
23491
23560
|
function toggleElement(elementId) {
|
|
23492
23561
|
if (!elementId) {
|
|
23493
23562
|
return false;
|
|
@@ -23591,7 +23660,7 @@ function findDOMElementById(elementId) {
|
|
|
23591
23660
|
// src/utils/webrtc-service.ts
|
|
23592
23661
|
var room = null;
|
|
23593
23662
|
var reconnectTimeout = null;
|
|
23594
|
-
var serverUrl = WEBRTC_BACKEND_SERVER_URL || "https://
|
|
23663
|
+
var serverUrl = WEBRTC_BACKEND_SERVER_URL || "https://ansyr-interview-be-dev-nlb-adb7e355084b6bb8.elb.ap-south-1.amazonaws.com";
|
|
23595
23664
|
var callbacks = {};
|
|
23596
23665
|
var audioContainerRef = null;
|
|
23597
23666
|
var livekitUrl = null;
|
package/dist/cuekit.css
CHANGED
package/dist/index.d.mts
CHANGED
|
@@ -119,6 +119,8 @@ interface AIIntentData {
|
|
|
119
119
|
actionType: 'navigate' | 'click' | 'input' | 'scroll';
|
|
120
120
|
routeName?: string;
|
|
121
121
|
elementId?: string;
|
|
122
|
+
text?: string;
|
|
123
|
+
inputIntent?: 'add' | 'replace';
|
|
122
124
|
}
|
|
123
125
|
interface NavigationCommand {
|
|
124
126
|
type: 'ai_intent';
|
|
@@ -373,6 +375,8 @@ interface ElementAction {
|
|
|
373
375
|
target_element?: string;
|
|
374
376
|
target?: string;
|
|
375
377
|
instruction?: string;
|
|
378
|
+
text?: string;
|
|
379
|
+
input_intent?: 'add' | 'replace';
|
|
376
380
|
}
|
|
377
381
|
declare function executeAction(action: ElementAction): boolean;
|
|
378
382
|
/**
|
package/dist/index.d.ts
CHANGED
|
@@ -119,6 +119,8 @@ interface AIIntentData {
|
|
|
119
119
|
actionType: 'navigate' | 'click' | 'input' | 'scroll';
|
|
120
120
|
routeName?: string;
|
|
121
121
|
elementId?: string;
|
|
122
|
+
text?: string;
|
|
123
|
+
inputIntent?: 'add' | 'replace';
|
|
122
124
|
}
|
|
123
125
|
interface NavigationCommand {
|
|
124
126
|
type: 'ai_intent';
|
|
@@ -373,6 +375,8 @@ interface ElementAction {
|
|
|
373
375
|
target_element?: string;
|
|
374
376
|
target?: string;
|
|
375
377
|
instruction?: string;
|
|
378
|
+
text?: string;
|
|
379
|
+
input_intent?: 'add' | 'replace';
|
|
376
380
|
}
|
|
377
381
|
declare function executeAction(action: ElementAction): boolean;
|
|
378
382
|
/**
|
package/dist/index.js
CHANGED
|
@@ -331,7 +331,7 @@ var WEBRTC_BACKEND_SERVER_URL;
|
|
|
331
331
|
var init_constants = __esm({
|
|
332
332
|
"src/constants/index.ts"() {
|
|
333
333
|
"use strict";
|
|
334
|
-
WEBRTC_BACKEND_SERVER_URL = "https://
|
|
334
|
+
WEBRTC_BACKEND_SERVER_URL = "https://ansyr-interview-be-dev-nlb-adb7e355084b6bb8.elb.ap-south-1.amazonaws.com";
|
|
335
335
|
}
|
|
336
336
|
});
|
|
337
337
|
|
|
@@ -23320,13 +23320,14 @@ function getImmediateText(element3) {
|
|
|
23320
23320
|
}
|
|
23321
23321
|
function executeAction(action) {
|
|
23322
23322
|
console.log("\u{1F3AF} Executing element action:", action);
|
|
23323
|
-
const { action_type, target_element, target } = action;
|
|
23323
|
+
const { action_type, target_element, target, text: text7, input_intent } = action;
|
|
23324
23324
|
switch (action_type) {
|
|
23325
23325
|
case "click":
|
|
23326
23326
|
return clickElement(target_element);
|
|
23327
23327
|
case "navigate":
|
|
23328
23328
|
return navigateToElement(target_element || target);
|
|
23329
23329
|
case "input":
|
|
23330
|
+
return inputElement(target_element, text7, input_intent);
|
|
23330
23331
|
case "focus":
|
|
23331
23332
|
return focusElement(target_element);
|
|
23332
23333
|
case "toggle":
|
|
@@ -23336,6 +23337,35 @@ function executeAction(action) {
|
|
|
23336
23337
|
return false;
|
|
23337
23338
|
}
|
|
23338
23339
|
}
|
|
23340
|
+
function getElementType(element3) {
|
|
23341
|
+
const tagName = element3.tagName.toLowerCase();
|
|
23342
|
+
if (tagName === "input") {
|
|
23343
|
+
const inputType = element3.type;
|
|
23344
|
+
return "input";
|
|
23345
|
+
}
|
|
23346
|
+
if (tagName === "textarea") {
|
|
23347
|
+
return "input";
|
|
23348
|
+
}
|
|
23349
|
+
if (tagName === "select") {
|
|
23350
|
+
return "input";
|
|
23351
|
+
}
|
|
23352
|
+
if (tagName === "button") {
|
|
23353
|
+
return "button";
|
|
23354
|
+
}
|
|
23355
|
+
if (element3.getAttribute("role") === "button") {
|
|
23356
|
+
return "button";
|
|
23357
|
+
}
|
|
23358
|
+
if (tagName === "a") {
|
|
23359
|
+
return "link";
|
|
23360
|
+
}
|
|
23361
|
+
if (element3.getAttribute("role") === "link") {
|
|
23362
|
+
return "link";
|
|
23363
|
+
}
|
|
23364
|
+
if (tagName === "form") {
|
|
23365
|
+
return "form";
|
|
23366
|
+
}
|
|
23367
|
+
return "button";
|
|
23368
|
+
}
|
|
23339
23369
|
function captureAllInteractiveElements() {
|
|
23340
23370
|
console.log("\u{1F333} Capturing ALL interactive elements for Cuekit...");
|
|
23341
23371
|
const interactiveElements = {};
|
|
@@ -23389,8 +23419,9 @@ function captureAllInteractiveElements() {
|
|
|
23389
23419
|
if (descriptionsMap.has(elementId)) {
|
|
23390
23420
|
tags.push(...descriptionsMap.get(elementId) || []);
|
|
23391
23421
|
}
|
|
23422
|
+
const elementType = getElementType(element3);
|
|
23392
23423
|
const textContent = getImmediateText(element3) || element3.textContent?.trim() || "";
|
|
23393
|
-
interactiveElements[elementId] = [textContent, ...tags];
|
|
23424
|
+
interactiveElements[elementId] = [elementType, textContent, ...tags];
|
|
23394
23425
|
console.log("\u{1F333} Captured element:", {
|
|
23395
23426
|
id: elementId,
|
|
23396
23427
|
tagName: element3.tagName,
|
|
@@ -23481,6 +23512,44 @@ function focusElement(elementId) {
|
|
|
23481
23512
|
return false;
|
|
23482
23513
|
}
|
|
23483
23514
|
}
|
|
23515
|
+
function inputElement(elementId, text7, inputIntent) {
|
|
23516
|
+
console.log("\u2328\uFE0F inputElement called with:", { elementId, text: text7, inputIntent });
|
|
23517
|
+
if (!elementId || !text7) {
|
|
23518
|
+
console.log("\u2328\uFE0F inputElement: missing elementId or text");
|
|
23519
|
+
return false;
|
|
23520
|
+
}
|
|
23521
|
+
const domElement = findDOMElementById(elementId);
|
|
23522
|
+
if (!domElement) {
|
|
23523
|
+
console.log("\u2328\uFE0F inputElement: element not found");
|
|
23524
|
+
return false;
|
|
23525
|
+
}
|
|
23526
|
+
if (domElement instanceof HTMLInputElement || domElement instanceof HTMLTextAreaElement) {
|
|
23527
|
+
console.log("\u2328\uFE0F inputElement: found input element:", {
|
|
23528
|
+
tagName: domElement.tagName,
|
|
23529
|
+
type: domElement.type,
|
|
23530
|
+
currentValue: domElement.value
|
|
23531
|
+
});
|
|
23532
|
+
domElement.focus();
|
|
23533
|
+
if (inputIntent === "add") {
|
|
23534
|
+
domElement.value += text7;
|
|
23535
|
+
} else {
|
|
23536
|
+
domElement.value = text7;
|
|
23537
|
+
}
|
|
23538
|
+
domElement.dispatchEvent(new Event("input", { bubbles: true }));
|
|
23539
|
+
domElement.dispatchEvent(new Event("change", { bubbles: true }));
|
|
23540
|
+
console.log("\u2328\uFE0F inputElement: text set successfully:", {
|
|
23541
|
+
newValue: domElement.value,
|
|
23542
|
+
inputIntent
|
|
23543
|
+
});
|
|
23544
|
+
return true;
|
|
23545
|
+
} else {
|
|
23546
|
+
console.log("\u2328\uFE0F inputElement: element is not an input field:", {
|
|
23547
|
+
tagName: domElement.tagName,
|
|
23548
|
+
type: domElement.type
|
|
23549
|
+
});
|
|
23550
|
+
return false;
|
|
23551
|
+
}
|
|
23552
|
+
}
|
|
23484
23553
|
function toggleElement(elementId) {
|
|
23485
23554
|
if (!elementId) {
|
|
23486
23555
|
return false;
|
|
@@ -23877,7 +23946,7 @@ var init_webrtc_service = __esm({
|
|
|
23877
23946
|
init_navigation();
|
|
23878
23947
|
room = null;
|
|
23879
23948
|
reconnectTimeout = null;
|
|
23880
|
-
serverUrl = WEBRTC_BACKEND_SERVER_URL || "https://
|
|
23949
|
+
serverUrl = WEBRTC_BACKEND_SERVER_URL || "https://ansyr-interview-be-dev-nlb-adb7e355084b6bb8.elb.ap-south-1.amazonaws.com";
|
|
23881
23950
|
callbacks = {};
|
|
23882
23951
|
audioContainerRef = null;
|
|
23883
23952
|
livekitUrl = null;
|
|
@@ -25054,7 +25123,7 @@ function InitCuekit(config) {
|
|
|
25054
25123
|
setAppId(config.appId);
|
|
25055
25124
|
}
|
|
25056
25125
|
const webRTCConfig = {
|
|
25057
|
-
serverUrl: config.webRTC?.serverUrl || "https://
|
|
25126
|
+
serverUrl: config.webRTC?.serverUrl || "https://ansyr-interview-be-dev-nlb-adb7e355084b6bb8.elb.ap-south-1.amazonaws.com",
|
|
25058
25127
|
roomName: config.webRTC?.roomName || "default-room",
|
|
25059
25128
|
participantName: config.webRTC?.participantName || "user",
|
|
25060
25129
|
tokenTtlSeconds: config.webRTC?.tokenTtlSeconds || 7200
|
|
@@ -25479,6 +25548,18 @@ var useCuekit = (options) => {
|
|
|
25479
25548
|
action_type: "navigate",
|
|
25480
25549
|
target_element: intent.routeName
|
|
25481
25550
|
});
|
|
25551
|
+
} else if (intent.actionType === "input" && intent.elementId && intent.text) {
|
|
25552
|
+
console.log("\u{1F3AF} Executing input action:", {
|
|
25553
|
+
elementId: intent.elementId,
|
|
25554
|
+
text: intent.text,
|
|
25555
|
+
inputIntent: intent.inputIntent
|
|
25556
|
+
});
|
|
25557
|
+
executeAction({
|
|
25558
|
+
action_type: "input",
|
|
25559
|
+
target_element: intent.elementId,
|
|
25560
|
+
text: intent.text,
|
|
25561
|
+
input_intent: intent.inputIntent || "replace"
|
|
25562
|
+
});
|
|
25482
25563
|
} else {
|
|
25483
25564
|
console.log("\u{1F3AF} AI Intent not handled:", intent);
|
|
25484
25565
|
}
|
package/dist/index.mjs
CHANGED
|
@@ -37,7 +37,7 @@ import {
|
|
|
37
37
|
setWebRTCCallbacks,
|
|
38
38
|
setWebRTCConfig,
|
|
39
39
|
validateDynamicElements
|
|
40
|
-
} from "./chunk-
|
|
40
|
+
} from "./chunk-A5SW5UJY.mjs";
|
|
41
41
|
|
|
42
42
|
// node_modules/inline-style-parser/index.js
|
|
43
43
|
var require_inline_style_parser = __commonJS({
|
|
@@ -1175,7 +1175,7 @@ function InitCuekit(config) {
|
|
|
1175
1175
|
setAppId(config.appId);
|
|
1176
1176
|
}
|
|
1177
1177
|
const webRTCConfig = {
|
|
1178
|
-
serverUrl: config.webRTC?.serverUrl || "https://
|
|
1178
|
+
serverUrl: config.webRTC?.serverUrl || "https://ansyr-interview-be-dev-nlb-adb7e355084b6bb8.elb.ap-south-1.amazonaws.com",
|
|
1179
1179
|
roomName: config.webRTC?.roomName || "default-room",
|
|
1180
1180
|
participantName: config.webRTC?.participantName || "user",
|
|
1181
1181
|
tokenTtlSeconds: config.webRTC?.tokenTtlSeconds || 7200
|
|
@@ -1293,7 +1293,7 @@ var AnsyrProvider = ({
|
|
|
1293
1293
|
};
|
|
1294
1294
|
}, [navigationHandler]);
|
|
1295
1295
|
useEffect(() => {
|
|
1296
|
-
import("./webrtc-service-
|
|
1296
|
+
import("./webrtc-service-L7VCVRGD.mjs").then(({ setWebRTCCallbacks: setWebRTCCallbacks2 }) => {
|
|
1297
1297
|
setWebRTCCallbacks2({
|
|
1298
1298
|
onNavigationCommand: (command) => {
|
|
1299
1299
|
if (command.data.actionType === "navigate" && command.data.routeName) {
|
|
@@ -1588,6 +1588,18 @@ var useCuekit = (options) => {
|
|
|
1588
1588
|
action_type: "navigate",
|
|
1589
1589
|
target_element: intent.routeName
|
|
1590
1590
|
});
|
|
1591
|
+
} else if (intent.actionType === "input" && intent.elementId && intent.text) {
|
|
1592
|
+
console.log("\u{1F3AF} Executing input action:", {
|
|
1593
|
+
elementId: intent.elementId,
|
|
1594
|
+
text: intent.text,
|
|
1595
|
+
inputIntent: intent.inputIntent
|
|
1596
|
+
});
|
|
1597
|
+
executeAction({
|
|
1598
|
+
action_type: "input",
|
|
1599
|
+
target_element: intent.elementId,
|
|
1600
|
+
text: intent.text,
|
|
1601
|
+
input_intent: intent.inputIntent || "replace"
|
|
1602
|
+
});
|
|
1591
1603
|
} else {
|
|
1592
1604
|
console.log("\u{1F3AF} AI Intent not handled:", intent);
|
|
1593
1605
|
}
|