deepspace 0.19.0 → 0.19.1

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.d.ts CHANGED
@@ -2766,12 +2766,15 @@ interface User extends UserProfile {
2766
2766
  */
2767
2767
  interface RoomUser {
2768
2768
  id: string;
2769
- email: string;
2769
+ /** Present only in the admin user-management view. */
2770
+ email?: string;
2770
2771
  name: string;
2771
2772
  imageUrl?: string;
2772
2773
  role: string;
2773
- createdAt: string;
2774
- lastSeenAt: string;
2774
+ /** Present only in the admin user-management view. */
2775
+ createdAt?: string;
2776
+ /** Present only in the admin user-management view. */
2777
+ lastSeenAt?: string;
2775
2778
  }
2776
2779
  type RoomConnectionState = 'connecting' | 'connected' | 'disconnected';
2777
2780
  /** A server-rejected optimistic write. */
@@ -3168,7 +3171,8 @@ declare function useYjsText(collection: string, recordId: string, fieldName: str
3168
3171
  */
3169
3172
  interface UserInfo {
3170
3173
  id: string;
3171
- email: string;
3174
+ /** Available to admins; ordinary collaborators receive public identity only. */
3175
+ email?: string;
3172
3176
  name: string;
3173
3177
  imageUrl?: string;
3174
3178
  role: string;
package/dist/index.js CHANGED
@@ -3429,16 +3429,21 @@ function useJobs(roomId) {
3429
3429
  // src/client/storage/hooks/usePresenceRoom.ts
3430
3430
  import { useState as useState11, useEffect as useEffect14, useCallback as useCallback13, useRef as useRef12 } from "react";
3431
3431
  function usePresenceRoom(scopeId) {
3432
+ const auth = useRecordAuth();
3433
+ const tokenProvider = auth?.getAuthToken ?? getAuthToken;
3432
3434
  const [peers, setPeers] = useState11([]);
3433
3435
  const [connected, setConnected] = useState11(false);
3434
3436
  const wsRef = useRef12(null);
3435
3437
  useEffect14(() => {
3438
+ setConnected(false);
3439
+ setPeers([]);
3436
3440
  let ws = null;
3437
3441
  let reconnectTimer = null;
3438
3442
  let alive = true;
3439
3443
  const connect = async () => {
3440
3444
  if (!alive) return;
3441
- const token = await getAuthToken();
3445
+ const token = await tokenProvider();
3446
+ if (!alive) return;
3442
3447
  const protocol = window.location.protocol === "https:" ? "wss:" : "ws:";
3443
3448
  const baseUrl = `${protocol}//${window.location.host}`;
3444
3449
  const url = new URL(`/ws/presence/${encodeURIComponent(scopeId)}`, baseUrl);
@@ -3492,7 +3497,7 @@ function usePresenceRoom(scopeId) {
3492
3497
  }
3493
3498
  wsRef.current = null;
3494
3499
  };
3495
- }, [scopeId]);
3500
+ }, [scopeId, tokenProvider]);
3496
3501
  const updateState = useCallback13((state) => {
3497
3502
  const ws = wsRef.current;
3498
3503
  if (!ws || ws.readyState !== WebSocket.OPEN) return;