@poolse/react-ui 2.23.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 +207 -274
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +32 -69
- package/dist/index.d.ts +32 -69
- package/dist/index.js +208 -275
- package/dist/index.js.map +1 -1
- package/dist/styles.css +549 -0
- package/package.json +11 -11
package/CHANGELOG.md
CHANGED
|
@@ -4,6 +4,14 @@ All notable changes to `@poolse/react-ui` are documented here. Format follows
|
|
|
4
4
|
[Keep a Changelog](https://keepachangelog.com/en/1.1.0/); versions follow
|
|
5
5
|
[semver](https://semver.org).
|
|
6
6
|
|
|
7
|
+
## [2.25.0] — 2026-10-22
|
|
8
|
+
|
|
9
|
+
### Removed
|
|
10
|
+
|
|
11
|
+
- **`CallProvider` / `useCallInvite`** — the legacy ringing call surface,
|
|
12
|
+
built on the removed `useCalls`. Rooms are `RoomJoinBar` + `RoomStage`
|
|
13
|
+
over `useRoom`; `useRoom().join(media, { ring: true })` rings phones.
|
|
14
|
+
|
|
7
15
|
## [2.20.0] — 2026-10-13
|
|
8
16
|
|
|
9
17
|
### Changed
|
package/dist/index.cjs
CHANGED
|
@@ -372,7 +372,9 @@ function CallVideoTile({
|
|
|
372
372
|
className: "callgrid__avatar",
|
|
373
373
|
style: { background: userColor(participant.userId) },
|
|
374
374
|
"aria-hidden": "true",
|
|
375
|
-
children: initialsOf(
|
|
375
|
+
children: initialsOf(
|
|
376
|
+
participant.isSelf ? participant.name ?? label(participant.userId) : name
|
|
377
|
+
)
|
|
376
378
|
}
|
|
377
379
|
) }),
|
|
378
380
|
!hideName && /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "callgrid__caption", children: [
|
|
@@ -546,275 +548,6 @@ function kindLabel(kind) {
|
|
|
546
548
|
if (kind === "audioinput") return "Microphone";
|
|
547
549
|
return "Output";
|
|
548
550
|
}
|
|
549
|
-
var InviteContext = react.createContext(null);
|
|
550
|
-
function useCallInvite() {
|
|
551
|
-
return react.useContext(InviteContext) ?? {
|
|
552
|
-
placeCall: () => {
|
|
553
|
-
},
|
|
554
|
-
busy: true
|
|
555
|
-
};
|
|
556
|
-
}
|
|
557
|
-
var CHROME_IDLE_MS = 4500;
|
|
558
|
-
function CallProvider({ userId, livekit, labelFor, children }) {
|
|
559
|
-
const calls = react$1.useCalls(userId);
|
|
560
|
-
const label = labelFor ?? ((id) => `User ${id.slice(0, 6)}`);
|
|
561
|
-
const placeCall = react.useCallback(
|
|
562
|
-
(conversationId, media = "audio") => {
|
|
563
|
-
void calls.call(conversationId, media);
|
|
564
|
-
},
|
|
565
|
-
[calls]
|
|
566
|
-
);
|
|
567
|
-
const invite = { placeCall, busy: calls.phase !== "idle" };
|
|
568
|
-
return /* @__PURE__ */ jsxRuntime.jsxs(InviteContext.Provider, { value: invite, children: [
|
|
569
|
-
children,
|
|
570
|
-
/* @__PURE__ */ jsxRuntime.jsx(CallSurface, { calls, livekit, labelFor: label })
|
|
571
|
-
] });
|
|
572
|
-
}
|
|
573
|
-
function CallSurface({
|
|
574
|
-
calls,
|
|
575
|
-
livekit,
|
|
576
|
-
labelFor
|
|
577
|
-
}) {
|
|
578
|
-
const conversationInCall = calls.phase === "active" ? calls.activeConversationId : null;
|
|
579
|
-
const isVideoCall = calls.media === "video";
|
|
580
|
-
const sfu = react$1.useCallRoom(conversationInCall, { livekit, video: isVideoCall });
|
|
581
|
-
const voice = react$1.useVoiceRoom(conversationInCall);
|
|
582
|
-
const usingSfu = sfu.sfuAvailable === true;
|
|
583
|
-
const mediaStatus = usingSfu ? sfu.status : voice.status;
|
|
584
|
-
const connected = calls.phase === "active" && mediaStatus === "connected";
|
|
585
|
-
react.useEffect(() => {
|
|
586
|
-
if (calls.phase !== "active" || !conversationInCall) return;
|
|
587
|
-
let cancelled = false;
|
|
588
|
-
void (async () => {
|
|
589
|
-
const joined = await sfu.join();
|
|
590
|
-
if (cancelled || joined) return;
|
|
591
|
-
await voice.join();
|
|
592
|
-
})();
|
|
593
|
-
return () => {
|
|
594
|
-
cancelled = true;
|
|
595
|
-
};
|
|
596
|
-
}, [calls.phase, conversationInCall]);
|
|
597
|
-
const hangUp = react.useCallback(() => {
|
|
598
|
-
sfu.leave();
|
|
599
|
-
voice.leave();
|
|
600
|
-
void calls.hangUp();
|
|
601
|
-
}, [sfu, voice, calls]);
|
|
602
|
-
const alone = usingSfu ? sfu.alone : voice.alone;
|
|
603
|
-
const endedOnEmpty = react.useRef(false);
|
|
604
|
-
if (calls.phase !== "active") endedOnEmpty.current = false;
|
|
605
|
-
react.useEffect(() => {
|
|
606
|
-
if (!alone || calls.phase !== "active" || endedOnEmpty.current) return;
|
|
607
|
-
endedOnEmpty.current = true;
|
|
608
|
-
hangUp();
|
|
609
|
-
}, [alone, calls.phase, hangUp]);
|
|
610
|
-
const [chromeVisible, setChromeVisible] = react.useState(true);
|
|
611
|
-
const [lastWake, setLastWake] = react.useState(0);
|
|
612
|
-
const [menu, setMenu] = react.useState(null);
|
|
613
|
-
const chromeHides = connected && isVideoCall && menu === null;
|
|
614
|
-
react.useEffect(() => {
|
|
615
|
-
setChromeVisible(true);
|
|
616
|
-
if (!chromeHides) return;
|
|
617
|
-
const timer = setTimeout(() => setChromeVisible(false), CHROME_IDLE_MS);
|
|
618
|
-
return () => clearTimeout(timer);
|
|
619
|
-
}, [chromeHides, lastWake]);
|
|
620
|
-
const wake = react.useCallback(() => setLastWake(Date.now()), []);
|
|
621
|
-
const withWake = react.useCallback(
|
|
622
|
-
(fn) => () => {
|
|
623
|
-
wake();
|
|
624
|
-
fn();
|
|
625
|
-
},
|
|
626
|
-
[wake]
|
|
627
|
-
);
|
|
628
|
-
const micOn = usingSfu ? sfu.micEnabled : !voice.muted;
|
|
629
|
-
const toggleMic = react.useCallback(() => {
|
|
630
|
-
if (usingSfu) void sfu.toggleMic();
|
|
631
|
-
else voice.toggleMute();
|
|
632
|
-
}, [usingSfu, sfu, voice]);
|
|
633
|
-
const openMenu = react.useCallback(
|
|
634
|
-
(kind) => {
|
|
635
|
-
sfu.refreshDevices();
|
|
636
|
-
setMenu((current) => current === kind ? null : kind);
|
|
637
|
-
},
|
|
638
|
-
[sfu]
|
|
639
|
-
);
|
|
640
|
-
const duration = useCallDuration(connected);
|
|
641
|
-
if (calls.phase === "idle") return null;
|
|
642
|
-
const ringingIn = calls.phase === "ringing-in";
|
|
643
|
-
const ringingOut = calls.phase === "ringing-out";
|
|
644
|
-
const ended = calls.phase === "declined" || calls.phase === "busy" || calls.phase === "timed-out";
|
|
645
|
-
const others = usingSfu ? sfu.participants.filter((p) => !p.isSelf) : [];
|
|
646
|
-
const peerIds = ringingIn && calls.incoming ? [calls.incoming.callerUserId] : others.length > 0 ? others.map((p) => p.userId) : calls.outgoing?.calleeUserIds ?? [];
|
|
647
|
-
const who = peerIds.length === 0 ? "Call" : peerIds.length <= 2 ? peerIds.map(labelFor).join(", ") : `${labelFor(peerIds[0])} and ${peerIds.length - 1} others`;
|
|
648
|
-
const showStage = connected && usingSfu && sfu.participants.length > 0;
|
|
649
|
-
const error = calls.error ?? (usingSfu ? sfu.error : voice.error);
|
|
650
|
-
const isGroup = others.length > 1;
|
|
651
|
-
return /* @__PURE__ */ jsxRuntime.jsxs(
|
|
652
|
-
"div",
|
|
653
|
-
{
|
|
654
|
-
className: "callsheet",
|
|
655
|
-
role: "dialog",
|
|
656
|
-
"aria-modal": "true",
|
|
657
|
-
"aria-label": "Call",
|
|
658
|
-
onPointerMove: wake,
|
|
659
|
-
children: [
|
|
660
|
-
/* @__PURE__ */ jsxRuntime.jsx("div", { className: "callsheet__stage", children: showStage ? /* @__PURE__ */ jsxRuntime.jsx(
|
|
661
|
-
CallVideoGrid,
|
|
662
|
-
{
|
|
663
|
-
participants: sfu.participants,
|
|
664
|
-
labelFor,
|
|
665
|
-
onLocalClick: sfu.cameraEnabled ? () => void sfu.switchCamera() : void 0
|
|
666
|
-
}
|
|
667
|
-
) : /* @__PURE__ */ jsxRuntime.jsx("div", { className: "callsheet__identity", children: /* @__PURE__ */ jsxRuntime.jsx("span", { className: "callsheet__avatar", "aria-hidden": "true", children: who.slice(0, 1).toUpperCase() }) }) }),
|
|
668
|
-
/* @__PURE__ */ jsxRuntime.jsxs("header", { className: `callsheet__header${chromeVisible ? "" : " callsheet__header--hidden"}`, children: [
|
|
669
|
-
/* @__PURE__ */ jsxRuntime.jsx("p", { className: "callsheet__who", children: who }),
|
|
670
|
-
/* @__PURE__ */ jsxRuntime.jsxs("p", { className: "callsheet__state", children: [
|
|
671
|
-
isGroup && showStage ? `${sfu.participants.length} \xB7 ` : "",
|
|
672
|
-
duration ?? statusLine(calls.phase, mediaStatus)
|
|
673
|
-
] })
|
|
674
|
-
] }),
|
|
675
|
-
/* @__PURE__ */ jsxRuntime.jsxs("div", { className: `callsheet__actions${chromeVisible ? "" : " callsheet__actions--hidden"}`, children: [
|
|
676
|
-
error && /* @__PURE__ */ jsxRuntime.jsx("p", { className: "callsheet__error", children: error.message }),
|
|
677
|
-
ringingIn ? /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "callsheet__row", children: [
|
|
678
|
-
/* @__PURE__ */ jsxRuntime.jsx(
|
|
679
|
-
CallControlButton,
|
|
680
|
-
{
|
|
681
|
-
icon: "phone-off",
|
|
682
|
-
tone: "danger",
|
|
683
|
-
large: true,
|
|
684
|
-
label: "Decline",
|
|
685
|
-
onClick: () => void calls.decline()
|
|
686
|
-
}
|
|
687
|
-
),
|
|
688
|
-
/* @__PURE__ */ jsxRuntime.jsx(
|
|
689
|
-
CallControlButton,
|
|
690
|
-
{
|
|
691
|
-
icon: isVideoCall ? "video" : "phone",
|
|
692
|
-
tone: "accept",
|
|
693
|
-
large: true,
|
|
694
|
-
label: "Accept",
|
|
695
|
-
onClick: () => void calls.accept()
|
|
696
|
-
}
|
|
697
|
-
)
|
|
698
|
-
] }) : ended ? /* @__PURE__ */ jsxRuntime.jsx("div", { className: "callsheet__row", children: /* @__PURE__ */ jsxRuntime.jsx(CallControlButton, { icon: "close", label: "Close", onClick: calls.reset }) }) : /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "callsheet__row", children: [
|
|
699
|
-
/* @__PURE__ */ jsxRuntime.jsxs("span", { className: "callsheet__control", children: [
|
|
700
|
-
/* @__PURE__ */ jsxRuntime.jsx(
|
|
701
|
-
CallControlButton,
|
|
702
|
-
{
|
|
703
|
-
icon: micOn ? "mic" : "mic-off",
|
|
704
|
-
active: !micOn,
|
|
705
|
-
label: micOn ? "Mute" : "Unmute",
|
|
706
|
-
onClick: withWake(toggleMic),
|
|
707
|
-
hasMenu: usingSfu && sfu.devices.audioinput.length > 0,
|
|
708
|
-
onMenuClick: withWake(() => openMenu("audioinput"))
|
|
709
|
-
}
|
|
710
|
-
),
|
|
711
|
-
menu === "audioinput" && /* @__PURE__ */ jsxRuntime.jsx(
|
|
712
|
-
CallDeviceMenu,
|
|
713
|
-
{
|
|
714
|
-
title: "Microphone",
|
|
715
|
-
devices: sfu.devices.audioinput,
|
|
716
|
-
activeId: sfu.activeDevices.audioinput,
|
|
717
|
-
onSelect: (kind, id) => void sfu.selectDevice(kind, id),
|
|
718
|
-
onClose: () => setMenu(null)
|
|
719
|
-
}
|
|
720
|
-
)
|
|
721
|
-
] }),
|
|
722
|
-
usingSfu && /* @__PURE__ */ jsxRuntime.jsxs("span", { className: "callsheet__control", children: [
|
|
723
|
-
/* @__PURE__ */ jsxRuntime.jsx(
|
|
724
|
-
CallControlButton,
|
|
725
|
-
{
|
|
726
|
-
icon: sfu.cameraEnabled ? "video" : "video-off",
|
|
727
|
-
active: !sfu.cameraEnabled,
|
|
728
|
-
label: "Camera",
|
|
729
|
-
onClick: withWake(() => void sfu.toggleCamera()),
|
|
730
|
-
disabled: sfu.devices.videoinput.length === 0,
|
|
731
|
-
hasMenu: sfu.devices.videoinput.length > 0,
|
|
732
|
-
onMenuClick: withWake(() => openMenu("videoinput"))
|
|
733
|
-
}
|
|
734
|
-
),
|
|
735
|
-
menu === "videoinput" && /* @__PURE__ */ jsxRuntime.jsx(
|
|
736
|
-
CallDeviceMenu,
|
|
737
|
-
{
|
|
738
|
-
title: "Camera",
|
|
739
|
-
devices: sfu.devices.videoinput,
|
|
740
|
-
activeId: sfu.activeDevices.videoinput,
|
|
741
|
-
onSelect: (kind, id) => void sfu.selectDevice(kind, id),
|
|
742
|
-
onClose: () => setMenu(null)
|
|
743
|
-
}
|
|
744
|
-
)
|
|
745
|
-
] }),
|
|
746
|
-
usingSfu && sfu.devices.audiooutput.length > 0 && /* @__PURE__ */ jsxRuntime.jsxs("span", { className: "callsheet__control", children: [
|
|
747
|
-
/* @__PURE__ */ jsxRuntime.jsx(
|
|
748
|
-
CallControlButton,
|
|
749
|
-
{
|
|
750
|
-
icon: "speaker",
|
|
751
|
-
label: "Output",
|
|
752
|
-
onClick: withWake(() => openMenu("audiooutput"))
|
|
753
|
-
}
|
|
754
|
-
),
|
|
755
|
-
menu === "audiooutput" && /* @__PURE__ */ jsxRuntime.jsx(
|
|
756
|
-
CallDeviceMenu,
|
|
757
|
-
{
|
|
758
|
-
title: "Speaker",
|
|
759
|
-
devices: sfu.devices.audiooutput,
|
|
760
|
-
activeId: sfu.activeDevices.audiooutput,
|
|
761
|
-
onSelect: (kind, id) => void sfu.selectDevice(kind, id),
|
|
762
|
-
onClose: () => setMenu(null)
|
|
763
|
-
}
|
|
764
|
-
)
|
|
765
|
-
] }),
|
|
766
|
-
/* @__PURE__ */ jsxRuntime.jsx(
|
|
767
|
-
CallControlButton,
|
|
768
|
-
{
|
|
769
|
-
icon: "phone-off",
|
|
770
|
-
tone: "danger",
|
|
771
|
-
large: true,
|
|
772
|
-
label: ringingOut ? "Cancel" : "Hang up",
|
|
773
|
-
onClick: ringingOut ? () => void calls.cancel() : hangUp
|
|
774
|
-
}
|
|
775
|
-
)
|
|
776
|
-
] })
|
|
777
|
-
] })
|
|
778
|
-
]
|
|
779
|
-
}
|
|
780
|
-
);
|
|
781
|
-
}
|
|
782
|
-
function useCallDuration(connected) {
|
|
783
|
-
const [startedAt, setStartedAt] = react.useState(null);
|
|
784
|
-
const [, tick] = react.useState(0);
|
|
785
|
-
react.useEffect(() => {
|
|
786
|
-
if (!connected) {
|
|
787
|
-
setStartedAt(null);
|
|
788
|
-
return;
|
|
789
|
-
}
|
|
790
|
-
setStartedAt(Date.now());
|
|
791
|
-
const id = setInterval(() => tick((n) => n + 1), 1e3);
|
|
792
|
-
return () => clearInterval(id);
|
|
793
|
-
}, [connected]);
|
|
794
|
-
if (!connected || startedAt === null) return null;
|
|
795
|
-
const total = Math.max(0, Math.floor((Date.now() - startedAt) / 1e3));
|
|
796
|
-
const minutes = Math.floor(total / 60);
|
|
797
|
-
const seconds = total % 60;
|
|
798
|
-
return `${minutes}:${String(seconds).padStart(2, "0")}`;
|
|
799
|
-
}
|
|
800
|
-
function statusLine(phase, mediaStatus) {
|
|
801
|
-
switch (phase) {
|
|
802
|
-
case "ringing-in":
|
|
803
|
-
return "Incoming call\u2026";
|
|
804
|
-
case "ringing-out":
|
|
805
|
-
return "Ringing\u2026";
|
|
806
|
-
case "declined":
|
|
807
|
-
return "Call declined";
|
|
808
|
-
case "busy":
|
|
809
|
-
return "Already on another call";
|
|
810
|
-
case "timed-out":
|
|
811
|
-
return "No answer";
|
|
812
|
-
case "active":
|
|
813
|
-
return mediaStatus === "connected" ? "Connected" : "Connecting\u2026";
|
|
814
|
-
default:
|
|
815
|
-
return "";
|
|
816
|
-
}
|
|
817
|
-
}
|
|
818
551
|
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";
|
|
819
552
|
var FONT_HREF_PRECONNECT_GOOGLE = "https://fonts.googleapis.com";
|
|
820
553
|
var FONT_HREF_PRECONNECT_STATIC = "https://fonts.gstatic.com";
|
|
@@ -851,8 +584,8 @@ function PoolseFonts() {
|
|
|
851
584
|
return null;
|
|
852
585
|
}
|
|
853
586
|
function LiveCallBanner({ call, inCall, onJoin }) {
|
|
854
|
-
const what = call.media === "video" ? "Video call in progress" : "Voice call in progress";
|
|
855
|
-
const who = inCall > 0 ? `${inCall} on the call` : "Ringing";
|
|
587
|
+
const what = call.kind === "room" ? call.media === "video" ? "Video room" : "Voice room" : call.media === "video" ? "Video call in progress" : "Voice call in progress";
|
|
588
|
+
const who = inCall > 0 ? `${inCall} ${call.kind === "room" ? "in the room" : "on the call"}` : call.kind === "room" ? "Starting" : "Ringing";
|
|
856
589
|
return /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "poolse-live-call", role: "status", "aria-label": `${what}, ${who}`, children: [
|
|
857
590
|
/* @__PURE__ */ jsxRuntime.jsx(
|
|
858
591
|
PoolseIcon,
|
|
@@ -3643,6 +3376,206 @@ var PoolseInbox = react.forwardRef(function PoolseInbox2({
|
|
|
3643
3376
|
) : null
|
|
3644
3377
|
] });
|
|
3645
3378
|
});
|
|
3379
|
+
function RoomJoinBar({ room, allowStart = true }) {
|
|
3380
|
+
if (room.joined) return null;
|
|
3381
|
+
const live = room.live;
|
|
3382
|
+
if (live) {
|
|
3383
|
+
const isRoom = live.kind === "room";
|
|
3384
|
+
const what = isRoom ? live.media === "video" ? "Video room" : "Voice room" : live.media === "video" ? "Video call in progress" : "Call in progress";
|
|
3385
|
+
const n = room.presentIds.length;
|
|
3386
|
+
return /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "poolse-roombar poolse-roombar--live", role: "status", children: [
|
|
3387
|
+
/* @__PURE__ */ jsxRuntime.jsx("span", { className: "poolse-roombar__dot", "aria-hidden": "true" }),
|
|
3388
|
+
/* @__PURE__ */ jsxRuntime.jsxs("span", { className: "poolse-roombar__text", children: [
|
|
3389
|
+
/* @__PURE__ */ jsxRuntime.jsx("strong", { children: what }),
|
|
3390
|
+
/* @__PURE__ */ jsxRuntime.jsx("span", { children: n > 0 ? ` \xB7 ${n} in the room` : " \xB7 starting" })
|
|
3391
|
+
] }),
|
|
3392
|
+
/* @__PURE__ */ jsxRuntime.jsxs("span", { className: "poolse-roombar__actions", children: [
|
|
3393
|
+
/* @__PURE__ */ jsxRuntime.jsxs(
|
|
3394
|
+
"button",
|
|
3395
|
+
{
|
|
3396
|
+
type: "button",
|
|
3397
|
+
className: "poolse-roombar__btn",
|
|
3398
|
+
onClick: () => void room.join("audio"),
|
|
3399
|
+
disabled: room.joining,
|
|
3400
|
+
children: [
|
|
3401
|
+
/* @__PURE__ */ jsxRuntime.jsx(PoolseIcon, { name: "mic", size: 15, label: null }),
|
|
3402
|
+
" Join"
|
|
3403
|
+
]
|
|
3404
|
+
}
|
|
3405
|
+
),
|
|
3406
|
+
/* @__PURE__ */ jsxRuntime.jsxs(
|
|
3407
|
+
"button",
|
|
3408
|
+
{
|
|
3409
|
+
type: "button",
|
|
3410
|
+
className: "poolse-roombar__btn poolse-roombar__btn--primary",
|
|
3411
|
+
onClick: () => void room.join("video"),
|
|
3412
|
+
disabled: room.joining,
|
|
3413
|
+
children: [
|
|
3414
|
+
/* @__PURE__ */ jsxRuntime.jsx(PoolseIcon, { name: "video", size: 15, label: null }),
|
|
3415
|
+
" Join with video"
|
|
3416
|
+
]
|
|
3417
|
+
}
|
|
3418
|
+
)
|
|
3419
|
+
] })
|
|
3420
|
+
] });
|
|
3421
|
+
}
|
|
3422
|
+
if (!allowStart) return null;
|
|
3423
|
+
return /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "poolse-roombar", children: [
|
|
3424
|
+
/* @__PURE__ */ jsxRuntime.jsx("span", { className: "poolse-roombar__text", children: "Start a room \u2014 nobody is rung, anyone here can drop in" }),
|
|
3425
|
+
/* @__PURE__ */ jsxRuntime.jsxs("span", { className: "poolse-roombar__actions", children: [
|
|
3426
|
+
/* @__PURE__ */ jsxRuntime.jsxs(
|
|
3427
|
+
"button",
|
|
3428
|
+
{
|
|
3429
|
+
type: "button",
|
|
3430
|
+
className: "poolse-roombar__btn",
|
|
3431
|
+
onClick: () => void room.join("audio"),
|
|
3432
|
+
disabled: room.joining,
|
|
3433
|
+
children: [
|
|
3434
|
+
/* @__PURE__ */ jsxRuntime.jsx(PoolseIcon, { name: "mic", size: 15, label: null }),
|
|
3435
|
+
" Voice"
|
|
3436
|
+
]
|
|
3437
|
+
}
|
|
3438
|
+
),
|
|
3439
|
+
/* @__PURE__ */ jsxRuntime.jsxs(
|
|
3440
|
+
"button",
|
|
3441
|
+
{
|
|
3442
|
+
type: "button",
|
|
3443
|
+
className: "poolse-roombar__btn poolse-roombar__btn--primary",
|
|
3444
|
+
onClick: () => void room.join("video"),
|
|
3445
|
+
disabled: room.joining,
|
|
3446
|
+
children: [
|
|
3447
|
+
/* @__PURE__ */ jsxRuntime.jsx(PoolseIcon, { name: "video", size: 15, label: null }),
|
|
3448
|
+
" Video"
|
|
3449
|
+
]
|
|
3450
|
+
}
|
|
3451
|
+
)
|
|
3452
|
+
] })
|
|
3453
|
+
] });
|
|
3454
|
+
}
|
|
3455
|
+
function RoomStage({ room, title, labelFor, className }) {
|
|
3456
|
+
const media = room.media;
|
|
3457
|
+
const [menu, setMenu] = react.useState(null);
|
|
3458
|
+
const elapsed = useElapsed(room.live?.started_at ?? null, media.status === "connected");
|
|
3459
|
+
const openMenu = react.useCallback(
|
|
3460
|
+
(kind) => {
|
|
3461
|
+
media.refreshDevices();
|
|
3462
|
+
setMenu((current) => current === kind ? null : kind);
|
|
3463
|
+
},
|
|
3464
|
+
[media]
|
|
3465
|
+
);
|
|
3466
|
+
const count = media.participants.length;
|
|
3467
|
+
const status = media.status === "connecting" || room.joining ? "Connecting\u2026" : `${count} in the room${elapsed ? ` \xB7 ${elapsed}` : ""}`;
|
|
3468
|
+
return /* @__PURE__ */ jsxRuntime.jsxs("section", { className: ["poolse-room", className].filter(Boolean).join(" "), "aria-label": "Room", children: [
|
|
3469
|
+
/* @__PURE__ */ jsxRuntime.jsxs("header", { className: "poolse-room__head", children: [
|
|
3470
|
+
/* @__PURE__ */ jsxRuntime.jsx("span", { className: "poolse-room__title", children: title ?? "Room" }),
|
|
3471
|
+
/* @__PURE__ */ jsxRuntime.jsx("span", { className: "poolse-room__status", children: status })
|
|
3472
|
+
] }),
|
|
3473
|
+
/* @__PURE__ */ jsxRuntime.jsx("div", { className: "poolse-room__stage", children: count > 0 ? /* @__PURE__ */ jsxRuntime.jsx(
|
|
3474
|
+
CallVideoGrid,
|
|
3475
|
+
{
|
|
3476
|
+
participants: media.participants,
|
|
3477
|
+
...labelFor ? { labelFor } : {},
|
|
3478
|
+
onLocalClick: media.cameraEnabled ? () => void media.switchCamera() : void 0
|
|
3479
|
+
}
|
|
3480
|
+
) : /* @__PURE__ */ jsxRuntime.jsx("div", { className: "poolse-room__waiting", children: "Connecting\u2026" }) }),
|
|
3481
|
+
room.error && /* @__PURE__ */ jsxRuntime.jsx("p", { className: "poolse-room__error", children: room.error.message }),
|
|
3482
|
+
/* @__PURE__ */ jsxRuntime.jsxs("div", { className: "poolse-room__bar", children: [
|
|
3483
|
+
/* @__PURE__ */ jsxRuntime.jsxs("span", { className: "callsheet__control", children: [
|
|
3484
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
3485
|
+
CallControlButton,
|
|
3486
|
+
{
|
|
3487
|
+
icon: media.micEnabled ? "mic" : "mic-off",
|
|
3488
|
+
active: !media.micEnabled,
|
|
3489
|
+
label: media.micEnabled ? "Mute" : "Unmute",
|
|
3490
|
+
onClick: () => void media.toggleMic(),
|
|
3491
|
+
hasMenu: media.devices.audioinput.length > 0,
|
|
3492
|
+
onMenuClick: () => openMenu("audioinput")
|
|
3493
|
+
}
|
|
3494
|
+
),
|
|
3495
|
+
menu === "audioinput" && /* @__PURE__ */ jsxRuntime.jsx(
|
|
3496
|
+
CallDeviceMenu,
|
|
3497
|
+
{
|
|
3498
|
+
title: "Microphone",
|
|
3499
|
+
devices: media.devices.audioinput,
|
|
3500
|
+
activeId: media.activeDevices.audioinput,
|
|
3501
|
+
onSelect: (kind, id) => void media.selectDevice(kind, id),
|
|
3502
|
+
onClose: () => setMenu(null)
|
|
3503
|
+
}
|
|
3504
|
+
)
|
|
3505
|
+
] }),
|
|
3506
|
+
/* @__PURE__ */ jsxRuntime.jsxs("span", { className: "callsheet__control", children: [
|
|
3507
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
3508
|
+
CallControlButton,
|
|
3509
|
+
{
|
|
3510
|
+
icon: media.cameraEnabled ? "video" : "video-off",
|
|
3511
|
+
active: !media.cameraEnabled,
|
|
3512
|
+
label: media.cameraEnabled ? "Camera" : "Camera off",
|
|
3513
|
+
onClick: () => void media.toggleCamera(),
|
|
3514
|
+
disabled: media.devices.videoinput.length === 0 && !media.cameraEnabled,
|
|
3515
|
+
hasMenu: media.devices.videoinput.length > 0,
|
|
3516
|
+
onMenuClick: () => openMenu("videoinput")
|
|
3517
|
+
}
|
|
3518
|
+
),
|
|
3519
|
+
menu === "videoinput" && /* @__PURE__ */ jsxRuntime.jsx(
|
|
3520
|
+
CallDeviceMenu,
|
|
3521
|
+
{
|
|
3522
|
+
title: "Camera",
|
|
3523
|
+
devices: media.devices.videoinput,
|
|
3524
|
+
activeId: media.activeDevices.videoinput,
|
|
3525
|
+
onSelect: (kind, id) => void media.selectDevice(kind, id),
|
|
3526
|
+
onClose: () => setMenu(null)
|
|
3527
|
+
}
|
|
3528
|
+
)
|
|
3529
|
+
] }),
|
|
3530
|
+
media.devices.audiooutput.length > 0 && /* @__PURE__ */ jsxRuntime.jsxs("span", { className: "callsheet__control", children: [
|
|
3531
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
3532
|
+
CallControlButton,
|
|
3533
|
+
{
|
|
3534
|
+
icon: "speaker",
|
|
3535
|
+
label: "Speaker",
|
|
3536
|
+
onClick: () => openMenu("audiooutput")
|
|
3537
|
+
}
|
|
3538
|
+
),
|
|
3539
|
+
menu === "audiooutput" && /* @__PURE__ */ jsxRuntime.jsx(
|
|
3540
|
+
CallDeviceMenu,
|
|
3541
|
+
{
|
|
3542
|
+
title: "Speaker",
|
|
3543
|
+
devices: media.devices.audiooutput,
|
|
3544
|
+
activeId: media.activeDevices.audiooutput,
|
|
3545
|
+
onSelect: (kind, id) => void media.selectDevice(kind, id),
|
|
3546
|
+
onClose: () => setMenu(null)
|
|
3547
|
+
}
|
|
3548
|
+
)
|
|
3549
|
+
] }),
|
|
3550
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
3551
|
+
CallControlButton,
|
|
3552
|
+
{
|
|
3553
|
+
icon: "phone-off",
|
|
3554
|
+
tone: "danger",
|
|
3555
|
+
large: true,
|
|
3556
|
+
label: "Leave",
|
|
3557
|
+
onClick: room.leave
|
|
3558
|
+
}
|
|
3559
|
+
)
|
|
3560
|
+
] })
|
|
3561
|
+
] });
|
|
3562
|
+
}
|
|
3563
|
+
function useElapsed(startedAt, running) {
|
|
3564
|
+
const [, tick] = react.useState(0);
|
|
3565
|
+
react.useEffect(() => {
|
|
3566
|
+
if (!running) return;
|
|
3567
|
+
const id = setInterval(() => tick((n) => n + 1), 1e3);
|
|
3568
|
+
return () => clearInterval(id);
|
|
3569
|
+
}, [running]);
|
|
3570
|
+
if (!running || !startedAt) return null;
|
|
3571
|
+
const start = Date.parse(startedAt);
|
|
3572
|
+
if (!Number.isFinite(start)) return null;
|
|
3573
|
+
const total = Math.max(0, Math.floor((Date.now() - start) / 1e3));
|
|
3574
|
+
const h = Math.floor(total / 3600);
|
|
3575
|
+
const m = Math.floor(total % 3600 / 60);
|
|
3576
|
+
const s = String(total % 60).padStart(2, "0");
|
|
3577
|
+
return h > 0 ? `${h}:${String(m).padStart(2, "0")}:${s}` : `${m}:${s}`;
|
|
3578
|
+
}
|
|
3646
3579
|
var MARK_PATHS = /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
|
|
3647
3580
|
/* @__PURE__ */ jsxRuntime.jsx(
|
|
3648
3581
|
"path",
|
|
@@ -3756,7 +3689,6 @@ exports.Avatar = Avatar;
|
|
|
3756
3689
|
exports.CallControlButton = CallControlButton;
|
|
3757
3690
|
exports.CallDeviceMenu = CallDeviceMenu;
|
|
3758
3691
|
exports.CallLogRow = CallLogRow;
|
|
3759
|
-
exports.CallProvider = CallProvider;
|
|
3760
3692
|
exports.CallVideoGrid = CallVideoGrid;
|
|
3761
3693
|
exports.ChatHeader = ChatHeader;
|
|
3762
3694
|
exports.ConversationList = ConversationList;
|
|
@@ -3775,12 +3707,13 @@ exports.PoolseInbox = PoolseInbox;
|
|
|
3775
3707
|
exports.PoolseLogo = PoolseLogo;
|
|
3776
3708
|
exports.ReactionPicker = ReactionPicker;
|
|
3777
3709
|
exports.ReactionStrip = ReactionStrip;
|
|
3710
|
+
exports.RoomJoinBar = RoomJoinBar;
|
|
3711
|
+
exports.RoomStage = RoomStage;
|
|
3778
3712
|
exports.ThreadView = ThreadView;
|
|
3779
3713
|
exports.TypingIndicator = TypingIndicator;
|
|
3780
3714
|
exports.UploadQueueStrip = UploadQueueStrip;
|
|
3781
3715
|
exports.UserName = UserName;
|
|
3782
3716
|
exports.UserPickerSheet = UserPickerSheet;
|
|
3783
|
-
exports.useCallInvite = useCallInvite;
|
|
3784
3717
|
exports.useDisplayName = useDisplayName;
|
|
3785
3718
|
exports.usePoolseFonts = usePoolseFonts;
|
|
3786
3719
|
//# sourceMappingURL=index.cjs.map
|