vg-x07df 1.9.5 → 1.10.5

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.cts CHANGED
@@ -2,8 +2,8 @@ import React from 'react';
2
2
  import { Socket } from 'socket.io-client';
3
3
  import * as immer from 'immer';
4
4
  import * as zustand from 'zustand';
5
- import { R as RtcState, a as RtcError, I as IncomingInvite, O as OutgoingInvite, P as ParticipantMetadata, L as LiveKitJoinInfo, b as ParticipantPermissions, c as Profile, d as ParticipantListOptions, e as ParticipantListReturn, f as RecordingInfo, G as GuestIdentity } from './types-CCWG5LpL.cjs';
6
- export { M as MeetingInfo, S as Session, g as SessionType } from './types-CCWG5LpL.cjs';
5
+ import { R as RtcState, a as RtcError, I as IncomingInvite, O as OutgoingInvite, P as ParticipantMetadata, L as LiveKitJoinInfo, b as ParticipantPermissions, c as Profile, d as ParticipantListOptions, e as ParticipantListReturn, f as RecordingInfo, G as GuestIdentity } from './types-BbdWZE4Y.cjs';
6
+ export { M as MeetingInfo, S as Session, g as SessionType } from './types-BbdWZE4Y.cjs';
7
7
  import { L as LogLevel, D as DurationResult, N as Nullable$1 } from './duration-DvuGtU76.cjs';
8
8
  import { Room, RemoteParticipant, LocalParticipant, RoomOptions, Participant } from 'livekit-client';
9
9
  export { U as UseVirtualBackgroundOptions, u as useVirtualBackground } from './useVirtualBackground-DInTzJ4F.cjs';
@@ -63,6 +63,7 @@ declare class GuestAuthManager {
63
63
  }
64
64
 
65
65
  type PresenceStatus = "online" | "offline" | "busy";
