@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/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
|
@@ -548,275 +548,6 @@ function kindLabel(kind) {
|
|
|
548
548
|
if (kind === "audioinput") return "Microphone";
|
|
549
549
|
return "Output";
|
|
550
550
|
}
|
|
551
|
-
var InviteContext = react.createContext(null);
|
|
552
|
-
function useCallInvite() {
|
|
553
|
-
return react.useContext(InviteContext) ?? {
|
|
554
|
-
placeCall: () => {
|
|
555
|
-
},
|
|
556
|
-
busy: true
|
|
557
|
-
};
|
|
558
|
-
}
|
|
559
|
-
var CHROME_IDLE_MS = 4500;
|
|
560
|
-
function CallProvider({ userId, livekit, labelFor, children }) {
|
|
561
|
-
const calls = react$1.useCalls(userId);
|
|
562
|
-
const label = labelFor ?? ((id) => `User ${id.slice(0, 6)}`);
|
|
563
|
-
const placeCall = react.useCallback(
|
|
564
|
-
(conversationId, media = "audio") => {
|
|
565
|
-
void calls.call(conversationId, media);
|
|
566
|
-
},
|
|
567
|
-
[calls]
|
|
568
|
-
);
|
|
569
|
-
const invite = { placeCall, busy: calls.phase !== "idle" };
|
|
570
|
-
return /* @__PURE__ */ jsxRuntime.jsxs(InviteContext.Provider, { value: invite, children: [
|
|
571
|
-
children,
|
|
572
|
-
/* @__PURE__ */ jsxRuntime.jsx(CallSurface, { calls, livekit, labelFor: label })
|
|
573
|
-
] });
|
|
574
|
-
}
|
|
575
|
-
function CallSurface({
|
|
576
|
-
calls,
|
|
577
|
-
livekit,
|
|
578
|
-
labelFor
|
|
579
|
-
}) {
|
|
580
|
-
const conversationInCall = calls.phase === "active" ? calls.activeConversationId : null;
|
|
581
|
-
const isVideoCall = calls.media === "video";
|
|
582
|
-
const sfu = react$1.useCallRoom(conversationInCall, { livekit, video: isVideoCall });
|
|
583
|
-
const voice = react$1.useVoiceRoom(conversationInCall);
|
|
584
|
-
const usingSfu = sfu.sfuAvailable === true;
|
|
585
|
-
const mediaStatus = usingSfu ? sfu.status : voice.status;
|
|
586
|
-
const connected = calls.phase === "active" && mediaStatus === "connected";
|
|
587
|
-
react.useEffect(() => {
|
|
588
|
-
if (calls.phase !== "active" || !conversationInCall) return;
|
|
589
|
-
let cancelled = false;
|
|
590
|
-
void (async () => {
|
|
591
|
-
const joined = await sfu.join();
|
|
592
|
-
if (cancelled || joined) return;
|
|
593
|
-
await voice.join();
|
|
594
|
-
})();
|
|
595
|
-
return () => {
|
|
596
|
-
cancelled = true;
|
|
597
|
-
};
|
|
598
|
-
}, [calls.phase, conversationInCall]);
|
|
599
|
-
const hangUp = react.useCallback(() => {
|
|
600
|
-
sfu.leave();
|
|
601
|
-
voice.leave();
|
|
602
|
-
void calls.hangUp();
|
|
603
|
-
}, [sfu, voice, calls]);
|
|
604
|
-
const alone = usingSfu ? sfu.alone : voice.alone;
|
|
605
|
-
const endedOnEmpty = react.useRef(false);
|
|
606
|
-
if (calls.phase !== "active") endedOnEmpty.current = false;
|
|
607
|
-
react.useEffect(() => {
|
|
608
|
-
if (!alone || calls.phase !== "active" || endedOnEmpty.current) return;
|
|
609
|
-
endedOnEmpty.current = true;
|
|
610
|
-
hangUp();
|
|
611
|
-
}, [alone, calls.phase, hangUp]);
|
|
612
|
-
const [chromeVisible, setChromeVisible] = react.useState(true);
|
|
613
|
-
const [lastWake, setLastWake] = react.useState(0);
|
|
614
|
-
const [menu, setMenu] = react.useState(null);
|
|
615
|
-
const chromeHides = connected && isVideoCall && menu === null;
|
|
616
|
-
react.useEffect(() => {
|
|
617
|
-
setChromeVisible(true);
|
|
618
|
-
if (!chromeHides) return;
|
|
619
|
-
const timer = setTimeout(() => setChromeVisible(false), CHROME_IDLE_MS);
|
|
620
|
-
return () => clearTimeout(timer);
|
|
621
|
-
}, [chromeHides, lastWake]);
|
|
622
|
-
const wake = react.useCallback(() => setLastWake(Date.now()), []);
|
|
623
|
-
const withWake = react.useCallback(
|
|
624
|
-
(fn) => () => {
|
|
625
|
-
wake();
|
|
626
|
-
fn();
|
|
627
|
-
},
|
|
628
|
-
[wake]
|
|
629
|
-
);
|
|
630
|
-
const micOn = usingSfu ? sfu.micEnabled : !voice.muted;
|
|
631
|
-
const toggleMic = react.useCallback(() => {
|
|
632
|
-
if (usingSfu) void sfu.toggleMic();
|
|
633
|
-
else voice.toggleMute();
|
|
634
|
-
}, [usingSfu, sfu, voice]);
|
|
635
|
-
const openMenu = react.useCallback(
|
|
636
|
-
(kind) => {
|
|
637
|
-
sfu.refreshDevices();
|
|
638
|
-
setMenu((current) => current === kind ? null : kind);
|
|
639
|
-
},
|
|
640
|
-
[sfu]
|
|
641
|
-
);
|
|
642
|
-
const duration = useCallDuration(connected);
|
|
643
|
-
if (calls.phase === "idle") return null;
|
|
644
|
-
const ringingIn = calls.phase === "ringing-in";
|
|
645
|
-
const ringingOut = calls.phase === "ringing-out";
|
|
646
|
-
const ended = calls.phase === "declined" || calls.phase === "busy" || calls.phase === "timed-out";
|
|
647
|
-
const others = usingSfu ? sfu.participants.filter((p) => !p.isSelf) : [];
|
|
648
|
-
const peerIds = ringingIn && calls.incoming ? [calls.incoming.callerUserId] : others.length > 0 ? others.map((p) => p.userId) : calls.outgoing?.calleeUserIds ?? [];
|
|
649
|
-
const who = peerIds.length === 0 ? "Call" : peerIds.length <= 2 ? peerIds.map(labelFor).join(", ") : `${labelFor(peerIds[0])} and ${peerIds.length - 1} others`;
|
|
650
|
-
const showStage = connected && usingSfu && sfu.participants.length > 0;
|
|
651
|
-
const error = calls.error ?? (usingSfu ? sfu.error : voice.error);
|
|
652
|
-
const isGroup = others.length > 1;
|
|
653
|
-
return /* @__PURE__ */ jsxRuntime.jsxs(
|
|
654
|
-
"div",
|
|
655
|
-
{
|
|
656
|
-
className: "callsheet",
|
|
657
|
-
role: "dialog",
|
|
658
|
-
"aria-modal": "true",
|
|
659
|
-
"aria-label": "Call",
|
|
660
|
-
onPointerMove: wake,
|
|
661
|
-
children: [
|
|
662
|
-
/* @__PURE__ */ jsxRuntime.jsx("div", { className: "callsheet__stage", children: showStage ? /* @__PURE__ */ jsxRuntime.jsx(
|
|
663
|
-
CallVideoGrid,
|
|
664
|
-
{
|
|
665
|
-
participants: sfu.participants,
|
|
666
|
-
labelFor,
|
|
667
|
-
onLocalClick: sfu.cameraEnabled ? () => void sfu.switchCamera() : void 0
|
|
668
|
-
}
|
|
669
|
-
) : /* @__PURE__ */ jsxRuntime.jsx("div", { className: "callsheet__identity", children: /* @__PURE__ */ jsxRuntime.jsx("span", { className: "callsheet__avatar", "aria-hidden": "true", children: who.slice(0, 1).toUpperCase() }) }) }),
|
|
670
|
-
/* @__PURE__ */ jsxRuntime.jsxs("header", { className: `callsheet__header${chromeVisible ? "" : " callsheet__header--hidden"}`, children: [
|
|
671
|
-
/* @__PURE__ */ jsxRuntime.jsx("p", { className: "callsheet__who", children: who }),
|
|
672
|
-
/* @__PURE__ */ jsxRuntime.jsxs("p", { className: "callsheet__state", children: [
|
|
673
|
-
isGroup && showStage ? `${sfu.participants.length} \xB7 ` : "",
|
|
674
|
-
duration ?? statusLine(calls.phase, mediaStatus)
|
|
675
|
-
] })
|
|
676
|
-
] }),
|
|
677
|
-
/* @__PURE__ */ jsxRuntime.jsxs("div", { className: `callsheet__actions${chromeVisible ? "" : " callsheet__actions--hidden"}`, children: [
|
|
678
|
-
error && /* @__PURE__ */ jsxRuntime.jsx("p", { className: "callsheet__error", children: error.message }),
|
|
679
|
-
ringingIn ? /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "callsheet__row", children: [
|
|
680
|
-
/* @__PURE__ */ jsxRuntime.jsx(
|
|
681
|
-
CallControlButton,
|
|
682
|
-
{
|
|
683
|
-
icon: "phone-off",
|
|
684
|
-
tone: "danger",
|
|
685
|
-
large: true,
|
|
686
|
-
label: "Decline",
|
|
687
|
-
onClick: () => void calls.decline()
|
|
688
|
-
}
|
|
689
|
-
),
|
|
690
|
-
/* @__PURE__ */ jsxRuntime.jsx(
|
|
691
|
-
CallControlButton,
|
|
692
|
-
{
|
|
693
|
-
icon: isVideoCall ? "video" : "phone",
|
|
694
|
-
tone: "accept",
|
|
695
|
-
large: true,
|
|
696
|
-
label: "Accept",
|
|
697
|
-
onClick: () => void calls.accept()
|
|
698
|
-
}
|
|
699
|
-
)
|
|
700
|
-
] }) : 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: [
|
|
701
|
-
/* @__PURE__ */ jsxRuntime.jsxs("span", { className: "callsheet__control", children: [
|
|
702
|
-
/* @__PURE__ */ jsxRuntime.jsx(
|
|
703
|
-
CallControlButton,
|
|
704
|
-
{
|
|
705
|
-
icon: micOn ? "mic" : "mic-off",
|
|
706
|
-
active: !micOn,
|
|
707
|
-
label: micOn ? "Mute" : "Unmute",
|
|
708
|
-
onClick: withWake(toggleMic),
|
|
709
|
-
hasMenu: usingSfu && sfu.devices.audioinput.length > 0,
|
|
710
|
-
onMenuClick: withWake(() => openMenu("audioinput"))
|
|
711
|
-
}
|
|
712
|
-
),
|
|
713
|
-
menu === "audioinput" && /* @__PURE__ */ jsxRuntime.jsx(
|
|
714
|
-
CallDeviceMenu,
|
|
715
|
-
{
|
|
716
|
-
title: "Microphone",
|
|
717
|
-
devices: sfu.devices.audioinput,
|
|
718
|
-
activeId: sfu.activeDevices.audioinput,
|
|
719
|
-
onSelect: (kind, id) => void sfu.selectDevice(kind, id),
|
|
720
|
-
onClose: () => setMenu(null)
|
|
721
|
-
}
|
|
722
|
-
)
|
|
723
|
-
] }),
|
|
724
|
-
usingSfu && /* @__PURE__ */ jsxRuntime.jsxs("span", { className: "callsheet__control", children: [
|
|
725
|
-
/* @__PURE__ */ jsxRuntime.jsx(
|
|
726
|
-
CallControlButton,
|
|
727
|
-
{
|
|
728
|
-
icon: sfu.cameraEnabled ? "video" : "video-off",
|
|
729
|
-
active: !sfu.cameraEnabled,
|
|
730
|
-
label: "Camera",
|
|
731
|
-
onClick: withWake(() => void sfu.toggleCamera()),
|
|
732
|
-
disabled: sfu.devices.videoinput.length === 0,
|
|
733
|
-
hasMenu: sfu.devices.videoinput.length > 0,
|
|
734
|
-
onMenuClick: withWake(() => openMenu("videoinput"))
|
|
735
|
-
}
|
|
736
|
-
),
|
|
737
|
-
menu === "videoinput" && /* @__PURE__ */ jsxRuntime.jsx(
|
|
738
|
-
CallDeviceMenu,
|
|
739
|
-
{
|
|
740
|
-
title: "Camera",
|
|
741
|
-
devices: sfu.devices.videoinput,
|
|
742
|
-
activeId: sfu.activeDevices.videoinput,
|
|
743
|
-
onSelect: (kind, id) => void sfu.selectDevice(kind, id),
|
|
744
|
-
onClose: () => setMenu(null)
|
|
745
|
-
}
|
|
746
|
-
)
|
|
747
|
-
] }),
|
|
748
|
-
usingSfu && sfu.devices.audiooutput.length > 0 && /* @__PURE__ */ jsxRuntime.jsxs("span", { className: "callsheet__control", children: [
|
|
749
|
-
/* @__PURE__ */ jsxRuntime.jsx(
|
|
750
|
-
CallControlButton,
|
|
751
|
-
{
|
|
752
|
-
icon: "speaker",
|
|
753
|
-
label: "Output",
|
|
754
|
-
onClick: withWake(() => openMenu("audiooutput"))
|
|
755
|
-
}
|
|
756
|
-
),
|
|
757
|
-
menu === "audiooutput" && /* @__PURE__ */ jsxRuntime.jsx(
|
|
758
|
-
CallDeviceMenu,
|
|
759
|
-
{
|
|
760
|
-
title: "Speaker",
|
|
761
|
-
devices: sfu.devices.audiooutput,
|
|
762
|
-
activeId: sfu.activeDevices.audiooutput,
|
|
763
|
-
onSelect: (kind, id) => void sfu.selectDevice(kind, id),
|
|
764
|
-
onClose: () => setMenu(null)
|
|
765
|
-
}
|
|
766
|
-
)
|
|
767
|
-
] }),
|
|
768
|
-
/* @__PURE__ */ jsxRuntime.jsx(
|
|
769
|
-
CallControlButton,
|
|
770
|
-
{
|
|
771
|
-
icon: "phone-off",
|
|
772
|
-
tone: "danger",
|
|
773
|
-
large: true,
|
|
774
|
-
label: ringingOut ? "Cancel" : "Hang up",
|
|
775
|
-
onClick: ringingOut ? () => void calls.cancel() : hangUp
|
|
776
|
-
}
|
|
777
|
-
)
|
|
778
|
-
] })
|
|
779
|
-
] })
|
|
780
|
-
]
|
|
781
|
-
}
|
|
782
|
-
);
|
|
783
|
-
}
|
|
784
|
-
function useCallDuration(connected) {
|
|
785
|
-
const [startedAt, setStartedAt] = react.useState(null);
|
|
786
|
-
const [, tick] = react.useState(0);
|
|
787
|
-
react.useEffect(() => {
|
|
788
|
-
if (!connected) {
|
|
789
|
-
setStartedAt(null);
|
|
790
|
-
return;
|
|
791
|
-
}
|
|
792
|
-
setStartedAt(Date.now());
|
|
793
|
-
const id = setInterval(() => tick((n) => n + 1), 1e3);
|
|
794
|
-
return () => clearInterval(id);
|
|
795
|
-
}, [connected]);
|
|
796
|
-
if (!connected || startedAt === null) return null;
|
|
797
|
-
const total = Math.max(0, Math.floor((Date.now() - startedAt) / 1e3));
|
|
798
|
-
const minutes = Math.floor(total / 60);
|
|
799
|
-
const seconds = total % 60;
|
|
800
|
-
return `${minutes}:${String(seconds).padStart(2, "0")}`;
|
|
801
|
-
}
|
|
802
|
-
function statusLine(phase, mediaStatus) {
|
|
803
|
-
switch (phase) {
|
|
804
|
-
case "ringing-in":
|
|
805
|
-
return "Incoming call\u2026";
|
|
806
|
-
case "ringing-out":
|
|
807
|
-
return "Ringing\u2026";
|
|
808
|
-
case "declined":
|
|
809
|
-
return "Call declined";
|
|
810
|
-
case "busy":
|
|
811
|
-
return "Already on another call";
|
|
812
|
-
case "timed-out":
|
|
813
|
-
return "No answer";
|
|
814
|
-
case "active":
|
|
815
|
-
return mediaStatus === "connected" ? "Connected" : "Connecting\u2026";
|
|
816
|
-
default:
|
|
817
|
-
return "";
|
|
818
|
-
}
|
|
819
|
-
}
|
|
820
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";
|
|
821
552
|
var FONT_HREF_PRECONNECT_GOOGLE = "https://fonts.googleapis.com";
|
|
822
553
|
var FONT_HREF_PRECONNECT_STATIC = "https://fonts.gstatic.com";
|
|
@@ -3958,7 +3689,6 @@ exports.Avatar = Avatar;
|
|
|
3958
3689
|
exports.CallControlButton = CallControlButton;
|
|
3959
3690
|
exports.CallDeviceMenu = CallDeviceMenu;
|
|
3960
3691
|
exports.CallLogRow = CallLogRow;
|
|
3961
|
-
exports.CallProvider = CallProvider;
|
|
3962
3692
|
exports.CallVideoGrid = CallVideoGrid;
|
|
3963
3693
|
exports.ChatHeader = ChatHeader;
|
|
3964
3694
|
exports.ConversationList = ConversationList;
|
|
@@ -3984,7 +3714,6 @@ exports.TypingIndicator = TypingIndicator;
|
|
|
3984
3714
|
exports.UploadQueueStrip = UploadQueueStrip;
|
|
3985
3715
|
exports.UserName = UserName;
|
|
3986
3716
|
exports.UserPickerSheet = UserPickerSheet;
|
|
3987
|
-
exports.useCallInvite = useCallInvite;
|
|
3988
3717
|
exports.useDisplayName = useDisplayName;
|
|
3989
3718
|
exports.usePoolseFonts = usePoolseFonts;
|
|
3990
3719
|
//# sourceMappingURL=index.cjs.map
|