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.

upgrade dub to 0.46.1

Kiran Kbb87549b7a76
diff --git a/apps/web/app/api/workspaces/[idOrSlug]/embed-token/route.ts b/apps/web/app/api/workspaces/[idOrSlug]/embed-token/route.ts
index 4a0492cd5c..c131d44798 100644
--- a/apps/web/app/api/workspaces/[idOrSlug]/embed-token/route.ts
+++ b/apps/web/app/api/workspaces/[idOrSlug]/embed-token/route.ts
@@ -1,6 +1,6 @@
import { DubApiError } from "@/lib/api/errors";
import { withWorkspace } from "@/lib/auth";
-import { APP_DOMAIN_WITH_NGROK } from "@dub/utils";
+import { dub } from "@/lib/dub";
import { NextResponse } from "next/server";
// GET /api/workspaces/[idOrSlug]/embed-token - create a new public embed token for the workspace
@@ -14,14 +14,9 @@ export const POST = withWorkspace(async ({ workspace }) => {
});
}
- const token = await fetch(`${APP_DOMAIN_WITH_NGROK}/api/tokens/embed`, {
- method: "POST",
- headers: {
- "Content-Type": "application/json",
- Authorization: `Bearer ${process.env.DUB_API_KEY}`,
- },
- body: JSON.stringify({ linkId: referralLinkId }),
- }).then((res) => res.json());
+ const token = await dub.embedTokens.create({
+ linkId: referralLinkId,
+ });
return NextResponse.json(token);
});
diff --git a/apps/web/lib/actions/get-referral-link.ts b/apps/web/lib/actions/get-referral-link.ts
deleted file mode 100644
index 19644c4339..0000000000
--- a/apps/web/lib/actions/get-referral-link.ts
+++ /dev/null
@@ -1,20 +0,0 @@
-"use server";
-
-import { dub } from "@/lib/dub";
-import { prisma } from "@/lib/prisma";
-
-export const getReferralLink = async (slug: string) => {
- const workspace = await prisma.project.findUnique({
- where: {
- slug,
- },
- });
-
- if (!workspace || !workspace.referralLinkId) {
- return null;
- }
-
- return await dub.links.get({
- linkId: workspace.referralLinkId,
- });
-};
diff --git a/apps/web/package.json b/apps/web/package.json
index 0d9fde9d43..60822b43f6 100644
--- a/apps/web/package.json
+++ b/apps/web/package.json
@@ -64,7 +64,7 @@
"csv-parse": "^5.5.6",
"d3-array": "^3.2.4",
"date-fns": "^3.6.0",
- "dub": "^0.43.4",
+ "dub": "^0.46.1",
"framer-motion": "^10.16.16",
"fuse.js": "^6.6.2",
"geist": "^1.3.1",
diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml
index a5d6680846..8ecfa85219 100644
--- a/pnpm-lock.yaml
+++ b/pnpm-lock.yaml
@@ -193,8 +193,8 @@ importers:
specifier: ^3.6.0
version: 3.6.0
dub:
- specifier: ^0.43.4
- version: 0.43.4([email protected])
+ specifier: ^0.46.1
framer-motion:
specifier: ^10.16.16
@@ -12479,11 +12479,15 @@ packages:
zod: 3.23.8
dev: false
- resolution: {integrity: sha512-HqNnCFgWy9PWvYUrLGDvjba4mqGpjkc+x74yaHhVG5Cm2gTQiIF7kmfUDmz6GOog/Gc9S3C0PicjmqgbMBgbaw==}
+ resolution: {integrity: sha512-3VRmxY3oAl4w3PCpwIO6R+SQCumlIJKZR5RCF9lPhj5IeUAGVTZsms3bMwKmO+uwQoWZ79ymZHnMOmmZvUaEsg==}
peerDependencies:
+ react: ^18 || ^19
+ react-dom: ^18 || ^19
zod: '>= 3'
dependencies:
+ react: 18.2.0
+ react-dom: 18.2.0([email protected])
zod: 3.22.4
dev: false