npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2026 – Pkg Stats / Ryan Hefner

@sentdm/voice-client-react

v0.2.1

Published

React bindings for Sent Voice Client: a provider and hooks that re-render on call events

Readme

@sentdm/voice-client-react

React bindings for @sentdm/voice-client, the Sent Voice Client for the web.

Installation

npm install @sentdm/voice-client @sentdm/voice-client-react

Usage

@sentdm/voice-client-react wraps one client in a provider, with hooks that re-render on its events. It supports React 18 and 19.

import { SentVoiceProvider, useActiveCall, useIncomingCall, useSentVoice } from '@sentdm/voice-client-react';

const getVoiceToken = () => fetch('/api/voice-token').then((response) => response.text());

export function App() {
  return (
    <SentVoiceProvider tokenProvider={getVoiceToken} autoRegister={false}>
      <Phone />
    </SentVoiceProvider>
  );
}

function Phone() {
  const { client, state, register } = useSentVoice();
  const invite = useIncomingCall();
  const { call, state: callState, isMuted, mute, hangup, duration } = useActiveCall();

  if (state !== 'registered') return <button onClick={register}>Go online</button>;
  if (invite) {
    return (
      <p>
        <button onClick={() => invite.accept()}>Answer</button>
        <button onClick={() => invite.reject()}>Decline</button>
      </p>
    );
  }
  if (call) {
    return (
      <p>
        {callState} for {duration} s <button onClick={() => mute()}>{isMuted ? 'Unmute' : 'Mute'}</button>
        <button onClick={hangup}>Hang up</button>
      </p>
    );
  }
  return <button onClick={() => client?.connect({ to: 'ben' })}>Call Ben</button>;
}
  • SentVoiceProvider takes every client option, plus autoRegister (default true), which registers as soon as the client exists. Registering needs the notification permission, which Firefox and Safari only ask for after a user gesture, so the example registers from a click.
  • The client is created after the provider mounts, so its children render first, on the server too, with client null and state 'unregistered'. Unmounting destroys the client and ends its calls.
  • Props are read once, when the client is created: remount the provider with a new key to change them, for example for another user. tokenProvider is the exception, the latest one is always used.
  • useSentVoice() gives the client, its state, register and unregister. useIncomingCall() gives the newest invite still waiting for an answer, or null. useActiveCall() gives the active call with its state, isMuted, mute, hangup, sendDigits and duration, the seconds since it connected. useAudioDevices() gives the microphones and speakers with setInput and setOutput.
  • The entry point is marked 'use client' for the Next.js App Router.