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

@tempered/hydrogen-restock

v0.0.0

Published

Back-in-stock notification components for Shopify Hydrogen storefronts

Readme

@tempered/hydrogen-restock

Back-in-stock notification components for Shopify Hydrogen storefronts.

Bundle size: < 15KB gzipped

Installation

npm install @tempered/hydrogen-restock
# or
pnpm add @tempered/hydrogen-restock
# or
yarn add @tempered/hydrogen-restock

Quick Start

1. Set up the provider

Wrap your Hydrogen app with RestockProvider:

// app/root.tsx
import { RestockProvider } from '@tempered/hydrogen-restock';

export default function App() {
  return (
    <RestockProvider
      config={{
        apiUrl: 'https://restockbridge.temperedtools.xyz',
        shopDomain: 'my-store.myshopify.com',
        apiKey: 'rb_...', // Optional: for authenticated requests
      }}
    >
      <Outlet />
    </RestockProvider>
  );
}

2. Add "Notify Me" buttons

Replace your "Add to Cart" button with a "Notify Me" button when products are out of stock:

// app/components/ProductForm.tsx
import { NotifyMeButton, useVariantAvailability } from '@tempered/hydrogen-restock';

export function ProductForm({ variant }) {
  const { showNotifyMe, isLowStock } = useVariantAvailability({ variant });

  if (showNotifyMe) {
    return (
      <NotifyMeButton
        variant={{
          id: variant.id,
          productId: variant.product.id,
          productTitle: variant.product.title,
          variantTitle: variant.title,
          availableForSale: variant.availableForSale,
        }}
      />
    );
  }

  return (
    <>
      <AddToCartButton variant={variant} />
      {isLowStock && <p>Only a few left!</p>}
    </>
  );
}

3. Show social proof

Display how many customers are waiting:

import { WaitlistCount } from '@tempered/hydrogen-restock';

export function ProductCard({ variant }) {
  return (
    <div>
      <WaitlistCount
        variantId={variant.id}
        formatText={(count) => `${count} customers want this!`}
      />
    </div>
  );
}

Components

RestockProvider

Context provider for RestockBridge configuration.

<RestockProvider
  config={{
    apiUrl: string;      // RestockBridge API URL
    shopDomain: string;  // Your Shopify domain
    apiKey?: string;     // Optional API key
  }}
>
  {children}
</RestockProvider>

NotifyMeButton

"Notify when available" button with inline email capture.

<NotifyMeButton
  variant={variant}           // Required: variant info
  buttonText="Notify Me"      // Button text (collapsed)
  submitText="Notify Me"      // Submit button text
  loadingText="Adding..."     // Loading state text
  placeholder="Enter email"   // Input placeholder
  inline={false}              // Show form by default
  onSuccess={(response) => {}}
  onError={(error) => {}}
  className="..."
  buttonClassName="..."
  inputClassName="..."
/>

WaitlistModal

Modal dialog for waitlist signup.

<WaitlistModal
  isOpen={isOpen}
  onClose={() => setIsOpen(false)}
  variant={variant}
  title="Get notified"
  showCount={true}            // Show waitlist count
  onSuccess={(response) => {}}
/>

WaitlistCount

Social proof component.

<WaitlistCount
  variantId={variant.id}
  minCount={1}                          // Min count to display
  formatText={(count) => `${count} waiting`}
/>

PreorderButton

Preorder button with delivery estimate.

<PreorderButton
  variant={variant}
  config={{
    enabled: true,
    estimatedShipDate: '2024-03-15',
    message: 'Ships in 2-3 weeks',
    requireDeposit: false,
  }}
  onClick={() => addToCart(variant.id)}
/>

Hooks

useWaitlist

Manage waitlist join/leave operations.

const {
  email,
  setEmail,
  join,
  leave,
  isJoining,
  isLeaving,
  isJoined,
  error,
  successMessage,
  reset,
} = useWaitlist({
  variant,
  onJoinSuccess: (response) => {},
  onJoinError: (error) => {},
});

useWaitlistCount

Fetch waitlist count with caching.

const { count, isLoading, error, refetch } = useWaitlistCount({
  variantId: variant.id,
  autoFetch: true,
  cacheDuration: 60000, // 1 minute
});

useVariantAvailability

Determine variant availability status.

const {
  status,          // 'available' | 'out_of_stock' | 'preorder'
  isAvailable,
  isOutOfStock,
  isLowStock,
  showNotifyMe,
  quantityAvailable,
} = useVariantAvailability({
  variant,
  lowStockThreshold: 5,
});

Styling

All components accept className props for custom styling. They ship with minimal inline styles that you can override.

For full control, use the render props:

<NotifyMeButton
  variant={variant}
  renderButton={({ onClick, isExpanded }) => (
    <button onClick={onClick} className="my-custom-button">
      {isExpanded ? 'Enter email' : 'Notify Me'}
    </button>
  )}
  renderSuccess={({ message, onReset }) => (
    <div className="my-success-message">
      <p>{message}</p>
      <button onClick={onReset}>Done</button>
    </div>
  )}
/>

TypeScript

Full TypeScript support with exported types:

import type {
  VariantInfo,
  RestockBridgeConfig,
  JoinWaitlistResponse,
  WaitlistStatus,
} from '@tempered/hydrogen-restock';

Requirements

  • React 18+ or React 19
  • RestockBridge backend (Shopify app)

License

MIT