@cuekit-ai/react 1.3.1 → 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,26 +1,25 @@
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,
19
17
  executeAction,
20
18
  getFullDOMStructure,
21
19
  getParticipants,
22
20
  getRoom,
23
21
  getRoomName,
22
+ isConnected,
24
23
  onStateChange,
25
24
  sendData,
26
25
  sendRuntimeData,
@@ -34,7 +33,12 @@ import {
34
33
  setServerUrl,
35
34
  setWebRTCCallbacks,
36
35
  setWebRTCConfig
37
- } from "./chunk-PLOG3DEN.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-BHI4M7YJ.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);
@@ -609,7 +613,7 @@ import { useState as useState3, useCallback as useCallback2, useRef as useRef2 }
609
613
  // src/hooks/use-webrtc.ts
610
614
  import { useState as useState2, useEffect as useEffect2, useCallback, useRef, useMemo } from "react";
611
615
  var useWebRTC = (options) => {
612
- const [isConnected, setIsConnected] = useState2(false);
616
+ const [isConnected2, setIsConnected] = useState2(false);
613
617
  const [isConnecting, setIsConnecting] = useState2(false);
614
618
  const [connectionState, setConnectionState] = useState2(null);
615
619
  const [participants, setParticipants] = useState2([]);
@@ -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,11 +674,20 @@ 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]);
675
689
  return {
676
- isConnected,
690
+ isConnected: isConnected2,
677
691
  isConnecting,
678
692
  connectionState,
679
693
  room,
@@ -13624,7 +13638,7 @@ var ChatPopup = ({
13624
13638
  onSendText,
13625
13639
  onEndCall,
13626
13640
  messages,
13627
- isConnected,
13641
+ isConnected: isConnected2,
13628
13642
  micState,
13629
13643
  error,
13630
13644
  currentTheme = "dark",
@@ -14211,7 +14225,7 @@ var ChatPopup = ({
14211
14225
  }
14212
14226
  }
14213
14227
  ),
14214
- isConnected && onEndCall && /* @__PURE__ */ React6.createElement(
14228
+ isConnected2 && onEndCall && /* @__PURE__ */ React6.createElement(
14215
14229
  "button",
14216
14230
  {
14217
14231
  type: "submit",
@@ -16401,7 +16415,7 @@ var MicButton = ({
16401
16415
  const aiSpeechTimeoutRef = useRef7(null);
16402
16416
  const activeAITracksRef = useRef7(/* @__PURE__ */ new Set());
16403
16417
  const {
16404
- isConnected,
16418
+ isConnected: isConnected2,
16405
16419
  isConnecting,
16406
16420
  error: voiceError,
16407
16421
  connect: voiceConnect,
@@ -16431,6 +16445,7 @@ var MicButton = ({
16431
16445
  console.log("\u{1F3A4} MicButton received messages:", JSON.stringify(messageManagerMessages, null, 2));
16432
16446
  }, [messageManagerMessages]);
16433
16447
  useEffect10(() => {
16448
+ if (typeof window === "undefined") return;
16434
16449
  const checkTheme = () => {
16435
16450
  if (typeof document !== "undefined") {
16436
16451
  let newTheme;
@@ -16444,6 +16459,7 @@ var MicButton = ({
16444
16459
  }
16445
16460
  };
16446
16461
  checkTheme();
16462
+ if (typeof window === "undefined") return;
16447
16463
  if (defaultTheme === "system") {
16448
16464
  const observer = new MutationObserver(checkTheme);
16449
16465
  observer.observe(document.documentElement, {
@@ -16486,8 +16502,8 @@ var MicButton = ({
16486
16502
  console.log("\u{1F3A4} MicButton: Current active AI tracks:", Array.from(activeAITracksRef.current));
16487
16503
  console.log("\u{1F3A4} MicButton: Current status:", status);
16488
16504
  console.log("\u{1F3A4} MicButton: Current mic state:", micState);
16489
- console.log("\u{1F3A4} MicButton: Is listening:", isConnected);
16490
- console.log("\u{1F3A4} MicButton: Is connected:", isConnected);
16505
+ console.log("\u{1F3A4} MicButton: Is listening:", isConnected2);
16506
+ console.log("\u{1F3A4} MicButton: Is connected:", isConnected2);
16491
16507
  if (isSpeaking && trackId) {
16492
16508
  console.log("\u{1F3A4} MicButton: ===== AI SPEECH START =====");
16493
16509
  console.log("\u{1F3A4} MicButton: Adding track to active set:", trackId);
@@ -16542,7 +16558,7 @@ var MicButton = ({
16542
16558
  console.log("\u{1F3A4} MicButton: - Status:", status);
16543
16559
  console.log("\u{1F3A4} MicButton: ================================");
16544
16560
  },
16545
- [status, micState, isConnected]
16561
+ [status, micState, isConnected2]
16546
16562
  );
16547
16563
  useEffect10(() => {
16548
16564
  if (audioContainerRef.current) {
@@ -16555,9 +16571,9 @@ var MicButton = ({
16555
16571
  }
16556
16572
  };
16557
16573
  }, [handleAISpeech]);
16558
- const isListening = isConnected;
16559
- const getUserFriendlyStatus = (micState2, isConnected2) => {
16560
- if (!isConnected2) {
16574
+ const isListening = isConnected2;
16575
+ const getUserFriendlyStatus = (micState2, isConnected3) => {
16576
+ if (!isConnected3) {
16561
16577
  return "Connecting...";
16562
16578
  }
16563
16579
  if (status && !status.includes("error") && !status.includes("failed") && !status.includes("Connection error") && !status.includes("Unable to")) {
@@ -16567,28 +16583,28 @@ var MicButton = ({
16567
16583
  if (micState2 === "thinking") return "Thinking...";
16568
16584
  if (micState2 === "replying") return "Responding...";
16569
16585
  if (micState2 === "idle") {
16570
- if (isConnected2) return "Listening...";
16586
+ if (isConnected3) return "Listening...";
16571
16587
  return "Connecting...";
16572
16588
  }
16573
- return isConnected2 ? "Ready" : "Connecting...";
16589
+ return isConnected3 ? "Ready" : "Connecting...";
16574
16590
  };
16575
16591
  useEffect10(() => {
16576
- if (isConnected) {
16592
+ if (isConnected2) {
16577
16593
  console.log("\u{1F3A4} MicButton: WebRTC and SSE connections established - ready for commands");
16578
16594
  } else {
16579
16595
  console.log("\u{1F3A4} MicButton: WebRTC not yet connected - ignoring speech");
16580
16596
  }
16581
- }, [isConnected]);
16597
+ }, [isConnected2]);
16582
16598
  useEffect10(() => {
16583
16599
  console.log("\u{1F3A4} MicButton: Auto-open check:", {
16584
- isConnected,
16600
+ isConnected: isConnected2,
16585
16601
  chatIsOpen: isChatOpen
16586
16602
  });
16587
- if (isConnected && !isChatOpen) {
16603
+ if (isConnected2 && !isChatOpen) {
16588
16604
  console.log("\u{1F3A4} MicButton: Auto-opening chat popup");
16589
16605
  openChat();
16590
16606
  }
16591
- }, [isConnected, isChatOpen, openChat]);
16607
+ }, [isConnected2, isChatOpen, openChat]);
16592
16608
  useEffect10(() => {
16593
16609
  if (messageManagerMessages.length > 0 && !isChatOpen) {
16594
16610
  console.log("\u{1F3A4} MicButton: Auto-opening chat popup due to messages");
@@ -16596,7 +16612,7 @@ var MicButton = ({
16596
16612
  }
16597
16613
  }, [messageManagerMessages.length, isChatOpen, openChat]);
16598
16614
  const handleMicClick = useCallback5(() => {
16599
- const shouldStop = micState === "listening" && isConnected;
16615
+ const shouldStop = micState === "listening" && isConnected2;
16600
16616
  if (shouldStop) {
16601
16617
  console.log("\u{1F3A4} MicButton: User wants to stop - closing everything");
16602
16618
  voiceDisconnect().then(() => {
@@ -16621,7 +16637,7 @@ var MicButton = ({
16621
16637
  }
16622
16638
  }, [
16623
16639
  micState,
16624
- isConnected,
16640
+ isConnected2,
16625
16641
  voiceDisconnect,
16626
16642
  voiceConnect,
16627
16643
  apiKey,
@@ -16636,7 +16652,7 @@ var MicButton = ({
16636
16652
  if (!isChatOpen) {
16637
16653
  openChat();
16638
16654
  }
16639
- if (isConnected) {
16655
+ if (isConnected2) {
16640
16656
  console.log("\u{1F3A4} MicButton: Sending via WebRTC");
16641
16657
  try {
16642
16658
  await sendUserCommand2(textToSend);
@@ -16833,13 +16849,13 @@ var MicButton = ({
16833
16849
  text: msg.text,
16834
16850
  sender: msg.role === "ai" ? "assistant" : "user"
16835
16851
  })),
16836
- isConnected: isConnected ?? false,
16852
+ isConnected: isConnected2 ?? false,
16837
16853
  micState,
16838
16854
  participants,
16839
16855
  error: voiceError,
16840
16856
  currentTheme,
16841
16857
  onThemeToggle: setCurrentTheme,
16842
- status: getUserFriendlyStatus(micState, isConnected ?? false),
16858
+ status: getUserFriendlyStatus(micState, isConnected2 ?? false),
16843
16859
  anchor: { position: screenPosition, bottom: bottomSpace, size: buttonSize }
16844
16860
  }
16845
16861
  ), isChatOpen && isChatMinimized && /* @__PURE__ */ React11.createElement(
@@ -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-PLOG3DEN.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.1",
3
+ "version": "1.3.2",
4
4
  "main": "dist/index.js",
5
5
  "types": "dist/index.d.ts",
6
6
  "exports": {