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

@hostwebhook/react

v1.1.1

Published

Embeddable React components for HostWebhook — event logs, endpoint status, delivery timelines

Readme

@hostwebhook/react

Embeddable React components and hooks for HostWebhook — webhook monitoring, forms, and event management.

Install

npm install @hostwebhook/react

Quick Start

1. Provider Setup (for data hooks)

import { HostWebhookProvider } from '@hostwebhook/react';
import '@hostwebhook/react/styles.css';

function App() {
  return (
    <HostWebhookProvider apiKey="your_api_key">
      <Dashboard />
    </HostWebhookProvider>
  );
}

2. Display Events

import { WebhookEventLog } from '@hostwebhook/react';

function Dashboard() {
  return <WebhookEventLog endpointId="your_endpoint_id" limit={25} />;
}

3. Webhook Form (no Provider needed)

import { WebhookForm } from '@hostwebhook/react';

<WebhookForm
  endpointToken="whk_abc123"
  fields={[
    { name: 'email', type: 'email', label: 'Email', required: true },
    { name: 'message', type: 'textarea', label: 'Message' },
  ]}
/>

Data Hooks

All data hooks require <HostWebhookProvider> and return { data, error, loading, refetch }.

| Hook | Description | |------|-------------| | useEvents(options?) | Paginated webhook events | | useEndpoint(id) | Single endpoint details | | useEndpoints() | All endpoints | | useDeliveries(eventId) | Delivery attempts for an event |

import { useEvents } from '@hostwebhook/react';

function FailedEvents() {
  const { data, loading } = useEvents({ status: 'failed', limit: 10 });
  if (loading) return <p>Loading...</p>;
  return <ul>{data?.events.map(e => <li key={e.id}>{e.eventType}</li>)}</ul>;
}

Form System

Forms submit data directly to POST /api/in/:token (public webhook ingress). Three usage modes:

Quick Mode

Auto-generates fields from a fields array:

<WebhookForm
  endpointToken="whk_abc123"
  fields={[
    { name: 'name', label: 'Name', required: true },
    { name: 'email', type: 'email', label: 'Email', required: true },
    { name: 'plan', type: 'select', label: 'Plan', options: [
      { label: 'Free', value: 'free' },
      { label: 'Pro', value: 'pro' },
    ]},
  ]}
  onSuccess={(result) => alert(`Created event: ${result.eventId}`)}
/>

Composable Mode

Use <WebhookField> and <WebhookSubmit> sub-components:

<WebhookForm endpointToken="whk_abc123">
  <WebhookField name="email" type="email" label="Email" required />
  <WebhookField name="message" type="textarea" label="Message" />
  <WebhookSubmit>Send Feedback</WebhookSubmit>
</WebhookForm>

Headless Mode

Full render control via render prop:

<WebhookForm endpointToken="whk_abc123">
  {(form) => (
    <div>
      <input {...form.getFieldProps('email')} placeholder="Email" />
      {form.getFieldMeta('email').error && (
        <span>{form.getFieldMeta('email').error}</span>
      )}
      <button type="submit" disabled={form.isSubmitting}>Submit</button>
    </div>
  )}
</WebhookForm>

Hook-only

Use useWebhookForm() directly without the <WebhookForm> wrapper:

import { useWebhookForm } from '@hostwebhook/react';

function MyForm() {
  const { values, handleChange, handleSubmit, isSubmitting } = useWebhookForm({
    endpointToken: 'whk_abc123',
    initialValues: { email: '' },
    onSuccess: (result) => console.log(result.eventId),
  });

  return (
    <form onSubmit={handleSubmit}>
      <input name="email" value={values.email} onChange={handleChange} />
      <button type="submit" disabled={isSubmitting}>Send</button>
    </form>
  );
}

Display Components

WebhookEventLog

Paginated table of webhook events with status filters.

<WebhookEventLog
  endpointId="..."
  limit={25}
  pollInterval={5000}
  showFilters
  onEventClick={(event) => console.log(event)}
/>

EndpointStatus

Health status indicator with optional details.

<EndpointStatus endpointId="..." showDetails />

DeliveryTimeline

Vertical timeline showing all delivery attempts for an event.

<DeliveryTimeline eventId="..." />

Validation

Built-in validators: required, email, url, minLength, maxLength, min, max, pattern.

Custom field validation:

<WebhookField
  name="age"
  type="number"
  validate={(value) => Number(value) < 18 ? 'Must be 18+' : undefined}
/>

Form-level validation:

<WebhookForm
  endpointToken="whk_abc123"
  validate={(values) => {
    const errors: Record<string, string> = {};
    if (!values.email && !values.phone) errors.email = 'Email or phone required';
    return errors;
  }}
>

Styling

Import the default stylesheet:

import '@hostwebhook/react/styles.css';

All CSS classes use the hwk- prefix. Customize the theme via CSS custom properties:

:root {
  --hwk-color-bg: #1a1a2e;
  --hwk-color-text: #e0e0e0;
  --hwk-color-border: #333;
  --hwk-color-info: #4fc3f7;
  --hwk-radius: 8px;
  --hwk-font-family: 'Inter', sans-serif;
}

Security

The form system includes built-in protections:

  • Honeypot anti-bot field (enabled by default)
  • Submit cooldown prevents rapid-fire spam (2s default)
  • XSS sanitization strips <script> tags and on*= handlers
  • Payload size limit rejects payloads over 1MB

License

MIT