@molecule/app-webhook-inspector-react
Feature · webhook-inspector · App (browser) · v4.1.1 · Apache-2.0
Webhook delivery log row with request/response JSON panels, status, and retry
npm install @molecule/app-webhook-inspector-reactHow it works
@molecule/app-webhook-inspector-react is a ready-made webhook-inspector feature for the app (browser) side. It composes the core interfaces it needs, so it works with whichever providers your app has bonded.
import { WebhookInspector } from '@molecule/app-webhook-inspector-react'
import type { WebhookDelivery } from '@molecule/app-webhook-inspector-react'
const deliveries: WebhookDelivery[] = [
{ id: '1', eventType: 'payment.succeeded', timestamp: '2 min ago', statusCode: 200, status: 'success', durationMs: 142 },
{ id: '2', eventType: 'invoice.failed', timestamp: '5 min ago', statusCode: 500, status: 'failure', attempt: 2 },
]
<WebhookInspector
deliveries={deliveries}
selectedId="1"
onSelect={(d) => console.log('selected', d.id)}
onRetry={(d) => console.log('retry', d.id)}
/>Works with: @molecule/app-i18n, @molecule/app-react, @molecule/app-ui, @molecule/app-ui-react
Reference
Webhook delivery-log inspector.
Exports <WebhookInspector> and WebhookDelivery type.
Auto-generated, AI-first package reference for the molecule.dev ecosystem. It is written to be read by coding agents as much as by people, and is generated from this package's source — edit
src/index.tsJSDoc, not this file.
Quick Start
import { WebhookInspector } from '@molecule/app-webhook-inspector-react'
import type { WebhookDelivery } from '@molecule/app-webhook-inspector-react'
const deliveries: WebhookDelivery[] = [
{ id: '1', eventType: 'payment.succeeded', timestamp: '2 min ago', statusCode: 200, status: 'success', durationMs: 142 },
{ id: '2', eventType: 'invoice.failed', timestamp: '5 min ago', statusCode: 500, status: 'failure', attempt: 2 },
]
<WebhookInspector
deliveries={deliveries}
selectedId="1"
onSelect={(d) => console.log('selected', d.id)}
onRetry={(d) => console.log('retry', d.id)}
/>
Type
feature
Installation
npm install @molecule/app-webhook-inspector-react @molecule/app-i18n @molecule/app-react @molecule/app-ui @molecule/app-ui-react react
npm install -D @types/react
API
Interfaces
WebhookDelivery
Shape of a single webhook delivery attempt shown in the inspector.
interface WebhookDelivery {
id: string
/** Event type name (e.g. "payment.succeeded"). */
eventType: string
/** ISO timestamp or formatted string. */
timestamp: ReactNode
/** Response status. */
statusCode: number
/** Success / failure / pending. */
status: 'success' | 'failure' | 'pending'
/** Latency in ms. */
durationMs?: number
/** Request payload (string or JSON). */
requestBody?: string | unknown
/** Response body. */
responseBody?: string | unknown
/** Optional attempt number. */
attempt?: number
}
WebhookInspectorProps
Props for the WebhookInspector component.
interface WebhookInspectorProps {
/** Deliveries to render. */
deliveries: WebhookDelivery[]
/** Called when a delivery is retried. */
onRetry?: (delivery: WebhookDelivery) => void
/** Called when a row is selected (for external detail panel). */
onSelect?: (delivery: WebhookDelivery) => void
/** Currently selected id. */
selectedId?: string
/** Extra classes. */
className?: string
}
Functions
WebhookInspector(props)
Webhook delivery log — one row per event with expandable
request/response JSON panels. Pass onRetry to show a retry button
per failed delivery.
The retry button sits beside its row, outside the <summary>: a button
nested inside the disclosure's own toggle control is not reachable for
assistive technology, so it is a sibling of the <details> and describes
itself through the row's event type (aria-describedby).
function WebhookInspector({
deliveries,
onRetry,
onSelect,
selectedId,
className,
}: WebhookInspectorProps): ReactNode
props— Component props (seeWebhookInspectorProps).
Injection Notes
Requirements
Peer dependencies:
@molecule/app-i18n^1.0.1@molecule/app-react^4.4.0 || ^5.0.0@molecule/app-ui^1.9.0@molecule/app-ui-react^4.7.0react^18.0.0 || ^19.0.0
Runtime Dependencies
@molecule/app-i18n@molecule/app-react@molecule/app-ui@molecule/app-ui-reactreact
Presentation-only: fetch and store deliveries yourself and pass them in —
there is no server contract beyond the WebhookDelivery shape, and
onRetry only invokes your callback (the button renders per-row when
status === 'failure'). The 'Retry', 'Request' and 'Response' labels route
through t() under webhookInspector.*, translated by the
@molecule/app-locales-webhook-inspector companion bond. Status pills take
their colour from the theme's semantic tones (success / error / warning)
through the ClassMap, with the theme's on-tone text. Rows are native
<details> elements and onSelect fires on EVERY toggle — opening and
closing alike. Non-string request/response bodies render via
JSON.stringify(v, null, 2). Props
(documented on the exported WebhookInspectorProps interface):
deliveries, onRetry, onSelect, selectedId, className.
Translations
Translation strings are provided by @molecule/app-locales-webhook-inspector.