The modern link attribution platform. Loved by world-class engineering teams at Twilio, Zillow, Jobber, Vercel, Raycast, and more.
TypeScript clickhousemysqlnextjsopen-sourceplanetscaleprismatailwindcsstinybirdtypescriptupstashvercel
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.tsindex 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.tsdeleted file mode 100644index 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.jsonindex 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.yamlindex a5d6680846..8ecfa85219 100644--- a/pnpm-lock.yaml+++ b/pnpm-lock.yaml@@ -193,8 +193,8 @@ importers:specifier: ^3.6.0version: 3.6.0dub:- specifier: ^0.43.4- version: 0.43.4([email protected])+ specifier: ^0.46.1framer-motion:specifier: ^10.16.16version: 10.18.0([email protected])([email protected])@@ -12479,11 +12479,15 @@ packages:zod: 3.23.8dev: false- resolution: {integrity: sha512-HqNnCFgWy9PWvYUrLGDvjba4mqGpjkc+x74yaHhVG5Cm2gTQiIF7kmfUDmz6GOog/Gc9S3C0PicjmqgbMBgbaw==}+ resolution: {integrity: sha512-3VRmxY3oAl4w3PCpwIO6R+SQCumlIJKZR5RCF9lPhj5IeUAGVTZsms3bMwKmO+uwQoWZ79ymZHnMOmmZvUaEsg==}peerDependencies:+ react: ^18 || ^19+ react-dom: ^18 || ^19zod: '>= 3'dependencies:+ react: 18.2.0+ react-dom: 18.2.0([email protected])zod: 3.22.4dev: false