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

@nexbasira/react

v0.1.1

Published

React component + hook wrapping the NexBasira embed widget.

Readme

@nexbasira/react

React component + hook wrapping the @nexbasira/embed browser widget.

Thin by design — the iframe and postMessage plumbing live in @nexbasira/embed; this package just makes the widget feel native to a React app (mount, unmount, ref-based imperative access, fresh-closure callbacks).

Install

npm install @nexbasira/react @nexbasira/embed react

react and @nexbasira/embed are peer dependencies — they aren't bundled.

Quick start (component)

import { NexBasiraSession } from "@nexbasira/react";

function InspectionPage({ joinUrl }: { joinUrl: string }) {
  return (
    <NexBasiraSession
      sessionUrl={joinUrl}
      height="720px"
      onSessionComplete={(id) => {
        console.log("inspection done:", id);
      }}
    />
  );
}

sessionUrl is the field-join URL your backend mints via POST /v1/public/sessions/{id}/invites (or the SPA equivalent). Never embed an API secret in the URL.

Imperative control (ref)

import { useRef } from "react";
import { NexBasiraSession, type NexBasiraSessionHandle } from "@nexbasira/react";

function ToolbarHost({ joinUrl }: { joinUrl: string }) {
  const session = useRef<NexBasiraSessionHandle>(null);
  return (
    <>
      <button onClick={() => session.current?.requestSnapshot()}>
        Capture
      </button>
      <NexBasiraSession ref={session} sessionUrl={joinUrl} />
    </>
  );
}

Methods on the handle:

  • requestSnapshot()
  • openWhiteboard() / closeWhiteboard()
  • switchCamera()
  • mute() / unmute()
  • endSession()

Hook variant

Use this when <NexBasiraSession>'s wrapper <div> doesn't fit your layout, or when you want to share the widget handle across multiple components without prop-drilling refs.

import { useNexBasiraSession } from "@nexbasira/react";

function CustomLayout({ joinUrl }: { joinUrl: string }) {
  const [containerRef, widget] = useNexBasiraSession({
    sessionUrl: joinUrl,
    onSessionComplete: (id) => navigate(`/inspections/${id}`),
  });
  return (
    <div className="my-layout">
      <header>
        <button onClick={() => widget.current?.requestSnapshot()}>
          Snap
        </button>
      </header>
      <div ref={containerRef} style={{ flex: 1 }} />
    </div>
  );
}

Lifecycle callbacks

Every callback supported by @nexbasira/embed is passed through unchanged:

| Prop | Fires when | |---|---| | onReady | The iframe finished loading + handshake completed. | | onSessionJoined(id) | The field user joined the session. | | onSessionComplete(id) | The session was closed (final state, recording paths queued). | | onEvidenceAdded(ev) | A new evidence row was created (snapshot, whiteboard, etc.). | | onWhiteboardOpened / onWhiteboardSaved(ev) | Whiteboard lifecycle. | | onParticipantJoined(p) / onParticipantLeft(p) | Participant changes. | | onError({message, code}) | Anything the iframe surfaces as an error. |

Callbacks are always re-read from the latest props on every re-render — closing over fresh state in your handlers works without remounting the iframe.

When the iframe rebuilds

The iframe is re-created only when sessionUrl changes. Every other prop (callbacks, width, height, expectedOrigin) is applied without remounting, so toolbars and overlays stay continuous through a session.

TypeScript

NexBasiraSessionProps, NexBasiraSessionHandle, EmbedOptions, and EmbedWidget are all exported. The component is a forwardRef, so useRef<NexBasiraSessionHandle>() gives you typed handle access.

License

MIT