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

@esigncomply/react

v1.0.1

Published

React hooks for the Esign Comply browser SDK. Hooks only: you build every element the signer sees.

Downloads

568

Readme

@esigncomply/react

React hooks for the Esign Comply browser SDK. Hooks only, no visual components: you build the notice, the links, the checkbox and the button, and the hooks connect them to the ceremony.

npm install @esigncomply/react @esigncomply/browser

Peer dependencies: react 18 or later and @esigncomply/browser. The built file starts with "use client".

Hooks

useCeremony({ clientToken, apiUrl? })

Attaches to the session in an effect, on the client, and follows it.

const { ceremony, status, remainingSteps, findings, error, canComplete } = useCeremony({ clientToken, apiUrl });

| Field | Meaning | |---|---| | ceremony | The attached ceremony from @esigncomply/browser, or null until status is ready. | | status | idle (no token yet), attaching, ready, error, completed. | | remainingSteps | Steps still outstanding. It follows the page: unticking the box puts intent.captured back. | | findings | Conformance findings that did not pass, the latest for each step. Each has rule, status, message, fix, doc_url. | | error | The last EsignComplyError, with code, rule and fix. | | canComplete | true when only the signing act is left. Use it to enable the button. |

The session is attached once per token. React strict mode runs effects twice in development; the hook still attaches once. The ceremony is destroyed when the last component that uses the token unmounts.

useDocument(ceremony, { versionId, mode })

Presents one document version of the session.

const tos = useDocument<HTMLAnchorElement>(ceremony, { versionId, mode: "hyperlink" });
// tos.ref goes on the link (hyperlink) or on the element that holds the document text (inline, scrollbox)
// tos.presented is true once the API recorded the presentation; tos.error holds a failure

Signup form

The server action creates the session with the secret key and returns clientToken, apiUrl and the pinned version IDs. The form does the rest.

"use client";
import { useEffect, useRef, useState } from "react";
import { useCeremony, useDocument } from "@esigncomply/react";

export function SignupForm({ clientToken, apiUrl, tosVersionId, privacyVersionId }: Props) {
  const { ceremony, status, findings, canComplete } = useCeremony({ clientToken, apiUrl });
  const tos = useDocument<HTMLAnchorElement>(ceremony, { versionId: tosVersionId, mode: "hyperlink" });
  const privacy = useDocument<HTMLAnchorElement>(ceremony, { versionId: privacyVersionId, mode: "hyperlink" });

  const assentRef = useRef<HTMLDivElement>(null);
  const checkboxRef = useRef<HTMLInputElement>(null);
  const submitRef = useRef<HTMLButtonElement>(null);
  const [message, setMessage] = useState("");

  // Observe the assent controls once both documents are presented.
  useEffect(() => {
    if (!ceremony || !tos.presented || !privacy.presented) return;
    ceremony.observeAssent({
      region: assentRef.current, // notice, links, checkbox, button
      checkbox: checkboxRef.current,
      submit: submitRef.current,
    });
  }, [ceremony, tos.presented, privacy.presented]);

  // The signing act, from the signer's real click.
  async function onSubmit(event: React.FormEvent<HTMLFormElement>) {
    event.preventDefault();
    if (!ceremony) return;
    try {
      const result = await ceremony.complete(); // { recordId, receipt, verifyUrl, status }
      await finishSignup(new FormData(event.currentTarget), result.recordId); // server action: confirms the record, then creates the account
    } catch (err) {
      setMessage(err instanceof Error ? err.message : "We could not record your acceptance."); // not signed: do not create the account
    }
  }

  return (
    <form onSubmit={onSubmit}>
      <input name="email" type="email" required />

      <div ref={assentRef}>
        <p>
          By checking the box and clicking Create account, you agree to the{" "}
          <a ref={tos.ref} href="/legal/terms">Terms of Service</a> and acknowledge the{" "}
          <a ref={privacy.ref} href="/legal/privacy">Privacy Notice</a>.
        </p>
        <label>
          <input ref={checkboxRef} type="checkbox" /> I agree to the Terms of Service and Privacy Notice
        </label>
        <button ref={submitRef} type="submit" disabled={!canComplete}>
          Create account
        </button>
      </div>

      {status === "error" && <p role="alert">We could not start the signing step. Reload the page to try again.</p>}
      {message && <p role="alert">{message}</p>}
      {process.env.NODE_ENV !== "production" && findings.map((f) => <p key={f.rule + f.event_type}>{f.rule}: {f.message} {f.fix}</p>)}
    </form>
  );
}

Points that matter:

  • Render the checkbox unchecked and leave it uncontrolled, or control it with state that starts false. A pre-checked box is reported as pre-checked (rule CR-01).
  • Keep the notice, the links, the checkbox and one primary button inside the element you pass as region.
  • Give document links a colour that differs from the surrounding text by at least 3 to 1, and keep them underlined (rule CR-05). The browser's default blue on black text measures 2.23 to 1.
  • Start the ceremony when the form mounts, not on submit.
  • A resolved complete() is not proof. Your server confirms the record with GET /v1/records/{id} before it creates the account.

Everything else is on the ceremony itself: ceremony.reviewPresented(...), ceremony.cancel() and the rest are described in the @esigncomply/browser README. So is the optional code step, ceremony.verify.start(...), for L2 profiles on Unlimited and Enterprise.

Development

node packages/react/build.mjs            # dist/index.js and dist/index.d.ts (builds the browser SDK first if needed)
node packages/react/test/e2e/run.mjs     # the form above inside <StrictMode>, in Chrome, against a local API