# [Dashboard] Feature: Add Webhook Management UI      ## Notes for the reviewer This PR adds a new webhook management UI to the dashboard, allowing users to create, edit, delete, and monitor webhooks. The implementation includes: - A new overview page for webhooks with a table to display all configured webhooks - Create/edit webhook modals with form validation - Topic selector for webhook event subscriptions - Delete confirmation with activity warning - Webhook metrics display showing request counts and error rates - API integration for webhook configuration management ## How to test Navigate to the webhooks section in a project to view the new UI. Create a new webhook, edit its configuration, and test the delete functionality. Verify that metrics are displayed correctly for existing webhooks. <!-- This is an auto-generated comment: release notes by coderabbit.ai --> ## Summary by CodeRabbit * **New Features** * Introduced a comprehensive webhooks management interface, including creation, editing, deletion, and topic selection with optional JSON filters. * Added analytics dashboards for webhooks, featuring charts for request status codes and latency percentiles, with filtering by webhook and date range. * Implemented feature flag-based tab navigation for "Overview" and "Analytics" in the webhooks section. * Provided detailed webhook metrics, including recent activity and error rates. * **Bug Fixes** * Improved error handling and user feedback for webhook configuration and analytics operations. * **Chores** * Added PostHog server-side analytics integration. * Updated environment variable naming for analytics configuration. * Added new dependency for analytics support. <!-- end of auto-generated comment: release notes by coderabbit.ai --> <!-- start pr-codex --> --- ## PR-Codex overview This PR introduces webhook analytics features and enhances the webhook management system, including new types for webhook statistics, UI components for creating and editing webhooks, and improvements in data fetching and handling. ### Detailed summary - Added `posthog-node` dependency for server-side analytics. - Updated environment variable from `NEXT_PUBLIC_POSTHOG_API_KEY` to `NEXT_PUBLIC_POSTHOG_KEY`. - Introduced interfaces for `WebhookRequestStats`, `WebhookLatencyStats`, and `WebhookSummaryStats`. - Created `CreateWebhookConfigModal` and `EditWebhookConfigModal` components for managing webhooks. - Implemented `WebhooksAnalytics` and `WebhookAnalyticsServer` components for displaying analytics data. - Enhanced `WebhookMetrics` to show metrics and error rates. - Added `isFeatureFlagEnabled` function for feature flag checks. - Implemented data fetching functions for webhook metrics in `analytics.ts`. - Updated the webhook configuration management with new API endpoints and improved error handling. - Created `TopicSelectorModal` for selecting topics with optional filters. - Improved UI components for better user experience in managing webhooks. > The following files were skipped due to too many changes: `pnpm-lock.yaml` > ✨ Ask PR-Codex anything about this PR by commenting with `/codex {your question}` <!-- end pr-codex -->
100 lines
3.0 KiB
Bash
100 lines
3.0 KiB
Bash
#
|
|
# Public (client)
|
|
#
|
|
|
|
# API authorized domain
|
|
# not required to build, defaults to prod
|
|
NEXT_PUBLIC_THIRDWEB_DOMAIN="localhost:3000"
|
|
|
|
# API host. For local development, please use "https://api.thirdweb-dev.com"
|
|
# otherwise: "https://api.thirdweb.com"
|
|
NEXT_PUBLIC_THIRDWEB_API_HOST="https://api.thirdweb-dev.com"
|
|
|
|
# Bridge API. For local development, please use "https://bridge.thirdweb-dev.com"
|
|
# otherwise: "https://bridge.thirdweb.com"
|
|
NEXT_PUBLIC_THIRDWEB_BRIDGE_HOST="https://bridge.thirdweb-dev.com"
|
|
|
|
# Paper API host
|
|
NEXT_PUBLIC_THIRDWEB_EWS_API_HOST="https://ews.thirdweb-dev.com"
|
|
|
|
# thirdweb local api host
|
|
# NEXT_PUBLIC_THIRDWEB_API_HOST="http://127.0.0.1:3005"
|
|
|
|
# Client ID
|
|
# Get the client id from https://thirdweb.com/create-api-key and set it here,
|
|
# make sure to allow localhost:3000 in the allowed origins
|
|
NEXT_PUBLIC_DASHBOARD_CLIENT_ID="<replace_me_with_your_client_id>"
|
|
|
|
# IPFS gateway url
|
|
NEXT_PUBLIC_IPFS_GATEWAY_URL="https://{clientId}.thirdwebstorage-dev.com/ipfs/{cid}/{path}"
|
|
|
|
# Upload server url
|
|
NEXT_PUBLIC_DASHBOARD_UPLOAD_SERVER="https://storage.thirdweb-dev.com"
|
|
|
|
# typesense.com API key (used for contract search)
|
|
# - not required to build (unless testing contract search)
|
|
NEXT_PUBLIC_TYPESENSE_CONTRACT_API_KEY=
|
|
|
|
# posthog API key
|
|
# - not required for prod/staging
|
|
NEXT_PUBLIC_POSTHOG_KEY=""
|
|
|
|
# Stripe Customer portal
|
|
NEXT_PUBLIC_STRIPE_KEY=
|
|
|
|
NEXT_PUBLIC_STRIPE_PAYMENT_METHOD_CFG_ID=
|
|
|
|
#
|
|
# Private (server)
|
|
#
|
|
# Get the secret key from https://thirdweb.com/create-api-key and set it here, Make sure to allow localhost:3000 in the allowed origins
|
|
DASHBOARD_SECRET_KEY="<replace_me_with_your_secret_key>"
|
|
|
|
# Client id for api routes
|
|
API_ROUTES_CLIENT_ID=
|
|
|
|
# <moralis.io API key (used for api routes for token balances and wallet NFTs)
|
|
# - not required to build (unless using wallet NFTs and token balances)>
|
|
MORALIS_API_KEY=
|
|
|
|
# alchemy.com API key (used for wallet NFTS)
|
|
# - cannot be restricted to IP/domain because vercel has no stable IPs and it happens during build & runtime api route call
|
|
# - not required to build (unless testing wallet NFTs)>
|
|
SSR_ALCHEMY_KEY=
|
|
|
|
|
|
# Hubspot Access Token (used for contact us form)
|
|
# - not required to build (unless testing contact us form)>
|
|
HUBSPOT_ACCESS_TOKEN=
|
|
|
|
# Upload server url
|
|
NEXT_PUBLIC_DASHBOARD_UPLOAD_SERVER="https://storage.thirdweb-preview.com"
|
|
|
|
# Unthread variables - only required for submitting the support form in /support
|
|
UNTHREAD_API_KEY=""
|
|
UNTHREAD_TRIAGE_CHANNEL_ID=""
|
|
UNTHREAD_EMAIL_INBOX_ID=""
|
|
UNTHREAD_FREE_TIER_ID=""
|
|
UNTHREAD_GROWTH_TIER_ID=""
|
|
UNTHREAD_PRO_TIER_ID=""
|
|
|
|
# Demo Engine
|
|
NEXT_PUBLIC_DEMO_ENGINE_URL=""
|
|
|
|
# API server secret (required for thirdweb.com SIWE login). Copy from Vercel.
|
|
API_SERVER_SECRET=""
|
|
|
|
# Used for the Faucet page (/<chain_id>)
|
|
NEXT_PUBLIC_TURNSTILE_SITE_KEY=""
|
|
TURNSTILE_SECRET_KEY=""
|
|
REDIS_URL=""
|
|
|
|
ANALYTICS_SERVICE_URL=""
|
|
|
|
|
|
# required for billing parts of the dashboard (team -> settings -> billing / invoices)
|
|
STRIPE_SECRET_KEY=""
|
|
|
|
# required for server wallet management
|
|
NEXT_PUBLIC_THIRDWEB_VAULT_URL=""
|
|
NEXT_PUBLIC_ENGINE_CLOUD_URL="" |