{
  "component": {
    "id": "webhook-manager",
    "name": "Webhook manager",
    "tier": "pro",
    "exampleId": "webhook-manager",
    "access": "pro",
    "requiresAuthorization": true
  },
  "source": {
    "demoModule": "src/webhook-manager-demo.tsx",
    "exportName": "WebhookManagerDemo",
    "sha256": "462be350701309c24d96000bb1e28818dfa97d9b754f67997558fb2b0e455e87",
    "helperImports": [],
    "directComponentImports": [
      "webhook-manager"
    ],
    "sampleBoundary": "Existing local demo fixture with fictional data and callbacks. No live service, customer data, access key, or Pro source is included."
  },
  "install": {
    "command": "npx shadcn@latest add @tidal-pro/webhook-manager",
    "registryUrl": "https://tidalui.com/r/pro/webhook-manager.json",
    "namespace": "@tidal-pro",
    "access": "pro",
    "sourceDelivery": "server-gated",
    "requiresAuthorization": true,
    "tokenSource": "local-env",
    "tokenEnvName": "TIDALUI_TOKEN",
    "cli": {
      "package": "shadcn",
      "requested": "latest"
    }
  },
  "installPlan": [
    {
      "order": 1,
      "kind": "primary",
      "dependency": "@tidal-pro/webhook-manager",
      "purpose": "component",
      "command": "npx shadcn@latest add @tidal-pro/webhook-manager",
      "registryUrl": "https://tidalui.com/r/pro/webhook-manager.json",
      "access": "pro",
      "sourceDelivery": "server-gated",
      "requiresAuthorization": true
    }
  ],
  "imports": {
    "componentPath": "components/ui/webhook-manager.tsx",
    "exports": [
      "TidalWebhookEndpoint",
      "TidalWebhookEndpointForm",
      "TidalWebhookManager"
    ],
    "stylesheets": [
      "components/ui/tidal.css",
      "components/ui/webhook-manager.css",
      "components/ui/status-badge.css",
      "components/ui/toggle-switch.css",
      "components/ui/collapsible-panel.css"
    ],
    "scopeClass": "tidal-scope"
  },
  "dependencies": {
    "npm": [
      "lucide-react"
    ],
    "registry": [
      "https://tidalui.com/r/tidal-button.json",
      "https://tidalui.com/r/status-badge.json",
      "@tidal-pro/toggle-switch",
      "@tidal-pro/collapsible-panel"
    ],
    "additionalRegistry": [],
    "installClosure": [
      "collapsible-panel",
      "status-badge",
      "tidal-button",
      "toggle-switch",
      "webhook-manager"
    ],
    "css": [
      "components/ui/tidal.css",
      "components/ui/webhook-manager.css",
      "components/ui/status-badge.css",
      "components/ui/toggle-switch.css",
      "components/ui/collapsible-panel.css"
    ],
    "demoCss": [],
    "consumerOwned": [
      "react",
      "react-dom"
    ]
  },
  "files": {
    "sourceFile": "/examples/webhook-manager.tsx",
    "demoStyles": [],
    "inlinedDemoStyles": [
      "src/webhook-manager-demo.css"
    ],
    "assets": []
  },
  "example": {
    "language": "tsx",
    "source": "import \"./components/ui/tidal.css\";\n\nimport { useLayoutEffect, useRef, useState } from \"react\";\n\nimport { TidalWebhookManager, TidalWebhookEndpointForm, type TidalWebhookEndpoint } from \"./components/ui/webhook-manager\";\n\nimport \"./components/ui/webhook-manager.css\";\n\nimport \"./components/ui/status-badge.css\";\n\nimport \"./components/ui/toggle-switch.css\";\n\nimport \"./components/ui/collapsible-panel.css\";\n\n\n\nconst tidalExampleStyles = \".tidal-scope .webhook-manager-demo {\\n  width: 100%;\\n  max-width: 740px;\\n  min-width: 0;\\n}\\n.webhook-manager-demo > p {\\n  font-size: 11px;\\n  line-height: 1.6;\\n  color: var(--t-muted);\\n  margin: 14px 4px 0;\\n  overflow-wrap: anywhere;\\n}\";\n\nconst initial: TidalWebhookEndpoint[] = [\n  {\n    id: \"billing\",\n    name: \"Billing events\",\n    url: \"https://example.com/webhooks/billing\",\n    enabled: true,\n    signing: \"configured\",\n    events: [\"invoice.paid\", \"subscription.updated\"],\n    deliveriesOpen: false,\n    deliveries: [\n      {\n        id: \"delivery-1\",\n        event: \"invoice.paid\",\n        outcome: \"delivered\",\n        time: { label: \"Today, 10:42 AM\" },\n        response: \"HTTP 200\",\n        duration: \"84 ms\",\n      },\n      {\n        id: \"delivery-2\",\n        event: \"subscription.updated\",\n        outcome: \"failed\",\n        time: { label: \"Today, 10:31 AM\" },\n        response: \"HTTP 503\",\n        duration: \"1.2 s\",\n      },\n    ],\n  },\n];\n\nconst events = [\n  { value: \"invoice.paid\", label: \"Invoice paid\" },\n  { value: \"subscription.updated\", label: \"Subscription updated\" },\n  { value: \"customer.created\", label: \"Customer created\" },\n];\n\nexport function WebhookManagerDemo() {\n  const [endpoints, setEndpoints] = useState(initial),\n    [editing, setEditing] = useState<string | null>(null),\n    [values, setValues] = useState({\n      name: \"\",\n      url: \"\",\n      events: [] as readonly string[],\n    }),\n    [message, setMessage] = useState(\n      \"Sample endpoints and deliveries. No requests are sent.\",\n    );\n  const createRef = useRef<HTMLButtonElement>(null),\n    opener = useRef<HTMLButtonElement | null>(null),\n    count = useRef(1);\n  const nameRef = useRef<HTMLInputElement>(null);\n  useLayoutEffect(() => {\n    if (editing !== null) nameRef.current?.focus();\n  }, [editing]);\n  const closeEditor = () => {\n    setEditing(null);\n    (opener.current ?? createRef.current)?.focus({ preventScroll: true });\n  };\n  return (\n    <div className=\"webhook-manager-demo\">\n      <TidalWebhookManager\n        title=\"Webhooks\"\n        description=\"Send product events to your application.\"\n        endpoints={endpoints}\n        createButtonRef={createRef}\n        onCreateRequest={(e) => {\n          opener.current = e.currentTarget;\n          setValues({ name: \"\", url: \"\", events: [] });\n          setEditing(\"new\");\n        }}\n        onEditRequest={(endpoint, e) => {\n          opener.current = e.currentTarget;\n          setValues({\n            name: endpoint.name,\n            url: endpoint.url,\n            events: endpoint.events,\n          });\n          setEditing(endpoint.id);\n        }}\n        onEnabledChange={(endpoint, enabled) => {\n          setEndpoints((v) =>\n            v.map((x) => (x.id === endpoint.id ? { ...x, enabled } : x)),\n          );\n          setMessage(\n            `${endpoint.name} ${enabled ? \"enabled\" : \"paused\"} in this preview.`,\n          );\n        }}\n        onDeliveriesOpenChange={(endpoint, open) =>\n          setEndpoints((v) =>\n            v.map((x) =>\n              x.id === endpoint.id ? { ...x, deliveriesOpen: open } : x,\n            ),\n          )\n        }\n        onTestRequest={(endpoint) => {\n          const deliveryId = `test-${count.current++}`;\n          setEndpoints((v) =>\n            v.map((x) =>\n              x.id === endpoint.id\n                ? {\n                    ...x,\n                    deliveriesOpen: true,\n                    deliveries: [\n                      {\n                        id: deliveryId,\n                        event: \"webhook.test\",\n                        outcome: \"delivered\",\n                        time: { label: \"Just now · sample\" },\n                        response: \"HTTP 200\",\n                        duration: \"75 ms\",\n                      },\n                      ...x.deliveries,\n                    ],\n                  }\n                : x,\n            ),\n          );\n          setMessage(\"Added a sample test delivery. No request was sent.\");\n        }}\n        onRetryRequest={(endpoint, delivery) => {\n          setEndpoints((v) =>\n            v.map((x) =>\n              x.id === endpoint.id\n                ? {\n                    ...x,\n                    deliveries: x.deliveries.map((d) =>\n                      d.id === delivery.id\n                        ? {\n                            ...d,\n                            outcome: \"delivered\",\n                            response: \"HTTP 200\",\n                            duration: \"91 ms\",\n                          }\n                        : d,\n                    ),\n                  }\n                : x,\n            ),\n          );\n          setMessage(\n            \"The sample retry is marked delivered. No request was sent.\",\n          );\n        }}\n        editor={\n          editing !== null ? (\n            <TidalWebhookEndpointForm\n              nameInputRef={nameRef}\n              nameValue={values.name}\n              urlValue={values.url}\n              selectedEvents={values.events}\n              eventOptions={events}\n              onValueChange={setValues}\n              onCancel={closeEditor}\n              onSubmit={(e) => {\n                e.preventDefault();\n                if (!values.name.trim()) return;\n                const name = values.name.trim();\n                const endpointId =\n                  editing === \"new\" ? `endpoint-${count.current++}` : editing;\n                setEndpoints((v) =>\n                  editing === \"new\"\n                    ? [\n                        ...v,\n                        {\n                          id: endpointId,\n                          name,\n                          url: values.url,\n                          events: values.events,\n                          enabled: false,\n                          signing: \"not-configured\",\n                          deliveries: [],\n                          deliveriesOpen: false,\n                        },\n                      ]\n                    : v.map((x) =>\n                        x.id === editing\n                          ? {\n                              ...x,\n                              name,\n                              url: values.url,\n                              events: values.events,\n                            }\n                          : x,\n                      ),\n                );\n                setMessage(`${name} saved in this preview.`);\n                closeEditor();\n              }}\n            />\n          ) : undefined\n        }\n      />\n      <p role=\"status\">{message}</p>\n    </div>\n  );\n}\n\nexport default function AgentExample() {\n  return (\n    <div className=\"tidal-scope\" data-theme=\"light\" dir=\"ltr\">\n      <style>{tidalExampleStyles}</style>\n      <WebhookManagerDemo />\n    </div>\n  );\n}\n",
    "sourceFile": "/examples/webhook-manager.tsx",
    "fixtureData": "Existing demo fixture data only; replace with consumer-owned data before production use."
  },
  "controlledState": [
    {
      "prop": "endpoints",
      "type": "inferred-from-existing-demo",
      "initial": "initial",
      "setter": "setEndpoints",
      "proposalCanBeRejected": false
    }
  ],
  "events": [
    {
      "name": "onCancel",
      "nativeType": "component callback",
      "callerFirst": true,
      "preventable": false,
      "observedResult": "The existing demo callback remains the source of truth; this example does not call a live service."
    },
    {
      "name": "onCreateRequest",
      "nativeType": "component callback",
      "callerFirst": true,
      "preventable": false,
      "observedResult": "The existing demo callback remains the source of truth; this example does not call a live service."
    },
    {
      "name": "onDeliveriesOpenChange",
      "nativeType": "component callback",
      "callerFirst": true,
      "preventable": false,
      "observedResult": "The existing demo callback remains the source of truth; this example does not call a live service."
    },
    {
      "name": "onEditRequest",
      "nativeType": "component callback",
      "callerFirst": true,
      "preventable": false,
      "observedResult": "The existing demo callback remains the source of truth; this example does not call a live service."
    },
    {
      "name": "onEnabledChange",
      "nativeType": "component callback",
      "callerFirst": true,
      "preventable": false,
      "observedResult": "The existing demo callback remains the source of truth; this example does not call a live service."
    },
    {
      "name": "onRetryRequest",
      "nativeType": "component callback",
      "callerFirst": true,
      "preventable": false,
      "observedResult": "The existing demo callback remains the source of truth; this example does not call a live service."
    },
    {
      "name": "onSubmit",
      "nativeType": "React synthetic event or native callback",
      "callerFirst": true,
      "preventable": false,
      "observedResult": "The existing demo callback remains the source of truth; this example does not call a live service."
    },
    {
      "name": "onTestRequest",
      "nativeType": "component callback",
      "callerFirst": true,
      "preventable": false,
      "observedResult": "The existing demo callback remains the source of truth; this example does not call a live service."
    },
    {
      "name": "onValueChange",
      "nativeType": "component callback",
      "callerFirst": true,
      "preventable": false,
      "observedResult": "The existing demo callback remains the source of truth; this example does not call a live service."
    }
  ],
  "nativeForm": {
    "participates": true,
    "names": [],
    "expectedFormData": {},
    "submitBehavior": "The existing demo's native form callback receives the submit event.",
    "resetBehavior": "Native reset behavior remains available where the demo renders a resettable control.",
    "disabledBehavior": "Disabled controls remain excluded from successful native form submission.",
    "readOnlyBehavior": "Read-only controls retain their value and remain inspectable by the consumer."
  },
  "accessibility": {
    "labelSource": "Consumer-provided label remains required where the component API requires one.",
    "semantics": "Preserve the component's native element and the semantics demonstrated by the source fixture.",
    "keyboard": [
      "Tab and Shift+Tab",
      "Enter or Space for native activation",
      "Arrow keys where the component exposes a composite control"
    ],
    "focusReturn": "Preserve browser focus order and visible focus.",
    "errorAnnouncement": "The existing error or alert path remains consumer-owned and should be announced by the rendered semantics.",
    "reducedMotion": "Verify prefers-reduced-motion with the existing component transition path.",
    "forcedColors": "Verify visible borders, text, and focus in forced-colors mode."
  },
  "responsive": {
    "widths": [
      320,
      390,
      768,
      1260
    ],
    "shortViewport": "Check the example at a 300px viewport height with keyboard or portal content visible.",
    "overflow": "The page should not gain horizontal overflow; component-local scrolling must remain intentional.",
    "touchTargetMinPx": 44,
    "coarseInputFontPx": 16
  },
  "errors": [
    {
      "fixture": "Exercise the existing demo's error, empty, loading, or invalid fixture.",
      "visibleResult": "The consumer-visible result must remain explicit and must not be replaced by a silent console error.",
      "focusResult": "Focus must remain on the triggering control or move to the announced error according to the native pattern.",
      "ownership": "Consumer-owned sample state only; no network request or customer data is used."
    }
  ],
  "verification": {
    "commands": [
      "npx tsc --noEmit",
      "npx vite build"
    ],
    "lockfile": "Use the consumer project's committed lockfile.",
    "browser": [
      "Chromium 1260x800",
      "Chromium 390x844",
      "Keyboard and reduced-motion pass"
    ]
  },
  "validation": {
    "consumerFixture": {
      "tsc": "pass",
      "viteBuild": "pass",
      "resourceModel": "Generated usage plus only the component files and CSS delivered by the primary item and listed registry dependencies."
    },
    "registryArtifact": "server-gated"
  },
  "exceptions": []
}
