@poolse/react-ui 2.24.0 → 2.25.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 +8 -0
- package/dist/index.cjs +0 -271
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +3 -68
- package/dist/index.d.ts +3 -68
- package/dist/index.js +3 -272
- package/dist/index.js.map +1 -1
- package/dist/styles.css +2 -2
- package/package.json +11 -11
package/dist/index.d.cts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import * as react_jsx_runtime from 'react/jsx-runtime';
|
|
2
|
-
import { CallParticipant,
|
|
2
|
+
import { CallParticipant, CallDevice, CallDeviceKind, Uuid, Message, LiveCall, Conversation, Membership, Attachment, MessageCreateRequest } from '@poolse/sdk';
|
|
3
3
|
import * as react from 'react';
|
|
4
|
-
import {
|
|
4
|
+
import { SVGProps, ReactElement, ReactNode } from 'react';
|
|
5
5
|
import { UseRoom, UploadItem, ReactionMap } from '@poolse/react';
|
|
6
6
|
|
|
7
7
|
interface CallVideoGridProps {
|
|
@@ -13,71 +13,6 @@ interface CallVideoGridProps {
|
|
|
13
13
|
}
|
|
14
14
|
declare function CallVideoGrid({ participants, labelFor, className, onLocalClick, }: CallVideoGridProps): react_jsx_runtime.JSX.Element | null;
|
|
15
15
|
|
|
16
|
-
interface CallInvite {
|
|
17
|
-
/** Ring everyone in a conversation. */
|
|
18
|
-
placeCall: (conversationId: string, media?: CallMedia) => void;
|
|
19
|
-
/** A call is already in flight, so a new one cannot be placed. */
|
|
20
|
-
busy: boolean;
|
|
21
|
-
}
|
|
22
|
-
/**
|
|
23
|
-
* Place a call from anywhere under {@link CallProvider}.
|
|
24
|
-
*
|
|
25
|
-
* const { placeCall, busy } = useCallInvite();
|
|
26
|
-
* <button disabled={busy} onClick={() => placeCall(id, 'video')}>Video</button>
|
|
27
|
-
*
|
|
28
|
-
* Separate from the call surface on purpose. The buttons belong in a
|
|
29
|
-
* conversation header, the surface belongs at the root, and they must
|
|
30
|
-
* share one state machine — see {@link CallProvider} for why that
|
|
31
|
-
* matters more than it sounds.
|
|
32
|
-
*/
|
|
33
|
-
declare function useCallInvite(): CallInvite;
|
|
34
|
-
interface CallProviderProps {
|
|
35
|
-
/** The signed-in user's poolse id — the topic calls arrive on. */
|
|
36
|
-
userId: string | null;
|
|
37
|
-
/**
|
|
38
|
-
* `livekit-client`, imported by your app:
|
|
39
|
-
*
|
|
40
|
-
* import * as livekit from 'livekit-client';
|
|
41
|
-
*/
|
|
42
|
-
livekit: LiveKitModule;
|
|
43
|
-
/** Resolves a user id to a display label. */
|
|
44
|
-
labelFor?: (userId: string) => string;
|
|
45
|
-
children: ReactNode;
|
|
46
|
-
}
|
|
47
|
-
/**
|
|
48
|
-
* Owns calling for a web app: ringing, answering, media and the call UI.
|
|
49
|
-
*
|
|
50
|
-
* ## Mount it ONCE, at the root
|
|
51
|
-
*
|
|
52
|
-
* Not inside a conversation view, and not behind a route that can
|
|
53
|
-
* unmount. A call arrives on the user's own topic at any moment, and
|
|
54
|
-
* this component is what listens — so anywhere it is not mounted, the
|
|
55
|
-
* app simply cannot be called. Putting it inside a "is a conversation
|
|
56
|
-
* open?" branch means the user is unreachable on the conversation list,
|
|
57
|
-
* which looks exactly like calls being unreliable rather than like a
|
|
58
|
-
* mounting mistake.
|
|
59
|
-
*
|
|
60
|
-
* <CallProvider userId={me.id} livekit={livekit}>
|
|
61
|
-
* <YourApp />
|
|
62
|
-
* </CallProvider>
|
|
63
|
-
*
|
|
64
|
-
* The buttons that place calls live wherever you want them, and reach
|
|
65
|
-
* this through {@link useCallInvite}.
|
|
66
|
-
*
|
|
67
|
-
* ## Two media paths
|
|
68
|
-
*
|
|
69
|
-
* Media rides the SFU when the deployment has one — that is what makes
|
|
70
|
-
* video and the mid-call camera toggle possible. Without one, calls fall
|
|
71
|
-
* back to the peer-to-peer mesh, which carries audio only. The fallback
|
|
72
|
-
* is automatic and silent by design.
|
|
73
|
-
*
|
|
74
|
-
* ## Styling
|
|
75
|
-
*
|
|
76
|
-
* Class-based, and no CSS ships with it. The host owns the look; the
|
|
77
|
-
* class names are stable.
|
|
78
|
-
*/
|
|
79
|
-
declare function CallProvider({ userId, livekit, labelFor, children }: CallProviderProps): react_jsx_runtime.JSX.Element;
|
|
80
|
-
|
|
81
16
|
declare const ICONS: {
|
|
82
17
|
readonly attachment: {
|
|
83
18
|
readonly vb: "0 0 24 24";
|
|
@@ -1039,4 +974,4 @@ declare function usePoolseFonts(enabled?: boolean): void;
|
|
|
1039
974
|
*/
|
|
1040
975
|
declare function PoolseFonts(): null;
|
|
1041
976
|
|
|
1042
|
-
export { AttachmentPreview, type AttachmentPreviewProps, Avatar, type AvatarProps, CallControlButton, type CallControlButtonProps, CallDeviceMenu, type CallDeviceMenuProps,
|
|
977
|
+
export { AttachmentPreview, type AttachmentPreviewProps, Avatar, type AvatarProps, CallControlButton, type CallControlButtonProps, CallDeviceMenu, type CallDeviceMenuProps, CallLogRow, type CallLogRowProps, CallVideoGrid, type CallVideoGridProps, ChatHeader, type ChatHeaderProps, ConversationList, type ConversationListProps, ConversationView, type ConversationViewProps, EditableMessageBubble, type EditableMessageBubbleProps, GroupDetailsSheet, type GroupDetailsSheetProps, type IconName, type InboxUser, LiveCallBanner, type LiveCallBannerProps, MemberList, type MemberListProps, MentionInput, type MentionInputProps, MessageActions, type MessageActionsProps, MessageBubble, type MessageBubbleProps, MessageComposer, type MessageComposerProps, PoolseFonts, PoolseIcon, type PoolseIconProps, PoolseInbox, type PoolseInboxHandle, type PoolseInboxProps, PoolseLogo, type PoolseLogoProps, type PoolseLogoVariant, ReactionPicker, ReactionStrip, type ReactionStripProps, RoomJoinBar, type RoomJoinBarProps, RoomStage, type RoomStageProps, ThreadView, type ThreadViewProps, TypingIndicator, type TypingIndicatorProps, UploadQueueStrip, UserName, type UserNameProps, UserPickerSheet, type UserPickerSheetProps, useDisplayName, usePoolseFonts };
|
package/dist/index.d.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import * as react_jsx_runtime from 'react/jsx-runtime';
|
|
2
|
-
import { CallParticipant,
|
|
2
|
+
import { CallParticipant, CallDevice, CallDeviceKind, Uuid, Message, LiveCall, Conversation, Membership, Attachment, MessageCreateRequest } from '@poolse/sdk';
|
|
3
3
|
import * as react from 'react';
|
|
4
|
-
import {
|
|
4
|
+
import { SVGProps, ReactElement, ReactNode } from 'react';
|
|
5
5
|
import { UseRoom, UploadItem, ReactionMap } from '@poolse/react';
|
|
6
6
|
|
|
7
7
|
interface CallVideoGridProps {
|
|
@@ -13,71 +13,6 @@ interface CallVideoGridProps {
|
|
|
13
13
|
}
|
|
14
14
|
declare function CallVideoGrid({ participants, labelFor, className, onLocalClick, }: CallVideoGridProps): react_jsx_runtime.JSX.Element | null;
|
|
15
15
|
|
|
16
|
-
interface CallInvite {
|
|
17
|
-
/** Ring everyone in a conversation. */
|
|
18
|
-
placeCall: (conversationId: string, media?: CallMedia) => void;
|
|
19
|
-
/** A call is already in flight, so a new one cannot be placed. */
|
|
20
|
-
busy: boolean;
|
|
21
|
-
}
|
|
22
|
-
/**
|
|
23
|
-
* Place a call from anywhere under {@link CallProvider}.
|
|
24
|
-
*
|
|
25
|
-
* const { placeCall, busy } = useCallInvite();
|
|
26
|
-
* <button disabled={busy} onClick={() => placeCall(id, 'video')}>Video</button>
|
|
27
|
-
*
|
|
28
|
-
* Separate from the call surface on purpose. The buttons belong in a
|
|
29
|
-
* conversation header, the surface belongs at the root, and they must
|
|
30
|
-
* share one state machine — see {@link CallProvider} for why that
|
|
31
|
-
* matters more than it sounds.
|
|
32
|
-
*/
|
|
33
|
-
declare function useCallInvite(): CallInvite;
|
|
34
|
-
interface CallProviderProps {
|
|
35
|
-
/** The signed-in user's poolse id — the topic calls arrive on. */
|
|
36
|
-
userId: string | null;
|
|
37
|
-
/**
|
|
38
|
-
* `livekit-client`, imported by your app:
|
|
39
|
-
*
|
|
40
|
-
* import * as livekit from 'livekit-client';
|
|
41
|
-
*/
|
|
42
|
-
livekit: LiveKitModule;
|
|
43
|
-
/** Resolves a user id to a display label. */
|
|
44
|
-
labelFor?: (userId: string) => string;
|
|
45
|
-
children: ReactNode;
|
|
46
|
-
}
|
|
47
|
-
/**
|
|
48
|
-
* Owns calling for a web app: ringing, answering, media and the call UI.
|
|
49
|
-
*
|
|
50
|
-
* ## Mount it ONCE, at the root
|
|
51
|
-
*
|
|
52
|
-
* Not inside a conversation view, and not behind a route that can
|
|
53
|
-
* unmount. A call arrives on the user's own topic at any moment, and
|
|
54
|
-
* this component is what listens — so anywhere it is not mounted, the
|
|
55
|
-
* app simply cannot be called. Putting it inside a "is a conversation
|
|
56
|
-
* open?" branch means the user is unreachable on the conversation list,
|
|
57
|
-
* which looks exactly like calls being unreliable rather than like a
|
|
58
|
-
* mounting mistake.
|
|
59
|
-
*
|
|
60
|
-
* <CallProvider userId={me.id} livekit={livekit}>
|
|
61
|
-
* <YourApp />
|
|
62
|
-
* </CallProvider>
|
|
63
|
-
*
|
|
64
|
-
* The buttons that place calls live wherever you want them, and reach
|
|
65
|
-
* this through {@link useCallInvite}.
|
|
66
|
-
*
|
|
67
|
-
* ## Two media paths
|
|
68
|
-
*
|
|
69
|
-
* Media rides the SFU when the deployment has one — that is what makes
|
|
70
|
-
* video and the mid-call camera toggle possible. Without one, calls fall
|
|
71
|
-
* back to the peer-to-peer mesh, which carries audio only. The fallback
|
|
72
|
-
* is automatic and silent by design.
|
|
73
|
-
*
|
|
74
|
-
* ## Styling
|
|
75
|
-
*
|
|
76
|
-
* Class-based, and no CSS ships with it. The host owns the look; the
|
|
77
|
-
* class names are stable.
|
|
78
|
-
*/
|
|
79
|
-
declare function CallProvider({ userId, livekit, labelFor, children }: CallProviderProps): react_jsx_runtime.JSX.Element;
|
|
80
|
-
|
|
81
16
|
declare const ICONS: {
|
|
82
17
|
readonly attachment: {
|
|
83
18
|
readonly vb: "0 0 24 24";
|
|
@@ -1039,4 +974,4 @@ declare function usePoolseFonts(enabled?: boolean): void;
|
|
|
1039
974
|
*/
|
|
1040
975
|
declare function PoolseFonts(): null;
|
|
1041
976
|
|
|
1042
|
-
export { AttachmentPreview, type AttachmentPreviewProps, Avatar, type AvatarProps, CallControlButton, type CallControlButtonProps, CallDeviceMenu, type CallDeviceMenuProps,
|
|
977
|
+
export { AttachmentPreview, type AttachmentPreviewProps, Avatar, type AvatarProps, CallControlButton, type CallControlButtonProps, CallDeviceMenu, type CallDeviceMenuProps, CallLogRow, type CallLogRowProps, CallVideoGrid, type CallVideoGridProps, ChatHeader, type ChatHeaderProps, ConversationList, type ConversationListProps, ConversationView, type ConversationViewProps, EditableMessageBubble, type EditableMessageBubbleProps, GroupDetailsSheet, type GroupDetailsSheetProps, type IconName, type InboxUser, LiveCallBanner, type LiveCallBannerProps, MemberList, type MemberListProps, MentionInput, type MentionInputProps, MessageActions, type MessageActionsProps, MessageBubble, type MessageBubbleProps, MessageComposer, type MessageComposerProps, PoolseFonts, PoolseIcon, type PoolseIconProps, PoolseInbox, type PoolseInboxHandle, type PoolseInboxProps, PoolseLogo, type PoolseLogoProps, type PoolseLogoVariant, ReactionPicker, ReactionStrip, type ReactionStripProps, RoomJoinBar, type RoomJoinBarProps, RoomStage, type RoomStageProps, ThreadView, type ThreadViewProps, TypingIndicator, type TypingIndicatorProps, UploadQueueStrip, UserName, type UserNameProps, UserPickerSheet, type UserPickerSheetProps, useDisplayName, usePoolseFonts };
|
package/dist/index.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
'use client';
|
|
2
|
-
import {
|
|
2
|
+
import { forwardRef, useState, useRef, useCallback, useImperativeHandle, useEffect, useMemo, Fragment as Fragment$1 } from 'react';
|
|
3
3
|
import { jsxs, jsx, Fragment } from 'react/jsx-runtime';
|
|
4
|
-
import { useMembers, useAttachmentUpload, useMe, useConversations, useUser, useConversation, usePresence, useMessages, useTyping, useRealtimeStatus, isMessageVisibleTo, receiptsOf, computeGroupPosition, sameDay, formatDayLabel, canEditOwnMessage, formatCallLogPreview, useLiveCall, callLogDisplayFor, useThread, useReactions, useAttachmentUrl
|
|
4
|
+
import { useMembers, useAttachmentUpload, useMe, useConversations, useUser, useConversation, usePresence, useMessages, useTyping, useRealtimeStatus, isMessageVisibleTo, receiptsOf, computeGroupPosition, sameDay, formatDayLabel, canEditOwnMessage, formatCallLogPreview, useLiveCall, callLogDisplayFor, useThread, useReactions, useAttachmentUrl } from '@poolse/react';
|
|
5
5
|
import ReactMarkdown from 'react-markdown';
|
|
6
6
|
import remarkGfm from 'remark-gfm';
|
|
7
7
|
|
|
@@ -541,275 +541,6 @@ function kindLabel(kind) {
|
|
|
541
541
|
if (kind === "audioinput") return "Microphone";
|
|
542
542
|
return "Output";
|
|
543
543
|
}
|
|
544
|
-
var InviteContext = createContext(null);
|
|
545
|
-
function useCallInvite() {
|
|
546
|
-
return useContext(InviteContext) ?? {
|
|
547
|
-
placeCall: () => {
|
|
548
|
-
},
|
|
549
|
-
busy: true
|
|
550
|
-
};
|
|
551
|
-
}
|
|
552
|
-
var CHROME_IDLE_MS = 4500;
|
|
553
|
-
function CallProvider({ userId, livekit, labelFor, children }) {
|
|
554
|
-
const calls = useCalls(userId);
|
|
555
|
-
const label = labelFor ?? ((id) => `User ${id.slice(0, 6)}`);
|
|
556
|
-
const placeCall = useCallback(
|
|
557
|
-
(conversationId, media = "audio") => {
|
|
558
|
-
void calls.call(conversationId, media);
|
|
559
|
-
},
|
|
560
|
-
[calls]
|
|
561
|
-
);
|
|
562
|
-
const invite = { placeCall, busy: calls.phase !== "idle" };
|
|
563
|
-
return /* @__PURE__ */ jsxs(InviteContext.Provider, { value: invite, children: [
|
|
564
|
-
children,
|
|
565
|
-
/* @__PURE__ */ jsx(CallSurface, { calls, livekit, labelFor: label })
|
|
566
|
-
] });
|
|
567
|
-
}
|
|
568
|
-
function CallSurface({
|
|
569
|
-
calls,
|
|
570
|
-
livekit,
|
|
571
|
-
labelFor
|
|
572
|
-
}) {
|
|
573
|
-
const conversationInCall = calls.phase === "active" ? calls.activeConversationId : null;
|
|
574
|
-
const isVideoCall = calls.media === "video";
|
|
575
|
-
const sfu = useCallRoom(conversationInCall, { livekit, video: isVideoCall });
|
|
576
|
-
const voice = useVoiceRoom(conversationInCall);
|
|
577
|
-
const usingSfu = sfu.sfuAvailable === true;
|
|
578
|
-
const mediaStatus = usingSfu ? sfu.status : voice.status;
|
|
579
|
-
const connected = calls.phase === "active" && mediaStatus === "connected";
|
|
580
|
-
useEffect(() => {
|
|
581
|
-
if (calls.phase !== "active" || !conversationInCall) return;
|
|
582
|
-
let cancelled = false;
|
|
583
|
-
void (async () => {
|
|
584
|
-
const joined = await sfu.join();
|
|
585
|
-
if (cancelled || joined) return;
|
|
586
|
-
await voice.join();
|
|
587
|
-
})();
|
|
588
|
-
return () => {
|
|
589
|
-
cancelled = true;
|
|
590
|
-
};
|
|
591
|
-
}, [calls.phase, conversationInCall]);
|
|
592
|
-
const hangUp = useCallback(() => {
|
|
593
|
-
sfu.leave();
|
|
594
|
-
voice.leave();
|
|
595
|
-
void calls.hangUp();
|
|
596
|
-
}, [sfu, voice, calls]);
|
|
597
|
-
const alone = usingSfu ? sfu.alone : voice.alone;
|
|
598
|
-
const endedOnEmpty = useRef(false);
|
|
599
|
-
if (calls.phase !== "active") endedOnEmpty.current = false;
|
|
600
|
-
useEffect(() => {
|
|
601
|
-
if (!alone || calls.phase !== "active" || endedOnEmpty.current) return;
|
|
602
|
-
endedOnEmpty.current = true;
|
|
603
|
-
hangUp();
|
|
604
|
-
}, [alone, calls.phase, hangUp]);
|
|
605
|
-
const [chromeVisible, setChromeVisible] = useState(true);
|
|
606
|
-
const [lastWake, setLastWake] = useState(0);
|
|
607
|
-
const [menu, setMenu] = useState(null);
|
|
608
|
-
const chromeHides = connected && isVideoCall && menu === null;
|
|
609
|
-
useEffect(() => {
|
|
610
|
-
setChromeVisible(true);
|
|
611
|
-
if (!chromeHides) return;
|
|
612
|
-
const timer = setTimeout(() => setChromeVisible(false), CHROME_IDLE_MS);
|
|
613
|
-
return () => clearTimeout(timer);
|
|
614
|
-
}, [chromeHides, lastWake]);
|
|
615
|
-
const wake = useCallback(() => setLastWake(Date.now()), []);
|
|
616
|
-
const withWake = useCallback(
|
|
617
|
-
(fn) => () => {
|
|
618
|
-
wake();
|
|
619
|
-
fn();
|
|
620
|
-
},
|
|
621
|
-
[wake]
|
|
622
|
-
);
|
|
623
|
-
const micOn = usingSfu ? sfu.micEnabled : !voice.muted;
|
|
624
|
-
const toggleMic = useCallback(() => {
|
|
625
|
-
if (usingSfu) void sfu.toggleMic();
|
|
626
|
-
else voice.toggleMute();
|
|
627
|
-
}, [usingSfu, sfu, voice]);
|
|
628
|
-
const openMenu = useCallback(
|
|
629
|
-
(kind) => {
|
|
630
|
-
sfu.refreshDevices();
|
|
631
|
-
setMenu((current) => current === kind ? null : kind);
|
|
632
|
-
},
|
|
633
|
-
[sfu]
|
|
634
|
-
);
|
|
635
|
-
const duration = useCallDuration(connected);
|
|
636
|
-
if (calls.phase === "idle") return null;
|
|
637
|
-
const ringingIn = calls.phase === "ringing-in";
|
|
638
|
-
const ringingOut = calls.phase === "ringing-out";
|
|
639
|
-
const ended = calls.phase === "declined" || calls.phase === "busy" || calls.phase === "timed-out";
|
|
640
|
-
const others = usingSfu ? sfu.participants.filter((p) => !p.isSelf) : [];
|
|
641
|
-
const peerIds = ringingIn && calls.incoming ? [calls.incoming.callerUserId] : others.length > 0 ? others.map((p) => p.userId) : calls.outgoing?.calleeUserIds ?? [];
|
|
642
|
-
const who = peerIds.length === 0 ? "Call" : peerIds.length <= 2 ? peerIds.map(labelFor).join(", ") : `${labelFor(peerIds[0])} and ${peerIds.length - 1} others`;
|
|
643
|
-
const showStage = connected && usingSfu && sfu.participants.length > 0;
|
|
644
|
-
const error = calls.error ?? (usingSfu ? sfu.error : voice.error);
|
|
645
|
-
const isGroup = others.length > 1;
|
|
646
|
-
return /* @__PURE__ */ jsxs(
|
|
647
|
-
"div",
|
|
648
|
-
{
|
|
649
|
-
className: "callsheet",
|
|
650
|
-
role: "dialog",
|
|
651
|
-
"aria-modal": "true",
|
|
652
|
-
"aria-label": "Call",
|
|
653
|
-
onPointerMove: wake,
|
|
654
|
-
children: [
|
|
655
|
-
/* @__PURE__ */ jsx("div", { className: "callsheet__stage", children: showStage ? /* @__PURE__ */ jsx(
|
|
656
|
-
CallVideoGrid,
|
|
657
|
-
{
|
|
658
|
-
participants: sfu.participants,
|
|
659
|
-
labelFor,
|
|
660
|
-
onLocalClick: sfu.cameraEnabled ? () => void sfu.switchCamera() : void 0
|
|
661
|
-
}
|
|
662
|
-
) : /* @__PURE__ */ jsx("div", { className: "callsheet__identity", children: /* @__PURE__ */ jsx("span", { className: "callsheet__avatar", "aria-hidden": "true", children: who.slice(0, 1).toUpperCase() }) }) }),
|
|
663
|
-
/* @__PURE__ */ jsxs("header", { className: `callsheet__header${chromeVisible ? "" : " callsheet__header--hidden"}`, children: [
|
|
664
|
-
/* @__PURE__ */ jsx("p", { className: "callsheet__who", children: who }),
|
|
665
|
-
/* @__PURE__ */ jsxs("p", { className: "callsheet__state", children: [
|
|
666
|
-
isGroup && showStage ? `${sfu.participants.length} \xB7 ` : "",
|
|
667
|
-
duration ?? statusLine(calls.phase, mediaStatus)
|
|
668
|
-
] })
|
|
669
|
-
] }),
|
|
670
|
-
/* @__PURE__ */ jsxs("div", { className: `callsheet__actions${chromeVisible ? "" : " callsheet__actions--hidden"}`, children: [
|
|
671
|
-
error && /* @__PURE__ */ jsx("p", { className: "callsheet__error", children: error.message }),
|
|
672
|
-
ringingIn ? /* @__PURE__ */ jsxs("div", { className: "callsheet__row", children: [
|
|
673
|
-
/* @__PURE__ */ jsx(
|
|
674
|
-
CallControlButton,
|
|
675
|
-
{
|
|
676
|
-
icon: "phone-off",
|
|
677
|
-
tone: "danger",
|
|
678
|
-
large: true,
|
|
679
|
-
label: "Decline",
|
|
680
|
-
onClick: () => void calls.decline()
|
|
681
|
-
}
|
|
682
|
-
),
|
|
683
|
-
/* @__PURE__ */ jsx(
|
|
684
|
-
CallControlButton,
|
|
685
|
-
{
|
|
686
|
-
icon: isVideoCall ? "video" : "phone",
|
|
687
|
-
tone: "accept",
|
|
688
|
-
large: true,
|
|
689
|
-
label: "Accept",
|
|
690
|
-
onClick: () => void calls.accept()
|
|
691
|
-
}
|
|
692
|
-
)
|
|
693
|
-
] }) : ended ? /* @__PURE__ */ jsx("div", { className: "callsheet__row", children: /* @__PURE__ */ jsx(CallControlButton, { icon: "close", label: "Close", onClick: calls.reset }) }) : /* @__PURE__ */ jsxs("div", { className: "callsheet__row", children: [
|
|
694
|
-
/* @__PURE__ */ jsxs("span", { className: "callsheet__control", children: [
|
|
695
|
-
/* @__PURE__ */ jsx(
|
|
696
|
-
CallControlButton,
|
|
697
|
-
{
|
|
698
|
-
icon: micOn ? "mic" : "mic-off",
|
|
699
|
-
active: !micOn,
|
|
700
|
-
label: micOn ? "Mute" : "Unmute",
|
|
701
|
-
onClick: withWake(toggleMic),
|
|
702
|
-
hasMenu: usingSfu && sfu.devices.audioinput.length > 0,
|
|
703
|
-
onMenuClick: withWake(() => openMenu("audioinput"))
|
|
704
|
-
}
|
|
705
|
-
),
|
|
706
|
-
menu === "audioinput" && /* @__PURE__ */ jsx(
|
|
707
|
-
CallDeviceMenu,
|
|
708
|
-
{
|
|
709
|
-
title: "Microphone",
|
|
710
|
-
devices: sfu.devices.audioinput,
|
|
711
|
-
activeId: sfu.activeDevices.audioinput,
|
|
712
|
-
onSelect: (kind, id) => void sfu.selectDevice(kind, id),
|
|
713
|
-
onClose: () => setMenu(null)
|
|
714
|
-
}
|
|
715
|
-
)
|
|
716
|
-
] }),
|
|
717
|
-
usingSfu && /* @__PURE__ */ jsxs("span", { className: "callsheet__control", children: [
|
|
718
|
-
/* @__PURE__ */ jsx(
|
|
719
|
-
CallControlButton,
|
|
720
|
-
{
|
|
721
|
-
icon: sfu.cameraEnabled ? "video" : "video-off",
|
|
722
|
-
active: !sfu.cameraEnabled,
|
|
723
|
-
label: "Camera",
|
|
724
|
-
onClick: withWake(() => void sfu.toggleCamera()),
|
|
725
|
-
disabled: sfu.devices.videoinput.length === 0,
|
|
726
|
-
hasMenu: sfu.devices.videoinput.length > 0,
|
|
727
|
-
onMenuClick: withWake(() => openMenu("videoinput"))
|
|
728
|
-
}
|
|
729
|
-
),
|
|
730
|
-
menu === "videoinput" && /* @__PURE__ */ jsx(
|
|
731
|
-
CallDeviceMenu,
|
|
732
|
-
{
|
|
733
|
-
title: "Camera",
|
|
734
|
-
devices: sfu.devices.videoinput,
|
|
735
|
-
activeId: sfu.activeDevices.videoinput,
|
|
736
|
-
onSelect: (kind, id) => void sfu.selectDevice(kind, id),
|
|
737
|
-
onClose: () => setMenu(null)
|
|
738
|
-
}
|
|
739
|
-
)
|
|
740
|
-
] }),
|
|
741
|
-
usingSfu && sfu.devices.audiooutput.length > 0 && /* @__PURE__ */ jsxs("span", { className: "callsheet__control", children: [
|
|
742
|
-
/* @__PURE__ */ jsx(
|
|
743
|
-
CallControlButton,
|
|
744
|
-
{
|
|
745
|
-
icon: "speaker",
|
|
746
|
-
label: "Output",
|
|
747
|
-
onClick: withWake(() => openMenu("audiooutput"))
|
|
748
|
-
}
|
|
749
|
-
),
|
|
750
|
-
menu === "audiooutput" && /* @__PURE__ */ jsx(
|
|
751
|
-
CallDeviceMenu,
|
|
752
|
-
{
|
|
753
|
-
title: "Speaker",
|
|
754
|
-
devices: sfu.devices.audiooutput,
|
|
755
|
-
activeId: sfu.activeDevices.audiooutput,
|
|
756
|
-
onSelect: (kind, id) => void sfu.selectDevice(kind, id),
|
|
757
|
-
onClose: () => setMenu(null)
|
|
758
|
-
}
|
|
759
|
-
)
|
|
760
|
-
] }),
|
|
761
|
-
/* @__PURE__ */ jsx(
|
|
762
|
-
CallControlButton,
|
|
763
|
-
{
|
|
764
|
-
icon: "phone-off",
|
|
765
|
-
tone: "danger",
|
|
766
|
-
large: true,
|
|
767
|
-
label: ringingOut ? "Cancel" : "Hang up",
|
|
768
|
-
onClick: ringingOut ? () => void calls.cancel() : hangUp
|
|
769
|
-
}
|
|
770
|
-
)
|
|
771
|
-
] })
|
|
772
|
-
] })
|
|
773
|
-
]
|
|
774
|
-
}
|
|
775
|
-
);
|
|
776
|
-
}
|
|
777
|
-
function useCallDuration(connected) {
|
|
778
|
-
const [startedAt, setStartedAt] = useState(null);
|
|
779
|
-
const [, tick] = useState(0);
|
|
780
|
-
useEffect(() => {
|
|
781
|
-
if (!connected) {
|
|
782
|
-
setStartedAt(null);
|
|
783
|
-
return;
|
|
784
|
-
}
|
|
785
|
-
setStartedAt(Date.now());
|
|
786
|
-
const id = setInterval(() => tick((n) => n + 1), 1e3);
|
|
787
|
-
return () => clearInterval(id);
|
|
788
|
-
}, [connected]);
|
|
789
|
-
if (!connected || startedAt === null) return null;
|
|
790
|
-
const total = Math.max(0, Math.floor((Date.now() - startedAt) / 1e3));
|
|
791
|
-
const minutes = Math.floor(total / 60);
|
|
792
|
-
const seconds = total % 60;
|
|
793
|
-
return `${minutes}:${String(seconds).padStart(2, "0")}`;
|
|
794
|
-
}
|
|
795
|
-
function statusLine(phase, mediaStatus) {
|
|
796
|
-
switch (phase) {
|
|
797
|
-
case "ringing-in":
|
|
798
|
-
return "Incoming call\u2026";
|
|
799
|
-
case "ringing-out":
|
|
800
|
-
return "Ringing\u2026";
|
|
801
|
-
case "declined":
|
|
802
|
-
return "Call declined";
|
|
803
|
-
case "busy":
|
|
804
|
-
return "Already on another call";
|
|
805
|
-
case "timed-out":
|
|
806
|
-
return "No answer";
|
|
807
|
-
case "active":
|
|
808
|
-
return mediaStatus === "connected" ? "Connected" : "Connecting\u2026";
|
|
809
|
-
default:
|
|
810
|
-
return "";
|
|
811
|
-
}
|
|
812
|
-
}
|
|
813
544
|
var FONT_HREF = "https://fonts.googleapis.com/css2?family=Bricolage+Grotesque:opsz,wght@12..96,400;12..96,600;12..96,800&family=Hanken+Grotesk:wght@400;500;600;700&family=JetBrains+Mono:wght@400;500&display=swap";
|
|
814
545
|
var FONT_HREF_PRECONNECT_GOOGLE = "https://fonts.googleapis.com";
|
|
815
546
|
var FONT_HREF_PRECONNECT_STATIC = "https://fonts.gstatic.com";
|
|
@@ -3946,6 +3677,6 @@ function PoolseLogo({
|
|
|
3946
3677
|
);
|
|
3947
3678
|
}
|
|
3948
3679
|
|
|
3949
|
-
export { AttachmentPreview, Avatar, CallControlButton, CallDeviceMenu, CallLogRow,
|
|
3680
|
+
export { AttachmentPreview, Avatar, CallControlButton, CallDeviceMenu, CallLogRow, CallVideoGrid, ChatHeader, ConversationList, ConversationView, EditableMessageBubble, GroupDetailsSheet, LiveCallBanner, MemberList, MentionInput, MessageActions, MessageBubble, MessageComposer, PoolseFonts, PoolseIcon, PoolseInbox, PoolseLogo, ReactionPicker, ReactionStrip, RoomJoinBar, RoomStage, ThreadView, TypingIndicator, UploadQueueStrip, UserName, UserPickerSheet, useDisplayName, usePoolseFonts };
|
|
3950
3681
|
//# sourceMappingURL=index.js.map
|
|
3951
3682
|
//# sourceMappingURL=index.js.map
|