The modern link attribution platform. Loved by world-class engineering teams at Twilio, Zillow, Jobber, Vercel, Raycast, and more.
TypeScript clickhousemysqlnextjsopen-sourceplanetscaleprismatailwindcsstinybirdtypescriptupstashvercel
update webhook ui
Kiran Kf4373c904100
diff --git a/apps/web/app/app.dub.co/(dashboard)/[slug]/settings/webhooks/[webhookId]/edit/page-client.tsx b/apps/web/app/app.dub.co/(dashboard)/[slug]/settings/webhooks/[webhookId]/edit/page-client.tsxindex be9762470c..76e135ff26 100644--- a/apps/web/app/app.dub.co/(dashboard)/[slug]/settings/webhooks/[webhookId]/edit/page-client.tsx+++ b/apps/web/app/app.dub.co/(dashboard)/[slug]/settings/webhooks/[webhookId]/edit/page-client.tsx@@ -7,12 +7,9 @@ import AddEditWebhookForm from "@/ui/webhooks/add-edit-webhook-form";import WebhookHeader from "@/ui/webhooks/webhook-header";import { MaxWidthWrapper } from "@dub/ui";import { fetcher } from "@dub/utils";-import { redirect } from "next/navigation";+import { notFound, redirect } from "next/navigation";import useSWR from "swr";-// TODO:-// Finish the remaining-export default function UpdateWebhookPageClient({webhookId,}: {@@ -34,11 +31,15 @@ export default function UpdateWebhookPageClient({fetcher,);+ if (!isLoading && !webhook) {+ notFound();+ }+return (<><WebhookHeader webhookId={webhookId} /><MaxWidthWrapper className="max-w-screen-lg space-y-6">- <AddEditWebhookForm webhook={null} />+ {webhook && <AddEditWebhookForm webhook={webhook} />}</MaxWidthWrapper></>);diff --git a/apps/web/lib/edge-config/get-feature-flags.ts b/apps/web/lib/edge-config/get-feature-flags.tsindex 4f543d6326..44aaa4ec66 100644--- a/apps/web/lib/edge-config/get-feature-flags.ts+++ b/apps/web/lib/edge-config/get-feature-flags.ts@@ -20,7 +20,7 @@ export const getFeatureFlags = async ({conversions: false,integrations: false,dublink: false,- webhooks: false,+ webhooks: true,};if (!process.env.NEXT_PUBLIC_IS_DUB || !process.env.EDGE_CONFIG) {diff --git a/apps/web/lib/webhook/constants.ts b/apps/web/lib/webhook/constants.tsindex c542afbc4b..2d38ddca76 100644--- a/apps/web/lib/webhook/constants.ts+++ b/apps/web/lib/webhook/constants.ts@@ -1,6 +1,11 @@export const WEBHOOK_SOURCES = ["zapier", "make", "user"] as const;-export const WEBHOOK_TRIGGERS = ["link.created", "link.clicked"] as const;+export const WEBHOOK_TRIGGERS = [+ "link.created",+ "link.updated",+ "link.deleted",+ "link.clicked",+] as const;export const WEBHOOK_SECRET_LENGTH = 16;diff --git a/apps/web/ui/webhooks/add-edit-webhook-form.tsx b/apps/web/ui/webhooks/add-edit-webhook-form.tsxindex de0b266725..5c1df8c989 100644--- a/apps/web/ui/webhooks/add-edit-webhook-form.tsx+++ b/apps/web/ui/webhooks/add-edit-webhook-form.tsx@@ -207,7 +207,7 @@ export default function AddEditWebhookForm({</div><Button- text={webhook ? "Save changes" : "Create"}+ text={webhook ? "Save changes" : "Create webhook"}disabled={buttonDisabled}loading={saving}type="submit"diff --git a/apps/web/ui/webhooks/webhook-header.tsx b/apps/web/ui/webhooks/webhook-header.tsxindex 952a192174..4878d42911 100644--- a/apps/web/ui/webhooks/webhook-header.tsx+++ b/apps/web/ui/webhooks/webhook-header.tsx@@ -7,13 +7,14 @@ import { useRemoveOAuthAppModal } from "@/ui/modals/remove-oauth-app-modal";import { ThreeDots } from "@/ui/shared/icons";import { Button, MaxWidthWrapper, Popover, TokenAvatar } from "@dub/ui";import { fetcher } from "@dub/utils";-import { ChevronLeft, RefreshCcw, Trash } from "lucide-react";+import { ChevronLeft, Edit3, Trash } from "lucide-react";import Link from "next/link";-import { notFound } from "next/navigation";+import { notFound, useRouter } from "next/navigation";import { useState } from "react";import useSWR from "swr";export default function WebhookHeader({ webhookId }: { webhookId: string }) {+ const router = useRouter();const { slug, id: workspaceId, role } = useWorkspace();const [openPopover, setOpenPopover] = useState(false);@@ -78,10 +79,11 @@ export default function WebhookHeader({ webhookId }: { webhookId: string }) {<Buttontext="Update webhook"variant="outline"- icon={<RefreshCcw className="h-4 w-4" />}+ icon={<Edit3 className="h-4 w-4" />}className="h-9 justify-start px-2 font-medium"onClick={async () => {setOpenPopover(false);+ router.push(`/${slug}/settings/webhooks/${webhookId}/edit`);}}/><Button