@cuekit-ai/react 1.3.0 → 1.3.2

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.mjs CHANGED
@@ -1,27 +1,26 @@
1
1
  import {
2
- ConnectionState,
3
- GlobalStore,
4
2
  Participant,
5
3
  ParticipantEvent,
6
4
  RoomEvent,
7
5
  Track,
6
+ createAudioAnalyser
7
+ } from "./chunk-H44FBEX3.mjs";
8
+ import {
9
+ GlobalStore,
8
10
  WEBRTC_BACKEND_SERVER_URL,
9
- __commonJS,
10
- __export,
11
- __toESM,
12
11
  _apiKey,
13
12
  _appId,
14
13
  authenticate,
15
14
  captureFullDOMStructure,
16
15
  connectToRoom,
17
- createAudioAnalyser,
18
16
  disconnectFromRoom,
17
+ executeAction,
18
+ getFullDOMStructure,
19
19
  getParticipants,
20
20
  getRoom,
21
21
  getRoomName,
22
- handleNavigationAndClick,
22
+ isConnected,
23
23
  onStateChange,
24
- safeNavigate,
25
24
  sendData,
26
25
  sendRuntimeData,
27
26
  sendScreenStatus,
@@ -34,7 +33,12 @@ import {
34
33
  setServerUrl,
35
34
  setWebRTCCallbacks,
36
35
  setWebRTCConfig
37
- } from "./chunk-6TG2XY2P.mjs";
36
+ } from "./chunk-Y2Q57RZJ.mjs";
37
+ import {
38
+ __commonJS,
39
+ __export,
40
+ __toESM
41
+ } from "./chunk-R7POPVJR.mjs";
38
42
 
39
43
  // node_modules/inline-style-parser/index.js
