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.

fix conflicts

Kiran Ke4daf8bd647b
diff --cc apps/web/app/api/webhooks/route.ts
index 9f1cadf03d,d3e365e26f..d6245cb49f
--- a/apps/web/app/api/webhooks/route.ts
+++ b/apps/web/app/api/webhooks/route.ts
@@@ -1,16 -1,22 +1,22 @@@
import { DubApiError } from "@/lib/api/errors";
import { linkCache } from "@/lib/api/links/cache";
- import { createId, parseRequestBody } from "@/lib/api/utils";
+ import { parseRequestBody } from "@/lib/api/utils";
import { withWorkspace } from "@/lib/auth";
import { webhookCache } from "@/lib/webhook/cache";
- import { WEBHOOK_ID_PREFIX } from "@/lib/webhook/constants";
+ import { createWebhook } from "@/lib/webhook/create-webhook";
import { transformWebhook } from "@/lib/webhook/transform";
- import { isLinkLevelWebhook } from "@/lib/webhook/utils";
+ import { toggleWebhooksForWorkspace } from "@/lib/webhook/update-webhook";
+ import {
+ identifyWebhookReceiver,
+ isLinkLevelWebhook,
+ } from "@/lib/webhook/utils";
import { createWebhookSchema } from "@/lib/zod/schemas/webhooks";
+import { sendEmail } from "@dub/email";
+import { WebhookAdded } from "@dub/email/templates/webhook-added";
import { prisma } from "@dub/prisma";
+ import { WebhookReceiver } from "@dub/prisma/client";
+ import { ZAPIER_INTEGRATION_ID } from "@dub/utils/src/constants";
import { waitUntil } from "@vercel/functions";
-import { sendEmail } from "emails";
-import WebhookAdded from "emails/webhook-added";
import { NextResponse } from "next/server";
// GET /api/webhooks - get all webhooks for the given workspace
diff --cc apps/web/lib/actions/partners/resend-program-invite.ts
index ad32faef52,0a69831eaa..4ccd2de5c1
--- a/apps/web/lib/actions/partners/resend-program-invite.ts
+++ b/apps/web/lib/actions/partners/resend-program-invite.ts
@@@ -1,10 -1,10 +1,10 @@@
"use server";
+import { sendEmail } from "@dub/email";
+import { PartnerInvite } from "@dub/email/templates/partner-invite";
import { prisma } from "@dub/prisma";
- import z from "../zod";
- import { authActionClient } from "./safe-action";
-import { sendEmail } from "emails";
-import PartnerInvite from "emails/partner-invite";
+ import z from "../../zod";
+ import { authActionClient } from "../safe-action";
export const resendProgramInviteAction = authActionClient
.schema(
diff --cc apps/web/lib/api/partners/invite-partner.ts
index 7a8867585f,4e007148bc..273a20ae52
--- a/apps/web/lib/api/partners/invite-partner.ts
+++ b/apps/web/lib/api/partners/invite-partner.ts
@@@ -1,10 -1,11 +1,11 @@@
import { updateConfig } from "@/lib/edge-config";
import { recordLink } from "@/lib/tinybird";
import { ProgramProps } from "@/lib/types";
+import { sendEmail } from "@dub/email";
+import { PartnerInvite } from "@dub/email/templates/partner-invite";
import { prisma } from "@dub/prisma";
- import { Link, Project } from "@dub/prisma/client";
+ import { Link } from "@dub/prisma/client";
+ import { waitUntil } from "@vercel/functions";
-import { sendEmail } from "emails";
-import PartnerInvite from "emails/partner-invite";
import { createId } from "../utils";
export const invitePartner = async ({
diff --cc apps/web/package.json
index ee85f24fa9,a54fdb25b3..b8b0f10f49
--- a/apps/web/package.json
+++ b/apps/web/package.json
@@@ -33,6 -32,8 +33,7 @@@
"@prisma/client": "5.18.0",
"@prisma/nextjs-monorepo-workaround-plugin": "^6.0.1",
"@radix-ui/react-hover-card": "^1.1.1",
- "@react-email/components": "^0.0.22",
+ "@react-pdf/renderer": "^4.1.5",
"@sindresorhus/slugify": "^2.2.1",
"@splinetool/react-spline": "^2.2.6",
"@splinetool/runtime": "^1.2.8",
diff --cc packages/email/src/templates/webhook-disabled.tsx
index 0000000000,cbe05a202d..e4d6144123
mode 000000,100644..100644
--- a/packages/email/src/templates/webhook-disabled.tsx
+++ b/packages/email/src/templates/webhook-disabled.tsx
@@@ -1,0 -1,80 +1,80 @@@
-import { WEBHOOK_FAILURE_NOTIFY_THRESHOLD } from "@/lib/webhook/constants";
++// import { WEBHOOK_FAILURE_NOTIFY_THRESHOLD } from "@/lib/webhook/constants";
+ import { DUB_WORDMARK } from "@dub/utils";
+ import {
+ Body,
+ Container,
+ Head,
+ Heading,
+ Html,
+ Img,
+ Link,
+ Preview,
+ Section,
+ Tailwind,
+ Text,
+ } from "@react-email/components";
-import Footer from "./components/footer";
++import { Footer } from "../components/footer";
+
+ export default function WebhookDisabled({
+ email = "[email protected]",
+ workspace = {
+ name: "Acme, Inc",
+ slug: "acme",
+ },
+ webhook = {
+ id: "wh_tYedrqsWgNJxUwQOaAnupcUJ1",
+ url: "https://example.com/webhook",
+ },
+ }: {
+ email: string;
+ workspace: {
+ name: string;
+ slug: string;
+ };
+ webhook: {
+ id: string;
+ url: string;
+ };
+ }) {
+ return (
+ <Html>
+ <Head />
+ <Preview>Webhook has been disabled</Preview>
+ <Tailwind>
+ <Body className="mx-auto my-auto bg-white font-sans">
+ <Container className="mx-auto my-10 max-w-[500px] rounded border border-solid border-gray-200 px-10 py-5">
+ <Section className="mt-8">
+ <Img
+ src={DUB_WORDMARK}
+ height="40"
+ alt="Dub.co"
+ className="mx-auto my-0"
+ />
+ </Section>
+ <Heading className="mx-0 my-7 p-0 text-center text-xl font-semibold text-black">
+ Webhook has been disabled
+ </Heading>
+ <Text className="text-sm leading-6 text-black">
+ Your webhook <strong>{webhook.url}</strong> has failed to deliver
- successfully {WEBHOOK_FAILURE_NOTIFY_THRESHOLD} times in a row and
- has been deactivated to prevent further issues.
++ successfully 20 times in a row and has been deactivated to prevent
++ further issues.
+ </Text>
+ <Text className="text-sm leading-6 text-black">
+ Please review the webhook details and update the URL if necessary
+ to restore functionality.
+ </Text>
+ <Section className="mb-8 mt-4 text-center">
+ <Link
+ className="rounded-full bg-black px-6 py-3 text-center text-[12px] font-semibold text-white no-underline"
+ href={`https://app.dub.co/${workspace.slug}/settings/webhooks/${webhook.id}/edit`}
+ >
+ Edit Webhook
+ </Link>
+ </Section>
+ <Footer email={email} />
+ </Container>
+ </Body>
+ </Tailwind>
+ </Html>
+ );
+ }
diff --cc pnpm-lock.yaml
index 8f7aaa49dd,dc404c97ec..f484d9aa4f
--- a/pnpm-lock.yaml
+++ b/pnpm-lock.yaml
@@@ -90,6 -87,12 +90,9 @@@ importers
'@radix-ui/react-hover-card':
specifier: ^1.1.1
- '@react-email/components':
- specifier: ^0.0.22
+ '@react-pdf/renderer':
+ specifier: ^4.1.5
+ version: 4.1.5([email protected])
'@sindresorhus/slugify':
specifier: ^2.2.1
version: 2.2.1
@@@ -9675,8 -10025,14 +9904,14 @@@ packages
dependencies:
'@types/prop-types': 15.7.8
'@types/scheduler': 0.16.4
- csstype: 3.1.2
+ csstype: 3.1.3
+ resolution: {integrity: sha512-USU8ZI/xyKJwFTpjSVIrSeHBVAGagkHQKPNbxeWwql/vDmnTIBgx+TJnhFnj1NXgz8XfprU0egV2dROLGpsBEg==}
+ dependencies:
+ csstype: 3.1.3
+ dev: true
+
resolution: {integrity: sha512-2L9ifAGl7wmXwP4v3pN4p2FLhD0O1qsJpvKmNin5VA8+UvNVb447UDaAEV6UdrkA+m/Xs58U1RFps44x6TFsVQ==}
@@@ -18675,7 -18977,16 +18856,16 @@@
react: 18.2.0
scheduler: 0.23.0
+ resolution: {integrity: sha512-4GV5sHFG0e/0AD4X+ySy6UJd3jVl1iNsNHdpad0qhABJ11twS3TTBnseqsKurKcsNqCEFeGL3uLpVChpIO3QfQ==}
+ peerDependencies:
+ react: ^19.0.0
+ dependencies:
+ react: 19.0.0
+ scheduler: 0.25.0
+ dev: false
+
resolution: {integrity: sha512-BtR9VI1CMq4953wfiBmzupKlWcRThaWG2dDgl1vWAllK3tNNmJNerwY4VlmASRDQZE3LpLXU3+lf8N/VAKdbZQ==}
engines: {node: '>=18.0.0'}
hasBin: true