@cuekit-ai/react 1.6.8 → 1.6.10

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.
@@ -5901,8 +5901,8 @@ function requireEvents() {
5901
5901
  ReflectApply(handler, this, args);
5902
5902
  } else {
5903
5903
  var len = handler.length;
5904
- var listeners = arrayClone(handler, len);
5905
- for (var i = 0; i < len; ++i) ReflectApply(listeners[i], this, args);
5904
+ var listeners2 = arrayClone(handler, len);
5905
+ for (var i = 0; i < len; ++i) ReflectApply(listeners2[i], this, args);
5906
5906
  }
5907
5907
  return true;
5908
5908
  };
@@ -6018,7 +6018,7 @@ function requireEvents() {
6018
6018
  };
6019
6019
  EventEmitter.prototype.off = EventEmitter.prototype.removeListener;
6020
6020
  EventEmitter.prototype.removeAllListeners = function removeAllListeners(type) {
6021
- var listeners, events2, i;
6021
+ var listeners2, events2, i;
6022
6022
  events2 = this._events;
6023
6023
  if (events2 === void 0) return this;
6024
6024
  if (events2.removeListener === void 0) {
@@ -6044,12 +6044,12 @@ function requireEvents() {
6044
6044
  this._eventsCount = 0;
6045
6045
  return this;
6046
6046
  }
6047
- listeners = events2[type];
6048
- if (typeof listeners === "function") {
6049
- this.removeListener(type, listeners);
6050
- } else if (listeners !== void 0) {
6051
- for (i = listeners.length - 1; i >= 0; i--) {
6052
- this.removeListener(type, listeners[i]);
6047
+ listeners2 = events2[type];
6048
+ if (typeof listeners2 === "function") {
6049
+ this.removeListener(type, listeners2);
6050
+ } else if (listeners2 !== void 0) {
6051
+ for (i = listeners2.length - 1; i >= 0; i--) {
6052
+ this.removeListener(type, listeners2[i]);
6053
6053
  }
6054
6054
  }
6055
6055
  return this;
@@ -6062,7 +6062,7 @@ function requireEvents() {
6062
6062
  if (typeof evlistener === "function") return unwrap ? [evlistener.listener || evlistener] : [evlistener];
6063
6063
  return unwrap ? unwrapListeners(evlistener) : arrayClone(evlistener, evlistener.length);
6064
6064
  }
6065
- EventEmitter.prototype.listeners = function listeners(type) {
6065
+ EventEmitter.prototype.listeners = function listeners2(type) {
6066
6066
  return _listeners(this, type, true);
6067
6067
  };
6068
6068
  EventEmitter.prototype.rawListeners = function rawListeners(type) {
@@ -23349,7 +23349,7 @@ function normalizeToNavigationCommand(message) {
23349
23349
  var room = null;
23350
23350
  var reconnectTimeout = null;
23351
23351
  var serverUrl = WEBRTC_BACKEND_SERVER_URL || "https://api-webrtc.ansyr.ai";
23352
- var callbacks = {};
23352
+ var listeners = /* @__PURE__ */ new Set();
23353
23353
  var audioContainerRef = null;
23354
23354
  var livekitUrl = null;
23355
23355
  var token = null;
@@ -23360,16 +23360,21 @@ function setServerUrl(url) {
23360
23360
  function setAudioContainer(newAudioContainerRef) {
23361
23361
  audioContainerRef = newAudioContainerRef;
23362
23362
  }
23363
+ function registerWebRTCCallbacks(callback) {
23364
+ listeners.add(callback);
23365
+ console.log("\u{1F4E1} WebRTC listener registered. Total listeners:", listeners.size);
23366
+ }
23367
+ function unregisterWebRTCCallbacks(callback) {
23368
+ listeners.delete(callback);
23369
+ console.log("\u{1F4E1} WebRTC listener unregistered. Total listeners:", listeners.size);
23370
+ }
23363
23371
  function setWebRTCCallbacks(newCallbacks) {
23364
- console.log("\u{1F4E1} setWebRTCCallbacks called with:", {
23365
- hasOnNavigationCommand: !!newCallbacks.onNavigationCommand,
23366
- hasOnConnectionStateChange: !!newCallbacks.onConnectionStateChange,
23367
- hasOnParticipantUpdate: !!newCallbacks.onParticipantUpdate
23368
- });
23369
- callbacks = newCallbacks;
23372
+ console.warn("\u26A0\uFE0F setWebRTCCallbacks is deprecated. Use registerWebRTCCallbacks instead.");
23373
+ listeners.clear();
23374
+ listeners.add(newCallbacks);
23370
23375
  }
23371
23376
  function getCurrentCallbacks() {
23372
- return callbacks;
23377
+ return Array.from(listeners)[0] || {};
23373
23378
  }
23374
23379
  async function authenticate(userIdentity, apiKey, appId, language) {
23375
23380
  try {
@@ -23428,7 +23433,7 @@ async function connectToRoom(newLivekitUrl, newToken) {
23428
23433
  function setupEventListeners() {
23429
23434
  if (!room) return;
23430
23435
  room.on(RoomEvent.ConnectionStateChanged, (state) => {
23431
- callbacks.onConnectionStateChange?.(state);
23436
+ listeners.forEach((l) => l.onConnectionStateChange?.(state));
23432
23437
  if (state === ConnectionState.Connected) {
23433
23438
  setWebRTCConnectionState({ isConnected: true, isConnecting: false });
23434
23439
  } else if (state === ConnectionState.Disconnected) {
@@ -23449,11 +23454,17 @@ function setupEventListeners() {
23449
23454
  audioContainerRef.current.appendChild(element);
23450
23455
  if (element instanceof HTMLAudioElement) {
23451
23456
  const trackId = track.sid || `track_${Date.now()}_${Math.random()}`;
23452
- callbacks.onAISpeechStart?.(trackId);
23457
+ listeners.forEach((l) => l.onAISpeechStart?.(trackId));
23453
23458
  element.play().catch((error) => {
23454
23459
  });
23455
- element.addEventListener("ended", () => callbacks.onAISpeechEnd?.(trackId));
23456
- element.addEventListener("pause", () => callbacks.onAISpeechEnd?.(trackId));
23460
+ element.addEventListener(
23461
+ "ended",
23462
+ () => listeners.forEach((l) => l.onAISpeechEnd?.(trackId))
23463
+ );
23464
+ element.addEventListener(
23465
+ "pause",
23466
+ () => listeners.forEach((l) => l.onAISpeechEnd?.(trackId))
23467
+ );
23457
23468
  }
23458
23469
  }
23459
23470
  }
@@ -23469,13 +23480,14 @@ function setupEventListeners() {
23469
23480
  const jsonPart = parts[1];
23470
23481
  console.log("\u{1F4E1} WebRTC Pipe-separated message:", { textPart, jsonPart });
23471
23482
  if (textPart) {
23472
- callbacks.onNavigationCommand?.({ type: "speech_text", data: textPart });
23483
+ listeners.forEach((l) => l.onNavigationCommand?.({ type: "speech_text", data: textPart }));
23473
23484
  }
23474
23485
  if (jsonPart) {
23475
23486
  try {
23476
23487
  const message = JSON.parse(jsonPart);
23477
23488
  console.log("\u{1F4E1} WebRTC Parsed JSON message:", message);
23478
- callbacks.onNavigationCommand?.(normalizeToNavigationCommand(message));
23489
+ const normalized = normalizeToNavigationCommand(message);
23490
+ listeners.forEach((l) => l.onNavigationCommand?.(normalized));
23479
23491
  } catch (error) {
23480
23492
  console.log("\u{1F4E1} WebRTC JSON parse error for JSON part:", error, "JSON part:", jsonPart);
23481
23493
  }
@@ -23484,11 +23496,12 @@ function setupEventListeners() {
23484
23496
  try {
23485
23497
  const message = JSON.parse(decodedPayload);
23486
23498
  console.log("\u{1F4E1} WebRTC Parsed message:", message);
23487
- callbacks.onNavigationCommand?.(normalizeToNavigationCommand(message));
23499
+ const normalized = normalizeToNavigationCommand(message);
23500
+ listeners.forEach((l) => l.onNavigationCommand?.(normalized));
23488
23501
  } catch (error) {
23489
23502
  console.log("\u{1F4E1} WebRTC JSON parse error:", error, "Raw payload:", decodedPayload);
23490
23503
  const message = decodedPayload;
23491
- callbacks.onNavigationCommand?.({ type: "raw_text", data: message });
23504
+ listeners.forEach((l) => l.onNavigationCommand?.({ type: "raw_text", data: message }));
23492
23505
  }
23493
23506
  }
23494
23507
  }).on(RoomEvent.Disconnected, () => {
@@ -23502,7 +23515,7 @@ function updateParticipantsList() {
23502
23515
  ...Array.from(room.remoteParticipants.values()).map((p) => p.identity)
23503
23516
  ];
23504
23517
  setWebRTCConnectionState({ participants });
23505
- callbacks.onParticipantUpdate?.(participants);
23518
+ listeners.forEach((l) => l.onParticipantUpdate?.(participants));
23506
23519
  }
23507
23520
  async function sendData(data, reliable = true) {
23508
23521
  if (!room) throw new Error("Not connected to room");
@@ -23635,6 +23648,8 @@ export {
23635
23648
  validateDynamicElements,
23636
23649
  setServerUrl,
23637
23650
  setAudioContainer,
23651
+ registerWebRTCCallbacks,
23652
+ unregisterWebRTCCallbacks,
23638
23653
  setWebRTCCallbacks,
23639
23654
  getCurrentCallbacks,
23640
23655
  authenticate,
package/dist/cuekit.css CHANGED
@@ -22,19 +22,23 @@
22
22
  --voice-border: 252 31% 91%;
23
23
  --voice-text: 222.2 84% 4.9%;
24
24
  --voice-text-muted: 252 16% 47%;
25
- --voice-accent: 252 81% 60%;
25
+ --voice-accent: 252 78% 60%; /* #6257d9 */
26
+ --voice-accent-vibrant: 245 84% 77%; /* #9a92f6 */
27
+ --voice-accent-dark: 246 57% 54%; /* #5447cd */
26
28
  --voice-accent-light: 252 100% 96%;
27
- --voice-user-bubble: 252 81% 60%;
29
+ --voice-user-bubble: 252 78% 60%;
28
30
  --voice-user-text: 0 0% 100%;
29
31
  --voice-ai-bubble: 0 0% 100%;
30
32
  --voice-ai-text: 222.2 84% 4.9%;
31
- --indicator-bg: 252 81% 60%;
33
+ --indicator-bg: 252 78% 60%;
34
+ --voice-status-bg: 252 100% 96%;
35
+ --voice-status-text: 252 78% 60%;
32
36
  --voice-placeholder: 252 16% 47%;
33
37
 
34
38
  /* Gradients Light - Purple */
35
- --gradient-primary: linear-gradient(135deg, hsl(252 81% 60%), hsl(252 88% 70%));
36
- --gradient-surface: linear-gradient(180deg, hsl(0 0% 100%), hsl(252 40% 98%));
37
- --gradient-mic-button: radial-gradient(circle at 50% 0%, hsl(252 88% 77%), hsl(252 66% 59%));
39
+ --gradient-primary: linear-gradient(135deg, #8177ed, #9a92f6);
40
+ --gradient-surface: linear-gradient(180deg, #ffffff, #f6f5ff);
41
+ --gradient-mic-button: radial-gradient(circle at 50% 0%, #9a92f6, #6257d9);
38
42
 
39
43
  /* Shadows Light */
40
44
  --shadow-soft: 0 4px 20px -2px hsl(252 81% 60% / 0.1);
@@ -49,18 +53,20 @@
49
53
  --voice-border: 252 31% 91%;
50
54
  --voice-text: 222.2 84% 4.9%;
51
55
  --voice-text-muted: 252 16% 47%;
52
- --voice-accent: 252 81% 60%;
56
+ --voice-accent: 252 78% 60%;
57
+ --voice-accent-vibrant: 245 84% 77%;
58
+ --voice-accent-dark: 246 57% 54%;
53
59
  --voice-accent-light: 252 100% 96%;
54
- --voice-user-bubble: 252 81% 60%;
60
+ --voice-user-bubble: 252 78% 60%;
55
61
  --voice-user-text: 0 0% 100%;
56
62
  --voice-ai-bubble: 0 0% 100%;
57
63
  --voice-ai-text: 222.2 84% 4.9%;
58
- --indicator-bg: 252 81% 60%;
64
+ --indicator-bg: 252 78% 60%;
59
65
  --voice-placeholder: 252 16% 47%;
60
- --gradient-primary: linear-gradient(135deg, hsl(252 81% 60%), hsl(252 88% 70%));
61
- --gradient-surface: linear-gradient(180deg, hsl(0 0% 100%), hsl(252 40% 98%));
62
- --gradient-mic-button: radial-gradient(circle at 50% 0%, hsl(252 88% 77%), hsl(252 66% 59%));
63
- --shadow-soft: 0 4px 20px -2px hsl(252 81% 60% / 0.1);
66
+ --gradient-primary: linear-gradient(135deg, #8177ed, #9a92f6);
67
+ --gradient-surface: linear-gradient(180deg, #ffffff, #f6f5ff);
68
+ --gradient-mic-button: radial-gradient(circle at 50% 0%, #9a92f6, #6257d9);
69
+ --shadow-soft: 0 4px 20px -2px rgba(129, 119, 237, 0.1);
64
70
  --shadow-card: 0 10px 40px -10px hsl(0 0% 0% / 0.05);
65
71
  }
66
72
 
@@ -71,22 +77,26 @@
71
77
  --voice-border: 248 32% 22%;
72
78
  --voice-text: 252 40% 98%;
73
79
  --voice-text-muted: 252 20% 65%;
74
- --voice-accent: 252 88% 70%;
80
+ --voice-accent: 245 84% 77%; /* #9a92f6 */
81
+ --voice-accent-vibrant: 252 88% 77%;
82
+ --voice-accent-dark: 246 57% 54%;
75
83
  --voice-accent-light: 252 47% 25%;
76
- --voice-user-bubble: 252 88% 70%;
84
+ --voice-user-bubble: 245 84% 77%;
77
85
  --voice-user-text: 0 0% 100%;
78
86
  --voice-ai-bubble: 252 32% 21%;
79
87
  --voice-ai-text: 0 0% 100%;
80
- --indicator-bg: 252 88% 70%;
88
+ --indicator-bg: 245 84% 77%;
89
+ --voice-status-bg: 252 47% 25%;
90
+ --voice-status-text: 245 84% 77%;
81
91
  --voice-placeholder: 252 20% 65%;
82
92
 
83
93
  /* Gradients Dark - Purple */
84
- --gradient-primary: linear-gradient(135deg, hsl(252 88% 70%), hsl(252 88% 77%));
85
- --gradient-surface: linear-gradient(180deg, hsl(248 32% 17.5%), hsl(248 35% 11%));
86
- --gradient-mic-button: radial-gradient(circle at 50% 0%, hsl(252 88% 77%), hsl(252 59% 54%));
94
+ --gradient-primary: linear-gradient(135deg, #8177ed, #9a92f6);
95
+ --gradient-surface: linear-gradient(180deg, #2b2640, #1a1625);
96
+ --gradient-mic-button: radial-gradient(circle at 50% 0%, #9a92f6, #5447cd);
87
97
 
88
98
  /* Shadows Dark */
89
- --shadow-soft: 0 4px 20px -2px hsl(252 88% 70% / 0.2);
99
+ --shadow-soft: 0 4px 20px -2px rgba(129, 119, 237, 0.2);
90
100
  --shadow-card: 0 10px 40px -10px hsl(0 0% 0% / 0.3);
91
101
  }
92
102
 
@@ -171,7 +181,7 @@
171
181
 
172
182
  /* Placeholder styles */
173
183
  input::placeholder {
174
- color: hsl(var(--voice-placeholder));
184
+ color: hsl(var(--voice-text) / 0.9);
175
185
  }
176
186
 
177
187
  /* Theme toggle animations */
@@ -554,8 +564,8 @@ input::placeholder {
554
564
  }
555
565
 
556
566
  .language-tooltip-content {
557
- background: oklch(0.23 0.08 252.75);
558
- color: hsl(0 0% 98%);
567
+ background: hsl(var(--voice-accent));
568
+ color: #fff;
559
569
  padding: 8px 12px;
560
570
  border-radius: 8px;
561
571
  font-size: 12px;
@@ -579,7 +589,7 @@ input::placeholder {
579
589
  width: 0;
580
590
  height: 0;
581
591
  border: 4px solid transparent;
582
- border-top-color: oklch(0.23 0.08 252.75);
592
+ border-top-color: hsl(var(--voice-accent));
583
593
  }
584
594
 
585
595
  .language-selector-content {
@@ -755,7 +765,7 @@ input::placeholder {
755
765
  align-items: center;
756
766
  gap: 12px;
757
767
  padding: 8px;
758
- background: hsl(var(--voice-surface));
768
+ background: white; /* Force white as per user request */
759
769
  border: 1px solid hsl(var(--voice-border));
760
770
  border-radius: 32px;
761
771
  box-shadow:
@@ -786,13 +796,12 @@ input::placeholder {
786
796
  align-items: center;
787
797
  gap: 16px;
788
798
  padding: 20px;
789
- background: hsl(var(--voice-surface));
799
+ background: white; /* Force white as per user request */
790
800
  border: 1px solid hsl(var(--voice-border));
791
801
  border-radius: 16px;
792
802
  box-shadow:
793
803
  0 20px 60px -12px hsl(0 0% 0% / 0.15),
794
804
  0 8px 32px -8px hsl(var(--voice-accent) / 0.1);
795
- backdrop-filter: blur(16px);
796
805
  min-width: 280px;
797
806
  animation: voiceChatLanguageEnter 0.3s cubic-bezier(0.4, 0, 0.2, 1);
798
807
  }
@@ -887,11 +896,11 @@ input::placeholder {
887
896
 
888
897
  /* Dark theme for voice chat button: only when popup has .cuekit-dark (no media query) */
889
898
  .cuekit-voice-popup.cuekit-dark .voice-chat-main-button {
890
- background: hsl(var(--voice-surface) / 0.8);
899
+ background: white; /* Force white in dark mode as per user request */
891
900
  border-color: hsl(var(--voice-border) / 0.5);
892
901
  }
893
902
 
894
903
  .cuekit-voice-popup.cuekit-dark .voice-chat-language-selection {
895
- background: hsl(var(--voice-surface));
904
+ background: white; /* Force white in dark mode as per user request */
896
905
  border-color: hsl(var(--voice-border));
897
906
  }
package/dist/index.d.mts CHANGED
@@ -11,8 +11,13 @@ interface DOMStructurePayload {
11
11
  }
12
12
  interface ThemeColors {
13
13
  primary: string;
14
- background: string;
15
- text: string;
14
+ primaryVibrant?: string;
15
+ primaryDark?: string;
16
+ indicator?: string;
17
+ statusBg?: string;
18
+ statusText?: string;
19
+ background?: string;
20
+ text?: string;
16
21
  surface?: string;
17
22
  border?: string;
18
23
  textMuted?: string;
@@ -22,8 +27,8 @@ interface ThemeColors {
22
27
  aiText?: string;
23
28
  }
24
29
  interface ThemeConfig {
25
- light: ThemeColors;
26
- dark: ThemeColors;
30
+ light?: Partial<ThemeColors>;
31
+ dark?: Partial<ThemeColors>;
27
32
  }
28
33
 
29
34
  declare global {
@@ -62,7 +67,7 @@ interface Props {
62
67
  showLogo?: boolean;
63
68
  showAIIcon?: boolean;
64
69
  showUserIcon?: boolean;
65
- theme: ThemeConfig;
70
+ theme?: ThemeConfig;
66
71
  emptyStateMessage?: string;
67
72
  }
68
73
  declare const AnsyrProvider: React__default.FC<Props>;
package/dist/index.d.ts CHANGED
@@ -11,8 +11,13 @@ interface DOMStructurePayload {
11
11
  }
12
12
  interface ThemeColors {
13
13
  primary: string;
14
- background: string;
15
- text: string;
14
+ primaryVibrant?: string;
15
+ primaryDark?: string;
16
+ indicator?: string;
17
+ statusBg?: string;
18
+ statusText?: string;
19
+ background?: string;
20
+ text?: string;
16
21
  surface?: string;
17
22
  border?: string;
18
23
  textMuted?: string;
@@ -22,8 +27,8 @@ interface ThemeColors {
22
27
  aiText?: string;
23
28
  }
24
29
  interface ThemeConfig {
25
- light: ThemeColors;
26
- dark: ThemeColors;
30
+ light?: Partial<ThemeColors>;
31
+ dark?: Partial<ThemeColors>;
27
32
  }
28
33
 
29
34
  declare global {
@@ -62,7 +67,7 @@ interface Props {
62
67
  showLogo?: boolean;
63
68
  showAIIcon?: boolean;
64
69
  showUserIcon?: boolean;
65
- theme: ThemeConfig;
70
+ theme?: ThemeConfig;
66
71
  emptyStateMessage?: string;
67
72
  }
68
73
  declare const AnsyrProvider: React__default.FC<Props>;