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

@withfeedback/react

v0.3.0

Published

React components for withfeedback.com — testimonial walls, carousels, and feedback collection.

Readme

@withfeedback/react

React components and hooks for withfeedback.com — testimonial walls, carousels, and feedback collection.

Why this package and not the <script> tag

The script tag renders in the browser, into a Shadow DOM. That is right for a site we know nothing about, and wrong for two things:

  • Machines that read the page. Search engines run JavaScript slowly and not always; most AI crawlers do not run it at all. Testimonials that arrive after JavaScript are close to invisible to both.
  • The first paint. An empty space, then a jump.

This package fixes both, but only through @withfeedback/react/server. The client entry point is a nicer script tag; the server entry point is the reason the package exists.

Install

npm install @withfeedback/react

React 18.2 or 19 is a peer dependency. This package has no runtime dependencies of its own and requires no CSS import.

Entry points

| Import | Runs where | Use it for | |---|---|---| | @withfeedback/react/server | React Server Component, getStaticProps, a route handler, a build script | Content in the served HTML | | @withfeedback/react | The browser (a Client Component in the App Router) | Pagination, the carousel, and pages where SSR is not available | | @withfeedback/react/collect | The browser | Collecting feedback, NPS and survey answers |

They are separate so that importing display code on a server does not drag hooks and browser code in with it — and so that a page which only shows testimonials never pays for a camera, a form and an upload.

Components

TestimonialWall and TestimonialCard are pure and hook-free, so they render in a Server Component as happily as in the browser. They need no CSS import: defaults are inline, every part carries a stable class name (wf-card, wf-stars, wf-text, wf-person, …), and unstyled drops the defaults so you can style them entirely yourself.

<TestimonialWall payload={payload} />                        // inline defaults
<TestimonialWall payload={payload} unstyled className="…" /> // your CSS only

showBranding comes from the payload, which the server computes from your plan. There is rarely a reason to pass it.

TestimonialCarousel shows one at a time, with dot navigation and optional autoplay from the widget's config. It holds the current slide in state, so it is a Client Component and is not exported from /server — but a Server Component can still fetch the payload and pass it down, and every slide is then prerendered into the served HTML:

// app/page.tsx — a Server Component
import { fetchTestimonials } from "@withfeedback/react/server";
import { TestimonialCarousel } from "@withfeedback/react";

export default async function Page() {
  const payload = await fetchTestimonials({ widgetId: "your-widget-uuid" });
  return <TestimonialCarousel payload={payload} label="What people say" />;
}

Autoplay pauses while the pointer is over it or focus is inside, stops entirely for prefers-reduced-motion: reduce, and off-screen slides are inert so a video's controls are never reachable by keyboard while invisible.

Collecting feedback

CollectWidget draws the launcher and the panel for all three collect widgets — feedback, survey and NPS. Which one you get comes from the payload.

"use client";
import { CollectWidget } from "@withfeedback/react/collect";

<CollectWidget payload={payload} publicKey="your-public-key" />

It renders into the normal DOM, not a Shadow DOM. That is deliberate: the <script> tag isolates itself because it lands on sites nobody controls, but you installed this package and own your page. Every part carries a wf- class name and unstyled drops the inline defaults, so the panel can be made to look like the rest of your product.

The video recorder, the honeypot, the minimum-fill timer, the consent wording and the three-step upload are shared with the <script> bundle rather than reimplemented, so both behave the same way.

Server rendering

// app/page.tsx — a React Server Component
import { fetchTestimonials } from "@withfeedback/react/server";

export default async function Page() {
  const payload = await fetchTestimonials({ widgetId: "your-widget-uuid" });
  return <ul>{payload.items.map((item) => <li key={item.id}>{item.text}</li>)}</ul>;
}

Client rendering, with pagination

"use client";
import { useTestimonials } from "@withfeedback/react";

export function Wall() {
  const { items, loading, error, hasMore, loadMore } = useTestimonials({
    widgetId: "your-widget-uuid",
  });

  if (error) return <p>Could not load testimonials.</p>;
  return (
    <>
      <ul>{items.map((item) => <li key={item.id}>{item.text}</li>)}</ul>
      {hasMore && <button onClick={loadMore} disabled={loading}>Load more</button>}
    </>
  );
}

Both: server-rendered, then paginated in the browser

Pass the server payload to the hook. It renders immediately, hydration matches, and no second request goes out.

const payload = await fetchTestimonials({ widgetId });      // server
<Wall initialPayload={payload} />                            // client
const { items, loadMore } = useTestimonials({ widgetId, initialPayload });

Three behaviours to know about

A server-rendered wall records no impressions. The impression beacon needs a view_token, the server mints a fresh one per response and it expires in ten minutes, and fetchTestimonials strips it — its return type does not even have the field. Shipping a token into HTML would hand every visitor the same dead token. An uncounted impression is better than a wrong one.

The consent checkbox's label IS the consent record. It changes when a video is attached, because a recording of somebody's face is not the same disclosure as their words — and a tick already given is cleared, with a note saying why, when the wording changes under it. Do not replace that sentence.

Pagination de-duplicates by id, and you should too if you page yourself. The API pages by offset. Approving one newer testimonial between two requests shifts every row by one, so page 2 can repeat a row page 1 already showed. useTestimonials handles this; fetchTestimonials hands you the raw page.

Development

From the repository root:

npm run react:test          # Vitest
npm run react:test18        # the same components against React 18
npm run react:check         # TypeScript
npm run react:build         # ESM + CJS + .d.ts
npm run react:types         # regenerate types from the server's OpenAPI schema
npm run react:types:check   # fail if the generated types are stale
npm run react:e2e:install   # once: installs the fixture app and Chromium
npm run react:e2e           # Playwright against a real Next.js app

fixtures/next-app is a Next.js 16 app that installs this package from a packed tarball, the way a customer would, and proves the claims by running them: both routers, a production build, the raw HTTP response read with no browser at all, and the collect panel posting cross-origin to a second origin — which is the only way to see a CORS or credentials mistake.

src/generated/schema.ts is generated from the server's OpenAPI schema and committed, so installing this package never needs Python. Regenerate it after any change to the public widget payload. mainapp/tests/test_react_sdk.py fails the Django suite if you forget.