Skip to content

armgit / dub

Public Imported from GitHub
0

The modern link attribution platform. Loved by world-class engineering teams at Twilio, Zillow, Jobber, Vercel, Raycast, and more.

wip

Kiran K3f184fc547cf
diff --git a/apps/web/app/app.dub.co/(dashboard)/[slug]/settings/webhooks/page-client.tsx b/apps/web/app/app.dub.co/(dashboard)/[slug]/settings/webhooks/page-client.tsx
index fe1ba4fdba..9eaad4085d 100644
--- a/apps/web/app/app.dub.co/(dashboard)/[slug]/settings/webhooks/page-client.tsx
+++ b/apps/web/app/app.dub.co/(dashboard)/[slug]/settings/webhooks/page-client.tsx
@@ -68,7 +68,12 @@ export default function WebhooksPageClient() {
</div>
) : (
<div className="flex flex-col items-center gap-4 rounded-xl border border-gray-200 py-10">
- <EmptyState icon={Cube} title="No webhooks added yet." />
+ <EmptyState
+ icon={Cube}
+ title="You haven't set up any webhooks yet."
+ description="Webhooks allow you to receive HTTP requests whenever a specific event (eg: someone clicked your link) occurs in Dub."
+ learnMore="https://dub.co/docs/webhooks"
+ />
</div>
)
) : (
diff --git a/apps/web/lib/types.ts b/apps/web/lib/types.ts
index 38e8cf95a1..eb91cf5ff9 100644
--- a/apps/web/lib/types.ts
+++ b/apps/web/lib/types.ts
@@ -2,7 +2,7 @@ import z from "@/lib/zod";
import { metaTagsSchema } from "@/lib/zod/schemas/metatags";
import { DirectorySyncProviders } from "@boxyhq/saml-jackson";
import { Link, Project } from "@prisma/client";
-import { WEBHOOK_TRIGGERS } from "./webhook/constants";
+import { WEBHOOK_TRIGGER_DESCRIPTIONS, WEBHOOK_TRIGGERS } from "./webhook/constants";
import { integrationSchema } from "./zod/schemas/integration";
import { createLinkBodySchema } from "./zod/schemas/links";
import { oAuthAppSchema } from "./zod/schemas/oauth";
@@ -255,7 +255,7 @@ export type InstalledIntegrationInfoProps = Pick<
} | null;
};
-export type WebhookTrigger = (typeof WEBHOOK_TRIGGERS)[number];
+export type WebhookTrigger = keyof typeof WEBHOOK_TRIGGER_DESCRIPTIONS;
export type WebhookProps = z.infer<typeof webhookSchema>;
diff --git a/apps/web/lib/webhook/constants.ts b/apps/web/lib/webhook/constants.ts
index 2d38ddca76..be5f8872f8 100644
--- a/apps/web/lib/webhook/constants.ts
+++ b/apps/web/lib/webhook/constants.ts
@@ -1,12 +1,18 @@
-export const WEBHOOK_SOURCES = ["zapier", "make", "user"] as const;
-
-export const WEBHOOK_TRIGGERS = [
- "link.created",
- "link.updated",
- "link.deleted",
- "link.clicked",
-] as const;
+import { WebhookTrigger } from "../types";
export const WEBHOOK_SECRET_LENGTH = 16;
export const WEBHOOK_SECRET_PREFIX = `whsec_`;
+
+export const WEBHOOK_TRIGGER_DESCRIPTIONS = {
+ "link.created": "Link created",
+ "link.updated": "Link updated",
+ "link.deleted": "Link deleted",
+ "link.clicked": "Link clicked",
+ "lead.created": "Lead created",
+ "sale.created": "Sale created",
+} as const;
+
+export const WEBHOOK_TRIGGERS = Object.keys(
+ WEBHOOK_TRIGGER_DESCRIPTIONS,
+) as WebhookTrigger[];
diff --git a/apps/web/ui/webhooks/add-edit-webhook-form.tsx b/apps/web/ui/webhooks/add-edit-webhook-form.tsx
index acdabbc305..ec900c6c7f 100644
--- a/apps/web/ui/webhooks/add-edit-webhook-form.tsx
+++ b/apps/web/ui/webhooks/add-edit-webhook-form.tsx
@@ -169,7 +169,7 @@ export default function AddEditWebhookForm({
<div>
<label htmlFor="triggers" className="flex items-center space-x-2">
<h2 className="text-sm font-medium text-gray-900">
- Events to send
+ Which events should we send?
</h2>
<InfoTooltip content="Select the events that will trigger the webhook." />
</label>