@cuekit-ai/react 1.2.2 → 1.3.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/{chunk-UD3LZUJ2.mjs → chunk-6TG2XY2P.mjs} +364 -24
- package/dist/cuekit.css +89 -536
- package/dist/index.d.mts +2 -95
- package/dist/index.d.ts +2 -95
- package/dist/index.js +760 -799
- package/dist/index.mjs +341 -742
- package/dist/{webrtc-service-UYILN4PB.mjs → webrtc-service-O4JWXTIF.mjs} +3 -1
- package/package.json +2 -9
package/dist/index.mjs
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import {
|
|
2
2
|
ConnectionState,
|
|
3
|
+
GlobalStore,
|
|
3
4
|
Participant,
|
|
4
5
|
ParticipantEvent,
|
|
5
6
|
RoomEvent,
|
|
@@ -11,23 +12,29 @@ import {
|
|
|
11
12
|
_apiKey,
|
|
12
13
|
_appId,
|
|
13
14
|
authenticate,
|
|
15
|
+
captureFullDOMStructure,
|
|
14
16
|
connectToRoom,
|
|
15
17
|
createAudioAnalyser,
|
|
16
18
|
disconnectFromRoom,
|
|
17
19
|
getParticipants,
|
|
18
20
|
getRoom,
|
|
19
21
|
getRoomName,
|
|
22
|
+
handleNavigationAndClick,
|
|
23
|
+
onStateChange,
|
|
24
|
+
safeNavigate,
|
|
20
25
|
sendData,
|
|
26
|
+
sendRuntimeData,
|
|
21
27
|
sendScreenStatus,
|
|
22
28
|
sendStaticData,
|
|
23
29
|
sendUserCommand,
|
|
24
30
|
setApiKey,
|
|
25
31
|
setAppId,
|
|
26
32
|
setAudioContainer,
|
|
33
|
+
setNavigationHandler,
|
|
27
34
|
setServerUrl,
|
|
28
35
|
setWebRTCCallbacks,
|
|
29
36
|
setWebRTCConfig
|
|
30
|
-
} from "./chunk-
|
|
37
|
+
} from "./chunk-6TG2XY2P.mjs";
|
|
31
38
|
|
|
32
39
|
// node_modules/inline-style-parser/index.js
|
|
33
40
|
var require_inline_style_parser = __commonJS({
|
|
@@ -377,205 +384,6 @@ function InitCuekit(config) {
|
|
|
377
384
|
setWebRTCConfig(webRTCConfig);
|
|
378
385
|
}
|
|
379
386
|
|
|
380
|
-
// src/core/intent-store.ts
|
|
381
|
-
var store = {
|
|
382
|
-
screenMetadata: {},
|
|
383
|
-
allElementsData: []
|
|
384
|
-
};
|
|
385
|
-
var GlobalStore = {
|
|
386
|
-
// 🔹 Screen Metadata Methods
|
|
387
|
-
setMetadata(screen, metadata) {
|
|
388
|
-
store.screenMetadata[screen] = metadata;
|
|
389
|
-
},
|
|
390
|
-
getMetadata(screen) {
|
|
391
|
-
return store.screenMetadata[screen];
|
|
392
|
-
},
|
|
393
|
-
clearMetadata(screen) {
|
|
394
|
-
delete store.screenMetadata[screen];
|
|
395
|
-
},
|
|
396
|
-
// 🔹 Generic Store Access Methods
|
|
397
|
-
setData(key, value) {
|
|
398
|
-
store[key] = value;
|
|
399
|
-
},
|
|
400
|
-
getData(key) {
|
|
401
|
-
return store[key];
|
|
402
|
-
},
|
|
403
|
-
clearData(key) {
|
|
404
|
-
delete store[key];
|
|
405
|
-
},
|
|
406
|
-
// 🔹 Element Data Management
|
|
407
|
-
setElement(elementData) {
|
|
408
|
-
const index2 = store.allElementsData.findIndex((e2) => e2.elementId === elementData.elementId);
|
|
409
|
-
if (index2 >= 0) {
|
|
410
|
-
console.log("Updating existing element");
|
|
411
|
-
store.allElementsData[index2] = elementData;
|
|
412
|
-
} else {
|
|
413
|
-
console.log("Adding new element");
|
|
414
|
-
store.allElementsData.push(elementData);
|
|
415
|
-
}
|
|
416
|
-
},
|
|
417
|
-
getElementById(elementId) {
|
|
418
|
-
const match = store.allElementsData.find((e2) => e2.elementId === elementId);
|
|
419
|
-
if (!match) {
|
|
420
|
-
console.warn(`[GlobalStore] No element found for ID: ${elementId}`);
|
|
421
|
-
console.log("All elements in store:", store.allElementsData);
|
|
422
|
-
}
|
|
423
|
-
return match;
|
|
424
|
-
},
|
|
425
|
-
deleteElementById(id) {
|
|
426
|
-
store.allElementsData = store.allElementsData.filter((e2) => e2.elementId !== id);
|
|
427
|
-
},
|
|
428
|
-
clearAllElements() {
|
|
429
|
-
store.allElementsData = [];
|
|
430
|
-
}
|
|
431
|
-
};
|
|
432
|
-
|
|
433
|
-
// src/core/navigation.ts
|
|
434
|
-
var navigation;
|
|
435
|
-
var navigationHandler = null;
|
|
436
|
-
function setNavigationHandler(handler) {
|
|
437
|
-
navigationHandler = handler;
|
|
438
|
-
}
|
|
439
|
-
function navigate(path2, params) {
|
|
440
|
-
const safeParams = params || {};
|
|
441
|
-
const absolutePath = path2.startsWith("/") ? path2 : `/${path2}`;
|
|
442
|
-
if (navigationHandler) {
|
|
443
|
-
try {
|
|
444
|
-
navigationHandler(absolutePath, safeParams);
|
|
445
|
-
} catch (error) {
|
|
446
|
-
console.error("[CueKit] navigation handler failed, falling back to default:", error);
|
|
447
|
-
}
|
|
448
|
-
return;
|
|
449
|
-
}
|
|
450
|
-
let fullPath = absolutePath;
|
|
451
|
-
if (safeParams) {
|
|
452
|
-
const searchParams = new URLSearchParams(safeParams).toString();
|
|
453
|
-
if (searchParams) {
|
|
454
|
-
fullPath += `?${searchParams}`;
|
|
455
|
-
}
|
|
456
|
-
}
|
|
457
|
-
if (navigation) {
|
|
458
|
-
navigation.push(fullPath);
|
|
459
|
-
} else {
|
|
460
|
-
if (typeof window !== "undefined") {
|
|
461
|
-
window.location.href = fullPath;
|
|
462
|
-
}
|
|
463
|
-
}
|
|
464
|
-
}
|
|
465
|
-
var getCurrentPath = () => {
|
|
466
|
-
if (typeof window === "undefined") return "";
|
|
467
|
-
return window.location.pathname;
|
|
468
|
-
};
|
|
469
|
-
var getSearchParams = () => {
|
|
470
|
-
if (typeof window === "undefined") return new URLSearchParams();
|
|
471
|
-
return new URLSearchParams(window.location.search);
|
|
472
|
-
};
|
|
473
|
-
var safeNavigate = (name2, params = {}) => {
|
|
474
|
-
if (name2) {
|
|
475
|
-
navigate(name2, params);
|
|
476
|
-
} else {
|
|
477
|
-
console.warn("[CueKit] route name not provided");
|
|
478
|
-
}
|
|
479
|
-
};
|
|
480
|
-
function getCurrentScreenName() {
|
|
481
|
-
try {
|
|
482
|
-
const path2 = getCurrentPath();
|
|
483
|
-
return path2 || "UnknownScreen";
|
|
484
|
-
} catch (e2) {
|
|
485
|
-
return "UnknownScreen";
|
|
486
|
-
}
|
|
487
|
-
}
|
|
488
|
-
function getCurrentRouteParams() {
|
|
489
|
-
try {
|
|
490
|
-
const params = {};
|
|
491
|
-
const searchParams = getSearchParams();
|
|
492
|
-
if (searchParams instanceof URLSearchParams) {
|
|
493
|
-
searchParams.forEach((value, key) => {
|
|
494
|
-
params[key] = value;
|
|
495
|
-
});
|
|
496
|
-
} else {
|
|
497
|
-
return searchParams;
|
|
498
|
-
}
|
|
499
|
-
return params;
|
|
500
|
-
} catch (e2) {
|
|
501
|
-
return {};
|
|
502
|
-
}
|
|
503
|
-
}
|
|
504
|
-
function onStateChange() {
|
|
505
|
-
const routeName = getCurrentScreenName();
|
|
506
|
-
const params = getCurrentRouteParams();
|
|
507
|
-
if (params && params.metadata) {
|
|
508
|
-
try {
|
|
509
|
-
const metadata = JSON.parse(params.metadata);
|
|
510
|
-
GlobalStore.setMetadata(routeName, metadata);
|
|
511
|
-
} catch (error) {
|
|
512
|
-
console.error("Failed to parse metadata from URL:", error);
|
|
513
|
-
}
|
|
514
|
-
}
|
|
515
|
-
}
|
|
516
|
-
var handleNavigationAndClick = (routeName, elementHash) => {
|
|
517
|
-
safeNavigate(routeName);
|
|
518
|
-
if (typeof MutationObserver === "undefined" || typeof document === "undefined") return;
|
|
519
|
-
const observer = new MutationObserver((mutationsList, observer2) => {
|
|
520
|
-
setTimeout(() => {
|
|
521
|
-
const allElements = document.querySelectorAll("*");
|
|
522
|
-
let elementToClick = null;
|
|
523
|
-
for (const element3 of allElements) {
|
|
524
|
-
if (element3 instanceof HTMLElement) {
|
|
525
|
-
const tagName = element3.tagName.toLowerCase();
|
|
526
|
-
const text7 = (element3.textContent || "").trim().substring(0, 50);
|
|
527
|
-
let sibling = element3.previousElementSibling;
|
|
528
|
-
let position3 = 1;
|
|
529
|
-
while (sibling) {
|
|
530
|
-
if (sibling.tagName === element3.tagName) {
|
|
531
|
-
position3++;
|
|
532
|
-
}
|
|
533
|
-
sibling = sibling.previousElementSibling;
|
|
534
|
-
}
|
|
535
|
-
const path2 = getElementPath(element3);
|
|
536
|
-
const idString = `${tagName}[${position3}]_(${text7})_${path2}`;
|
|
537
|
-
let hash = 0;
|
|
538
|
-
for (let i2 = 0; i2 < idString.length; i2++) {
|
|
539
|
-
const char = idString.charCodeAt(i2);
|
|
540
|
-
hash = (hash << 5) - hash + char;
|
|
541
|
-
hash |= 0;
|
|
542
|
-
}
|
|
543
|
-
const elementHashValue = hash.toString(36);
|
|
544
|
-
if (elementHashValue === elementHash) {
|
|
545
|
-
elementToClick = element3;
|
|
546
|
-
break;
|
|
547
|
-
}
|
|
548
|
-
}
|
|
549
|
-
}
|
|
550
|
-
if (elementToClick) {
|
|
551
|
-
elementToClick.click();
|
|
552
|
-
observer2.disconnect();
|
|
553
|
-
}
|
|
554
|
-
}, 100);
|
|
555
|
-
});
|
|
556
|
-
observer.observe(document.body, { childList: true, subtree: true });
|
|
557
|
-
};
|
|
558
|
-
function getElementPath(element3) {
|
|
559
|
-
if (element3.id) {
|
|
560
|
-
return `id(${element3.id})`;
|
|
561
|
-
}
|
|
562
|
-
const path2 = [];
|
|
563
|
-
let current = element3;
|
|
564
|
-
while (current && current !== document.body) {
|
|
565
|
-
let index2 = 1;
|
|
566
|
-
let sibling = current.previousElementSibling;
|
|
567
|
-
while (sibling) {
|
|
568
|
-
if (sibling.tagName === current.tagName) {
|
|
569
|
-
index2++;
|
|
570
|
-
}
|
|
571
|
-
sibling = sibling.previousElementSibling;
|
|
572
|
-
}
|
|
573
|
-
path2.unshift(`${current.tagName.toLowerCase()}[${index2}]`);
|
|
574
|
-
current = current.parentElement;
|
|
575
|
-
}
|
|
576
|
-
return path2.join("/");
|
|
577
|
-
}
|
|
578
|
-
|
|
579
387
|
// src/utils/webrtc-config.ts
|
|
580
388
|
var configureWebRTCServer = (config) => {
|
|
581
389
|
if (!config.apiKey) {
|
|
@@ -654,7 +462,7 @@ var CuekitProvider = ({
|
|
|
654
462
|
deviceId = "",
|
|
655
463
|
appId,
|
|
656
464
|
children,
|
|
657
|
-
navigationHandler
|
|
465
|
+
navigationHandler,
|
|
658
466
|
onConnectionStateChange,
|
|
659
467
|
onParticipantUpdate
|
|
660
468
|
}) => {
|
|
@@ -678,13 +486,13 @@ var CuekitProvider = ({
|
|
|
678
486
|
}
|
|
679
487
|
}, [apiKey]);
|
|
680
488
|
useEffect(() => {
|
|
681
|
-
setNavigationHandler(
|
|
489
|
+
setNavigationHandler(navigationHandler ?? null);
|
|
682
490
|
return () => {
|
|
683
491
|
setNavigationHandler(null);
|
|
684
492
|
};
|
|
685
|
-
}, [
|
|
493
|
+
}, [navigationHandler]);
|
|
686
494
|
useEffect(() => {
|
|
687
|
-
import("./webrtc-service-
|
|
495
|
+
import("./webrtc-service-O4JWXTIF.mjs").then(({ setWebRTCCallbacks: setWebRTCCallbacks2 }) => {
|
|
688
496
|
setWebRTCCallbacks2({
|
|
689
497
|
onNavigationCommand: (command) => {
|
|
690
498
|
console.log("\u{1F9ED} Processing navigation command:", command);
|
|
@@ -696,8 +504,8 @@ var CuekitProvider = ({
|
|
|
696
504
|
console.log("\u{1F3AF} AI Intent:", command.text, "->", command.actionType);
|
|
697
505
|
if (command.actionType === "navigate" && command.current_page) {
|
|
698
506
|
console.log(`\u{1F9ED} Navigating to: ${command.current_page}`);
|
|
699
|
-
if (
|
|
700
|
-
|
|
507
|
+
if (navigationHandler) {
|
|
508
|
+
navigationHandler(command.current_page, {
|
|
701
509
|
intent: command.intent,
|
|
702
510
|
text: command.text,
|
|
703
511
|
confidence: command.confidence
|
|
@@ -727,7 +535,7 @@ var CuekitProvider = ({
|
|
|
727
535
|
}
|
|
728
536
|
});
|
|
729
537
|
});
|
|
730
|
-
}, [onConnectionStateChange, onParticipantUpdate,
|
|
538
|
+
}, [onConnectionStateChange, onParticipantUpdate, navigationHandler]);
|
|
731
539
|
useEffect(() => {
|
|
732
540
|
const updateGlobalStore = (id) => {
|
|
733
541
|
if (typeof window !== "undefined" && globalThis.CuekitStore) {
|
|
@@ -793,16 +601,15 @@ var CuekitProvider = ({
|
|
|
793
601
|
};
|
|
794
602
|
|
|
795
603
|
// src/components/mic-button.tsx
|
|
796
|
-
import
|
|
797
|
-
import { Mic, Loader2 } from "lucide-react";
|
|
604
|
+
import React11, { useState as useState10, useEffect as useEffect10, useCallback as useCallback5, useRef as useRef7 } from "react";
|
|
798
605
|
|
|
799
606
|
// src/hooks/use-cuekit.ts
|
|
800
|
-
import { useState as useState3, useCallback as useCallback2,
|
|
607
|
+
import { useState as useState3, useCallback as useCallback2, useRef as useRef2 } from "react";
|
|
801
608
|
|
|
802
609
|
// src/hooks/use-webrtc.ts
|
|
803
610
|
import { useState as useState2, useEffect as useEffect2, useCallback, useRef, useMemo } from "react";
|
|
804
611
|
var useWebRTC = (options) => {
|
|
805
|
-
const [
|
|
612
|
+
const [isConnected2, setIsConnected] = useState2(false);
|
|
806
613
|
const [isConnecting, setIsConnecting] = useState2(false);
|
|
807
614
|
const [connectionState, setConnectionState] = useState2(null);
|
|
808
615
|
const [participants, setParticipants] = useState2([]);
|
|
@@ -866,7 +673,7 @@ var useWebRTC = (options) => {
|
|
|
866
673
|
return getParticipants().map((p) => p.identity);
|
|
867
674
|
}, [participants]);
|
|
868
675
|
return {
|
|
869
|
-
isConnected:
|
|
676
|
+
isConnected: isConnected2,
|
|
870
677
|
isConnecting,
|
|
871
678
|
connectionState,
|
|
872
679
|
room,
|
|
@@ -883,330 +690,6 @@ var useWebRTC = (options) => {
|
|
|
883
690
|
};
|
|
884
691
|
};
|
|
885
692
|
|
|
886
|
-
// src/utils/jsx-encoder.ts
|
|
887
|
-
function generateStableDOMId(element3) {
|
|
888
|
-
const tagName = element3.tagName.toLowerCase();
|
|
889
|
-
const text7 = (element3.textContent || "").trim().substring(0, 50);
|
|
890
|
-
let sibling = element3.previousElementSibling;
|
|
891
|
-
let position3 = 1;
|
|
892
|
-
while (sibling) {
|
|
893
|
-
if (sibling.tagName === element3.tagName) {
|
|
894
|
-
position3++;
|
|
895
|
-
}
|
|
896
|
-
sibling = sibling.previousElementSibling;
|
|
897
|
-
}
|
|
898
|
-
const path2 = getElementPath2(element3);
|
|
899
|
-
const idString = `${tagName}[${position3}]_(${text7})_${path2}`;
|
|
900
|
-
let hash = 0;
|
|
901
|
-
for (let i2 = 0; i2 < idString.length; i2++) {
|
|
902
|
-
const char = idString.charCodeAt(i2);
|
|
903
|
-
hash = (hash << 5) - hash + char;
|
|
904
|
-
hash |= 0;
|
|
905
|
-
}
|
|
906
|
-
return hash.toString(36);
|
|
907
|
-
}
|
|
908
|
-
function getElementPath2(element3) {
|
|
909
|
-
if (element3.id) {
|
|
910
|
-
return `id(${element3.id})`;
|
|
911
|
-
}
|
|
912
|
-
if (element3.tagName.toLowerCase() === "body") {
|
|
913
|
-
return "/body";
|
|
914
|
-
}
|
|
915
|
-
let ix = 0;
|
|
916
|
-
const siblings = element3.parentNode?.children || new HTMLCollection();
|
|
917
|
-
for (let i2 = 0; i2 < siblings.length; i2++) {
|
|
918
|
-
const sibling = siblings[i2];
|
|
919
|
-
if (sibling === element3) {
|
|
920
|
-
return `${getElementPath2(element3.parentNode)}/${element3.tagName}[${ix + 1}]`;
|
|
921
|
-
}
|
|
922
|
-
if (sibling.nodeType === 1 && sibling.tagName === element3.tagName) {
|
|
923
|
-
ix++;
|
|
924
|
-
}
|
|
925
|
-
}
|
|
926
|
-
return "not_found";
|
|
927
|
-
}
|
|
928
|
-
|
|
929
|
-
// src/utils/patch-react.ts
|
|
930
|
-
function getImmediateText(element3) {
|
|
931
|
-
let text7 = "";
|
|
932
|
-
if (element3.childNodes) {
|
|
933
|
-
for (const node2 of Array.from(element3.childNodes)) {
|
|
934
|
-
if (node2.nodeType === 3) {
|
|
935
|
-
text7 += node2.textContent || "";
|
|
936
|
-
}
|
|
937
|
-
}
|
|
938
|
-
}
|
|
939
|
-
return text7.trim();
|
|
940
|
-
}
|
|
941
|
-
function captureFullDOMStructure() {
|
|
942
|
-
console.log("\u{1F333} Capturing full DOM structure...");
|
|
943
|
-
const components = [];
|
|
944
|
-
const interactiveElements = document.querySelectorAll(
|
|
945
|
-
'a, button, input, textarea, select, [role="button"], [onclick]'
|
|
946
|
-
);
|
|
947
|
-
interactiveElements.forEach((element3) => {
|
|
948
|
-
if (element3 instanceof HTMLElement && !element3.closest("[data-cuekit-ignore]")) {
|
|
949
|
-
const nodeData = buildFlatDOMNode(element3);
|
|
950
|
-
if (nodeData) {
|
|
951
|
-
components.push(nodeData);
|
|
952
|
-
}
|
|
953
|
-
}
|
|
954
|
-
});
|
|
955
|
-
const result = { components };
|
|
956
|
-
console.log("\u{1F333} Full DOM structure captured:", result);
|
|
957
|
-
return result;
|
|
958
|
-
}
|
|
959
|
-
function buildFlatDOMNode(element3) {
|
|
960
|
-
if (element3.tagName.toLowerCase() === "script" || element3.hasAttribute("data-cuekit-ignore") || element3.style.display === "none" || element3.style.visibility === "hidden") {
|
|
961
|
-
return null;
|
|
962
|
-
}
|
|
963
|
-
const hash = generateStableDOMId(element3);
|
|
964
|
-
const text7 = getImmediateText(element3).substring(0, 100);
|
|
965
|
-
const isClickable = isElementClickable(element3);
|
|
966
|
-
const componentType = element3.tagName.toLowerCase();
|
|
967
|
-
return {
|
|
968
|
-
hash,
|
|
969
|
-
text: text7,
|
|
970
|
-
isClickable,
|
|
971
|
-
componentType,
|
|
972
|
-
children: []
|
|
973
|
-
// No children in a flat structure
|
|
974
|
-
};
|
|
975
|
-
}
|
|
976
|
-
function isElementClickable(element3) {
|
|
977
|
-
const interactiveSelectors = [
|
|
978
|
-
"button",
|
|
979
|
-
"a",
|
|
980
|
-
"input",
|
|
981
|
-
"select",
|
|
982
|
-
"textarea",
|
|
983
|
-
'[role="button"]',
|
|
984
|
-
'[role="link"]',
|
|
985
|
-
'[role="tab"]',
|
|
986
|
-
"[data-onclick-id]",
|
|
987
|
-
"[data-on-press-id]",
|
|
988
|
-
"[onclick]",
|
|
989
|
-
"[onmousedown]",
|
|
990
|
-
"[onmouseup]",
|
|
991
|
-
"[ontouchstart]",
|
|
992
|
-
"[ontouchend]",
|
|
993
|
-
"[onkeydown]",
|
|
994
|
-
"[onkeyup]",
|
|
995
|
-
"[onkeypress]"
|
|
996
|
-
];
|
|
997
|
-
for (const selector of interactiveSelectors) {
|
|
998
|
-
if (element3.matches(selector)) {
|
|
999
|
-
return true;
|
|
1000
|
-
}
|
|
1001
|
-
}
|
|
1002
|
-
const hasClickEvents = element3.onclick !== null || element3.getAttribute("onclick") !== null;
|
|
1003
|
-
const hasInteractiveEvents = element3.ontouchstart !== null || element3.getAttribute("ontouchstart") !== null || element3.ontouchend !== null || element3.getAttribute("ontouchend") !== null || element3.onkeydown !== null || element3.getAttribute("onkeydown") !== null || element3.onkeyup !== null || element3.getAttribute("onkeyup") !== null || element3.onkeypress !== null || element3.getAttribute("onkeypress") !== null;
|
|
1004
|
-
const hasPointerCursor = element3.style.cursor === "pointer" || getComputedStyle(element3).cursor === "pointer";
|
|
1005
|
-
const hasTabIndex = element3.hasAttribute("tabindex") && parseInt(element3.getAttribute("tabindex") || "0") >= 0;
|
|
1006
|
-
const hasInteractiveDataAttrs = element3.hasAttribute("data-clickable") || element3.hasAttribute("data-interactive") || element3.hasAttribute("data-action") || element3.hasAttribute("data-handler");
|
|
1007
|
-
const hasInteractiveAria = element3.hasAttribute("aria-pressed") || element3.hasAttribute("aria-expanded") || element3.hasAttribute("aria-selected") || element3.hasAttribute("aria-checked");
|
|
1008
|
-
return hasClickEvents || hasInteractiveEvents || hasPointerCursor || hasTabIndex || hasInteractiveDataAttrs || hasInteractiveAria;
|
|
1009
|
-
}
|
|
1010
|
-
|
|
1011
|
-
// src/utils/sse-service.ts
|
|
1012
|
-
var eventSource = null;
|
|
1013
|
-
var isConnected2 = false;
|
|
1014
|
-
var serverUrl = WEBRTC_BACKEND_SERVER_URL || "https://bdd4c945f073.ngrok-free.app";
|
|
1015
|
-
var callbacks = {};
|
|
1016
|
-
var sessionId = null;
|
|
1017
|
-
function setSSECallbacks(newCallbacks) {
|
|
1018
|
-
callbacks = newCallbacks;
|
|
1019
|
-
}
|
|
1020
|
-
async function connectSSE(newSessionId) {
|
|
1021
|
-
if (eventSource) {
|
|
1022
|
-
eventSource.close();
|
|
1023
|
-
}
|
|
1024
|
-
if (typeof EventSource === "undefined") {
|
|
1025
|
-
console.warn("\u{1F527} EventSource not available, SSE functionality disabled");
|
|
1026
|
-
callbacks.onError?.("EventSource not available");
|
|
1027
|
-
return;
|
|
1028
|
-
}
|
|
1029
|
-
try {
|
|
1030
|
-
const url = `${serverUrl}/navigation/stream?session_id=${newSessionId}`;
|
|
1031
|
-
eventSource = new EventSource(url);
|
|
1032
|
-
sessionId = newSessionId;
|
|
1033
|
-
eventSource.onopen = () => {
|
|
1034
|
-
console.log("\u{1F517} SSE connection opened");
|
|
1035
|
-
isConnected2 = true;
|
|
1036
|
-
callbacks.onConnectionChange?.(true);
|
|
1037
|
-
};
|
|
1038
|
-
eventSource.onmessage = (event) => {
|
|
1039
|
-
console.log("\u{1F4E1} SSE MESSAGE RECEIVED:", event.data);
|
|
1040
|
-
try {
|
|
1041
|
-
const data = JSON.parse(event.data);
|
|
1042
|
-
console.log("\u{1F4E1} SSE MESSAGE PARSED:", data);
|
|
1043
|
-
handleSSEMessage(data);
|
|
1044
|
-
} catch (error) {
|
|
1045
|
-
console.error("\u274C Failed to parse SSE message:", error);
|
|
1046
|
-
}
|
|
1047
|
-
};
|
|
1048
|
-
eventSource.onerror = (error) => {
|
|
1049
|
-
console.error("\u274C SSE connection error:", error);
|
|
1050
|
-
isConnected2 = false;
|
|
1051
|
-
callbacks.onConnectionChange?.(false);
|
|
1052
|
-
callbacks.onError?.("SSE connection failed");
|
|
1053
|
-
};
|
|
1054
|
-
} catch (error) {
|
|
1055
|
-
console.error("\u274C Failed to create SSE connection:", error);
|
|
1056
|
-
callbacks.onError?.("Failed to create SSE connection");
|
|
1057
|
-
}
|
|
1058
|
-
}
|
|
1059
|
-
function handleSSEMessage(data) {
|
|
1060
|
-
console.log("\u{1F50D} Processing SSE message type:", data.type);
|
|
1061
|
-
console.log("\u{1F50D} Full SSE data:", data);
|
|
1062
|
-
console.log("\u{1F50D} SSE data.data:", data.data);
|
|
1063
|
-
const actionEvent = data;
|
|
1064
|
-
console.log("\u{1F50D} Created action event:", actionEvent);
|
|
1065
|
-
callbacks.onActionEvent?.(actionEvent);
|
|
1066
|
-
switch (actionEvent.type) {
|
|
1067
|
-
case "static_data_ready":
|
|
1068
|
-
console.log("\u{1F4E6} Handling static_data_ready event");
|
|
1069
|
-
callbacks.onStaticDataUpdate?.(actionEvent.data);
|
|
1070
|
-
break;
|
|
1071
|
-
case "ai_intent":
|
|
1072
|
-
console.log("\u{1F3AF} Handling ai_intent event");
|
|
1073
|
-
callbacks.onIntentUpdate?.(actionEvent.data);
|
|
1074
|
-
break;
|
|
1075
|
-
case "request_runtime_data":
|
|
1076
|
-
console.log("\u{1F4E6} Handling request_runtime_data event");
|
|
1077
|
-
sendRuntimeData();
|
|
1078
|
-
break;
|
|
1079
|
-
case "user_speech_chunk":
|
|
1080
|
-
console.log("\u{1F464} Handling user_speech_chunk event");
|
|
1081
|
-
const userSpeechEntry = {
|
|
1082
|
-
speaker: "user",
|
|
1083
|
-
text: actionEvent.data?.text_chunk,
|
|
1084
|
-
is_final: actionEvent.data?.is_final
|
|
1085
|
-
};
|
|
1086
|
-
callbacks.onConversationUpdate?.(userSpeechEntry);
|
|
1087
|
-
break;
|
|
1088
|
-
case "ai_speech_chunk":
|
|
1089
|
-
console.log("\u{1F916} Handling ai_speech_chunk event");
|
|
1090
|
-
callbacks.onConversationUpdate?.({
|
|
1091
|
-
speaker: "ai",
|
|
1092
|
-
text: actionEvent.data?.text_chunk,
|
|
1093
|
-
is_final: actionEvent.data?.is_final
|
|
1094
|
-
});
|
|
1095
|
-
break;
|
|
1096
|
-
case "ai_interrupted":
|
|
1097
|
-
console.log("\u{1F507} Handling ai_interrupted event");
|
|
1098
|
-
break;
|
|
1099
|
-
case "tool_log":
|
|
1100
|
-
console.log("\u{1F527} Handling tool_log event");
|
|
1101
|
-
callbacks.onToolStatusUpdate?.(actionEvent.data);
|
|
1102
|
-
break;
|
|
1103
|
-
case "connection":
|
|
1104
|
-
console.log("\u{1F517} Handling connection event");
|
|
1105
|
-
break;
|
|
1106
|
-
case "keepalive":
|
|
1107
|
-
console.log("\u{1F493} Handling keepalive event");
|
|
1108
|
-
break;
|
|
1109
|
-
default:
|
|
1110
|
-
console.log("\u{1F50D} Unknown SSE message type:", data.type);
|
|
1111
|
-
}
|
|
1112
|
-
}
|
|
1113
|
-
async function sendRuntimeData() {
|
|
1114
|
-
if (!sessionId) {
|
|
1115
|
-
console.error("\u274C Cannot send runtime data without a session ID");
|
|
1116
|
-
return;
|
|
1117
|
-
}
|
|
1118
|
-
try {
|
|
1119
|
-
const domStructure = captureFullDOMStructure();
|
|
1120
|
-
const screenName = getCurrentScreenName();
|
|
1121
|
-
const response = await fetch(`${serverUrl}/api/runtime/data/${sessionId}`, {
|
|
1122
|
-
method: "POST",
|
|
1123
|
-
headers: {
|
|
1124
|
-
"Content-Type": "application/json",
|
|
1125
|
-
Authorization: `Bearer ${_apiKey}`
|
|
1126
|
-
},
|
|
1127
|
-
body: JSON.stringify({
|
|
1128
|
-
session_id: sessionId,
|
|
1129
|
-
components: domStructure.components,
|
|
1130
|
-
screen: screenName
|
|
1131
|
-
})
|
|
1132
|
-
});
|
|
1133
|
-
if (!response.ok) {
|
|
1134
|
-
const errorData = await response.json();
|
|
1135
|
-
throw new Error(errorData.detail || "Failed to send runtime data");
|
|
1136
|
-
}
|
|
1137
|
-
console.log("\u{1F4E6} Runtime data sent successfully");
|
|
1138
|
-
} catch (error) {
|
|
1139
|
-
console.error("\u274C Failed to send runtime data:", error);
|
|
1140
|
-
callbacks.onError?.("Failed to send runtime data");
|
|
1141
|
-
}
|
|
1142
|
-
}
|
|
1143
|
-
async function sendDashboardData(dashboardData) {
|
|
1144
|
-
try {
|
|
1145
|
-
console.log("\u{1F4E4} SSEService: Sending dashboard data...");
|
|
1146
|
-
const response = await fetch(`${serverUrl}/ai/data`, {
|
|
1147
|
-
method: "POST",
|
|
1148
|
-
headers: {
|
|
1149
|
-
"Content-Type": "application/json"
|
|
1150
|
-
},
|
|
1151
|
-
body: JSON.stringify({
|
|
1152
|
-
type: "dashboard_data",
|
|
1153
|
-
data: dashboardData
|
|
1154
|
-
})
|
|
1155
|
-
});
|
|
1156
|
-
if (!response.ok) {
|
|
1157
|
-
throw new Error(`HTTP ${response.status}: ${response.statusText}`);
|
|
1158
|
-
}
|
|
1159
|
-
console.log("\u2705 SSEService: Dashboard data sent successfully");
|
|
1160
|
-
} catch (error) {
|
|
1161
|
-
console.error("\u274C SSEService: Failed to send dashboard data:", error);
|
|
1162
|
-
}
|
|
1163
|
-
}
|
|
1164
|
-
async function sendElementData(appId = "default") {
|
|
1165
|
-
try {
|
|
1166
|
-
console.log("\u{1F4E4} SSEService: Sending element data...");
|
|
1167
|
-
const domStructure = captureFullDOMStructure();
|
|
1168
|
-
const currentPage = getCurrentScreenName();
|
|
1169
|
-
const elementData = {
|
|
1170
|
-
app_id: appId,
|
|
1171
|
-
current_page: currentPage,
|
|
1172
|
-
dom_structure: domStructure,
|
|
1173
|
-
timestamp: Date.now()
|
|
1174
|
-
};
|
|
1175
|
-
const response = await fetch(`${serverUrl}/ai/data`, {
|
|
1176
|
-
method: "POST",
|
|
1177
|
-
headers: {
|
|
1178
|
-
"Content-Type": "application/json"
|
|
1179
|
-
},
|
|
1180
|
-
body: JSON.stringify(elementData)
|
|
1181
|
-
});
|
|
1182
|
-
if (!response.ok) {
|
|
1183
|
-
throw new Error(`HTTP ${response.status}: ${response.statusText}`);
|
|
1184
|
-
}
|
|
1185
|
-
console.log("\u2705 SSEService: Element data sent successfully");
|
|
1186
|
-
return elementData;
|
|
1187
|
-
} catch (error) {
|
|
1188
|
-
console.error("\u274C SSEService: Failed to send element data:", error);
|
|
1189
|
-
throw error;
|
|
1190
|
-
}
|
|
1191
|
-
}
|
|
1192
|
-
function disconnectSSE() {
|
|
1193
|
-
console.log("\u{1F50C} SSEService: Disconnecting SSE...");
|
|
1194
|
-
if (eventSource) {
|
|
1195
|
-
eventSource.close();
|
|
1196
|
-
eventSource = null;
|
|
1197
|
-
}
|
|
1198
|
-
isConnected2 = false;
|
|
1199
|
-
callbacks.onConnectionChange?.(false);
|
|
1200
|
-
}
|
|
1201
|
-
function getSSEConnectionStatus() {
|
|
1202
|
-
return isConnected2 && eventSource?.readyState === EventSource.OPEN;
|
|
1203
|
-
}
|
|
1204
|
-
function getSSEConnectionState() {
|
|
1205
|
-
if (isConnected2 && eventSource?.readyState === EventSource.OPEN) return "connected";
|
|
1206
|
-
if (eventSource?.readyState === EventSource.CONNECTING) return "connecting";
|
|
1207
|
-
return "disconnected";
|
|
1208
|
-
}
|
|
1209
|
-
|
|
1210
693
|
// src/utils/element-service.ts
|
|
1211
694
|
function executeAction(action) {
|
|
1212
695
|
console.log("\u{1F3AF} Executing element action:", action);
|
|
@@ -1392,89 +875,83 @@ var useCuekit = (options) => {
|
|
|
1392
875
|
}, []);
|
|
1393
876
|
const [micState, setMicState] = useState3("idle");
|
|
1394
877
|
const [status, setStatus] = useState3("");
|
|
1395
|
-
const
|
|
1396
|
-
|
|
1397
|
-
|
|
1398
|
-
|
|
1399
|
-
|
|
1400
|
-
|
|
1401
|
-
|
|
1402
|
-
|
|
1403
|
-
|
|
1404
|
-
|
|
1405
|
-
|
|
1406
|
-
|
|
1407
|
-
|
|
1408
|
-
|
|
1409
|
-
|
|
1410
|
-
|
|
1411
|
-
|
|
1412
|
-
|
|
1413
|
-
|
|
1414
|
-
|
|
1415
|
-
|
|
1416
|
-
|
|
1417
|
-
|
|
1418
|
-
|
|
1419
|
-
|
|
1420
|
-
|
|
1421
|
-
|
|
1422
|
-
|
|
1423
|
-
|
|
1424
|
-
|
|
1425
|
-
|
|
1426
|
-
if (entry.is_final) {
|
|
1427
|
-
if (entry.speaker === "user") {
|
|
1428
|
-
setMicState("thinking");
|
|
1429
|
-
} else if (entry.speaker === "ai") {
|
|
1430
|
-
setTimeout(() => setMicState("listening"), 1e3);
|
|
1431
|
-
}
|
|
1432
|
-
}
|
|
1433
|
-
break;
|
|
1434
|
-
}
|
|
1435
|
-
case "ai_intent": {
|
|
1436
|
-
const intent = event.data;
|
|
1437
|
-
if (intent.actionType === "click" && intent.actionMetadata.elementId) {
|
|
1438
|
-
executeAction({
|
|
1439
|
-
action_type: "click",
|
|
1440
|
-
target_element: intent.actionMetadata.elementId
|
|
1441
|
-
});
|
|
1442
|
-
} else if (intent.actionType === "navigate" && intent.actionMetadata.routeName) {
|
|
1443
|
-
executeAction({
|
|
1444
|
-
action_type: "navigate",
|
|
1445
|
-
target_element: intent.actionMetadata.routeName
|
|
1446
|
-
});
|
|
1447
|
-
}
|
|
1448
|
-
break;
|
|
1449
|
-
}
|
|
1450
|
-
case "ai_interrupted": {
|
|
1451
|
-
handleAIInterruption();
|
|
1452
|
-
break;
|
|
1453
|
-
}
|
|
1454
|
-
case "keepalive": {
|
|
1455
|
-
if (currentUserMessageRef.current) {
|
|
1456
|
-
const finalMessageId = currentUserMessageRef.current.id;
|
|
1457
|
-
setMessages(
|
|
1458
|
-
(prev) => prev.map((m) => m.id === finalMessageId ? { ...m, isFinal: true } : m)
|
|
1459
|
-
);
|
|
1460
|
-
currentUserMessageRef.current = null;
|
|
1461
|
-
}
|
|
1462
|
-
if (currentAIMessageRef.current) {
|
|
1463
|
-
const finalMessageId = currentAIMessageRef.current.id;
|
|
1464
|
-
setMessages(
|
|
1465
|
-
(prev) => prev.map((m) => m.id === finalMessageId ? { ...m, isFinal: true } : m)
|
|
1466
|
-
);
|
|
1467
|
-
currentAIMessageRef.current = null;
|
|
1468
|
-
}
|
|
1469
|
-
break;
|
|
878
|
+
const handleNavigationCommand = (event) => {
|
|
879
|
+
switch (event.type) {
|
|
880
|
+
case "user_speech_chunk":
|
|
881
|
+
case "ai_speech_chunk": {
|
|
882
|
+
const role = event.type === "user_speech_chunk" ? "user" : "ai";
|
|
883
|
+
if (role === "user" && currentAIMessageRef.current) {
|
|
884
|
+
const finalMessageId = currentAIMessageRef.current.id;
|
|
885
|
+
setMessages(
|
|
886
|
+
(prev) => prev.map((m) => m.id === finalMessageId ? { ...m, isFinal: true } : m)
|
|
887
|
+
);
|
|
888
|
+
currentAIMessageRef.current = null;
|
|
889
|
+
}
|
|
890
|
+
if (role === "ai" && currentUserMessageRef.current) {
|
|
891
|
+
const finalMessageId = currentUserMessageRef.current.id;
|
|
892
|
+
setMessages(
|
|
893
|
+
(prev) => prev.map((m) => m.id === finalMessageId ? { ...m, isFinal: true } : m)
|
|
894
|
+
);
|
|
895
|
+
currentUserMessageRef.current = null;
|
|
896
|
+
}
|
|
897
|
+
const entry = {
|
|
898
|
+
speaker: role,
|
|
899
|
+
text: event.data.text_chunk,
|
|
900
|
+
is_final: event.data.is_final,
|
|
901
|
+
timestamp: new Date(event.timestamp || Date.now()).toISOString()
|
|
902
|
+
};
|
|
903
|
+
handleMessageChunk(entry.text, entry.speaker, entry.is_final);
|
|
904
|
+
if (entry.is_final) {
|
|
905
|
+
if (entry.speaker === "user") {
|
|
906
|
+
setMicState("thinking");
|
|
907
|
+
} else if (entry.speaker === "ai") {
|
|
908
|
+
setTimeout(() => setMicState("listening"), 1e3);
|
|
1470
909
|
}
|
|
1471
910
|
}
|
|
1472
|
-
|
|
1473
|
-
onConnectionChange: (isConnected3) => {
|
|
1474
|
-
setIsSseConnected(isConnected3);
|
|
911
|
+
break;
|
|
1475
912
|
}
|
|
1476
|
-
|
|
1477
|
-
|
|
913
|
+
case "ai_intent": {
|
|
914
|
+
const intent = event.data;
|
|
915
|
+
if (intent.actionType === "click" && intent.actionMetadata.elementId) {
|
|
916
|
+
executeAction({
|
|
917
|
+
action_type: "click",
|
|
918
|
+
target_element: intent.actionMetadata.elementId
|
|
919
|
+
});
|
|
920
|
+
} else if (intent.actionType === "navigate" && intent.actionMetadata.routeName) {
|
|
921
|
+
executeAction({
|
|
922
|
+
action_type: "navigate",
|
|
923
|
+
target_element: intent.actionMetadata.routeName
|
|
924
|
+
});
|
|
925
|
+
}
|
|
926
|
+
break;
|
|
927
|
+
}
|
|
928
|
+
case "request_runtime_data": {
|
|
929
|
+
sendRuntimeData();
|
|
930
|
+
break;
|
|
931
|
+
}
|
|
932
|
+
case "ai_interrupted": {
|
|
933
|
+
handleAIInterruption();
|
|
934
|
+
break;
|
|
935
|
+
}
|
|
936
|
+
case "keepalive": {
|
|
937
|
+
if (currentUserMessageRef.current) {
|
|
938
|
+
const finalMessageId = currentUserMessageRef.current.id;
|
|
939
|
+
setMessages(
|
|
940
|
+
(prev) => prev.map((m) => m.id === finalMessageId ? { ...m, isFinal: true } : m)
|
|
941
|
+
);
|
|
942
|
+
currentUserMessageRef.current = null;
|
|
943
|
+
}
|
|
944
|
+
if (currentAIMessageRef.current) {
|
|
945
|
+
const finalMessageId = currentAIMessageRef.current.id;
|
|
946
|
+
setMessages(
|
|
947
|
+
(prev) => prev.map((m) => m.id === finalMessageId ? { ...m, isFinal: true } : m)
|
|
948
|
+
);
|
|
949
|
+
currentAIMessageRef.current = null;
|
|
950
|
+
}
|
|
951
|
+
break;
|
|
952
|
+
}
|
|
953
|
+
}
|
|
954
|
+
};
|
|
1478
955
|
const handleConnectionStateChange = (state) => {
|
|
1479
956
|
switch (state) {
|
|
1480
957
|
case "connecting":
|
|
@@ -1498,32 +975,22 @@ var useCuekit = (options) => {
|
|
|
1498
975
|
};
|
|
1499
976
|
const webrtc = useWebRTC({
|
|
1500
977
|
...options,
|
|
1501
|
-
onConnectionStateChange: handleConnectionStateChange
|
|
978
|
+
onConnectionStateChange: handleConnectionStateChange,
|
|
979
|
+
onNavigationCommand: handleNavigationCommand
|
|
1502
980
|
});
|
|
1503
981
|
const connect = useCallback2(
|
|
1504
982
|
async (identity, apiKey, appId) => {
|
|
1505
|
-
|
|
1506
|
-
if (authData?.session_id) {
|
|
1507
|
-
connectSSE(authData.session_id);
|
|
1508
|
-
}
|
|
983
|
+
await webrtc.connect(identity, apiKey, appId);
|
|
1509
984
|
},
|
|
1510
985
|
[webrtc]
|
|
1511
986
|
);
|
|
1512
987
|
const disconnect = useCallback2(async () => {
|
|
1513
988
|
await webrtc.disconnect();
|
|
1514
|
-
disconnectSSE();
|
|
1515
989
|
clearMessages();
|
|
1516
990
|
setMicState("idle");
|
|
1517
991
|
}, [webrtc, clearMessages]);
|
|
1518
|
-
useEffect3(() => {
|
|
1519
|
-
if (lastActionEvent?.type === "ai_interrupted") {
|
|
1520
|
-
handleAIInterruption();
|
|
1521
|
-
}
|
|
1522
|
-
}, [lastActionEvent, handleAIInterruption]);
|
|
1523
992
|
return {
|
|
1524
993
|
...webrtc,
|
|
1525
|
-
isSseConnected,
|
|
1526
|
-
lastActionEvent,
|
|
1527
994
|
messages,
|
|
1528
995
|
micState,
|
|
1529
996
|
setMicState,
|
|
@@ -1535,8 +1002,7 @@ var useCuekit = (options) => {
|
|
|
1535
1002
|
};
|
|
1536
1003
|
|
|
1537
1004
|
// src/components/chat-popup.tsx
|
|
1538
|
-
import
|
|
1539
|
-
import { X, Sun, Moon, PhoneOff } from "lucide-react";
|
|
1005
|
+
import React6, { useState as useState5, useEffect as useEffect5, useRef as useRef3 } from "react";
|
|
1540
1006
|
|
|
1541
1007
|
// node_modules/devlop/lib/default.js
|
|
1542
1008
|
function ok() {
|
|
@@ -7265,7 +6731,7 @@ function createTokenizer(parser, initialize, from) {
|
|
|
7265
6731
|
function handleConstruct(construct) {
|
|
7266
6732
|
return start2;
|
|
7267
6733
|
function start2(code4) {
|
|
7268
|
-
info =
|
|
6734
|
+
info = store();
|
|
7269
6735
|
currentConstruct = construct;
|
|
7270
6736
|
if (!construct.partial) {
|
|
7271
6737
|
context.currentConstruct = construct;
|
|
@@ -7310,7 +6776,7 @@ function createTokenizer(parser, initialize, from) {
|
|
|
7310
6776
|
context.events = construct.resolveTo(context.events, context);
|
|
7311
6777
|
}
|
|
7312
6778
|
}
|
|
7313
|
-
function
|
|
6779
|
+
function store() {
|
|
7314
6780
|
const startPoint = now();
|
|
7315
6781
|
const startPrevious = context.previous;
|
|
7316
6782
|
const startCurrentConstruct = context.currentConstruct;
|
|
@@ -14177,6 +13643,109 @@ function remarkGfm(options) {
|
|
|
14177
13643
|
toMarkdownExtensions.push(gfmToMarkdown(settings));
|
|
14178
13644
|
}
|
|
14179
13645
|
|
|
13646
|
+
// src/components/svgs/sun.tsx
|
|
13647
|
+
import React2 from "react";
|
|
13648
|
+
var SunIcon = ({ width = 24, height = 24, className, ...props }) => {
|
|
13649
|
+
return /* @__PURE__ */ React2.createElement(
|
|
13650
|
+
"svg",
|
|
13651
|
+
{
|
|
13652
|
+
xmlns: "http://www.w3.org/2000/svg",
|
|
13653
|
+
width: "24",
|
|
13654
|
+
height: "24",
|
|
13655
|
+
viewBox: "0 0 24 24",
|
|
13656
|
+
fill: "none",
|
|
13657
|
+
stroke: "currentColor",
|
|
13658
|
+
"stroke-width": "2",
|
|
13659
|
+
"stroke-linecap": "round",
|
|
13660
|
+
"stroke-linejoin": "round",
|
|
13661
|
+
className,
|
|
13662
|
+
...props
|
|
13663
|
+
},
|
|
13664
|
+
/* @__PURE__ */ React2.createElement("circle", { cx: "12", cy: "12", r: "4" }),
|
|
13665
|
+
/* @__PURE__ */ React2.createElement("path", { d: "M12 2v2" }),
|
|
13666
|
+
/* @__PURE__ */ React2.createElement("path", { d: "M12 20v2" }),
|
|
13667
|
+
/* @__PURE__ */ React2.createElement("path", { d: "m4.93 4.93 1.41 1.41" }),
|
|
13668
|
+
/* @__PURE__ */ React2.createElement("path", { d: "m17.66 17.66 1.41 1.41" }),
|
|
13669
|
+
/* @__PURE__ */ React2.createElement("path", { d: "M2 12h2" }),
|
|
13670
|
+
/* @__PURE__ */ React2.createElement("path", { d: "M20 12h2" }),
|
|
13671
|
+
/* @__PURE__ */ React2.createElement("path", { d: "m6.34 17.66-1.41 1.41" }),
|
|
13672
|
+
/* @__PURE__ */ React2.createElement("path", { d: "m19.07 4.93-1.41 1.41" })
|
|
13673
|
+
);
|
|
13674
|
+
};
|
|
13675
|
+
var sun_default = SunIcon;
|
|
13676
|
+
|
|
13677
|
+
// src/components/svgs/moon.tsx
|
|
13678
|
+
import React3 from "react";
|
|
13679
|
+
var MoonIcon = ({ width = 24, height = 24, className, ...props }) => {
|
|
13680
|
+
return /* @__PURE__ */ React3.createElement(
|
|
13681
|
+
"svg",
|
|
13682
|
+
{
|
|
13683
|
+
xmlns: "http://www.w3.org/2000/svg",
|
|
13684
|
+
width: "24",
|
|
13685
|
+
height: "24",
|
|
13686
|
+
viewBox: "0 0 24 24",
|
|
13687
|
+
fill: "none",
|
|
13688
|
+
stroke: "currentColor",
|
|
13689
|
+
"stroke-width": "2",
|
|
13690
|
+
"stroke-linecap": "round",
|
|
13691
|
+
"stroke-linejoin": "round",
|
|
13692
|
+
className,
|
|
13693
|
+
...props
|
|
13694
|
+
},
|
|
13695
|
+
/* @__PURE__ */ React3.createElement("path", { d: "M20.985 12.486a9 9 0 1 1-9.473-9.472c.405-.022.617.46.402.803a6 6 0 0 0 8.268 8.268c.344-.215.825-.004.803.401" })
|
|
13696
|
+
);
|
|
13697
|
+
};
|
|
13698
|
+
var moon_default = MoonIcon;
|
|
13699
|
+
|
|
13700
|
+
// src/components/svgs/close.tsx
|
|
13701
|
+
import React4 from "react";
|
|
13702
|
+
var CloseIcon = ({ width = 24, height = 24, className, ...props }) => {
|
|
13703
|
+
return /* @__PURE__ */ React4.createElement(
|
|
13704
|
+
"svg",
|
|
13705
|
+
{
|
|
13706
|
+
xmlns: "http://www.w3.org/2000/svg",
|
|
13707
|
+
width: "24",
|
|
13708
|
+
height: "24",
|
|
13709
|
+
viewBox: "0 0 24 24",
|
|
13710
|
+
fill: "none",
|
|
13711
|
+
stroke: "currentColor",
|
|
13712
|
+
"stroke-width": "2",
|
|
13713
|
+
"stroke-linecap": "round",
|
|
13714
|
+
"stroke-linejoin": "round",
|
|
13715
|
+
className,
|
|
13716
|
+
...props
|
|
13717
|
+
},
|
|
13718
|
+
/* @__PURE__ */ React4.createElement("path", { d: "M18 6 6 18" }),
|
|
13719
|
+
/* @__PURE__ */ React4.createElement("path", { d: "m6 6 12 12" })
|
|
13720
|
+
);
|
|
13721
|
+
};
|
|
13722
|
+
var close_default = CloseIcon;
|
|
13723
|
+
|
|
13724
|
+
// src/components/svgs/phone-off.tsx
|
|
13725
|
+
import React5 from "react";
|
|
13726
|
+
var PhoneOffIcon = ({ width = 24, height = 24, className, ...props }) => {
|
|
13727
|
+
return /* @__PURE__ */ React5.createElement(
|
|
13728
|
+
"svg",
|
|
13729
|
+
{
|
|
13730
|
+
xmlns: "http://www.w3.org/2000/svg",
|
|
13731
|
+
width: "24",
|
|
13732
|
+
height: "24",
|
|
13733
|
+
viewBox: "0 0 24 24",
|
|
13734
|
+
fill: "none",
|
|
13735
|
+
stroke: "currentColor",
|
|
13736
|
+
"stroke-width": "2",
|
|
13737
|
+
"stroke-linecap": "round",
|
|
13738
|
+
"stroke-linejoin": "round",
|
|
13739
|
+
className,
|
|
13740
|
+
...props
|
|
13741
|
+
},
|
|
13742
|
+
/* @__PURE__ */ React5.createElement("path", { d: "M10.1 13.9a14 14 0 0 0 3.732 2.668 1 1 0 0 0 1.213-.303l.355-.465A2 2 0 0 1 17 15h3a2 2 0 0 1 2 2v3a2 2 0 0 1-2 2 18 18 0 0 1-12.728-5.272" }),
|
|
13743
|
+
/* @__PURE__ */ React5.createElement("path", { d: "M22 2 2 22" }),
|
|
13744
|
+
/* @__PURE__ */ React5.createElement("path", { d: "M4.76 13.582A18 18 0 0 1 2 4a2 2 0 0 1 2-2h3a2 2 0 0 1 2 2v3a2 2 0 0 1-.8 1.6l-.468.351a1 1 0 0 0-.292 1.233 14 14 0 0 0 .244.473" })
|
|
13745
|
+
);
|
|
13746
|
+
};
|
|
13747
|
+
var phone_off_default = PhoneOffIcon;
|
|
13748
|
+
|
|
14180
13749
|
// src/components/chat-popup.tsx
|
|
14181
13750
|
var ChatPopup = ({
|
|
14182
13751
|
isOpen,
|
|
@@ -14187,7 +13756,7 @@ var ChatPopup = ({
|
|
|
14187
13756
|
onSendText,
|
|
14188
13757
|
onEndCall,
|
|
14189
13758
|
messages,
|
|
14190
|
-
isConnected:
|
|
13759
|
+
isConnected: isConnected2,
|
|
14191
13760
|
micState,
|
|
14192
13761
|
error,
|
|
14193
13762
|
currentTheme = "dark",
|
|
@@ -14263,7 +13832,7 @@ var ChatPopup = ({
|
|
|
14263
13832
|
}
|
|
14264
13833
|
};
|
|
14265
13834
|
const positionStyle = getPositionStyle();
|
|
14266
|
-
return /* @__PURE__ */
|
|
13835
|
+
return /* @__PURE__ */ React6.createElement(
|
|
14267
13836
|
"div",
|
|
14268
13837
|
{
|
|
14269
13838
|
"data-cuekit-ignore": true,
|
|
@@ -14286,7 +13855,7 @@ var ChatPopup = ({
|
|
|
14286
13855
|
...positionStyle
|
|
14287
13856
|
}
|
|
14288
13857
|
},
|
|
14289
|
-
/* @__PURE__ */
|
|
13858
|
+
/* @__PURE__ */ React6.createElement(
|
|
14290
13859
|
"div",
|
|
14291
13860
|
{
|
|
14292
13861
|
style: {
|
|
@@ -14297,14 +13866,14 @@ var ChatPopup = ({
|
|
|
14297
13866
|
justifyContent: "space-between"
|
|
14298
13867
|
}
|
|
14299
13868
|
},
|
|
14300
|
-
/* @__PURE__ */
|
|
13869
|
+
/* @__PURE__ */ React6.createElement("div", { style: { display: "flex", alignItems: "center", gap: 0 } }, /* @__PURE__ */ React6.createElement(
|
|
14301
13870
|
"img",
|
|
14302
13871
|
{
|
|
14303
13872
|
src: "https://dashboard.cuekit.ai/_next/image?url=%2Fimages%2Fcuekit-logo-2.png&w=256&q=100",
|
|
14304
13873
|
alt: "Cuekit AI",
|
|
14305
13874
|
style: { width: 58, objectFit: "cover" }
|
|
14306
13875
|
}
|
|
14307
|
-
), /* @__PURE__ */
|
|
13876
|
+
), /* @__PURE__ */ React6.createElement(
|
|
14308
13877
|
"div",
|
|
14309
13878
|
{
|
|
14310
13879
|
style: {
|
|
@@ -14315,7 +13884,7 @@ var ChatPopup = ({
|
|
|
14315
13884
|
justifyContent: "center"
|
|
14316
13885
|
}
|
|
14317
13886
|
},
|
|
14318
|
-
/* @__PURE__ */
|
|
13887
|
+
/* @__PURE__ */ React6.createElement(
|
|
14319
13888
|
"span",
|
|
14320
13889
|
{
|
|
14321
13890
|
style: {
|
|
@@ -14332,7 +13901,7 @@ var ChatPopup = ({
|
|
|
14332
13901
|
},
|
|
14333
13902
|
"Cuekit.ai"
|
|
14334
13903
|
),
|
|
14335
|
-
/* @__PURE__ */
|
|
13904
|
+
/* @__PURE__ */ React6.createElement("div", { style: { display: "flex", flexDirection: "column", alignItems: "center", gap: 4 } }, /* @__PURE__ */ React6.createElement(
|
|
14336
13905
|
"div",
|
|
14337
13906
|
{
|
|
14338
13907
|
style: {
|
|
@@ -14348,7 +13917,7 @@ var ChatPopup = ({
|
|
|
14348
13917
|
fontWeight: "500"
|
|
14349
13918
|
}
|
|
14350
13919
|
},
|
|
14351
|
-
/* @__PURE__ */
|
|
13920
|
+
/* @__PURE__ */ React6.createElement(
|
|
14352
13921
|
"span",
|
|
14353
13922
|
{
|
|
14354
13923
|
style: {
|
|
@@ -14359,8 +13928,8 @@ var ChatPopup = ({
|
|
|
14359
13928
|
)
|
|
14360
13929
|
))
|
|
14361
13930
|
)),
|
|
14362
|
-
/* @__PURE__ */
|
|
14363
|
-
/* @__PURE__ */
|
|
13931
|
+
/* @__PURE__ */ React6.createElement("div", { style: { minWidth: 100, textAlign: "center" } }),
|
|
13932
|
+
/* @__PURE__ */ React6.createElement(
|
|
14364
13933
|
"div",
|
|
14365
13934
|
{
|
|
14366
13935
|
style: {
|
|
@@ -14372,7 +13941,7 @@ var ChatPopup = ({
|
|
|
14372
13941
|
top: 16
|
|
14373
13942
|
}
|
|
14374
13943
|
},
|
|
14375
|
-
onThemeToggle && /* @__PURE__ */
|
|
13944
|
+
onThemeToggle && /* @__PURE__ */ React6.createElement(
|
|
14376
13945
|
"button",
|
|
14377
13946
|
{
|
|
14378
13947
|
onClick: () => {
|
|
@@ -14402,8 +13971,8 @@ var ChatPopup = ({
|
|
|
14402
13971
|
"aria-label": "Toggle theme",
|
|
14403
13972
|
title: `Switch to ${currentTheme === "dark" ? "light" : "dark"} mode`
|
|
14404
13973
|
},
|
|
14405
|
-
currentTheme === "dark" ? /* @__PURE__ */
|
|
14406
|
-
|
|
13974
|
+
currentTheme === "dark" ? /* @__PURE__ */ React6.createElement(
|
|
13975
|
+
sun_default,
|
|
14407
13976
|
{
|
|
14408
13977
|
style: {
|
|
14409
13978
|
width: 16,
|
|
@@ -14412,8 +13981,8 @@ var ChatPopup = ({
|
|
|
14412
13981
|
animation: "themeToggleEnter 0.3s ease-in-out"
|
|
14413
13982
|
}
|
|
14414
13983
|
}
|
|
14415
|
-
) : /* @__PURE__ */
|
|
14416
|
-
|
|
13984
|
+
) : /* @__PURE__ */ React6.createElement(
|
|
13985
|
+
moon_default,
|
|
14417
13986
|
{
|
|
14418
13987
|
style: {
|
|
14419
13988
|
width: 16,
|
|
@@ -14424,7 +13993,7 @@ var ChatPopup = ({
|
|
|
14424
13993
|
}
|
|
14425
13994
|
)
|
|
14426
13995
|
),
|
|
14427
|
-
/* @__PURE__ */
|
|
13996
|
+
/* @__PURE__ */ React6.createElement(
|
|
14428
13997
|
"button",
|
|
14429
13998
|
{
|
|
14430
13999
|
onClick: onMinimize,
|
|
@@ -14451,11 +14020,11 @@ var ChatPopup = ({
|
|
|
14451
14020
|
"aria-label": "Minimize",
|
|
14452
14021
|
title: "Minimize chat"
|
|
14453
14022
|
},
|
|
14454
|
-
/* @__PURE__ */
|
|
14023
|
+
/* @__PURE__ */ React6.createElement(close_default, { style: { width: 16, height: 16, color: "hsl(var(--voice-text-muted))" } })
|
|
14455
14024
|
)
|
|
14456
14025
|
)
|
|
14457
14026
|
),
|
|
14458
|
-
/* @__PURE__ */
|
|
14027
|
+
/* @__PURE__ */ React6.createElement(
|
|
14459
14028
|
"div",
|
|
14460
14029
|
{
|
|
14461
14030
|
style: {
|
|
@@ -14468,7 +14037,7 @@ var ChatPopup = ({
|
|
|
14468
14037
|
color: "hsl(var(--voice-text))"
|
|
14469
14038
|
}
|
|
14470
14039
|
},
|
|
14471
|
-
messages.length === 0 ? /* @__PURE__ */
|
|
14040
|
+
messages.length === 0 ? /* @__PURE__ */ React6.createElement(
|
|
14472
14041
|
"div",
|
|
14473
14042
|
{
|
|
14474
14043
|
style: {
|
|
@@ -14478,7 +14047,7 @@ var ChatPopup = ({
|
|
|
14478
14047
|
}
|
|
14479
14048
|
},
|
|
14480
14049
|
"Start a conversation with CueKit AI"
|
|
14481
|
-
) : messages.map((message, index2) => /* @__PURE__ */
|
|
14050
|
+
) : messages.map((message, index2) => /* @__PURE__ */ React6.createElement(
|
|
14482
14051
|
"div",
|
|
14483
14052
|
{
|
|
14484
14053
|
key: index2,
|
|
@@ -14492,7 +14061,7 @@ var ChatPopup = ({
|
|
|
14492
14061
|
justifyContent: message.sender === "user" ? "flex-end" : "flex-start"
|
|
14493
14062
|
}
|
|
14494
14063
|
},
|
|
14495
|
-
message.sender === "assistant" && /* @__PURE__ */
|
|
14064
|
+
message.sender === "assistant" && /* @__PURE__ */ React6.createElement(
|
|
14496
14065
|
"div",
|
|
14497
14066
|
{
|
|
14498
14067
|
style: {
|
|
@@ -14507,7 +14076,7 @@ var ChatPopup = ({
|
|
|
14507
14076
|
overflow: "hidden"
|
|
14508
14077
|
}
|
|
14509
14078
|
},
|
|
14510
|
-
/* @__PURE__ */
|
|
14079
|
+
/* @__PURE__ */ React6.createElement(
|
|
14511
14080
|
"img",
|
|
14512
14081
|
{
|
|
14513
14082
|
src: "https://dashboard.cuekit.ai/_next/image?url=%2Fimages%2Fcuekit-logo-2.png&w=256&q=100",
|
|
@@ -14521,7 +14090,7 @@ var ChatPopup = ({
|
|
|
14521
14090
|
}
|
|
14522
14091
|
)
|
|
14523
14092
|
),
|
|
14524
|
-
/* @__PURE__ */
|
|
14093
|
+
/* @__PURE__ */ React6.createElement(
|
|
14525
14094
|
"div",
|
|
14526
14095
|
{
|
|
14527
14096
|
style: {
|
|
@@ -14532,7 +14101,7 @@ var ChatPopup = ({
|
|
|
14532
14101
|
flex: 1
|
|
14533
14102
|
}
|
|
14534
14103
|
},
|
|
14535
|
-
/* @__PURE__ */
|
|
14104
|
+
/* @__PURE__ */ React6.createElement(
|
|
14536
14105
|
"div",
|
|
14537
14106
|
{
|
|
14538
14107
|
style: {
|
|
@@ -14550,12 +14119,12 @@ var ChatPopup = ({
|
|
|
14550
14119
|
marginLeft: message.sender === "user" ? "auto" : 0
|
|
14551
14120
|
}
|
|
14552
14121
|
},
|
|
14553
|
-
/* @__PURE__ */
|
|
14122
|
+
/* @__PURE__ */ React6.createElement("div", null, /* @__PURE__ */ React6.createElement(
|
|
14554
14123
|
Markdown,
|
|
14555
14124
|
{
|
|
14556
14125
|
remarkPlugins: [remarkGfm],
|
|
14557
14126
|
components: {
|
|
14558
|
-
p: ({ children }) => /* @__PURE__ */
|
|
14127
|
+
p: ({ children }) => /* @__PURE__ */ React6.createElement(
|
|
14559
14128
|
"p",
|
|
14560
14129
|
{
|
|
14561
14130
|
style: {
|
|
@@ -14566,7 +14135,7 @@ var ChatPopup = ({
|
|
|
14566
14135
|
},
|
|
14567
14136
|
children
|
|
14568
14137
|
),
|
|
14569
|
-
h1: ({ children }) => /* @__PURE__ */
|
|
14138
|
+
h1: ({ children }) => /* @__PURE__ */ React6.createElement(
|
|
14570
14139
|
"h1",
|
|
14571
14140
|
{
|
|
14572
14141
|
style: {
|
|
@@ -14578,7 +14147,7 @@ var ChatPopup = ({
|
|
|
14578
14147
|
},
|
|
14579
14148
|
children
|
|
14580
14149
|
),
|
|
14581
|
-
h2: ({ children }) => /* @__PURE__ */
|
|
14150
|
+
h2: ({ children }) => /* @__PURE__ */ React6.createElement(
|
|
14582
14151
|
"h2",
|
|
14583
14152
|
{
|
|
14584
14153
|
style: {
|
|
@@ -14590,7 +14159,7 @@ var ChatPopup = ({
|
|
|
14590
14159
|
},
|
|
14591
14160
|
children
|
|
14592
14161
|
),
|
|
14593
|
-
h3: ({ children }) => /* @__PURE__ */
|
|
14162
|
+
h3: ({ children }) => /* @__PURE__ */ React6.createElement(
|
|
14594
14163
|
"h3",
|
|
14595
14164
|
{
|
|
14596
14165
|
style: {
|
|
@@ -14602,7 +14171,7 @@ var ChatPopup = ({
|
|
|
14602
14171
|
},
|
|
14603
14172
|
children
|
|
14604
14173
|
),
|
|
14605
|
-
ul: ({ children }) => /* @__PURE__ */
|
|
14174
|
+
ul: ({ children }) => /* @__PURE__ */ React6.createElement(
|
|
14606
14175
|
"ul",
|
|
14607
14176
|
{
|
|
14608
14177
|
style: {
|
|
@@ -14614,7 +14183,7 @@ var ChatPopup = ({
|
|
|
14614
14183
|
},
|
|
14615
14184
|
children
|
|
14616
14185
|
),
|
|
14617
|
-
ol: ({ children }) => /* @__PURE__ */
|
|
14186
|
+
ol: ({ children }) => /* @__PURE__ */ React6.createElement(
|
|
14618
14187
|
"ol",
|
|
14619
14188
|
{
|
|
14620
14189
|
style: {
|
|
@@ -14626,7 +14195,7 @@ var ChatPopup = ({
|
|
|
14626
14195
|
},
|
|
14627
14196
|
children
|
|
14628
14197
|
),
|
|
14629
|
-
li: ({ children }) => /* @__PURE__ */
|
|
14198
|
+
li: ({ children }) => /* @__PURE__ */ React6.createElement(
|
|
14630
14199
|
"li",
|
|
14631
14200
|
{
|
|
14632
14201
|
style: {
|
|
@@ -14637,7 +14206,7 @@ var ChatPopup = ({
|
|
|
14637
14206
|
},
|
|
14638
14207
|
children
|
|
14639
14208
|
),
|
|
14640
|
-
strong: ({ children }) => /* @__PURE__ */
|
|
14209
|
+
strong: ({ children }) => /* @__PURE__ */ React6.createElement(
|
|
14641
14210
|
"strong",
|
|
14642
14211
|
{
|
|
14643
14212
|
style: {
|
|
@@ -14648,7 +14217,7 @@ var ChatPopup = ({
|
|
|
14648
14217
|
},
|
|
14649
14218
|
children
|
|
14650
14219
|
),
|
|
14651
|
-
em: ({ children }) => /* @__PURE__ */
|
|
14220
|
+
em: ({ children }) => /* @__PURE__ */ React6.createElement(
|
|
14652
14221
|
"em",
|
|
14653
14222
|
{
|
|
14654
14223
|
style: {
|
|
@@ -14659,7 +14228,7 @@ var ChatPopup = ({
|
|
|
14659
14228
|
},
|
|
14660
14229
|
children
|
|
14661
14230
|
),
|
|
14662
|
-
code: ({ children }) => /* @__PURE__ */
|
|
14231
|
+
code: ({ children }) => /* @__PURE__ */ React6.createElement(
|
|
14663
14232
|
"code",
|
|
14664
14233
|
{
|
|
14665
14234
|
style: {
|
|
@@ -14672,7 +14241,7 @@ var ChatPopup = ({
|
|
|
14672
14241
|
},
|
|
14673
14242
|
children
|
|
14674
14243
|
),
|
|
14675
|
-
pre: ({ children }) => /* @__PURE__ */
|
|
14244
|
+
pre: ({ children }) => /* @__PURE__ */ React6.createElement(
|
|
14676
14245
|
"pre",
|
|
14677
14246
|
{
|
|
14678
14247
|
style: {
|
|
@@ -14687,7 +14256,7 @@ var ChatPopup = ({
|
|
|
14687
14256
|
},
|
|
14688
14257
|
children
|
|
14689
14258
|
),
|
|
14690
|
-
blockquote: ({ children }) => /* @__PURE__ */
|
|
14259
|
+
blockquote: ({ children }) => /* @__PURE__ */ React6.createElement(
|
|
14691
14260
|
"blockquote",
|
|
14692
14261
|
{
|
|
14693
14262
|
style: {
|
|
@@ -14706,7 +14275,7 @@ var ChatPopup = ({
|
|
|
14706
14275
|
message.text
|
|
14707
14276
|
))
|
|
14708
14277
|
),
|
|
14709
|
-
message.sender === "user" && /* @__PURE__ */
|
|
14278
|
+
message.sender === "user" && /* @__PURE__ */ React6.createElement(
|
|
14710
14279
|
"div",
|
|
14711
14280
|
{
|
|
14712
14281
|
style: {
|
|
@@ -14727,9 +14296,9 @@ var ChatPopup = ({
|
|
|
14727
14296
|
)
|
|
14728
14297
|
)
|
|
14729
14298
|
)),
|
|
14730
|
-
/* @__PURE__ */
|
|
14299
|
+
/* @__PURE__ */ React6.createElement("div", { ref: messagesEndRef })
|
|
14731
14300
|
),
|
|
14732
|
-
/* @__PURE__ */
|
|
14301
|
+
/* @__PURE__ */ React6.createElement(
|
|
14733
14302
|
"div",
|
|
14734
14303
|
{
|
|
14735
14304
|
style: {
|
|
@@ -14738,7 +14307,7 @@ var ChatPopup = ({
|
|
|
14738
14307
|
background: "hsl(var(--voice-bg))"
|
|
14739
14308
|
}
|
|
14740
14309
|
},
|
|
14741
|
-
/* @__PURE__ */
|
|
14310
|
+
/* @__PURE__ */ React6.createElement(
|
|
14742
14311
|
"form",
|
|
14743
14312
|
{
|
|
14744
14313
|
onSubmit: (e2) => {
|
|
@@ -14747,7 +14316,7 @@ var ChatPopup = ({
|
|
|
14747
14316
|
},
|
|
14748
14317
|
style: { display: "flex", alignItems: "center", gap: 8, margin: 0 }
|
|
14749
14318
|
},
|
|
14750
|
-
/* @__PURE__ */
|
|
14319
|
+
/* @__PURE__ */ React6.createElement(
|
|
14751
14320
|
"input",
|
|
14752
14321
|
{
|
|
14753
14322
|
type: "text",
|
|
@@ -14774,7 +14343,7 @@ var ChatPopup = ({
|
|
|
14774
14343
|
}
|
|
14775
14344
|
}
|
|
14776
14345
|
),
|
|
14777
|
-
|
|
14346
|
+
isConnected2 && onEndCall && /* @__PURE__ */ React6.createElement(
|
|
14778
14347
|
"button",
|
|
14779
14348
|
{
|
|
14780
14349
|
type: "submit",
|
|
@@ -14793,7 +14362,7 @@ var ChatPopup = ({
|
|
|
14793
14362
|
cursor: "pointer"
|
|
14794
14363
|
}
|
|
14795
14364
|
},
|
|
14796
|
-
/* @__PURE__ */
|
|
14365
|
+
/* @__PURE__ */ React6.createElement(phone_off_default, { style: { width: 16, height: 16 } })
|
|
14797
14366
|
)
|
|
14798
14367
|
)
|
|
14799
14368
|
)
|
|
@@ -14801,7 +14370,7 @@ var ChatPopup = ({
|
|
|
14801
14370
|
};
|
|
14802
14371
|
|
|
14803
14372
|
// src/components/border-glow.tsx
|
|
14804
|
-
import
|
|
14373
|
+
import React7 from "react";
|
|
14805
14374
|
var BorderGlow = ({ isActive }) => {
|
|
14806
14375
|
if (!isActive) return null;
|
|
14807
14376
|
const styles = {
|
|
@@ -14928,7 +14497,7 @@ var BorderGlow = ({ isActive }) => {
|
|
|
14928
14497
|
opacity: 0.6
|
|
14929
14498
|
}
|
|
14930
14499
|
};
|
|
14931
|
-
return /* @__PURE__ */
|
|
14500
|
+
return /* @__PURE__ */ React7.createElement(React7.Fragment, null, /* @__PURE__ */ React7.createElement("style", null, `
|
|
14932
14501
|
@keyframes borderPulse {
|
|
14933
14502
|
0%, 100% {
|
|
14934
14503
|
opacity: 1;
|
|
@@ -14937,12 +14506,12 @@ var BorderGlow = ({ isActive }) => {
|
|
|
14937
14506
|
opacity: 0.5;
|
|
14938
14507
|
}
|
|
14939
14508
|
}
|
|
14940
|
-
`), /* @__PURE__ */
|
|
14509
|
+
`), /* @__PURE__ */ React7.createElement("div", { style: styles.container }, /* @__PURE__ */ React7.createElement("div", { style: styles.rightBorder1 }), /* @__PURE__ */ React7.createElement("div", { style: styles.rightBorder2 }), /* @__PURE__ */ React7.createElement("div", { style: styles.rightBorder3 }), /* @__PURE__ */ React7.createElement("div", { style: styles.leftBorder1 }), /* @__PURE__ */ React7.createElement("div", { style: styles.leftBorder2 }), /* @__PURE__ */ React7.createElement("div", { style: styles.leftBorder3 }), /* @__PURE__ */ React7.createElement("div", { style: styles.cornerTopLeft }), /* @__PURE__ */ React7.createElement("div", { style: styles.cornerTopRight }), /* @__PURE__ */ React7.createElement("div", { style: styles.cornerBottomRight }), /* @__PURE__ */ React7.createElement("div", { style: styles.cornerBottomLeft })));
|
|
14941
14510
|
};
|
|
14942
14511
|
var border_glow_default = BorderGlow;
|
|
14943
14512
|
|
|
14944
14513
|
// src/components/voice-intensity-visualizer.tsx
|
|
14945
|
-
import
|
|
14514
|
+
import React8, { useEffect as useEffect9, useState as useState9 } from "react";
|
|
14946
14515
|
|
|
14947
14516
|
// node_modules/@livekit/components-react/dist/hooks-C2Bp5v2q.mjs
|
|
14948
14517
|
import * as r from "react";
|
|
@@ -16772,7 +16341,7 @@ var VoiceIntensityWithRoom = (props) => {
|
|
|
16772
16341
|
if (!room) {
|
|
16773
16342
|
return null;
|
|
16774
16343
|
}
|
|
16775
|
-
return /* @__PURE__ */
|
|
16344
|
+
return /* @__PURE__ */ React8.createElement(Wn.Provider, { value: room }, /* @__PURE__ */ React8.createElement(VoiceIntensityBars, { ...props }));
|
|
16776
16345
|
};
|
|
16777
16346
|
var VoiceIntensityBars = ({
|
|
16778
16347
|
isActive,
|
|
@@ -16835,7 +16404,7 @@ var VoiceIntensityBars = ({
|
|
|
16835
16404
|
if (!trackRef) {
|
|
16836
16405
|
return null;
|
|
16837
16406
|
}
|
|
16838
|
-
return /* @__PURE__ */
|
|
16407
|
+
return /* @__PURE__ */ React8.createElement(
|
|
16839
16408
|
"div",
|
|
16840
16409
|
{
|
|
16841
16410
|
className: `voice-intensity-visualizer ${className}`,
|
|
@@ -16852,28 +16421,81 @@ var VoiceIntensityBars = ({
|
|
|
16852
16421
|
pointerEvents: "none"
|
|
16853
16422
|
}
|
|
16854
16423
|
},
|
|
16855
|
-
/* @__PURE__ */
|
|
16424
|
+
/* @__PURE__ */ React8.createElement(
|
|
16856
16425
|
Xt,
|
|
16857
16426
|
{
|
|
16858
16427
|
barCount,
|
|
16859
16428
|
state: "speaking",
|
|
16860
16429
|
options: { minHeight },
|
|
16861
16430
|
trackRef,
|
|
16862
|
-
|
|
16431
|
+
style: {
|
|
16432
|
+
display: "flex",
|
|
16433
|
+
alignItems: "center",
|
|
16434
|
+
justifyContent: "center",
|
|
16435
|
+
gap: "0.25rem"
|
|
16436
|
+
}
|
|
16863
16437
|
},
|
|
16864
|
-
/* @__PURE__ */
|
|
16438
|
+
/* @__PURE__ */ React8.createElement("span", { className: "cuekit-voice-intensity-bar" })
|
|
16865
16439
|
)
|
|
16866
16440
|
);
|
|
16867
16441
|
};
|
|
16868
16442
|
var VoiceIntensityVisualizer = VoiceIntensityWithRoom;
|
|
16869
16443
|
|
|
16444
|
+
// src/components/svgs/mic.tsx
|
|
16445
|
+
import React9 from "react";
|
|
16446
|
+
var MicIcon = ({ width = 24, height = 24, className, ...props }) => {
|
|
16447
|
+
return /* @__PURE__ */ React9.createElement(
|
|
16448
|
+
"svg",
|
|
16449
|
+
{
|
|
16450
|
+
xmlns: "http://www.w3.org/2000/svg",
|
|
16451
|
+
width,
|
|
16452
|
+
height,
|
|
16453
|
+
viewBox: "0 0 24 24",
|
|
16454
|
+
fill: "none",
|
|
16455
|
+
stroke: "currentColor",
|
|
16456
|
+
"stroke-width": "2",
|
|
16457
|
+
"stroke-linecap": "round",
|
|
16458
|
+
"stroke-linejoin": "round",
|
|
16459
|
+
className,
|
|
16460
|
+
...props
|
|
16461
|
+
},
|
|
16462
|
+
/* @__PURE__ */ React9.createElement("path", { d: "M12 19v3" }),
|
|
16463
|
+
/* @__PURE__ */ React9.createElement("path", { d: "M19 10v2a7 7 0 0 1-14 0v-2" }),
|
|
16464
|
+
/* @__PURE__ */ React9.createElement("rect", { x: "9", y: "2", width: "6", height: "13", rx: "3" })
|
|
16465
|
+
);
|
|
16466
|
+
};
|
|
16467
|
+
var mic_default = MicIcon;
|
|
16468
|
+
|
|
16469
|
+
// src/components/svgs/loader.tsx
|
|
16470
|
+
import React10 from "react";
|
|
16471
|
+
var LoaderIcon = ({ width = 24, height = 24, className, ...props }) => {
|
|
16472
|
+
return /* @__PURE__ */ React10.createElement(
|
|
16473
|
+
"svg",
|
|
16474
|
+
{
|
|
16475
|
+
xmlns: "http://www.w3.org/2000/svg",
|
|
16476
|
+
width: "24",
|
|
16477
|
+
height: "24",
|
|
16478
|
+
viewBox: "0 0 24 24",
|
|
16479
|
+
fill: "none",
|
|
16480
|
+
stroke: "currentColor",
|
|
16481
|
+
"stroke-width": "2",
|
|
16482
|
+
"stroke-linecap": "round",
|
|
16483
|
+
"stroke-linejoin": "round",
|
|
16484
|
+
className,
|
|
16485
|
+
...props
|
|
16486
|
+
},
|
|
16487
|
+
/* @__PURE__ */ React10.createElement("path", { d: "M21 12a9 9 0 1 1-6.219-8.56" })
|
|
16488
|
+
);
|
|
16489
|
+
};
|
|
16490
|
+
var loader_default = LoaderIcon;
|
|
16491
|
+
|
|
16870
16492
|
// src/components/mic-button.tsx
|
|
16871
16493
|
var chatState = {
|
|
16872
16494
|
isOpen: false,
|
|
16873
16495
|
isMinimized: false
|
|
16874
16496
|
};
|
|
16875
16497
|
var VoiceIntensityWrapper = ({ active, buttonSize }) => {
|
|
16876
|
-
return /* @__PURE__ */
|
|
16498
|
+
return /* @__PURE__ */ React11.createElement(
|
|
16877
16499
|
VoiceIntensityVisualizer,
|
|
16878
16500
|
{
|
|
16879
16501
|
isActive: active,
|
|
@@ -16911,13 +16533,12 @@ var MicButton = ({
|
|
|
16911
16533
|
const aiSpeechTimeoutRef = useRef7(null);
|
|
16912
16534
|
const activeAITracksRef = useRef7(/* @__PURE__ */ new Set());
|
|
16913
16535
|
const {
|
|
16914
|
-
isConnected:
|
|
16536
|
+
isConnected: isConnected2,
|
|
16915
16537
|
isConnecting,
|
|
16916
16538
|
error: voiceError,
|
|
16917
16539
|
connect: voiceConnect,
|
|
16918
16540
|
disconnect: voiceDisconnect,
|
|
16919
16541
|
sendUserCommand: sendUserCommand2,
|
|
16920
|
-
lastActionEvent,
|
|
16921
16542
|
messages: messageManagerMessages,
|
|
16922
16543
|
micState,
|
|
16923
16544
|
setMicState,
|
|
@@ -16997,8 +16618,8 @@ var MicButton = ({
|
|
|
16997
16618
|
console.log("\u{1F3A4} MicButton: Current active AI tracks:", Array.from(activeAITracksRef.current));
|
|
16998
16619
|
console.log("\u{1F3A4} MicButton: Current status:", status);
|
|
16999
16620
|
console.log("\u{1F3A4} MicButton: Current mic state:", micState);
|
|
17000
|
-
console.log("\u{1F3A4} MicButton: Is listening:",
|
|
17001
|
-
console.log("\u{1F3A4} MicButton: Is connected:",
|
|
16621
|
+
console.log("\u{1F3A4} MicButton: Is listening:", isConnected2);
|
|
16622
|
+
console.log("\u{1F3A4} MicButton: Is connected:", isConnected2);
|
|
17002
16623
|
if (isSpeaking && trackId) {
|
|
17003
16624
|
console.log("\u{1F3A4} MicButton: ===== AI SPEECH START =====");
|
|
17004
16625
|
console.log("\u{1F3A4} MicButton: Adding track to active set:", trackId);
|
|
@@ -17053,7 +16674,7 @@ var MicButton = ({
|
|
|
17053
16674
|
console.log("\u{1F3A4} MicButton: - Status:", status);
|
|
17054
16675
|
console.log("\u{1F3A4} MicButton: ================================");
|
|
17055
16676
|
},
|
|
17056
|
-
[status, micState,
|
|
16677
|
+
[status, micState, isConnected2]
|
|
17057
16678
|
);
|
|
17058
16679
|
useEffect10(() => {
|
|
17059
16680
|
if (audioContainerRef.current) {
|
|
@@ -17066,10 +16687,9 @@ var MicButton = ({
|
|
|
17066
16687
|
}
|
|
17067
16688
|
};
|
|
17068
16689
|
}, [handleAISpeech]);
|
|
17069
|
-
const isListening =
|
|
17070
|
-
const
|
|
17071
|
-
|
|
17072
|
-
if (!isConnected4) {
|
|
16690
|
+
const isListening = isConnected2;
|
|
16691
|
+
const getUserFriendlyStatus = (micState2, isConnected3) => {
|
|
16692
|
+
if (!isConnected3) {
|
|
17073
16693
|
return "Connecting...";
|
|
17074
16694
|
}
|
|
17075
16695
|
if (status && !status.includes("error") && !status.includes("failed") && !status.includes("Connection error") && !status.includes("Unable to")) {
|
|
@@ -17079,28 +16699,28 @@ var MicButton = ({
|
|
|
17079
16699
|
if (micState2 === "thinking") return "Thinking...";
|
|
17080
16700
|
if (micState2 === "replying") return "Responding...";
|
|
17081
16701
|
if (micState2 === "idle") {
|
|
17082
|
-
if (
|
|
16702
|
+
if (isConnected3) return "Listening...";
|
|
17083
16703
|
return "Connecting...";
|
|
17084
16704
|
}
|
|
17085
|
-
return
|
|
16705
|
+
return isConnected3 ? "Ready" : "Connecting...";
|
|
17086
16706
|
};
|
|
17087
16707
|
useEffect10(() => {
|
|
17088
|
-
if (
|
|
16708
|
+
if (isConnected2) {
|
|
17089
16709
|
console.log("\u{1F3A4} MicButton: WebRTC and SSE connections established - ready for commands");
|
|
17090
16710
|
} else {
|
|
17091
16711
|
console.log("\u{1F3A4} MicButton: WebRTC not yet connected - ignoring speech");
|
|
17092
16712
|
}
|
|
17093
|
-
}, [
|
|
16713
|
+
}, [isConnected2]);
|
|
17094
16714
|
useEffect10(() => {
|
|
17095
16715
|
console.log("\u{1F3A4} MicButton: Auto-open check:", {
|
|
17096
|
-
isConnected:
|
|
16716
|
+
isConnected: isConnected2,
|
|
17097
16717
|
chatIsOpen: isChatOpen
|
|
17098
16718
|
});
|
|
17099
|
-
if (
|
|
16719
|
+
if (isConnected2 && !isChatOpen) {
|
|
17100
16720
|
console.log("\u{1F3A4} MicButton: Auto-opening chat popup");
|
|
17101
16721
|
openChat();
|
|
17102
16722
|
}
|
|
17103
|
-
}, [
|
|
16723
|
+
}, [isConnected2, isChatOpen, openChat]);
|
|
17104
16724
|
useEffect10(() => {
|
|
17105
16725
|
if (messageManagerMessages.length > 0 && !isChatOpen) {
|
|
17106
16726
|
console.log("\u{1F3A4} MicButton: Auto-opening chat popup due to messages");
|
|
@@ -17108,7 +16728,7 @@ var MicButton = ({
|
|
|
17108
16728
|
}
|
|
17109
16729
|
}, [messageManagerMessages.length, isChatOpen, openChat]);
|
|
17110
16730
|
const handleMicClick = useCallback5(() => {
|
|
17111
|
-
const shouldStop = micState === "listening" &&
|
|
16731
|
+
const shouldStop = micState === "listening" && isConnected2;
|
|
17112
16732
|
if (shouldStop) {
|
|
17113
16733
|
console.log("\u{1F3A4} MicButton: User wants to stop - closing everything");
|
|
17114
16734
|
voiceDisconnect().then(() => {
|
|
@@ -17133,7 +16753,7 @@ var MicButton = ({
|
|
|
17133
16753
|
}
|
|
17134
16754
|
}, [
|
|
17135
16755
|
micState,
|
|
17136
|
-
|
|
16756
|
+
isConnected2,
|
|
17137
16757
|
voiceDisconnect,
|
|
17138
16758
|
voiceConnect,
|
|
17139
16759
|
apiKey,
|
|
@@ -17141,19 +16761,6 @@ var MicButton = ({
|
|
|
17141
16761
|
openChat,
|
|
17142
16762
|
showBorderGlow
|
|
17143
16763
|
]);
|
|
17144
|
-
useEffect10(() => {
|
|
17145
|
-
if (!isConnected3) {
|
|
17146
|
-
return;
|
|
17147
|
-
}
|
|
17148
|
-
if (transcript && transcript.trim() && !aiSpeakingRef.current) {
|
|
17149
|
-
console.log("\u{1F3A4} MicButton: Processing new transcript:", transcript);
|
|
17150
|
-
sendUserCommand2(transcript).then(() => {
|
|
17151
|
-
console.log("\u{1F3A4} MicButton: User command sent successfully");
|
|
17152
|
-
}).catch((error) => {
|
|
17153
|
-
console.error("\u{1F3A4} MicButton: Failed to send user command:", error);
|
|
17154
|
-
});
|
|
17155
|
-
}
|
|
17156
|
-
}, [transcript, isConnected3, sendUserCommand2]);
|
|
17157
16764
|
const handleSendText = async (textToSend) => {
|
|
17158
16765
|
console.log("\u{1F3A4} MicButton: handleSendText called with:", textToSend);
|
|
17159
16766
|
setMicState("thinking");
|
|
@@ -17161,7 +16768,7 @@ var MicButton = ({
|
|
|
17161
16768
|
if (!isChatOpen) {
|
|
17162
16769
|
openChat();
|
|
17163
16770
|
}
|
|
17164
|
-
if (
|
|
16771
|
+
if (isConnected2) {
|
|
17165
16772
|
console.log("\u{1F3A4} MicButton: Sending via WebRTC");
|
|
17166
16773
|
try {
|
|
17167
16774
|
await sendUserCommand2(textToSend);
|
|
@@ -17204,7 +16811,7 @@ var MicButton = ({
|
|
|
17204
16811
|
...imageStyle
|
|
17205
16812
|
};
|
|
17206
16813
|
const animatedImageStyle = micState === "thinking" ? { ...baseImageStyle, animation: "spin 1s linear infinite" } : micState === "replying" ? { ...baseImageStyle, animation: "pulse 2s cubic-bezier(0.4, 0, 0.6, 1) infinite" } : baseImageStyle;
|
|
17207
|
-
return /* @__PURE__ */
|
|
16814
|
+
return /* @__PURE__ */ React11.createElement("img", { src: imageSource, alt: "Voice Assistant", style: animatedImageStyle });
|
|
17208
16815
|
}
|
|
17209
16816
|
const iconStyle = {
|
|
17210
16817
|
width: `100%`,
|
|
@@ -17214,13 +16821,13 @@ var MicButton = ({
|
|
|
17214
16821
|
};
|
|
17215
16822
|
switch (micState) {
|
|
17216
16823
|
case "thinking":
|
|
17217
|
-
return /* @__PURE__ */
|
|
16824
|
+
return /* @__PURE__ */ React11.createElement(loader_default, { style: { ...iconStyle, animation: "spin 1s linear infinite" } });
|
|
17218
16825
|
case "replying":
|
|
17219
|
-
return /* @__PURE__ */
|
|
16826
|
+
return /* @__PURE__ */ React11.createElement(VoiceIntensityWrapper, { active: true, buttonSize });
|
|
17220
16827
|
case "listening":
|
|
17221
|
-
return /* @__PURE__ */
|
|
16828
|
+
return /* @__PURE__ */ React11.createElement(VoiceIntensityWrapper, { active: true, buttonSize });
|
|
17222
16829
|
default:
|
|
17223
|
-
return /* @__PURE__ */
|
|
16830
|
+
return /* @__PURE__ */ React11.createElement(mic_default, { style: iconStyle });
|
|
17224
16831
|
}
|
|
17225
16832
|
};
|
|
17226
16833
|
const getPositionStyle = () => {
|
|
@@ -17300,7 +16907,7 @@ var MicButton = ({
|
|
|
17300
16907
|
}
|
|
17301
16908
|
return baseStyle;
|
|
17302
16909
|
};
|
|
17303
|
-
return /* @__PURE__ */
|
|
16910
|
+
return /* @__PURE__ */ React11.createElement(React11.Fragment, null, /* @__PURE__ */ React11.createElement("div", { "data-cuekit-ignore": true, style: { ...buttonStyles.container, ...getPositionStyle() } }, /* @__PURE__ */ React11.createElement("div", { style: { display: "flex", flexDirection: "column", alignItems: "center", gap: "8px" } }, /* @__PURE__ */ React11.createElement(
|
|
17304
16911
|
"button",
|
|
17305
16912
|
{
|
|
17306
16913
|
"data-testid": "ignore",
|
|
@@ -17321,8 +16928,8 @@ var MicButton = ({
|
|
|
17321
16928
|
},
|
|
17322
16929
|
"aria-label": micState === "thinking" ? "Processing..." : micState === "replying" ? "AI is responding..." : isListening ? "Stop listening" : "Start listening"
|
|
17323
16930
|
},
|
|
17324
|
-
/* @__PURE__ */
|
|
17325
|
-
), hasText && text7 && /* @__PURE__ */
|
|
16931
|
+
/* @__PURE__ */ React11.createElement("div", { style: buttonStyles.iconContainer }, getIcon())
|
|
16932
|
+
), hasText && text7 && /* @__PURE__ */ React11.createElement(
|
|
17326
16933
|
"div",
|
|
17327
16934
|
{
|
|
17328
16935
|
style: {
|
|
@@ -17343,8 +16950,8 @@ var MicButton = ({
|
|
|
17343
16950
|
...textStyle
|
|
17344
16951
|
}
|
|
17345
16952
|
},
|
|
17346
|
-
/* @__PURE__ */
|
|
17347
|
-
))), /* @__PURE__ */
|
|
16953
|
+
/* @__PURE__ */ React11.createElement("span", null, text7)
|
|
16954
|
+
))), /* @__PURE__ */ React11.createElement(
|
|
17348
16955
|
ChatPopup,
|
|
17349
16956
|
{
|
|
17350
16957
|
isOpen: isChatOpen,
|
|
@@ -17358,16 +16965,16 @@ var MicButton = ({
|
|
|
17358
16965
|
text: msg.text,
|
|
17359
16966
|
sender: msg.role === "ai" ? "assistant" : "user"
|
|
17360
16967
|
})),
|
|
17361
|
-
isConnected:
|
|
16968
|
+
isConnected: isConnected2 ?? false,
|
|
17362
16969
|
micState,
|
|
17363
16970
|
participants,
|
|
17364
16971
|
error: voiceError,
|
|
17365
16972
|
currentTheme,
|
|
17366
16973
|
onThemeToggle: setCurrentTheme,
|
|
17367
|
-
status: getUserFriendlyStatus(micState,
|
|
16974
|
+
status: getUserFriendlyStatus(micState, isConnected2 ?? false),
|
|
17368
16975
|
anchor: { position: screenPosition, bottom: bottomSpace, size: buttonSize }
|
|
17369
16976
|
}
|
|
17370
|
-
), isChatOpen && isChatMinimized && /* @__PURE__ */
|
|
16977
|
+
), isChatOpen && isChatMinimized && /* @__PURE__ */ React11.createElement(
|
|
17371
16978
|
"button",
|
|
17372
16979
|
{
|
|
17373
16980
|
onClick: restoreChat,
|
|
@@ -17388,8 +16995,8 @@ var MicButton = ({
|
|
|
17388
16995
|
className: `cuekit-voice-popup ${currentTheme === "dark" ? "cuekit-dark" : ""}`,
|
|
17389
16996
|
"aria-label": "Open chat"
|
|
17390
16997
|
},
|
|
17391
|
-
/* @__PURE__ */
|
|
17392
|
-
), /* @__PURE__ */
|
|
16998
|
+
/* @__PURE__ */ React11.createElement("span", { style: { fontSize: 12, fontWeight: 600, color: "hsl(var(--voice-text))" } }, "Open chat")
|
|
16999
|
+
), /* @__PURE__ */ React11.createElement("div", { ref: audioContainerRef, style: { display: "none" } }), showBorderGlow && showBodyGlow && /* @__PURE__ */ React11.createElement(border_glow_default, { isActive: true }));
|
|
17393
17000
|
};
|
|
17394
17001
|
export {
|
|
17395
17002
|
border_glow_default as BorderGlow,
|
|
@@ -17400,19 +17007,11 @@ export {
|
|
|
17400
17007
|
VoiceIntensityVisualizer,
|
|
17401
17008
|
captureFullDOMStructure,
|
|
17402
17009
|
configureWebRTCServer,
|
|
17403
|
-
connectSSE,
|
|
17404
|
-
disconnectSSE,
|
|
17405
17010
|
executeAction,
|
|
17406
17011
|
getFullDOMStructure,
|
|
17407
|
-
getSSEConnectionState,
|
|
17408
|
-
getSSEConnectionStatus,
|
|
17409
17012
|
getWebRTCServerConfig,
|
|
17410
17013
|
initWebRTC,
|
|
17411
17014
|
initWebRTCWithDeployedBackend,
|
|
17412
|
-
sendDashboardData,
|
|
17413
|
-
sendElementData,
|
|
17414
|
-
sendRuntimeData,
|
|
17415
|
-
setSSECallbacks,
|
|
17416
17015
|
useCuekit,
|
|
17417
17016
|
useQubeContext,
|
|
17418
17017
|
useWebRTC
|