The modern link attribution platform. Loved by world-class engineering teams at Twilio, Zillow, Jobber, Vercel, Raycast, and more.
TypeScript clickhousemysqlnextjsopen-sourceplanetscaleprismatailwindcsstinybirdtypescriptupstashvercel
use TS SDK
Steven Tey27577b11a3e1
diff --git a/apps/web/app/app.dub.co/(dashboard)/[slug]/settings/referrals/page.tsx b/apps/web/app/app.dub.co/(dashboard)/[slug]/settings/referrals/page.tsxindex 390506256d..20a716cc27 100644--- a/apps/web/app/app.dub.co/(dashboard)/[slug]/settings/referrals/page.tsx+++ b/apps/web/app/app.dub.co/(dashboard)/[slug]/settings/referrals/page.tsx@@ -1,5 +1,11 @@+import { dub } from "@/lib/dub";import { Button, CopyButton, Wordmark } from "@dub/ui";-import { Crosshairs, CursorRays, InvoiceDollar } from "@dub/ui/src/icons";+import {+ Crosshairs,+ CursorRays,+ Globe,+ InvoiceDollar,+} from "@dub/ui/src/icons";import { COUNTRIES, getPrettyUrl, timeAgo } from "@dub/utils";import { Mail } from "lucide-react";import ReferralsPageClient from "./page-client";@@ -65,34 +71,30 @@ export default function ReferralsPage({}async function ClickEvents({ slug }: { slug: string }) {- const events = (await fetch(- `https://api.dub.co/events?domain=refer.dub.co&key=${slug}`,- {- headers: {- Authorization: `Bearer ${process.env.DUB_API_KEY}`,- },- },- ).then((res) => res.json())) as {- timestamp: string;- click_id: string;- country: string;- }[];+ const events = await dub.events.list({+ domain: "refer.dub.co",+ key: slug,+ });return (<div className="grid divide-y divide-gray-200">- {events.map(({ click_id, country, timestamp }) => (- <div key={click_id} className="flex justify-between gap-2 p-4">+ {events.map(({ clickId, country, timestamp }) => (+ <div key={clickId} className="flex justify-between gap-2 p-4"><div className="flex items-center gap-2 text-sm text-gray-500"><CursorRays className="size-4 text-gray-500" /><p>Someone from</p>- <img- alt={country}- src={`https://flag.vercel.app/m/${country}.svg`}- className="h-3 w-5"- />+ {country ? (+ <img+ alt={country}+ src={`https://flag.vercel.app/m/${country}.svg`}+ className="h-3 w-5"+ />+ ) : (+ <Globe className="size-3 text-gray-700" />+ )}<p><span className="font-semibold text-gray-700">- {COUNTRIES[country]}+ {country ? COUNTRIES[country] : "Planet Earth"}</span>{" "}clicked on your link</p>diff --git a/apps/web/package.json b/apps/web/package.jsonindex b63b792127..7168a54e26 100644--- a/apps/web/package.json+++ b/apps/web/package.json@@ -63,7 +63,7 @@"csv-parse": "^5.5.6","d3-array": "^3.2.4","date-fns": "^3.6.0",- "dub": "^0.32.0",+ "dub": "^0.36.0","fathom-client": "^3.7.2","framer-motion": "^10.16.16","fuse.js": "^6.6.2",diff --git a/pnpm-lock.yaml b/pnpm-lock.yamlindex 2f2f6e9fb9..02a9545fc9 100644--- a/pnpm-lock.yaml+++ b/pnpm-lock.yaml@@ -186,8 +186,8 @@ importers:specifier: ^3.6.0version: 3.6.0dub:- specifier: ^0.32.0- version: 0.32.0([email protected])+ specifier: ^0.36.0+ version: 0.36.0([email protected])fathom-client:specifier: ^3.7.2version: 3.7.2@@ -11856,8 +11856,8 @@ packages:resolution: {integrity: sha512-IPzF4w4/Rd94bA9imS68tZBaYyBWSCE47V1RGuMrB94iyTOIEwRmVL2x/4An+6mETpLrKJ5hQkB8W4kFAadeIQ==}engines: {node: '>=12'}- resolution: {integrity: sha512-MGo/309AUxsmSLyrbdre93H1qdqGJIG4obDqT1RYYLOJq2wlOuwiIGGsTayhmCpeWOjPvEbd9sU4TtU8y5zpKw==}+ resolution: {integrity: sha512-nrZvRu9//GtHFT0xWwcV7mox4JHzBKdZK1CGuEOtMPklnILeEXMjO77JKAFzTgMp9F0dcWujgRmv/BH+J7s00w==}peerDependencies:zod: '>= 3'dependencies: