farvex 0.2.0 → 1.0.0

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.
@@ -1,88 +1,21 @@
1
+ import * as react_jsx_runtime from 'react/jsx-runtime';
1
2
  import { ReactNode } from 'react';
2
- import { CallpadConfig, CallpadClient, ClientStatus, ClientEventMap, Nullable, Session, SessionEventMap, Invite, Recording, Participant, SessionParticipantCapability, Dispatch, PresenceRef, PresenceSnapshot, PresenceMode } from '../core/index.cjs';
3
- import 'livekit-client';
3
+ import { i as SessionClient, S as SessionAction, N as Nullable, l as SessionInvite, s as VoiceSession, k as SessionDuration, b as ClientStatus } from '../types-DhJEeeui.cjs';
4
4
 
5
- interface CallpadProviderProps {
6
- config: CallpadConfig;
5
+ type CallpadProviderProps<TClient extends SessionClient = SessionClient> = {
6
+ client: TClient;
7
+ connect?: boolean;
8
+ disposeOnUnmount?: boolean;
7
9
  children: ReactNode;
8
- audioRenderer?: ReactNode;
9
- }
10
- declare function CallpadProvider({ config, children, audioRenderer, }: CallpadProviderProps): ReactNode;
11
-
12
- declare function useCallpadClient(): {
13
- client: CallpadClient;
14
- status: ClientStatus;
15
10
  };
16
-
17
- declare function useClientEvent<K extends keyof ClientEventMap>(event: K, handler: (payload: ClientEventMap[K]) => void): void;
18
-
19
- declare function useSessions(): readonly Session[];
20
- declare function useSession(sessionId?: string): Nullable<Session>;
21
-
22
- declare function useSessionEvent<K extends keyof SessionEventMap>(event: K, handler: (payload: SessionEventMap[K]) => void, sessionId?: string): void;
23
-
24
- declare function useIncomingInvites(): readonly Invite[];
25
- declare function useIncomingInvite(): Nullable<Invite>;
26
-
27
- interface CallDuration {
28
- formatted: string;
29
- elapsedSeconds: number;
30
- }
31
- declare function useCallDuration(sessionId?: string): CallDuration;
32
-
33
- declare function useIsHeld(sessionId?: string): boolean;
34
-
35
- declare function useActiveRecording(sessionId?: string): Nullable<Recording>;
36
-
37
- declare function useSessionParticipants(sessionId?: string): readonly Participant[];
38
- declare function useSessionParticipant(participantId: string, sessionId?: string): Nullable<Participant>;
39
- declare function useSelfParticipant(sessionId?: string): Nullable<Participant>;
40
-
41
- declare function useSessionCapabilities(sessionId?: string): ReadonlySet<SessionParticipantCapability>;
42
-
43
- declare function useSessionDispatches(sessionId?: string): readonly Dispatch[];
44
-
45
- interface CallControls {
46
- mic: {
47
- muted: boolean;
48
- toggle: () => Promise<void>;
49
- setMuted: (v: boolean) => Promise<void>;
50
- };
51
- camera: {
52
- enabled: boolean;
53
- toggle: () => Promise<void>;
54
- };
55
- screenShare: {
56
- active: boolean;
57
- toggle: () => Promise<void>;
58
- };
59
- hold: {
60
- active: boolean;
61
- enabled: boolean;
62
- toggle: () => Promise<void>;
63
- };
64
- recording: {
65
- active: boolean;
66
- enabled: boolean;
67
- toggle: () => Promise<void>;
68
- };
69
- leave: {
70
- enabled: boolean;
71
- run: () => Promise<void>;
72
- };
73
- end: {
74
- enabled: boolean;
75
- run: () => Promise<void>;
76
- };
77
- }
78
- declare function useCallControls(sessionId?: string): CallControls;
79
-
80
- declare function usePresence(refs: readonly PresenceRef[]): ReadonlyMap<string, PresenceSnapshot>;
81
- interface MyPresenceHandle {
82
- snapshot: Nullable<PresenceSnapshot>;
83
- setStatus: (mode: PresenceMode, note?: Nullable<string>) => Promise<void>;
84
- clearStatus: () => Promise<void>;
85
- }
86
- declare function useMyPresence(): MyPresenceHandle;
87
-
88
- export { type CallControls, type CallDuration, CallpadProvider, type CallpadProviderProps, type MyPresenceHandle, useActiveRecording, useCallControls, useCallDuration, useCallpadClient, useClientEvent, useIncomingInvite, useIncomingInvites, useIsHeld, useMyPresence, usePresence, useSelfParticipant, useSession, useSessionCapabilities, useSessionDispatches, useSessionEvent, useSessionParticipant, useSessionParticipants, useSessions };
11
+ declare const CallpadProvider: <TClient extends SessionClient>({ client, connect, disposeOnUnmount, children, }: CallpadProviderProps<TClient>) => react_jsx_runtime.JSX.Element;
12
+ declare const useCallpad: <TClient extends SessionClient = SessionClient>() => TClient;
13
+ declare const useStatus: () => ClientStatus;
14
+ declare const useSessions: () => readonly VoiceSession[];
15
+ declare const useSession: (sessionId?: string) => Nullable<VoiceSession>;
16
+ declare const useIncomingInvites: () => readonly SessionInvite[];
17
+ declare const useIncomingInvite: () => Nullable<SessionInvite>;
18
+ declare const useCan: (sessionId: string | undefined, action: SessionAction) => boolean;
19
+ declare const useSessionDuration: (sessionId?: string) => SessionDuration;
20
+
21
+ export { CallpadProvider, type CallpadProviderProps, useCallpad, useCan, useIncomingInvite, useIncomingInvites, useSession, useSessionDuration, useSessions, useStatus };
@@ -1,88 +1,21 @@
1
+ import * as react_jsx_runtime from 'react/jsx-runtime';
1
2
  import { ReactNode } from 'react';
2
- import { CallpadConfig, CallpadClient, ClientStatus, ClientEventMap, Nullable, Session, SessionEventMap, Invite, Recording, Participant, SessionParticipantCapability, Dispatch, PresenceRef, PresenceSnapshot, PresenceMode } from '../core/index.js';
3
- import 'livekit-client';
3
+ import { i as SessionClient, S as SessionAction, N as Nullable, l as SessionInvite, s as VoiceSession, k as SessionDuration, b as ClientStatus } from '../types-DhJEeeui.js';
4
4
 
5
- interface CallpadProviderProps {
6
- config: CallpadConfig;
5
+ type CallpadProviderProps<TClient extends SessionClient = SessionClient> = {
6
+ client: TClient;
7
+ connect?: boolean;
8
+ disposeOnUnmount?: boolean;
7
9
  children: ReactNode;
8
- audioRenderer?: ReactNode;
9
- }
10
- declare function CallpadProvider({ config, children, audioRenderer, }: CallpadProviderProps): ReactNode;
11
-
12
- declare function useCallpadClient(): {
13
- client: CallpadClient;
14
- status: ClientStatus;
15
10
  };
16
-
17
- declare function useClientEvent<K extends keyof ClientEventMap>(event: K, handler: (payload: ClientEventMap[K]) => void): void;
18
-
19
- declare function useSessions(): readonly Session[];
20
- declare function useSession(sessionId?: string): Nullable<Session>;
21
-
22
- declare function useSessionEvent<K extends keyof SessionEventMap>(event: K, handler: (payload: SessionEventMap[K]) => void, sessionId?: string): void;
23
-
24
- declare function useIncomingInvites(): readonly Invite[];
25
- declare function useIncomingInvite(): Nullable<Invite>;
26
-
27
- interface CallDuration {
28
- formatted: string;
29
- elapsedSeconds: number;
30
- }
31
- declare function useCallDuration(sessionId?: string): CallDuration;
32
-
33
- declare function useIsHeld(sessionId?: string): boolean;
34
-
35
- declare function useActiveRecording(sessionId?: string): Nullable<Recording>;
36
-
37
- declare function useSessionParticipants(sessionId?: string): readonly Participant[];
38
- declare function useSessionParticipant(participantId: string, sessionId?: string): Nullable<Participant>;
39
- declare function useSelfParticipant(sessionId?: string): Nullable<Participant>;
40
-
41
- declare function useSessionCapabilities(sessionId?: string): ReadonlySet<SessionParticipantCapability>;
42
-
43
- declare function useSessionDispatches(sessionId?: string): readonly Dispatch[];
44
-
45
- interface CallControls {
46
- mic: {
47
- muted: boolean;
48
- toggle: () => Promise<void>;
49
- setMuted: (v: boolean) => Promise<void>;
50
- };
51
- camera: {
52
- enabled: boolean;
53
- toggle: () => Promise<void>;
54
- };
55
- screenShare: {
56
- active: boolean;
57
- toggle: () => Promise<void>;
58
- };
59
- hold: {
60
- active: boolean;
61
- enabled: boolean;
62
- toggle: () => Promise<void>;
63
- };
64
- recording: {
65
- active: boolean;
66
- enabled: boolean;
67
- toggle: () => Promise<void>;
68
- };
69
- leave: {
70
- enabled: boolean;
71
- run: () => Promise<void>;
72
- };
73
- end: {
74
- enabled: boolean;
75
- run: () => Promise<void>;
76
- };
77
- }
78
- declare function useCallControls(sessionId?: string): CallControls;
79
-
80
- declare function usePresence(refs: readonly PresenceRef[]): ReadonlyMap<string, PresenceSnapshot>;
81
- interface MyPresenceHandle {
82
- snapshot: Nullable<PresenceSnapshot>;
83
- setStatus: (mode: PresenceMode, note?: Nullable<string>) => Promise<void>;
84
- clearStatus: () => Promise<void>;
85
- }
86
- declare function useMyPresence(): MyPresenceHandle;
87
-
88
- export { type CallControls, type CallDuration, CallpadProvider, type CallpadProviderProps, type MyPresenceHandle, useActiveRecording, useCallControls, useCallDuration, useCallpadClient, useClientEvent, useIncomingInvite, useIncomingInvites, useIsHeld, useMyPresence, usePresence, useSelfParticipant, useSession, useSessionCapabilities, useSessionDispatches, useSessionEvent, useSessionParticipant, useSessionParticipants, useSessions };
11
+ declare const CallpadProvider: <TClient extends SessionClient>({ client, connect, disposeOnUnmount, children, }: CallpadProviderProps<TClient>) => react_jsx_runtime.JSX.Element;
12
+ declare const useCallpad: <TClient extends SessionClient = SessionClient>() => TClient;
13
+ declare const useStatus: () => ClientStatus;
14
+ declare const useSessions: () => readonly VoiceSession[];
15
+ declare const useSession: (sessionId?: string) => Nullable<VoiceSession>;
16
+ declare const useIncomingInvites: () => readonly SessionInvite[];
17
+ declare const useIncomingInvite: () => Nullable<SessionInvite>;
18
+ declare const useCan: (sessionId: string | undefined, action: SessionAction) => boolean;
19
+ declare const useSessionDuration: (sessionId?: string) => SessionDuration;
20
+
21
+ export { CallpadProvider, type CallpadProviderProps, useCallpad, useCan, useIncomingInvite, useIncomingInvites, useSession, useSessionDuration, useSessions, useStatus };