66
+ type PresenceResolvedStatus = PresenceStatus | "unknown";
66
67
  interface UserPresence {
67
68
  userId: string;
68
69
  status: PresenceStatus;
@@ -1316,15 +1317,25 @@ declare const useScreenShare: () => {
1316
1317
  handleStopScreenShare: () => Promise<void>;
1317
1318
  };
1318
1319
 
1319
- declare function usePresence(userId: string): {
1320
+ interface UsePresenceOptions {
1321
+ pollIntervalMs?: number;
1322
+ }
1323
+ declare function usePresence(userId: string, options?: UsePresenceOptions): {
1320
1324
  presence: UserPresence | undefined;
1321
1325
  status: PresenceStatus | undefined;
1326
+ resolvedStatus: PresenceResolvedStatus | undefined;
1322
1327
  isLoading: boolean;
1328
+ error: unknown;
1323
1329
  refetch: () => Promise<void>;
1324
1330
  };
1325
- declare function usePresenceMany(userIds: string[]): {
1331
+ interface UsePresenceManyOptions {
1332
+ pollIntervalMs?: number;
1333
+ }
1334
+ declare function usePresenceMany(userIds: string[], options?: UsePresenceManyOptions): {
1326
1335
  presences: Map<string, UserPresence>;
1327
1336
  isLoading: boolean;
1337
+ error: unknown;
1338
+ getStatus: (userId: string) => PresenceResolvedStatus | undefined;
1328
1339
  refetch: () => Promise<void>;
1329
1340
  };
1330
1341
 
@@ -1604,17 +1615,40 @@ type CallParticipantAddedEvent = z.infer<typeof callParticipantAddedSchema>;
1604
1615
  declare const callParticipantKickedSchema: z.ZodObject<{
1605
1616
  callId: z.ZodString;
1606
1617
  participantId: z.ZodString;
1618
+ userId: z.ZodString;
1607
1619
  reason: z.ZodOptional<z.ZodString>;
1608
1620
  }, "strict", z.ZodTypeAny, {
1609
1621
  callId: string;
1622
+ userId: string;
1610
1623
  participantId: string;
1611
1624
  reason?: string | undefined;
1612
1625
  }, {
1613
1626
  callId: string;
1627
+ userId: string;
1614
1628
  participantId: string;
1615
1629
  reason?: string | undefined;
1616
1630
  }>;
1617
1631
  type CallParticipantKickedEvent = z.infer<typeof callParticipantKickedSchema>;
1632
+ declare const callParticipantLeftSchema: z.ZodObject<{
1633
+ callId: z.ZodString;
1634
+ userId: z.ZodString;
1635
+ participantId: z.ZodString;
1636
+ leftAt: z.ZodString;
1637
+ reason: z.ZodOptional<z.ZodString>;
1638
+ }, "strict", z.ZodTypeAny, {
1639
+ callId: string;
1640
+ userId: string;
1641
+ participantId: string;
1642
+ leftAt: string;
1643
+ reason?: string | undefined;
1644
+ }, {
1645
+ callId: string;
1646
+ userId: string;
1647
+ participantId: string;
1648
+ leftAt: string;
1649
+ reason?: string | undefined;
1650
+ }>;
1651
+ type CallParticipantLeftEvent = z.infer<typeof callParticipantLeftSchema>;
1618
1652
  declare const callReadySchema: z.ZodObject<{
1619
1653
  callId: z.ZodString;
1620
1654
  participantId: z.ZodOptional<z.ZodString>;
@@ -1737,4 +1771,4 @@ declare function pushNetworkError(operation: string, error: unknown, logger?: (l
1737
1771
  declare function pushMediaPermissionError(device: string, error?: unknown, logger?: (level: LogLevel, message: string, meta?: any) => void): void;
1738
1772
  declare function pushDeviceError(operation: string, device: string, error: unknown, logger?: (level: LogLevel, message: string, meta?: any) => void): void;
1739
1773
 
1740
- export { type ApiConfig, type AuthenticatedSdkOptions, type CallActionResponse, type CallEndedEvent, type CallInfo, type CallInviteAcceptedEvent, type CallInviteCancelledEvent, type CallInviteDeclinedEvent, type CallInviteEvent, type CallInviteMissedEvent, type CallMode, type CallParticipant, type CallParticipantAddedEvent, type CallParticipantKickedEvent, type CallReadyEvent, type CallRecordingStartedEvent, type CallRecordingStoppedEvent, type CallResponse, type CallStartedEvent, type CallState, type CallStateType, type CallsData, CallsService, type ConnectionState, type CreateAdHocMeetingParams, type EndMeetingResponse, type EndReason, type ErrorCode, type EventHandler, type EventSubscription, type GuestErrorCode, GuestIdentity, GuestJoinError, type GuestJoinMeetingParams, type GuestJoinParams, type GuestJoinResponse, type GuestRtcSdk, type GuestSdkOptions, type GuestSessionInfo, type HealthData, HealthService, type IncomingCallEvent, IncomingInvite, type InitiateCallParams$1 as InitiateCallParams, type JoinMeetingParams, LiveKitJoinInfo, type Meeting, type MeetingJoinInfo, type MeetingResponse, type MeetingState, type MeetingStatus, type MeetingsData, MeetingsService, OpenApiConfigService, OutgoingInvite, ParticipantMetadata, ParticipantPermissions, type ParticipantProfilesEvent, type PresenceConfig, type PresencePingEvent, type PresenceStatus, Profile, RecordingInfo, RtcError, type RtcOptions, RtcProvider, type RtcSdk, RtcState, type SdkBuildOptions, type SdkBuildOptionsBase, type SdkEvent, SdkEventType, SignalCallsService, SignalClient, type SignalClientConfig, type SignalClientOptions, SignalHealthService, SignalMeetingsService, SignalPresenceService, type UseGuestJoinReturn, type UseTerminateReturn, type UseTimeoutReturn, type UserPresence, apiConfig, buildGuestSdk, buildSdk, callEndedSchema, callInviteAcceptedSchema, callInviteCancelledSchema, callInviteDeclinedSchema, callInviteMissedSchema, callInviteSchema, callParticipantAddedSchema, callParticipantKickedSchema, callReadySchema, callRecordingStartedSchema, callRecordingStoppedSchema, callStartedSchema, clearErrors, eventBus, participantProfilesSchema, presencePingSchema, profileCache, pushApiError, pushDeviceError, pushError, pushIdentityGuardError, pushLiveKitConnectError, pushMediaPermissionError, pushNetworkError, pushSocketValidationError, pushStaleEventError, recordingStore, useAutoConnectRoom, useCallActions, useCallInitiated, useCallState, useConnectionState, useEvent, useGuestIdentity, useGuestJoin, useGuestPermissions, useGuestSdk, useHasActiveSession, useIncomingInvite, useInviteAccepted, useIsGuestMode, useIsProfilePending, useLivekitInfo, useMeeting, useMeetingActions, useMeetingState, useOutgoingInvites, useParticipantList, useParticipantMetadata, useParticipantPermissions, useParticipantProfile, usePresence, usePresenceMany, useProfileCache, useRecording, useRecordingStore, useRingTimeout, useRoomReady, useScreenShare, useSdk, useSessionDuration, useSessionId, useSignalClient, useTerminate, useTimeout, useTimeoutEffect };
1774
+ export { type ApiConfig, type AuthenticatedSdkOptions, type CallActionResponse, type CallEndedEvent, type CallInfo, type CallInviteAcceptedEvent, type CallInviteCancelledEvent, type CallInviteDeclinedEvent, type CallInviteEvent, type CallInviteMissedEvent, type CallMode, type CallParticipant, type CallParticipantAddedEvent, type CallParticipantKickedEvent, type CallParticipantLeftEvent, type CallReadyEvent, type CallRecordingStartedEvent, type CallRecordingStoppedEvent, type CallResponse, type CallStartedEvent, type CallState, type CallStateType, type CallsData, CallsService, type ConnectionState, type CreateAdHocMeetingParams, type EndMeetingResponse, type EndReason, type ErrorCode, type EventHandler, type EventSubscription, type GuestErrorCode, GuestIdentity, GuestJoinError, type GuestJoinMeetingParams, type GuestJoinParams, type GuestJoinResponse, type GuestRtcSdk, type GuestSdkOptions, type GuestSessionInfo, type HealthData, HealthService, type IncomingCallEvent, IncomingInvite, type InitiateCallParams$1 as InitiateCallParams, type JoinMeetingParams, LiveKitJoinInfo, type Meeting, type MeetingJoinInfo, type MeetingResponse, type MeetingState, type MeetingStatus, type MeetingsData, MeetingsService, OpenApiConfigService, OutgoingInvite, ParticipantMetadata, ParticipantPermissions, type ParticipantProfilesEvent, type PresenceConfig, type PresencePingEvent, type PresenceStatus, Profile, RecordingInfo, RtcError, type RtcOptions, RtcProvider, type RtcSdk, RtcState, type SdkBuildOptions, type SdkBuildOptionsBase, type SdkEvent, SdkEventType, SignalCallsService, SignalClient, type SignalClientConfig, type SignalClientOptions, SignalHealthService, SignalMeetingsService, SignalPresenceService, type UseGuestJoinReturn, type UsePresenceManyOptions, type UsePresenceOptions, type UseTerminateReturn, type UseTimeoutReturn, type UserPresence, apiConfig, buildGuestSdk, buildSdk, callEndedSchema, callInviteAcceptedSchema, callInviteCancelledSchema, callInviteDeclinedSchema, callInviteMissedSchema, callInviteSchema, callParticipantAddedSchema, callParticipantKickedSchema, callParticipantLeftSchema, callReadySchema, callRecordingStartedSchema, callRecordingStoppedSchema, callStartedSchema, clearErrors, eventBus, participantProfilesSchema, presencePingSchema, profileCache, pushApiError, pushDeviceError, pushError, pushIdentityGuardError, pushLiveKitConnectError, pushMediaPermissionError, pushNetworkError, pushSocketValidationError, pushStaleEventError, recordingStore, useAutoConnectRoom, useCallActions, useCallInitiated, useCallState, useConnectionState, useEvent, useGuestIdentity, useGuestJoin, useGuestPermissions, useGuestSdk, useHasActiveSession, useIncomingInvite, useInviteAccepted, useIsGuestMode, useIsProfilePending, useLivekitInfo, useMeeting, useMeetingActions, useMeetingState, useOutgoingInvites, useParticipantList, useParticipantMetadata, useParticipantPermissions, useParticipantProfile, usePresence, usePresenceMany, useProfileCache, useRecording, useRecordingStore, useRingTimeout, useRoomReady, useScreenShare, useSdk, useSessionDuration, useSessionId, useSignalClient, useTerminate, useTimeout, useTimeoutEffect };
package/dist/index.d.ts CHANGED
@@ -2,8 +2,8 @@ import React from 'react';
2
2
  import { Socket } from 'socket.io-client';
3
3
  import * as immer from 'immer';
4
4
  import * as zustand from 'zustand';
5
- import { R as RtcState, a as RtcError, I as IncomingInvite, O as OutgoingInvite, P as ParticipantMetadata, L as LiveKitJoinInfo, b as ParticipantPermissions, c as Profile, d as ParticipantListOptions, e as ParticipantListReturn, f as RecordingInfo, G as GuestIdentity } from './types-CCWG5LpL.js';
6
- export { M as MeetingInfo, S as Session, g as SessionType } from './types-CCWG5LpL.js';
5
+ import { R as RtcState, a as RtcError, I as IncomingInvite, O as OutgoingInvite, P as ParticipantMetadata, L as LiveKitJoinInfo, b as ParticipantPermissions, c as Profile, d as ParticipantListOptions, e as ParticipantListReturn, f as RecordingInfo, G as GuestIdentity } from './types-BbdWZE4Y.js';
6
+ export { M as MeetingInfo, S as Session, g as SessionType } from './types-BbdWZE4Y.js';
7
7
  import { L as LogLevel, D as DurationResult, N as Nullable$1 } from './duration-DvuGtU76.js';
8
8
  import { Room, RemoteParticipant, LocalParticipant, RoomOptions, Participant } from 'livekit-client';
9
9
  export { U as UseVirtualBackgroundOptions, u as useVirtualBackground } from './useVirtualBackground-DInTzJ4F.js';
@@ -63,6 +63,7 @@ declare class GuestAuthManager {
63
63
  }
64
64
 
65
65
  type PresenceStatus = "online" | "offline" | "busy";
66
+ type PresenceResolvedStatus = PresenceStatus | "unknown";
66
67
  interface UserPresence {
67
68
  userId: string;
68
69
  status: PresenceStatus;
@@ -1316,15 +1317,25 @@ declare const useScreenShare: () => {
1316
1317
  handleStopScreenShare: () => Promise<void>;
1317
1318
  };
1318
1319
 
1319
- declare function usePresence(userId: string): {
1320
+ interface UsePresenceOptions {
1321
+ pollIntervalMs?: number;
1322
+ }
1323
+ declare function usePresence(userId: string, options?: UsePresenceOptions): {
1320
1324
  presence: UserPresence | undefined;
1321
1325
  status: PresenceStatus | undefined;
1326
+ resolvedStatus: PresenceResolvedStatus | undefined;
1322
1327
  isLoading: boolean;
1328
+ error: unknown;
1323
1329
  refetch: () => Promise<void>;
1324
1330
  };
1325
- declare function usePresenceMany(userIds: string[]): {
1331
+ interface UsePresenceManyOptions {
1332
+ pollIntervalMs?: number;
1333
+ }
1334
+ declare function usePresenceMany(userIds: string[], options?: UsePresenceManyOptions): {
1326
1335
  presences: Map<string, UserPresence>;
1327
1336
  isLoading: boolean;
1337
+ error: unknown;
1338
+ getStatus: (userId: string) => PresenceResolvedStatus | undefined;
1328
1339
  refetch: () => Promise<void>;
1329
1340
  };
1330
1341
 
@@ -1604,17 +1615,40 @@ type CallParticipantAddedEvent = z.infer<typeof callParticipantAddedSchema>;
1604
1615
  declare const callParticipantKickedSchema: z.ZodObject<{
1605
1616
  callId: z.ZodString;
1606
1617
  participantId: z.ZodString;
1618
+ userId: z.ZodString;
1607
1619
  reason: z.ZodOptional<z.ZodString>;
1608
1620
  }, "strict", z.ZodTypeAny, {
1609
1621
  callId: string;
1622
+ userId: string;
1610
1623
  participantId: string;
1611
1624
  reason?: string | undefined;
1612
1625
  }, {
1613
1626
  callId: string;
1627
+ userId: string;
1614
1628
  participantId: string;
1615
1629
  reason?: string | undefined;
1616
1630
  }>;
1617
1631
  type CallParticipantKickedEvent = z.infer<typeof callParticipantKickedSchema>;
1632
+ declare const callParticipantLeftSchema: z.ZodObject<{
1633
+ callId: z.ZodString;
1634
+ userId: z.ZodString;
1635
+ participantId: z.ZodString;
1636
+ leftAt: z.ZodString;
1637
+ reason: z.ZodOptional<z.ZodString>;
1638
+ }, "strict", z.ZodTypeAny, {
1639
+ callId: string;
1640
+ userId: string;
1641
+ participantId: string;
1642
+ leftAt: string;
1643
+ reason?: string | undefined;
1644
+ }, {
1645
+ callId: string;
1646
+ userId: string;
1647
+ participantId: string;
1648
+ leftAt: string;
1649
+ reason?: string | undefined;
1650
+ }>;
1651
+ type CallParticipantLeftEvent = z.infer<typeof callParticipantLeftSchema>;
1618
1652
  declare const callReadySchema: z.ZodObject<{
1619
1653
  callId: z.ZodString;
1620
1654
  participantId: z.ZodOptional<z.ZodString>;
@@ -1737,4 +1771,4 @@ declare function pushNetworkError(operation: string, error: unknown, logger?: (l
1737
1771
  declare function pushMediaPermissionError(device: string, error?: unknown, logger?: (level: LogLevel, message: string, meta?: any) => void): void;
1738
1772
  declare function pushDeviceError(operation: string, device: string, error: unknown, logger?: (level: LogLevel, message: string, meta?: any) => void): void;
1739
1773
 
1740
- export { type ApiConfig, type AuthenticatedSdkOptions, type CallActionResponse, type CallEndedEvent, type CallInfo, type CallInviteAcceptedEvent, type CallInviteCancelledEvent, type CallInviteDeclinedEvent, type CallInviteEvent, type CallInviteMissedEvent, type CallMode, type CallParticipant, type CallParticipantAddedEvent, type CallParticipantKickedEvent, type CallReadyEvent, type CallRecordingStartedEvent, type CallRecordingStoppedEvent, type CallResponse, type CallStartedEvent, type CallState, type CallStateType, type CallsData, CallsService, type ConnectionState, type CreateAdHocMeetingParams, type EndMeetingResponse, type EndReason, type ErrorCode, type EventHandler, type EventSubscription, type GuestErrorCode, GuestIdentity, GuestJoinError, type GuestJoinMeetingParams, type GuestJoinParams, type GuestJoinResponse, type GuestRtcSdk, type GuestSdkOptions, type GuestSessionInfo, type HealthData, HealthService, type IncomingCallEvent, IncomingInvite, type InitiateCallParams$1 as InitiateCallParams, type JoinMeetingParams, LiveKitJoinInfo, type Meeting, type MeetingJoinInfo, type MeetingResponse, type MeetingState, type MeetingStatus, type MeetingsData, MeetingsService, OpenApiConfigService, OutgoingInvite, ParticipantMetadata, ParticipantPermissions, type ParticipantProfilesEvent, type PresenceConfig, type PresencePingEvent, type PresenceStatus, Profile, RecordingInfo, RtcError, type RtcOptions, RtcProvider, type RtcSdk, RtcState, type SdkBuildOptions, type SdkBuildOptionsBase, type SdkEvent, SdkEventType, SignalCallsService, SignalClient, type SignalClientConfig, type SignalClientOptions, SignalHealthService, SignalMeetingsService, SignalPresenceService, type UseGuestJoinReturn, type UseTerminateReturn, type UseTimeoutReturn, type UserPresence, apiConfig, buildGuestSdk, buildSdk, callEndedSchema, callInviteAcceptedSchema, callInviteCancelledSchema, callInviteDeclinedSchema, callInviteMissedSchema, callInviteSchema, callParticipantAddedSchema, callParticipantKickedSchema, callReadySchema, callRecordingStartedSchema, callRecordingStoppedSchema, callStartedSchema, clearErrors, eventBus, participantProfilesSchema, presencePingSchema, profileCache, pushApiError, pushDeviceError, pushError, pushIdentityGuardError, pushLiveKitConnectError, pushMediaPermissionError, pushNetworkError, pushSocketValidationError, pushStaleEventError, recordingStore, useAutoConnectRoom, useCallActions, useCallInitiated, useCallState, useConnectionState, useEvent, useGuestIdentity, useGuestJoin, useGuestPermissions, useGuestSdk, useHasActiveSession, useIncomingInvite, useInviteAccepted, useIsGuestMode, useIsProfilePending, useLivekitInfo, useMeeting, useMeetingActions, useMeetingState, useOutgoingInvites, useParticipantList, useParticipantMetadata, useParticipantPermissions, useParticipantProfile, usePresence, usePresenceMany, useProfileCache, useRecording, useRecordingStore, useRingTimeout, useRoomReady, useScreenShare, useSdk, useSessionDuration, useSessionId, useSignalClient, useTerminate, useTimeout, useTimeoutEffect };
1774
+ export { type ApiConfig, type AuthenticatedSdkOptions, type CallActionResponse, type CallEndedEvent, type CallInfo, type CallInviteAcceptedEvent, type CallInviteCancelledEvent, type CallInviteDeclinedEvent, type CallInviteEvent, type CallInviteMissedEvent, type CallMode, type CallParticipant, type CallParticipantAddedEvent, type CallParticipantKickedEvent, type CallParticipantLeftEvent, type CallReadyEvent, type CallRecordingStartedEvent, type CallRecordingStoppedEvent, type CallResponse, type CallStartedEvent, type CallState, type CallStateType, type CallsData, CallsService, type ConnectionState, type CreateAdHocMeetingParams, type EndMeetingResponse, type EndReason, type ErrorCode, type EventHandler, type EventSubscription, type GuestErrorCode, GuestIdentity, GuestJoinError, type GuestJoinMeetingParams, type GuestJoinParams, type GuestJoinResponse, type GuestRtcSdk, type GuestSdkOptions, type GuestSessionInfo, type HealthData, HealthService, type IncomingCallEvent, IncomingInvite, type InitiateCallParams$1 as InitiateCallParams, type JoinMeetingParams, LiveKitJoinInfo, type Meeting, type MeetingJoinInfo, type MeetingResponse, type MeetingState, type MeetingStatus, type MeetingsData, MeetingsService, OpenApiConfigService, OutgoingInvite, ParticipantMetadata, ParticipantPermissions, type ParticipantProfilesEvent, type PresenceConfig, type PresencePingEvent, type PresenceStatus, Profile, RecordingInfo, RtcError, type RtcOptions, RtcProvider, type RtcSdk, RtcState, type SdkBuildOptions, type SdkBuildOptionsBase, type SdkEvent, SdkEventType, SignalCallsService, SignalClient, type SignalClientConfig, type SignalClientOptions, SignalHealthService, SignalMeetingsService, SignalPresenceService, type UseGuestJoinReturn, type UsePresenceManyOptions, type UsePresenceOptions, type UseTerminateReturn, type UseTimeoutReturn, type UserPresence, apiConfig, buildGuestSdk, buildSdk, callEndedSchema, callInviteAcceptedSchema, callInviteCancelledSchema, callInviteDeclinedSchema, callInviteMissedSchema, callInviteSchema, callParticipantAddedSchema, callParticipantKickedSchema, callParticipantLeftSchema, callReadySchema, callRecordingStartedSchema, callRecordingStoppedSchema, callStartedSchema, clearErrors, eventBus, participantProfilesSchema, presencePingSchema, profileCache, pushApiError, pushDeviceError, pushError, pushIdentityGuardError, pushLiveKitConnectError, pushMediaPermissionError, pushNetworkError, pushSocketValidationError, pushStaleEventError, recordingStore, useAutoConnectRoom, useCallActions, useCallInitiated, useCallState, useConnectionState, useEvent, useGuestIdentity, useGuestJoin, useGuestPermissions, useGuestSdk, useHasActiveSession, useIncomingInvite, useInviteAccepted, useIsGuestMode, useIsProfilePending, useLivekitInfo, useMeeting, useMeetingActions, useMeetingState, useOutgoingInvites, useParticipantList, useParticipantMetadata, useParticipantPermissions, useParticipantProfile, usePresence, usePresenceMany, useProfileCache, useRecording, useRecordingStore, useRingTimeout, useRoomReady, useScreenShare, useSdk, useSessionDuration, useSessionId, useSignalClient, useTerminate, useTimeout, useTimeoutEffect };
package/dist/index.mjs CHANGED
@@ -1906,6 +1906,14 @@ var callParticipantAddedSchema = z.object({
1906
1906
  var callParticipantKickedSchema = z.object({
1907
1907
  callId: z.string(),
1908
1908
  participantId: z.string(),
1909
+ userId: z.string(),
1910
+ reason: z.string().optional()
1911
+ }).strict();
1912
+ var callParticipantLeftSchema = z.object({
1913
+ callId: z.string(),
1914
+ userId: z.string(),
1915
+ participantId: z.string(),
1916
+ leftAt: z.string(),
1909
1917
  reason: z.string().optional()
1910
1918
  }).strict();
1911
1919
  var callReadySchema = z.object({
@@ -2265,8 +2273,14 @@ var CallParticipantKickedHandler = class extends BaseSocketHandler {
2265
2273
  participantId: data.participantId,
2266
2274
  reason: data.reason
2267
2275
  });
2276
+ this.updateStore((state) => {
2277
+ if (data.userId && state.outgoingInvites[data.userId]) {
2278
+ delete state.outgoingInvites[data.userId];
2279
+ }
2280
+ });
2268
2281
  this.logger.debug("Participant kicked from call", {
2269
- participantId: data.participantId
2282
+ participantId: data.participantId,
2283
+ userId: data.userId
2270
2284
  });
2271
2285
  }
2272
2286
  };
@@ -2473,6 +2487,12 @@ var InviteMissedHandler = class extends BaseSocketHandler {
2473
2487
  userId: data.userId
2474
2488
  });
2475
2489
  if (currentState.session?.id !== data.callId) {
2490
+ this.logger.warn("Invite missed ignored due to session mismatch", {
2491
+ eventCallId: data.callId,
2492
+ sessionCallId: currentState.session?.id,
2493
+ hasSession: !!currentState.session,
2494
+ outgoingInviteKeys: Object.keys(currentState.outgoingInvites || {})
2495
+ });
2476
2496
  pushStaleEventError("call:inviteMissed", "callId mismatch", {
2477
2497
  eventCallId: data.callId,
2478
2498
  sessionCallId: currentState.session?.id
@@ -2608,6 +2628,42 @@ var ParticipantAddedHandler = class extends BaseSocketHandler {
2608
2628
  }
2609
2629
  };
2610
2630
 
2631
+ // src/core/socketio/handlers/participant-left.handler.ts
2632
+ var ParticipantLeftHandler = class extends BaseSocketHandler {
2633
+ constructor() {
2634
+ super(...arguments);
2635
+ this.eventName = "call:participantLeft";
2636
+ this.schema = callParticipantLeftSchema;
2637
+ }
2638
+ handle(data) {
2639
+ const currentState = rtcStore.getState();
2640
+ this.logger.info("Participant left call", {
2641
+ callId: data.callId,
2642
+ userId: data.userId,
2643
+ participantId: data.participantId
2644
+ });
2645
+ if (currentState.session?.id !== data.callId) {
2646
+ pushStaleEventError("call:participantLeft", "callId mismatch", {
2647
+ eventCallId: data.callId,
2648
+ sessionCallId: currentState.session?.id
2649
+ });
2650
+ this.logger.warn("Ignoring participant left for different call", {
2651
+ callId: data.callId
2652
+ });
2653
+ return;
2654
+ }
2655
+ this.updateStore((state) => {
2656
+ if (state.outgoingInvites[data.userId]) {
2657
+ state.outgoingInvites[data.userId].status = "left";
2658
+ this.logger.info("Outgoing invite marked as left", {
2659
+ userId: data.userId,
2660
+ callId: data.callId
2661
+ });
2662
+ }
2663
+ });
2664
+ }
2665
+ };
2666
+
2611
2667
  // src/core/socketio/handlers/participant-profiles.handler.ts
2612
2668
  var ParticipantProfilesHandler = class extends BaseSocketHandler {
2613
2669
  constructor() {
@@ -2785,6 +2841,7 @@ var SocketHandlerRegistry = class {
2785
2841
  new InviteCancelledHandler(this.options),
2786
2842
  // Participant management
2787
2843
  new ParticipantAddedHandler(this.options),
2844
+ new ParticipantLeftHandler(this.options),
2788
2845
  new CallParticipantKickedHandler(this.options),
2789
2846
  // Profile hydration
2790
2847
  new ParticipantProfilesHandler(this.options),
@@ -3969,7 +4026,8 @@ function createPresenceService(config, deps) {
3969
4026
  if (userIds.length === 0) {
3970
4027
  return [];
3971
4028
  }
3972
- const cacheKey = [...userIds].sort().join(",");
4029
+ const uniqueUserIds = Array.from(new Set(userIds));
4030
+ const cacheKey = [...uniqueUserIds].sort().join(",");
3973
4031
  const existing = inFlight.get(cacheKey);
3974
4032
  if (existing) {
3975
4033
  logger7.debug("Reusing in-flight request", { cacheKey });
@@ -3977,7 +4035,7 @@ function createPresenceService(config, deps) {
3977
4035
  }
3978
4036
  const fetchPromise = (async () => {
3979
4037
  try {
3980
- const response = await signalPresence.queryPresence(userIds);
4038
+ const response = await signalPresence.queryPresence(uniqueUserIds);
3981
4039
  return response.presence.map((p) => ({
3982
4040
  userId: p.userId,
3983
4041
  status: p.status,
@@ -5004,56 +5062,105 @@ var useScreenShare = () => {
5004
5062
  handleStopScreenShare
5005
5063
  };
5006
5064
  };
5007
- function usePresence(userId) {
5065
+ function usePresence(userId, options) {
5008
5066
  const sdk = useSdk();
5009
5067
  const [presence, setPresence] = useState();
5010
5068
  const [isLoading, setIsLoading] = useState(false);
5069
+ const [error, setError] = useState(null);
5070
+ const isMountedRef = useRef(true);
5011
5071
  const refetch = useCallback(async () => {
5012
5072
  if (!userId) return;
5013
5073
  setIsLoading(true);
5074
+ setError(null);
5014
5075
  try {
5015
5076
  const result = await sdk.presence.getPresence(userId);
5016
- setPresence(result);
5077
+ if (isMountedRef.current) {
5078
+ setPresence(result);
5079
+ }
5080
+ } catch (err) {
5081
+ if (isMountedRef.current) {
5082
+ setError(err);
5083
+ }
5017
5084
  } finally {
5018
- setIsLoading(false);
5085
+ if (isMountedRef.current) {
5086
+ setIsLoading(false);
5087
+ }
5019
5088
  }
5020
5089
  }, [sdk, userId]);
5021
5090
  useEffect(() => {
5022
5091
  refetch();
5023
5092
  }, [refetch]);
5093
+ useEffect(() => {
5094
+ if (!options?.pollIntervalMs) return;
5095
+ const id = setInterval(refetch, options.pollIntervalMs);
5096
+ return () => clearInterval(id);
5097
+ }, [options?.pollIntervalMs, refetch]);
5098
+ useEffect(() => {
5099
+ return () => {
5100
+ isMountedRef.current = false;
5101
+ };
5102
+ }, []);
5024
5103
  return {
5025
5104
  presence,
5026
5105
  status: presence?.status,
5106
+ resolvedStatus: error ? "unknown" : presence?.status,
5027
5107
  isLoading,
5108
+ error,
5028
5109
  refetch
5029
5110
  };
5030
5111
  }
5031
- function usePresenceMany(userIds) {
5112
+ function usePresenceMany(userIds, options) {
5032
5113
  const sdk = useSdk();
5033
5114
  const [presences, setPresences] = useState(
5034
5115
  /* @__PURE__ */ new Map()
5035
5116
  );
5036
5117
  const [isLoading, setIsLoading] = useState(false);
5118
+ const [error, setError] = useState(null);
5119
+ const isMountedRef = useRef(true);
5037
5120
  const refetch = useCallback(async () => {
5038
5121
  if (userIds.length === 0) return;
5039
5122
  setIsLoading(true);
5123
+ setError(null);
5040
5124
  try {
5041
5125
  const results = await sdk.presence.queryPresence(userIds);
5042
5126
  const map = /* @__PURE__ */ new Map();
5043
5127
  for (const p of results) {
5044
5128
  map.set(p.userId, p);
5045
5129
  }
5046
- setPresences(map);
5130
+ if (isMountedRef.current) {
5131
+ setPresences(map);
5132
+ }
5133
+ } catch (err) {
5134
+ if (isMountedRef.current) {
5135
+ setError(err);
5136
+ }
5047
5137
  } finally {
5048
- setIsLoading(false);
5138
+ if (isMountedRef.current) {
5139
+ setIsLoading(false);
5140
+ }
5049
5141
  }
5050
5142
  }, [sdk, userIds]);
5051
5143
  useEffect(() => {
5052
5144
  refetch();
5053
5145
  }, [refetch]);
5146
+ useEffect(() => {
5147
+ if (!options?.pollIntervalMs) return;
5148
+ const id = setInterval(refetch, options.pollIntervalMs);
5149
+ return () => clearInterval(id);
5150
+ }, [options?.pollIntervalMs, refetch]);
5151
+ useEffect(() => {
5152
+ return () => {
5153
+ isMountedRef.current = false;
5154
+ };
5155
+ }, []);
5054
5156
  return {
5055
5157
  presences,
5056
5158
  isLoading,
5159
+ error,
5160
+ getStatus: (userId) => {
5161
+ if (error) return "unknown";
5162
+ return presences.get(userId)?.status;
5163
+ },
5057
5164
  refetch
5058
5165
  };
5059
5166
  }
@@ -5142,6 +5249,6 @@ function useGuestPermissions() {
5142
5249
  return GUEST_PERMISSIONS;
5143
5250
  }
5144
5251
 
5145
- export { CallsService, GuestJoinError, HealthService, MeetingsService, OpenApiConfigService, RtcProvider, SdkEventType, SignalCallsService, SignalClient, SignalHealthService, SignalMeetingsService, SignalPresenceService, apiConfig, buildGuestSdk, buildSdk, callEndedSchema, callInviteAcceptedSchema, callInviteCancelledSchema, callInviteDeclinedSchema, callInviteMissedSchema, callInviteSchema, callParticipantAddedSchema, callParticipantKickedSchema, callReadySchema, callRecordingStartedSchema, callRecordingStoppedSchema, callStartedSchema, clearErrors, eventBus, participantProfilesSchema, presencePingSchema, profileCache, pushApiError, pushDeviceError, pushError, pushIdentityGuardError, pushLiveKitConnectError, pushMediaPermissionError, pushNetworkError, pushSocketValidationError, pushStaleEventError, recordingStore, useAutoConnectRoom, useCallActions, useCallInitiated, useCallState, useConnectionState, useEvent, useGuestIdentity, useGuestJoin, useGuestPermissions, useGuestSdk, useHasActiveSession, useIncomingInvite, useInviteAccepted, useIsGuestMode, useIsProfilePending, useLivekitInfo, useMeeting, useMeetingActions, useMeetingState, useOutgoingInvites, useParticipantList, useParticipantMetadata, useParticipantPermissions, useParticipantProfile, usePresence, usePresenceMany, useProfileCache, useRecording, useRecordingStore, useRingTimeout, useRoomReady, useScreenShare, useSdk, useSessionDuration, useSessionId, useSignalClient, useTerminate, useTimeout, useTimeoutEffect, useVirtualBackground };
5252
+ export { CallsService, GuestJoinError, HealthService, MeetingsService, OpenApiConfigService, RtcProvider, SdkEventType, SignalCallsService, SignalClient, SignalHealthService, SignalMeetingsService, SignalPresenceService, apiConfig, buildGuestSdk, buildSdk, callEndedSchema, callInviteAcceptedSchema, callInviteCancelledSchema, callInviteDeclinedSchema, callInviteMissedSchema, callInviteSchema, callParticipantAddedSchema, callParticipantKickedSchema, callParticipantLeftSchema, callReadySchema, callRecordingStartedSchema, callRecordingStoppedSchema, callStartedSchema, clearErrors, eventBus, participantProfilesSchema, presencePingSchema, profileCache, pushApiError, pushDeviceError, pushError, pushIdentityGuardError, pushLiveKitConnectError, pushMediaPermissionError, pushNetworkError, pushSocketValidationError, pushStaleEventError, recordingStore, useAutoConnectRoom, useCallActions, useCallInitiated, useCallState, useConnectionState, useEvent, useGuestIdentity, useGuestJoin, useGuestPermissions, useGuestSdk, useHasActiveSession, useIncomingInvite, useInviteAccepted, useIsGuestMode, useIsProfilePending, useLivekitInfo, useMeeting, useMeetingActions, useMeetingState, useOutgoingInvites, useParticipantList, useParticipantMetadata, useParticipantPermissions, useParticipantProfile, usePresence, usePresenceMany, useProfileCache, useRecording, useRecordingStore, useRingTimeout, useRoomReady, useScreenShare, useSdk, useSessionDuration, useSessionId, useSignalClient, useTerminate, useTimeout, useTimeoutEffect, useVirtualBackground };
5146
5253
  //# sourceMappingURL=index.mjs.map
5147
5254
  //# sourceMappingURL=index.mjs.map