@orbitconnect/react 0.1.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.
- package/CHANGELOG.md +56 -0
- package/LICENSE +21 -0
- package/README.md +374 -0
- package/dist/OrbitContext.d.ts +87 -0
- package/dist/OrbitProvider.d.ts +24 -0
- package/dist/api/client.d.ts +44 -0
- package/dist/api/index.d.ts +2 -0
- package/dist/bg.svg +1 -0
- package/dist/call/CallContext.d.ts +27 -0
- package/dist/call/CallProvider.d.ts +4 -0
- package/dist/components/call/CallControls.d.ts +18 -0
- package/dist/components/call/CallHistory.d.ts +22 -0
- package/dist/components/call/CallScreen.d.ts +11 -0
- package/dist/components/call/InCallChatPanel.d.ts +7 -0
- package/dist/components/call/IncomingCallModal.d.ts +8 -0
- package/dist/components/call/OutgoingCallScreen.d.ts +8 -0
- package/dist/components/call/VideoCallScreen.d.ts +23 -0
- package/dist/components/call/index.d.ts +11 -0
- package/dist/components/chat/AttachmentPicker.d.ts +23 -0
- package/dist/components/chat/AttachmentRenderer.d.ts +15 -0
- package/dist/components/chat/AudioRecorder.d.ts +6 -0
- package/dist/components/chat/BatchToolbar.d.ts +8 -0
- package/dist/components/chat/CallBanner.d.ts +14 -0
- package/dist/components/chat/ChatBox.d.ts +90 -0
- package/dist/components/chat/Composer.d.ts +15 -0
- package/dist/components/chat/ConversationList.d.ts +32 -0
- package/dist/components/chat/ConversationPicker.d.ts +7 -0
- package/dist/components/chat/ConversationProfile.d.ts +13 -0
- package/dist/components/chat/DocumentViewer.d.ts +2 -0
- package/dist/components/chat/EmojiPicker.d.ts +5 -0
- package/dist/components/chat/ImageViewer.d.ts +2 -0
- package/dist/components/chat/LinkPreview.d.ts +7 -0
- package/dist/components/chat/MediaMessage.d.ts +5 -0
- package/dist/components/chat/MediaViewer.d.ts +13 -0
- package/dist/components/chat/MessageActionMenu.d.ts +16 -0
- package/dist/components/chat/MessageBubble.d.ts +61 -0
- package/dist/components/chat/MessageInfoSheet.d.ts +7 -0
- package/dist/components/chat/MessageInput.d.ts +12 -0
- package/dist/components/chat/MessageList.d.ts +7 -0
- package/dist/components/chat/QuickMessages.d.ts +17 -0
- package/dist/components/chat/ReactionDialog.d.ts +6 -0
- package/dist/components/chat/ReplyComposer.d.ts +8 -0
- package/dist/components/chat/StickerPicker.d.ts +21 -0
- package/dist/components/chat/VideoViewer.d.ts +2 -0
- package/dist/components/chat/emojiData.d.ts +9 -0
- package/dist/components/chat/index.d.ts +44 -0
- package/dist/components/chat/mediaViewerRegistry.d.ts +22 -0
- package/dist/components/chat/urlUtils.d.ts +1 -0
- package/dist/components/index.d.ts +4 -0
- package/dist/components/meeting/MeetingControls.d.ts +15 -0
- package/dist/components/meeting/MeetingRoom.d.ts +27 -0
- package/dist/components/meeting/ParticipantGrid.d.ts +6 -0
- package/dist/components/meeting/ParticipantsPanel.d.ts +8 -0
- package/dist/components/meeting/ReactionBurst.d.ts +9 -0
- package/dist/components/meeting/ScreenShareView.d.ts +5 -0
- package/dist/components/meeting/WaitingRoom.d.ts +7 -0
- package/dist/components/meeting/index.d.ts +8 -0
- package/dist/components/ui/Avatar.d.ts +13 -0
- package/dist/components/ui/BottomNav.d.ts +8 -0
- package/dist/components/ui/EscalationButton.d.ts +12 -0
- package/dist/components/ui/IconBtn.d.ts +8 -0
- package/dist/components/ui/PoweredBy.d.ts +1 -0
- package/dist/components/ui/index.d.ts +5 -0
- package/dist/favicon.svg +1 -0
- package/dist/hooks/index.d.ts +20 -0
- package/dist/hooks/useAppBrand.d.ts +6 -0
- package/dist/hooks/useCall.d.ts +2 -0
- package/dist/hooks/useCallHistory.d.ts +5 -0
- package/dist/hooks/useConversations.d.ts +7 -0
- package/dist/hooks/useMedia.d.ts +19 -0
- package/dist/hooks/useMeeting.d.ts +22 -0
- package/dist/hooks/useMeetingWebRTC.d.ts +28 -0
- package/dist/hooks/useMessages.d.ts +11 -0
- package/dist/hooks/useNotifications.d.ts +19 -0
- package/dist/hooks/usePresence.d.ts +8 -0
- package/dist/hooks/usePushToken.d.ts +11 -0
- package/dist/hooks/useRealtime.d.ts +21 -0
- package/dist/hooks/useRecording.d.ts +16 -0
- package/dist/hooks/useSound.d.ts +9 -0
- package/dist/hooks/useWebRTC.d.ts +12 -0
- package/dist/icons.svg +24 -0
- package/dist/index.css +1 -0
- package/dist/index.d.ts +16 -0
- package/dist/index.js +12441 -0
- package/dist/meeting/MeetingContext.d.ts +19 -0
- package/dist/meeting/MeetingProvider.d.ts +4 -0
- package/dist/meeting/index.d.ts +3 -0
- package/dist/socket/OrbitListenerProvider.d.ts +14 -0
- package/dist/socket/OrbitSocket.d.ts +97 -0
- package/dist/socket/config.d.ts +10 -0
- package/dist/socket/context.d.ts +10 -0
- package/dist/socket/events.d.ts +283 -0
- package/dist/socket/index.d.ts +8 -0
- package/dist/socket/useOrbitEvent.d.ts +8 -0
- package/dist/theme/ThemeProvider.d.ts +17 -0
- package/dist/theme/defaults.d.ts +3 -0
- package/dist/theme/index.d.ts +3 -0
- package/dist/theme/types.d.ts +85 -0
- package/dist/widgets/Chat.d.ts +13 -0
- package/dist/widgets/MeetingWidget.d.ts +6 -0
- package/dist/widgets/VideoCall.d.ts +1 -0
- package/dist/widgets/index.d.ts +6 -0
- package/package.json +79 -0
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import type { ActiveMeeting } from '../hooks/useMeeting';
|
|
2
|
+
import type { ReactionEvent } from '../components/meeting/ReactionBurst';
|
|
3
|
+
export interface MeetingContextValue {
|
|
4
|
+
meeting: ActiveMeeting | null;
|
|
5
|
+
localStream: MediaStream | null;
|
|
6
|
+
localDisplayStream: MediaStream | null;
|
|
7
|
+
reactionEvents: ReactionEvent[];
|
|
8
|
+
joinMeeting: (meetingId: string, title: string) => Promise<void>;
|
|
9
|
+
leaveMeeting: () => Promise<void>;
|
|
10
|
+
muteSelf: (muted: boolean) => void;
|
|
11
|
+
toggleCamera: (off: boolean) => void;
|
|
12
|
+
startScreenShare: () => Promise<void>;
|
|
13
|
+
stopScreenShare: () => Promise<void>;
|
|
14
|
+
raiseHand: () => void;
|
|
15
|
+
lowerHand: () => void;
|
|
16
|
+
sendReaction: (emoji: string) => void;
|
|
17
|
+
}
|
|
18
|
+
export declare const MeetingContext: import("react").Context<MeetingContextValue | null>;
|
|
19
|
+
export declare function useMeetingContext(): MeetingContextValue;
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { type ReactNode } from 'react';
|
|
2
|
+
export interface OrbitListenerProviderProps {
|
|
3
|
+
clientId: string;
|
|
4
|
+
userToken: string;
|
|
5
|
+
/** Optional REST base URL — used to derive the WS URL when provided */
|
|
6
|
+
baseUrl?: string;
|
|
7
|
+
maxRetries?: number;
|
|
8
|
+
retryBaseMs?: number;
|
|
9
|
+
heartbeatMs?: number;
|
|
10
|
+
/** Called when the server closes the connection with code 4001 (token expired). Should return a fresh token. */
|
|
11
|
+
onTokenExpired?: () => Promise<string>;
|
|
12
|
+
children: ReactNode;
|
|
13
|
+
}
|
|
14
|
+
export declare function OrbitListenerProvider({ clientId, userToken, baseUrl, maxRetries, retryBaseMs, heartbeatMs, onTokenExpired, children, }: OrbitListenerProviderProps): import("react/jsx-runtime").JSX.Element;
|
|
@@ -0,0 +1,97 @@
|
|
|
1
|
+
import type { OrbitSocketEvents, OrbitEventType } from './events';
|
|
2
|
+
export type EventHandler<T> = (payload: T) => void;
|
|
3
|
+
export interface OrbitSocketOptions {
|
|
4
|
+
/** Resolved WebSocket endpoint — set internally by the SDK, never by the consumer */
|
|
5
|
+
readonly wsUrl: string;
|
|
6
|
+
/** Publishable client ID (pk_live_... / pk_test_...) */
|
|
7
|
+
readonly clientId: string;
|
|
8
|
+
/** Short-lived user token from your server SDK */
|
|
9
|
+
token: string;
|
|
10
|
+
/** Reconnect attempts before giving up. Default: 5 */
|
|
11
|
+
maxRetries?: number;
|
|
12
|
+
/** Base delay in ms for exponential backoff. Default: 1000 */
|
|
13
|
+
retryBaseMs?: number;
|
|
14
|
+
/** Heartbeat interval in ms. Default: 25000 */
|
|
15
|
+
heartbeatMs?: number;
|
|
16
|
+
/** Called when the server closes the connection with code 4001 (token expired). Should return a fresh token. */
|
|
17
|
+
onTokenExpired?: () => Promise<string>;
|
|
18
|
+
}
|
|
19
|
+
export type SocketStatus = 'connecting' | 'connected' | 'reconnecting' | 'disconnected';
|
|
20
|
+
type StatusListener = (status: SocketStatus) => void;
|
|
21
|
+
/**
|
|
22
|
+
* Typed WebSocket client for OrbitConnect.
|
|
23
|
+
*
|
|
24
|
+
* - Auto-reconnect with exponential backoff
|
|
25
|
+
* - Heartbeat ping/pong keepalive
|
|
26
|
+
* - Typed event subscriptions matching OrbitSocketEvents
|
|
27
|
+
*/
|
|
28
|
+
export declare class OrbitSocket {
|
|
29
|
+
private ws;
|
|
30
|
+
private handlers;
|
|
31
|
+
private statusListeners;
|
|
32
|
+
private retries;
|
|
33
|
+
private retryTimer;
|
|
34
|
+
private heartbeatTimer;
|
|
35
|
+
private destroyed;
|
|
36
|
+
private readonly maxRetries;
|
|
37
|
+
private readonly retryBaseMs;
|
|
38
|
+
private readonly heartbeatMs;
|
|
39
|
+
status: SocketStatus;
|
|
40
|
+
readonly opts: OrbitSocketOptions;
|
|
41
|
+
constructor(opts: OrbitSocketOptions);
|
|
42
|
+
connect(): void;
|
|
43
|
+
disconnect(): void;
|
|
44
|
+
/** Subscribe to a typed server event */
|
|
45
|
+
on<K extends OrbitEventType>(event: K, handler: EventHandler<OrbitSocketEvents[K]>): () => void;
|
|
46
|
+
off<K extends OrbitEventType>(event: K, handler: EventHandler<OrbitSocketEvents[K]>): void;
|
|
47
|
+
/** Listen to connection status changes */
|
|
48
|
+
onStatus(listener: StatusListener): () => void;
|
|
49
|
+
/** Subscribe to a context (conversation / call / meeting) */
|
|
50
|
+
subscribeContext(contextId: string): void;
|
|
51
|
+
unsubscribeContext(contextId: string): void;
|
|
52
|
+
/** Notify server you are typing in a conversation */
|
|
53
|
+
sendTyping(conversationId: string): void;
|
|
54
|
+
sendStoppedTyping(conversationId: string): void;
|
|
55
|
+
/** Acknowledge message delivery */
|
|
56
|
+
sendAck(messageId: string): void;
|
|
57
|
+
/** Mark message as read */
|
|
58
|
+
sendRead(messageId: string): void;
|
|
59
|
+
/** Update presence status */
|
|
60
|
+
sendPresence(status: 'online' | 'away' | 'offline'): void;
|
|
61
|
+
/** Send WebRTC offer SDP via WS (fast path, also persisted via REST in useWebRTC) */
|
|
62
|
+
sendOffer(callId: string, sdp: string): void;
|
|
63
|
+
/** Send WebRTC answer SDP via WS */
|
|
64
|
+
sendAnswer(callId: string, sdp: string): void;
|
|
65
|
+
/** Trickle ICE candidate */
|
|
66
|
+
sendIceCandidate(callId: string, candidate: string, sdpMid?: string | null, sdpMLineIndex?: number | null): void;
|
|
67
|
+
/** Broadcast mute state to remote party */
|
|
68
|
+
sendCallMute(callId: string, muted: boolean): void;
|
|
69
|
+
/** Raise hand in a meeting */
|
|
70
|
+
sendRaiseHand(meetingId: string): void;
|
|
71
|
+
sendLowerHand(meetingId: string): void;
|
|
72
|
+
/** Send emoji reaction in a meeting */
|
|
73
|
+
sendReaction(meetingId: string, emoji: string): void;
|
|
74
|
+
/** Report active speaker state (from client-side VAD) */
|
|
75
|
+
sendActiveSpeaker(meetingId: string, speaking: boolean): void;
|
|
76
|
+
/** Toggle screen share via WS fast path */
|
|
77
|
+
sendScreenShare(meetingId: string, sharing: boolean): void;
|
|
78
|
+
/** Self-mute in a meeting */
|
|
79
|
+
sendMeetingMute(meetingId: string, muted: boolean): void;
|
|
80
|
+
/** Send WebRTC offer to a specific peer in a meeting */
|
|
81
|
+
sendMeetingOffer(meetingId: string, targetUserId: string, sdp: string): void;
|
|
82
|
+
/** Send WebRTC answer to a specific peer in a meeting */
|
|
83
|
+
sendMeetingAnswer(meetingId: string, targetUserId: string, sdp: string): void;
|
|
84
|
+
/** Send ICE candidate to a specific peer in a meeting */
|
|
85
|
+
sendMeetingIceCandidate(meetingId: string, targetUserId: string, candidate: string, sdpMid?: string | null, sdpMLineIndex?: number | null): void;
|
|
86
|
+
/** Put a call on hold or resume it */
|
|
87
|
+
sendHold(callId: string, onHold: boolean): void;
|
|
88
|
+
private contextSubscriptions;
|
|
89
|
+
private openSocket;
|
|
90
|
+
private dispatch;
|
|
91
|
+
private send;
|
|
92
|
+
private scheduleReconnect;
|
|
93
|
+
private startHeartbeat;
|
|
94
|
+
private clearTimers;
|
|
95
|
+
private setStatus;
|
|
96
|
+
}
|
|
97
|
+
export {};
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* SDK-internal endpoint resolution.
|
|
3
|
+
*
|
|
4
|
+
* clientId format: pk_live_<...> → wss://api.orbitconnect.cloud/ws
|
|
5
|
+
* pk_test_<...> → wss://sandbox.orbitconnect.cloud/ws
|
|
6
|
+
*
|
|
7
|
+
* In development, set VITE_ORBIT_WS_URL to override:
|
|
8
|
+
* VITE_ORBIT_WS_URL=ws://localhost:3000/ws
|
|
9
|
+
*/
|
|
10
|
+
export declare function resolveWsUrl(clientId: string): string;
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import type { OrbitSocket } from './OrbitSocket';
|
|
2
|
+
import type { SocketStatus } from './OrbitSocket';
|
|
3
|
+
export interface OrbitListenerContextValue {
|
|
4
|
+
socket: OrbitSocket;
|
|
5
|
+
status: SocketStatus;
|
|
6
|
+
subscribeContext: (contextId: string) => void;
|
|
7
|
+
unsubscribeContext: (contextId: string) => void;
|
|
8
|
+
}
|
|
9
|
+
export declare const OrbitListenerContext: import("react").Context<OrbitListenerContextValue | null>;
|
|
10
|
+
export declare function useOrbitListener(): OrbitListenerContextValue;
|
|
@@ -0,0 +1,283 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* All server → client WebSocket event types emitted by OrbitConnect backend.
|
|
3
|
+
* Protocol: { type: string, payload: Record<string, unknown> }
|
|
4
|
+
*/
|
|
5
|
+
export interface ConnectedPayload {
|
|
6
|
+
app_user_id: string;
|
|
7
|
+
display_name: string;
|
|
8
|
+
}
|
|
9
|
+
export interface SubscribedPayload {
|
|
10
|
+
context_id: string;
|
|
11
|
+
}
|
|
12
|
+
export interface UnsubscribedPayload {
|
|
13
|
+
context_id: string;
|
|
14
|
+
}
|
|
15
|
+
export interface PongPayload {
|
|
16
|
+
ts: number;
|
|
17
|
+
}
|
|
18
|
+
export interface MessageNewPayload {
|
|
19
|
+
conversation_id: string;
|
|
20
|
+
message: {
|
|
21
|
+
id: string;
|
|
22
|
+
sender_id: string;
|
|
23
|
+
type: 'text' | 'media' | 'system';
|
|
24
|
+
content: string | null;
|
|
25
|
+
metadata: Record<string, unknown>;
|
|
26
|
+
sequence_number: number;
|
|
27
|
+
created_at: string;
|
|
28
|
+
updated_at: string;
|
|
29
|
+
};
|
|
30
|
+
}
|
|
31
|
+
export interface MessageDeliveredPayload {
|
|
32
|
+
message_id: string;
|
|
33
|
+
app_user_id: string;
|
|
34
|
+
}
|
|
35
|
+
export interface MessageReadPayload {
|
|
36
|
+
message_id: string;
|
|
37
|
+
app_user_id: string;
|
|
38
|
+
}
|
|
39
|
+
export interface ConversationUpdatedPayload {
|
|
40
|
+
conversation_id: string;
|
|
41
|
+
}
|
|
42
|
+
export interface MessageReactionPayload {
|
|
43
|
+
message_id: string;
|
|
44
|
+
app_user_id: string;
|
|
45
|
+
reaction_type: string;
|
|
46
|
+
action: 'added' | 'removed';
|
|
47
|
+
}
|
|
48
|
+
export interface MessageRecalledPayload {
|
|
49
|
+
message_id: string;
|
|
50
|
+
conversation_id: string;
|
|
51
|
+
}
|
|
52
|
+
export interface MessageEditedPayload {
|
|
53
|
+
message_id: string;
|
|
54
|
+
conversation_id: string;
|
|
55
|
+
content: string;
|
|
56
|
+
}
|
|
57
|
+
export interface MessagePinnedPayload {
|
|
58
|
+
message_id: string;
|
|
59
|
+
conversation_id: string;
|
|
60
|
+
pinned_by: string;
|
|
61
|
+
}
|
|
62
|
+
export interface MessageUnpinnedPayload {
|
|
63
|
+
message_id: string;
|
|
64
|
+
conversation_id: string;
|
|
65
|
+
}
|
|
66
|
+
export interface CallIncomingPayload {
|
|
67
|
+
call_id: string;
|
|
68
|
+
caller_id: string;
|
|
69
|
+
caller_name?: string;
|
|
70
|
+
caller_avatar?: string | null;
|
|
71
|
+
type: 'voice' | 'video';
|
|
72
|
+
}
|
|
73
|
+
export interface CallRingingPayload {
|
|
74
|
+
call_id: string;
|
|
75
|
+
callee_id?: string;
|
|
76
|
+
callee_name?: string;
|
|
77
|
+
callee_avatar?: string | null;
|
|
78
|
+
}
|
|
79
|
+
export interface CallAcceptedPayload {
|
|
80
|
+
call_id: string;
|
|
81
|
+
callee_id: string;
|
|
82
|
+
}
|
|
83
|
+
export interface CallRejectedPayload {
|
|
84
|
+
call_id: string;
|
|
85
|
+
callee_id: string;
|
|
86
|
+
}
|
|
87
|
+
export interface CallEndedPayload {
|
|
88
|
+
call_id: string;
|
|
89
|
+
ended_by: string;
|
|
90
|
+
}
|
|
91
|
+
export interface WebRtcOfferPayload {
|
|
92
|
+
call_id: string;
|
|
93
|
+
sdp: string;
|
|
94
|
+
}
|
|
95
|
+
export interface WebRtcAnswerPayload {
|
|
96
|
+
call_id: string;
|
|
97
|
+
sdp: string;
|
|
98
|
+
}
|
|
99
|
+
export interface WebRtcIceCandidatePayload {
|
|
100
|
+
call_id: string;
|
|
101
|
+
candidate: string;
|
|
102
|
+
sdpMid?: string;
|
|
103
|
+
sdpMLineIndex?: number;
|
|
104
|
+
}
|
|
105
|
+
export interface MeetingStartedPayload {
|
|
106
|
+
meeting_id: string;
|
|
107
|
+
started_at: string;
|
|
108
|
+
}
|
|
109
|
+
export interface MeetingEndedPayload {
|
|
110
|
+
meeting_id: string;
|
|
111
|
+
ended_at: string;
|
|
112
|
+
ended_by: string;
|
|
113
|
+
}
|
|
114
|
+
export interface ParticipantJoinedPayload {
|
|
115
|
+
meeting_id: string;
|
|
116
|
+
app_user_id: string;
|
|
117
|
+
display_name?: string | null;
|
|
118
|
+
}
|
|
119
|
+
export interface ParticipantLeftPayload {
|
|
120
|
+
meeting_id: string;
|
|
121
|
+
app_user_id: string;
|
|
122
|
+
kicked?: boolean;
|
|
123
|
+
kicked_by?: string;
|
|
124
|
+
}
|
|
125
|
+
export interface ParticipantMutedPayload {
|
|
126
|
+
meeting_id: string;
|
|
127
|
+
app_user_id: string;
|
|
128
|
+
muted_by: string;
|
|
129
|
+
}
|
|
130
|
+
export interface ParticipantUnmutedPayload {
|
|
131
|
+
meeting_id: string;
|
|
132
|
+
app_user_id: string;
|
|
133
|
+
muted_by: string;
|
|
134
|
+
}
|
|
135
|
+
export interface ScreenShareStartedPayload {
|
|
136
|
+
meeting_id: string;
|
|
137
|
+
app_user_id: string;
|
|
138
|
+
}
|
|
139
|
+
export interface ScreenShareStoppedPayload {
|
|
140
|
+
meeting_id: string;
|
|
141
|
+
app_user_id: string;
|
|
142
|
+
}
|
|
143
|
+
export interface SessionStartedPayload {
|
|
144
|
+
session_id: string;
|
|
145
|
+
type: 'chat_session' | 'call_session' | 'meeting_session';
|
|
146
|
+
context_id?: string;
|
|
147
|
+
}
|
|
148
|
+
export interface SessionEndedPayload {
|
|
149
|
+
session_id: string;
|
|
150
|
+
}
|
|
151
|
+
export interface SessionTransitionedPayload {
|
|
152
|
+
session_id: string;
|
|
153
|
+
transition_type: string;
|
|
154
|
+
context_id?: string;
|
|
155
|
+
}
|
|
156
|
+
export interface ChatTypingPayload {
|
|
157
|
+
conversation_id: string;
|
|
158
|
+
app_user_id: string;
|
|
159
|
+
display_name: string;
|
|
160
|
+
}
|
|
161
|
+
export interface ChatStoppedTypingPayload {
|
|
162
|
+
conversation_id: string;
|
|
163
|
+
app_user_id: string;
|
|
164
|
+
}
|
|
165
|
+
export interface PresenceChangedPayload {
|
|
166
|
+
app_user_id: string;
|
|
167
|
+
display_name: string;
|
|
168
|
+
status: 'online' | 'away' | 'offline';
|
|
169
|
+
}
|
|
170
|
+
export interface CallMuteChangedPayload {
|
|
171
|
+
call_id: string;
|
|
172
|
+
app_user_id: string;
|
|
173
|
+
muted: boolean;
|
|
174
|
+
}
|
|
175
|
+
export interface CallHoldChangedPayload {
|
|
176
|
+
call_id: string;
|
|
177
|
+
app_user_id: string;
|
|
178
|
+
on_hold: boolean;
|
|
179
|
+
}
|
|
180
|
+
export interface MeetingHandRaisedPayload {
|
|
181
|
+
meeting_id: string;
|
|
182
|
+
app_user_id: string;
|
|
183
|
+
display_name: string;
|
|
184
|
+
}
|
|
185
|
+
export interface MeetingHandLoweredPayload {
|
|
186
|
+
meeting_id: string;
|
|
187
|
+
app_user_id: string;
|
|
188
|
+
}
|
|
189
|
+
export interface MeetingReactionPayload {
|
|
190
|
+
meeting_id: string;
|
|
191
|
+
app_user_id: string;
|
|
192
|
+
display_name: string;
|
|
193
|
+
emoji: string;
|
|
194
|
+
}
|
|
195
|
+
export interface MeetingActiveSpeakerPayload {
|
|
196
|
+
meeting_id: string;
|
|
197
|
+
app_user_id: string;
|
|
198
|
+
speaking: boolean;
|
|
199
|
+
}
|
|
200
|
+
export interface MeetingOfferPayload {
|
|
201
|
+
meeting_id: string;
|
|
202
|
+
from_user_id: string;
|
|
203
|
+
sdp: string;
|
|
204
|
+
}
|
|
205
|
+
export interface MeetingAnswerPayload {
|
|
206
|
+
meeting_id: string;
|
|
207
|
+
from_user_id: string;
|
|
208
|
+
sdp: string;
|
|
209
|
+
}
|
|
210
|
+
export interface MeetingIceCandidatePayload {
|
|
211
|
+
meeting_id: string;
|
|
212
|
+
from_user_id: string;
|
|
213
|
+
candidate: string;
|
|
214
|
+
sdpMid?: string | null;
|
|
215
|
+
sdpMLineIndex?: number | null;
|
|
216
|
+
}
|
|
217
|
+
export interface AuthTokenExpiredPayload {
|
|
218
|
+
code: 4001;
|
|
219
|
+
}
|
|
220
|
+
export interface MediaReadyPayload {
|
|
221
|
+
media_id: string;
|
|
222
|
+
status: 'ready' | 'failed';
|
|
223
|
+
file_url: string;
|
|
224
|
+
mime_type: string;
|
|
225
|
+
}
|
|
226
|
+
export interface NotificationReceivedPayload {
|
|
227
|
+
/** Notification type, e.g. "alert", "info", "warning" */
|
|
228
|
+
type: string;
|
|
229
|
+
/** Arbitrary data sent by the server */
|
|
230
|
+
payload: Record<string, unknown>;
|
|
231
|
+
/** ISO timestamp of when the notification was sent */
|
|
232
|
+
timestamp: string;
|
|
233
|
+
}
|
|
234
|
+
export interface OrbitSocketEvents {
|
|
235
|
+
'auth:token_expired': AuthTokenExpiredPayload;
|
|
236
|
+
'media:ready': MediaReadyPayload;
|
|
237
|
+
'notification:received': NotificationReceivedPayload;
|
|
238
|
+
'connected': ConnectedPayload;
|
|
239
|
+
'subscribed': SubscribedPayload;
|
|
240
|
+
'unsubscribed': UnsubscribedPayload;
|
|
241
|
+
'pong': PongPayload;
|
|
242
|
+
'message:new': MessageNewPayload;
|
|
243
|
+
'message:delivered': MessageDeliveredPayload;
|
|
244
|
+
'message:read': MessageReadPayload;
|
|
245
|
+
'message:reaction': MessageReactionPayload;
|
|
246
|
+
'message:recalled': MessageRecalledPayload;
|
|
247
|
+
'message:edited': MessageEditedPayload;
|
|
248
|
+
'message:pinned': MessagePinnedPayload;
|
|
249
|
+
'message:unpinned': MessageUnpinnedPayload;
|
|
250
|
+
'conversation:updated': ConversationUpdatedPayload;
|
|
251
|
+
'chat:typing': ChatTypingPayload;
|
|
252
|
+
'chat:stopped_typing': ChatStoppedTypingPayload;
|
|
253
|
+
'presence:changed': PresenceChangedPayload;
|
|
254
|
+
'call:incoming': CallIncomingPayload;
|
|
255
|
+
'call:ringing': CallRingingPayload;
|
|
256
|
+
'call:accepted': CallAcceptedPayload;
|
|
257
|
+
'call:rejected': CallRejectedPayload;
|
|
258
|
+
'call:ended': CallEndedPayload;
|
|
259
|
+
'call:mute_changed': CallMuteChangedPayload;
|
|
260
|
+
'call:hold_changed': CallHoldChangedPayload;
|
|
261
|
+
'webrtc:offer': WebRtcOfferPayload;
|
|
262
|
+
'webrtc:answer': WebRtcAnswerPayload;
|
|
263
|
+
'webrtc:ice_candidate': WebRtcIceCandidatePayload;
|
|
264
|
+
'meeting:started': MeetingStartedPayload;
|
|
265
|
+
'meeting:ended': MeetingEndedPayload;
|
|
266
|
+
'participant:joined': ParticipantJoinedPayload;
|
|
267
|
+
'participant:left': ParticipantLeftPayload;
|
|
268
|
+
'participant:muted': ParticipantMutedPayload;
|
|
269
|
+
'participant:unmuted': ParticipantUnmutedPayload;
|
|
270
|
+
'screen_share:started': ScreenShareStartedPayload;
|
|
271
|
+
'screen_share:stopped': ScreenShareStoppedPayload;
|
|
272
|
+
'meeting:hand_raised': MeetingHandRaisedPayload;
|
|
273
|
+
'meeting:hand_lowered': MeetingHandLoweredPayload;
|
|
274
|
+
'meeting:reaction': MeetingReactionPayload;
|
|
275
|
+
'meeting:active_speaker': MeetingActiveSpeakerPayload;
|
|
276
|
+
'meeting:offer': MeetingOfferPayload;
|
|
277
|
+
'meeting:answer': MeetingAnswerPayload;
|
|
278
|
+
'meeting:ice_candidate': MeetingIceCandidatePayload;
|
|
279
|
+
'session:started': SessionStartedPayload;
|
|
280
|
+
'session:ended': SessionEndedPayload;
|
|
281
|
+
'session:transitioned': SessionTransitionedPayload;
|
|
282
|
+
}
|
|
283
|
+
export type OrbitEventType = keyof OrbitSocketEvents;
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
export { OrbitListenerProvider } from './OrbitListenerProvider';
|
|
2
|
+
export type { OrbitListenerProviderProps } from './OrbitListenerProvider';
|
|
3
|
+
export { useOrbitListener } from './context';
|
|
4
|
+
export type { OrbitListenerContextValue } from './context';
|
|
5
|
+
export { useOrbitEvent } from './useOrbitEvent';
|
|
6
|
+
export { OrbitSocket } from './OrbitSocket';
|
|
7
|
+
export type { OrbitSocketOptions, SocketStatus } from './OrbitSocket';
|
|
8
|
+
export type { OrbitSocketEvents, OrbitEventType } from './events';
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import type { OrbitEventType, OrbitSocketEvents } from './events';
|
|
2
|
+
/**
|
|
3
|
+
* Subscribe to a typed OrbitConnect socket event.
|
|
4
|
+
*
|
|
5
|
+
* @example
|
|
6
|
+
* useOrbitEvent('message:new', (p) => addMessage(p.message))
|
|
7
|
+
*/
|
|
8
|
+
export declare function useOrbitEvent<K extends OrbitEventType>(event: K, handler: (payload: OrbitSocketEvents[K]) => void): void;
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import { type ReactNode } from 'react';
|
|
2
|
+
import type { OrbitTheme, PartialTheme } from './types';
|
|
3
|
+
interface ThemeContextValue {
|
|
4
|
+
theme: OrbitTheme;
|
|
5
|
+
}
|
|
6
|
+
export declare function useTheme(): ThemeContextValue;
|
|
7
|
+
interface ThemeProviderProps {
|
|
8
|
+
/** Partial theme overrides — merged on top of the default dark theme */
|
|
9
|
+
theme?: PartialTheme;
|
|
10
|
+
/** Base theme to extend. Defaults to 'dark'. */
|
|
11
|
+
baseTheme?: OrbitTheme;
|
|
12
|
+
children: ReactNode;
|
|
13
|
+
/** Optional className for the wrapper div */
|
|
14
|
+
className?: string;
|
|
15
|
+
}
|
|
16
|
+
export declare function ThemeProvider({ theme: overrides, baseTheme, children, className, }: ThemeProviderProps): import("react/jsx-runtime").JSX.Element;
|
|
17
|
+
export {};
|
|
@@ -0,0 +1,85 @@
|
|
|
1
|
+
export interface OrbitTheme {
|
|
2
|
+
background: string;
|
|
3
|
+
foreground: string;
|
|
4
|
+
border: string;
|
|
5
|
+
input: string;
|
|
6
|
+
primary: string;
|
|
7
|
+
primaryForeground: string;
|
|
8
|
+
secondary: string;
|
|
9
|
+
secondaryForeground: string;
|
|
10
|
+
muted: string;
|
|
11
|
+
mutedForeground: string;
|
|
12
|
+
card: string;
|
|
13
|
+
cardForeground: string;
|
|
14
|
+
sidebar: string;
|
|
15
|
+
sidebarForeground: string;
|
|
16
|
+
sidebarPrimary: string;
|
|
17
|
+
sidebarPrimaryForeground: string;
|
|
18
|
+
success: string;
|
|
19
|
+
successForeground: string;
|
|
20
|
+
accent: string;
|
|
21
|
+
accentForeground: string;
|
|
22
|
+
destructive: string;
|
|
23
|
+
destructiveForeground: string;
|
|
24
|
+
warning: string;
|
|
25
|
+
warningForeground: string;
|
|
26
|
+
/** Outgoing bubble background */
|
|
27
|
+
bubbleSender: string;
|
|
28
|
+
/** Outgoing bubble text */
|
|
29
|
+
bubbleSenderForeground: string;
|
|
30
|
+
/** Incoming bubble background */
|
|
31
|
+
bubbleReceiver: string;
|
|
32
|
+
/** Incoming bubble text */
|
|
33
|
+
bubbleReceiverForeground: string;
|
|
34
|
+
/** Single check — message sent to server */
|
|
35
|
+
iconSent: string;
|
|
36
|
+
/** Double check (grey) — delivered to recipient device */
|
|
37
|
+
iconDelivered: string;
|
|
38
|
+
/** Double check (colored) — read by recipient */
|
|
39
|
+
iconRead: string;
|
|
40
|
+
messageMeta: string;
|
|
41
|
+
replyBorder: string;
|
|
42
|
+
replySenderForeground: string;
|
|
43
|
+
/** Reply preview bg inside outgoing bubble */
|
|
44
|
+
replyBgSender: string;
|
|
45
|
+
/** Reply preview bg inside incoming bubble */
|
|
46
|
+
replyBgReceiver: string;
|
|
47
|
+
replyPreviewForeground: string;
|
|
48
|
+
reactionBg: string;
|
|
49
|
+
reactionBorder: string;
|
|
50
|
+
reactionForeground: string;
|
|
51
|
+
/** Own reaction pill — highlighted state */
|
|
52
|
+
reactionOwnBg: string;
|
|
53
|
+
reactionOwnBorder: string;
|
|
54
|
+
typingDot: string;
|
|
55
|
+
audioSenderBg: string;
|
|
56
|
+
audioReceiverBg: string;
|
|
57
|
+
/** Play button bg inside incoming audio bubble */
|
|
58
|
+
audioPlayBtnBg: string;
|
|
59
|
+
audioPlayBtnForeground: string;
|
|
60
|
+
/** Unplayed waveform bar */
|
|
61
|
+
waveBarDefault: string;
|
|
62
|
+
/** Played waveform bar inside incoming bubble */
|
|
63
|
+
waveBarPlayedReceiver: string;
|
|
64
|
+
/** Played waveform bar inside outgoing bubble */
|
|
65
|
+
waveBarPlayedSender: string;
|
|
66
|
+
audioDuration: string;
|
|
67
|
+
fileIconBgReceiver: string;
|
|
68
|
+
fileIconColorReceiver: string;
|
|
69
|
+
fileIconBgSender: string;
|
|
70
|
+
fileIconColorSender: string;
|
|
71
|
+
fileSizeForeground: string;
|
|
72
|
+
fileDownloadIcon: string;
|
|
73
|
+
composerBg: string;
|
|
74
|
+
composerInputBg: string;
|
|
75
|
+
composerInputBorder: string;
|
|
76
|
+
composerInputForeground: string;
|
|
77
|
+
composerPlaceholder: string;
|
|
78
|
+
composerIconColor: string;
|
|
79
|
+
radiusSm: string;
|
|
80
|
+
radiusMd: string;
|
|
81
|
+
radiusLg: string;
|
|
82
|
+
radiusXl: string;
|
|
83
|
+
fontBody: string;
|
|
84
|
+
}
|
|
85
|
+
export type PartialTheme = Partial<OrbitTheme>;
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import type { ChatHeaderInfo } from '../components/chat/ChatBox';
|
|
2
|
+
export interface ChatProps {
|
|
3
|
+
/** Open directly to a specific conversation */
|
|
4
|
+
conversationId?: string;
|
|
5
|
+
onCallRequest?: (userId: string, type: 'voice' | 'video') => void;
|
|
6
|
+
/** Replace the default header identity section with a custom component */
|
|
7
|
+
renderHeader?: (info: ChatHeaderInfo) => React.ReactNode;
|
|
8
|
+
/** Rendered at the top of the message list when a conversation is open */
|
|
9
|
+
chatBanner?: React.ReactNode;
|
|
10
|
+
/** Default quick messages seeded into the picker if the user has none saved */
|
|
11
|
+
defaultQuickMessages?: import('../components/chat/QuickMessages').QuickMessage[];
|
|
12
|
+
}
|
|
13
|
+
export declare function Chat({ conversationId: initialConvId, onCallRequest, renderHeader, chatBanner, defaultQuickMessages }: ChatProps): import("react/jsx-runtime").JSX.Element;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare function VideoCall(): import("react/jsx-runtime").JSX.Element | null;
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
export { Chat } from './Chat';
|
|
2
|
+
export type { ChatProps } from './Chat';
|
|
3
|
+
export type { ChatHeaderInfo } from '../components/chat/ChatBox';
|
|
4
|
+
export { VideoCall } from './VideoCall';
|
|
5
|
+
export { MeetingWidget } from './MeetingWidget';
|
|
6
|
+
export type { MeetingWidgetProps } from './MeetingWidget';
|