40
44
  var require_inline_style_parser = __commonJS({
@@ -492,7 +496,7 @@ var CuekitProvider = ({
492
496
  };
493
497
  }, [navigationHandler]);
494
498
  useEffect(() => {
495
- import("./webrtc-service-O4JWXTIF.mjs").then(({ setWebRTCCallbacks: setWebRTCCallbacks2 }) => {
499
+ import("./webrtc-service-TL73OATV.mjs").then(({ setWebRTCCallbacks: setWebRTCCallbacks2 }) => {
496
500
  setWebRTCCallbacks2({
497
501
  onNavigationCommand: (command) => {
498
502
  console.log("\u{1F9ED} Processing navigation command:", command);
@@ -620,9 +624,10 @@ var useWebRTC = (options) => {
620
624
  setAudioContainer(audioContainerRef);
621
625
  }, []);
622
626
  useEffect2(() => {
623
- const handleConnectionStateChange = (state) => {
624
- setIsConnected(state === ConnectionState.Connected);
625
- setIsConnecting(state === ConnectionState.Connecting);
627
+ const handleConnectionStateChange = async (state) => {
628
+ const { ConnectionState: ConnectionState2 } = await import("./livekit-client.esm-33GHDCYA.mjs");
629
+ setIsConnected(state === ConnectionState2.Connected);
630
+ setIsConnecting(state === ConnectionState2.Connecting);
626
631
  setConnectionState(state);
627
632
  options?.onConnectionStateChange?.(state);
628
633
  };
@@ -669,6 +674,15 @@ var useWebRTC = (options) => {
669
674
  setIsConnected(false);
670
675
  setRoom(null);
671
676
  }, []);
677
+ useEffect2(() => {
678
+ const checkConnection = async () => {
679
+ const connected = await isConnected();
680
+ setIsConnected(connected);
681
+ };
682
+ checkConnection();
683
+ const interval = setInterval(checkConnection, 5e3);
684
+ return () => clearInterval(interval);
685
+ }, []);
672
686
  const memoizedParticipants = useMemo(() => {
673
687
  return getParticipants().map((p) => p.identity);
674
688
  }, [participants]);
@@ -690,140 +704,6 @@ var useWebRTC = (options) => {
690
704
  };
691
705
  };
692
706
 
693
- // src/utils/element-service.ts
694
- function executeAction(action) {
695
- console.log("\u{1F3AF} Executing element action:", action);
696
- const { action_type, target_element, target } = action;
697
- switch (action_type) {
698
- case "click":
699
- return clickElement(target_element);
700
- case "navigate":
701
- return navigateToElement(target_element || target);
702
- case "input":
703
- case "focus":
704
- return focusElement(target_element);
705
- case "toggle":
706
- return toggleElement(target_element);
707
- default:
708
- console.warn(`\u26A0\uFE0F Unknown action type: ${action_type}`);
709
- return false;
710
- }
711
- }
712
- function getFullDOMStructure() {
713
- console.log("\u{1F333} ElementService: Getting full DOM structure...");
714
- return captureFullDOMStructure();
715
- }
716
- function clickElement(elementId) {
717
- if (!elementId) {
718
- console.warn("\u26A0\uFE0F No element ID provided for click action");
719
- return false;
720
- }
721
- const domStructure = getFullDOMStructure();
722
- const elementToClick = findElementById(domStructure, elementId);
723
- if (elementToClick) {
724
- console.log(`\u{1F3AF} Clicking element: ${elementId}`);
725
- const domElement = findDOMElementById(elementId);
726
- if (domElement) {
727
- domElement.click();
728
- return true;
729
- }
730
- } else {
731
- console.warn(`\u26A0\uFE0F Element not found: ${elementId}`);
732
- }
733
- return false;
734
- }
735
- function navigateToElement(target) {
736
- if (!target) {
737
- console.warn("\u26A0\uFE0F No target provided for navigation action");
738
- return false;
739
- }
740
- console.log(`\u{1F9ED} Navigating to: ${target}`);
741
- if (target.includes("/") || target.startsWith("http")) {
742
- safeNavigate(target, {});
743
- } else {
744
- handleNavigationAndClick(target, target);
745
- }
746
- return true;
747
- }
748
- function focusElement(elementId) {
749
- if (!elementId) {
750
- console.warn("\u26A0\uFE0F No element ID provided for focus action");
751
- return false;
752
- }
753
- const domElement = findDOMElementById(elementId);
754
- if (domElement instanceof HTMLInputElement || domElement instanceof HTMLTextAreaElement || domElement instanceof HTMLSelectElement) {
755
- console.log(`\u{1F4DD} Focusing element: ${elementId}`);
756
- domElement.focus();
757
- return true;
758
- } else {
759
- console.warn(`\u26A0\uFE0F Focusable element not found: ${elementId}`);
760
- return false;
761
- }
762
- }
763
- function toggleElement(elementId) {
764
- if (!elementId) {
765
- console.warn("\u26A0\uFE0F No element ID provided for toggle action");
766
- return false;
767
- }
768
- const domElement = findDOMElementById(elementId);
769
- if (domElement instanceof HTMLElement) {
770
- console.log(`\u{1F504} Toggling element: ${elementId}`);
771
- if (domElement instanceof HTMLInputElement) {
772
- if (domElement.type === "checkbox") {
773
- domElement.checked = !domElement.checked;
774
- } else if (domElement.type === "radio") {
775
- domElement.checked = true;
776
- }
777
- domElement.dispatchEvent(new Event("change", { bubbles: true }));
778
- } else {
779
- domElement.click();
780
- }
781
- return true;
782
- } else {
783
- console.warn(`\u26A0\uFE0F Toggleable element not found: ${elementId}`);
784
- return false;
785
- }
786
- }
787
- function findElementById(domStructure, elementId) {
788
- const searchInComponents = (components) => {
789
- for (const component of components) {
790
- if (component.hash === elementId) {
791
- return component;
792
- }
793
- if (component.children.length > 0) {
794
- const found = searchInComponents(component.children);
795
- if (found) return found;
796
- }
797
- }
798
- return null;
799
- };
800
- return searchInComponents(domStructure.components);
801
- }
802
- function findDOMElementById(elementId) {
803
- const allElements = document.querySelectorAll("*");
804
- for (const element3 of allElements) {
805
- if (element3 instanceof HTMLElement) {
806
- const hash = generateHash(element3);
807
- if (hash === elementId) {
808
- return element3;
809
- }
810
- }
811
- }
812
- return null;
813
- }
814
- function generateHash(element3) {
815
- const tagName = element3.tagName.toLowerCase();
816
- const text7 = (element3.textContent || "").trim().substring(0, 50);
817
- const idString = `${tagName}_${text7}_${element3.tagName}`;
818
- let hash = 0;
819
- for (let i2 = 0; i2 < idString.length; i2++) {
820
- const char = idString.charCodeAt(i2);
821
- hash = (hash << 5) - hash + char;
822
- hash |= 0;
823
- }
824
- return hash.toString(36);
825
- }
826
-
827
707
  // src/hooks/use-cuekit.ts
828
708
  var useCuekit = (options) => {
829
709
  const [messages, setMessages] = useState3([]);
@@ -876,6 +756,7 @@ var useCuekit = (options) => {
876
756
  const [micState, setMicState] = useState3("idle");
877
757
  const [status, setStatus] = useState3("");
878
758
  const handleNavigationCommand = (event) => {
759
+ console.log(`\u{1F9E0} Processing event in useCuekit: ${event.type}`, event);
879
760
  switch (event.type) {
880
761
  case "user_speech_chunk":
881
762
  case "ai_speech_chunk": {
@@ -926,6 +807,7 @@ var useCuekit = (options) => {
926
807
  break;
927
808
  }
928
809
  case "request_runtime_data": {
810
+ console.log("\u{1F9E0} Requesting runtime data");
929
811
  sendRuntimeData();
930
812
  break;
931
813
  }
@@ -16563,6 +16445,7 @@ var MicButton = ({
16563
16445
  console.log("\u{1F3A4} MicButton received messages:", JSON.stringify(messageManagerMessages, null, 2));
16564
16446
  }, [messageManagerMessages]);
16565
16447
  useEffect10(() => {
16448
+ if (typeof window === "undefined") return;
16566
16449
  const checkTheme = () => {
16567
16450
  if (typeof document !== "undefined") {
16568
16451
  let newTheme;
@@ -16576,6 +16459,7 @@ var MicButton = ({
16576
16459
  }
16577
16460
  };
16578
16461
  checkTheme();
16462
+ if (typeof window === "undefined") return;
16579
16463
  if (defaultTheme === "system") {
16580
16464
  const observer = new MutationObserver(checkTheme);
16581
16465
  observer.observe(document.documentElement, {
@@ -0,0 +1,219 @@
1
+ import {
2
+ AudioPresets,
3
+ BackupCodecPolicy,
4
+ BaseKeyProvider,
5
+ CheckStatus,
6
+ Checker,
7
+ ConnectionCheck,
8
+ ConnectionError,
9
+ ConnectionErrorReason,
10
+ ConnectionQuality,
11
+ ConnectionState,
12
+ CriticalTimers,
13
+ CryptorError,
14
+ CryptorErrorReason,
15
+ CryptorEvent,
16
+ DataPacket_Kind,
17
+ DefaultReconnectPolicy,
18
+ DeviceUnsupportedError,
19
+ DisconnectReason,
20
+ EncryptionEvent,
21
+ EngineEvent,
22
+ ExternalE2EEKeyProvider,
23
+ KeyHandlerEvent,
24
+ KeyProviderEvent,
25
+ LivekitError,
26
+ LocalAudioTrack,
27
+ LocalParticipant,
28
+ LocalTrack,
29
+ LocalTrackPublication,
30
+ LocalTrackRecorder,
31
+ LocalVideoTrack,
32
+ LogLevel,
33
+ LoggerNames,
34
+ MediaDeviceFailure,
35
+ NegotiationError,
36
+ Participant,
37
+ ParticipantEvent,
38
+ ParticipantInfo_Kind,
39
+ PublishDataError,
40
+ PublishTrackError,
41
+ RemoteAudioTrack,
42
+ RemoteParticipant,
43
+ RemoteTrack,
44
+ RemoteTrackPublication,
45
+ RemoteVideoTrack,
46
+ Room,
47
+ RoomEvent,
48
+ RpcError,
49
+ ScreenSharePresets,
50
+ SignalRequestError,
51
+ SubscriptionError,
52
+ Track,
53
+ TrackEvent,
54
+ TrackInvalidError,
55
+ TrackPublication,
56
+ TrackType,
57
+ UnexpectedConnectionState,
58
+ UnsupportedServer,
59
+ VideoPreset,
60
+ VideoPresets,
61
+ VideoPresets43,
62
+ VideoQuality,
63
+ _,
64
+ attachToElement,
65
+ attributeTypings,
66
+ compareVersions,
67
+ createAudioAnalyser,
68
+ createE2EEKey,
69
+ createKeyMaterialFromBuffer,
70
+ createKeyMaterialFromString,
71
+ createLocalAudioTrack,
72
+ createLocalScreenTracks,
73
+ createLocalTracks,
74
+ createLocalVideoTrack,
75
+ deriveKeys,
76
+ detachTrack,
77
+ facingModeFromDeviceLabel,
78
+ facingModeFromLocalTrack,
79
+ getBrowser,
80
+ getEmptyAudioStreamTrack,
81
+ getEmptyVideoStreamTrack,
82
+ getLogger,
83
+ importKey,
84
+ isAudioTrack,
85
+ isBackupCodec,
86
+ isBrowserSupported,
87
+ isE2EESupported,
88
+ isInsertableStreamSupported,
89
+ isLocalParticipant,
90
+ isLocalTrack,
91
+ isRemoteParticipant,
92
+ isRemoteTrack,
93
+ isScriptTransformSupported,
94
+ isVideoFrame,
95
+ isVideoTrack,
96
+ needsRbspUnescaping,
97
+ parseRbsp,
98
+ protocolVersion,
99
+ ratchet,
100
+ setLogExtension,
101
+ setLogLevel,
102
+ supportsAV1,
103
+ supportsAdaptiveStream,
104
+ supportsDynacast,
105
+ supportsVP9,
106
+ version,
107
+ videoCodecs,
108
+ writeRbsp
109
+ } from "./chunk-H44FBEX3.mjs";
110
+ import "./chunk-R7POPVJR.mjs";
111
+ export {
112
+ AudioPresets,
113
+ BackupCodecPolicy,
114
+ BaseKeyProvider,
115
+ CheckStatus,
116
+ Checker,
117
+ ConnectionCheck,
118
+ ConnectionError,
119
+ ConnectionErrorReason,
120
+ ConnectionQuality,
121
+ ConnectionState,
122
+ CriticalTimers,
123
+ CryptorError,
124
+ CryptorErrorReason,
125
+ CryptorEvent,
126
+ DataPacket_Kind,
127
+ DefaultReconnectPolicy,
128
+ DeviceUnsupportedError,
129
+ DisconnectReason,
130
+ EncryptionEvent,
131
+ EngineEvent,
132
+ ExternalE2EEKeyProvider,
133
+ KeyHandlerEvent,
134
+ KeyProviderEvent,
135
+ LivekitError,
136
+ LocalAudioTrack,
137
+ LocalParticipant,
138
+ LocalTrack,
139
+ LocalTrackPublication,
140
+ LocalTrackRecorder,
141
+ LocalVideoTrack,
142
+ LogLevel,
143
+ LoggerNames,
144
+ MediaDeviceFailure,
145
+ _ as Mutex,
146
+ NegotiationError,
147
+ Participant,
148
+ ParticipantEvent,
149
+ ParticipantInfo_Kind as ParticipantKind,
150
+ PublishDataError,
151
+ PublishTrackError,
152
+ RemoteAudioTrack,
153
+ RemoteParticipant,
154
+ RemoteTrack,
155
+ RemoteTrackPublication,
156
+ RemoteVideoTrack,
157
+ Room,
158
+ RoomEvent,
159
+ RpcError,
160
+ ScreenSharePresets,
161
+ SignalRequestError,
162
+ SubscriptionError,
163
+ Track,
164
+ TrackEvent,
165
+ TrackInvalidError,
166
+ TrackPublication,
167
+ TrackType,
168
+ UnexpectedConnectionState,
169
+ UnsupportedServer,
170
+ VideoPreset,
171
+ VideoPresets,
172
+ VideoPresets43,
173
+ VideoQuality,
174
+ attachToElement,
175
+ attributeTypings as attributes,
176
+ compareVersions,
177
+ createAudioAnalyser,
178
+ createE2EEKey,
179
+ createKeyMaterialFromBuffer,
180
+ createKeyMaterialFromString,
181
+ createLocalAudioTrack,
182
+ createLocalScreenTracks,
183
+ createLocalTracks,
184
+ createLocalVideoTrack,
185
+ deriveKeys,
186
+ detachTrack,
187
+ facingModeFromDeviceLabel,
188
+ facingModeFromLocalTrack,
189
+ getBrowser,
190
+ getEmptyAudioStreamTrack,
191
+ getEmptyVideoStreamTrack,
192
+ getLogger,
193
+ importKey,
194
+ isAudioTrack,
195
+ isBackupCodec,
196
+ isBrowserSupported,
197
+ isE2EESupported,
198
+ isInsertableStreamSupported,
199
+ isLocalParticipant,
200
+ isLocalTrack,
201
+ isRemoteParticipant,
202
+ isRemoteTrack,
203
+ isScriptTransformSupported,
204
+ isVideoFrame,
205
+ isVideoTrack,
206
+ needsRbspUnescaping,
207
+ parseRbsp,
208
+ protocolVersion,
209
+ ratchet,
210
+ setLogExtension,
211
+ setLogLevel,
212
+ supportsAV1,
213
+ supportsAdaptiveStream,
214
+ supportsDynacast,
215
+ supportsVP9,
216
+ version,
217
+ videoCodecs,
218
+ writeRbsp
219
+ };
@@ -14,7 +14,8 @@ import {
14
14
  setAudioContainer,
15
15
  setServerUrl,
16
16
  setWebRTCCallbacks
17
- } from "./chunk-6TG2XY2P.mjs";
17
+ } from "./chunk-Y2Q57RZJ.mjs";
18
+ import "./chunk-R7POPVJR.mjs";
18
19
  export {
19
20
  authenticate,
20
21
  connectToRoom,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@cuekit-ai/react",
3
- "version": "1.3.0",
3
+ "version": "1.3.2",
4
4
  "main": "dist/index.js",
5
5
  "types": "dist/index.d.ts",
6
6
  "exports": {