The modern link attribution platform. Loved by world-class engineering teams at Twilio, Zillow, Jobber, Vercel, Raycast, and more.
TypeScript clickhousemysqlnextjsopen-sourceplanetscaleprismatailwindcsstinybirdtypescriptupstashvercel
Merge branch 'main' into clicks-migration
Steven Teyaf269db8f3ad
diff --cc apps/web/app/api/cron/usage/utils.tsindex 5d4ea18c95,fbcef3c8c2..b56befa69f--- a/apps/web/app/api/cron/usage/utils.ts+++ b/apps/web/app/api/cron/usage/utils.ts@@@ -116,21 -115,10 +115,10 @@@ export const updateUsage = async (skip?project.createdAt.getTime() <new Date().getTime() - 30 * 24 * 60 * 60 * 1000) {- const [createdLinks, topLinks] = await Promise.allSettled([- prisma.link.count({- where: {- project: {- id: project.id,- },- createdAt: {- // in the last 30 days- gte: new Date(new Date().setDate(new Date().getDate() - 30)),- },- },- }),+ const topLinks =project.usage > 0- ? getStats({+ ? await getStats({- domain: project.domains.map((domain) => domain.slug).join(","),+ projectId: project.id,endpoint: "top_links",interval: "30d",}).then((data) =>diff --cc apps/web/app/api/stats/[endpoint]/route.tsindex dead24e68f,0429511742..1934d5eb76--- a/apps/web/app/api/stats/[endpoint]/route.ts+++ b/apps/web/app/api/stats/[endpoint]/route.ts@@@ -1,6 -1,6 +1,7 @@@import { withAuth } from "@/lib/auth";+import { getDomainViaEdge, getLinkViaEdge } from "@/lib/planetscale";import { getStats } from "@/lib/stats";+ import { DUB_PROJECT_ID, isDubDomain } from "@dub/utils";import { NextResponse } from "next/server";// GET /api/stats/[endpoint] – get stats for a specific endpointdiff --cc apps/web/lib/types.tsindex 5da3f5c635,9f83e85c0c..8f9bcab887--- a/apps/web/lib/types.ts+++ b/apps/web/lib/types.ts@@@ -108,11 -98,11 +117,12 @@@ export interface DomainPropsslug: string;verified: boolean;primary: boolean;+ archived: boolean;target?: string;- type: "redirect" | "rewrite";+ type: string;placeholder?: string;clicks: number;+ projectId: string;}export interface BitlyGroupProps {diff --cc apps/web/package.jsonindex 3639149d5b,2836f9b05a..4b9413f60d--- a/apps/web/package.json+++ b/apps/web/package.json@@@ -52,9 -52,10 +52,9 @@@"he": "^1.2.0","html-escaper": "^3.0.3","js-cookie": "^3.0.5",- "linkify-react": "^4.1.3","lucide-react": "^0.299.0","nanoid": "^5.0.1",- "next": "14.0.5-canary.39",+ "next": "14.0.5-canary.55","next-auth": "^4.24.4","node-html-parser": "^6.1.4","nodemailer": "^6.9.3",diff --cc apps/web/ui/links/link-card.tsxindex 995eac0504,a96f6e17d6..eda198a411--- a/apps/web/ui/links/link-card.tsx+++ b/apps/web/ui/links/link-card.tsx@@@ -44,10 -43,10 +43,10 @@@ import} from "lucide-react";import Link from "next/link";import { useParams } from "next/navigation";-import Linkify from "linkify-react";import punycode from "punycode/";- import { useContext, useEffect, useMemo, useRef, useState } from "react";+ import { useEffect, useMemo, useRef, useState } from "react";import useSWR from "swr";+import { LinkifyTooltipContent } from "@dub/ui/src/tooltip";export default function LinkCard({props,diff --cc packages/utils/src/constants/index.tsindex dae2bc3503,00389f9b75..34a1ca09c7--- a/packages/utils/src/constants/index.ts+++ b/packages/utils/src/constants/index.ts@@@ -215,8 -220,8 +220,9 @@@ export const DEFAULT_LINK_PROPS =proxy: false,};+export const DEMO_LINK_ID = "clqo10sum0006js08vutzfxt3";export const DUB_PROJECT_ID = "cl7pj5kq4006835rbjlt2ofka";+ export const LEGAL_PROJECT_ID = "clrflia0j0000vs7sqfhz9c7q";export const LEGAL_USER_ID = "clqei1lgc0000vsnzi01pbf47";export const SAML_PROVIDERS = [diff --cc pnpm-lock.yamlindex 52b8713396,399ef2ece5..9aab28539d--- a/pnpm-lock.yaml+++ b/pnpm-lock.yaml@@@ -6258,7 -7917,7 +7917,7 @@@ packagesreact-native:optional: truedependencies:-- '@babel/runtime': 7.23.2++ '@babel/runtime': 7.23.8'@types/react-reconciler': 0.26.7base64-js: 1.5.1its-fine: 1.1.1([email protected])@@@ -7427,7 -9384,7 +9384,7 @@@'@vue/shared': 3.3.4estree-walker: 2.0.2magic-string: 0.30.4-- postcss: 8.4.31++ postcss: 8.4.32source-map-js: 1.0.2dev: true@@@ -11286,7 -14210,7 +14210,7 @@@resolution: {integrity: sha512-Orbvg18qXHCrSj1KbaeSDVYRy/gkro2PC7Fy2tDSH1c9RB4aH8tuMOIXnKJE+1SXxBtjWmQ5Yirwkth2DyyEZA==}engines: {node: '>=16'}dependencies:-- terser: 5.21.0++ terser: 5.27.0dev: false@@@ -11418,7 -14342,7 +14342,7 @@@resolution: {integrity: sha512-XKahvB+iuYJSCr3QqCpROli4B4zASAYpkK+j3a0CJmokxCDNbgyI4Fp88uIL6rNaZfN0Mv35S0b99SdFXIfHjg==}engines: {node: '>=16'}dependencies:-- '@babel/runtime': 7.23.2++ '@babel/runtime': 7.23.8react-refresh: 0.4.3dev: false@@@ -11991,6 -14932,12 +14932,11 @@@engines: {node: ^10 || ^12 || ^13.7 || ^14 || >=15.0.1}hasBin: true+ resolution: {integrity: sha512-eSRppjcPIatRIMC1U6UngP8XFcz8MQWGQdt1MTBQ7NaAmvXDfvNxbvWV3x2y6CdEUciCSsDHDQZbhYaB8QEo2g==}+ engines: {node: ^10 || ^12 || ^13.7 || ^14 || >=15.0.1}+ hasBin: true- dev: false+resolution: {integrity: sha512-vWeVtV5Cw68aML/QaZvqN/3QQXc6fBfIieAlu05m7FZW2Dgb+3f0xc0TTxuJW+7u30t7iSDTV/j3kVI0oJqIfQ==}engines: {node: ^18 || >=20}@@@ -12870,6 -16110,15 +16109,14 @@@picocolors: 1.0.0source-map-js: 1.0.2+ resolution: {integrity: sha512-D/kj5JNu6oo2EIy+XL/26JEDTlIbB8hw85G8StOE6L74RQAVVP5rej6wxCNqyMbR4RkPfqvezVbPw81Ngd6Kcw==}+ engines: {node: ^10 || ^12 || >=14}+ dependencies:+ nanoid: 3.3.7+ picocolors: 1.0.0+ source-map-js: 1.0.2- dev: false+resolution: {integrity: sha512-VpZrUqU5A69eQyW2c5CA1jtLecCsN2U/bD6VilrFDWq5+5UIEVO7nazS3TEcHf1zuPYO/sqGvUvW62g86RXZuA==}engines: {node: '>=4'}@@@ -13666,7 -17126,7 +17124,7 @@@resolution: {integrity: sha512-hfMp2BoF0qOk3uc5V20ALGDS2ddjQaLrdl7xrGXvAIow7qeWRM2VA2HuCHkUKk9slq3VwEwLNK3DFBqDfPGYtg==}dependencies:-- '@babel/runtime': 7.23.2++ '@babel/runtime': 7.23.8dev: false@@@ -14540,8 -18225,45 +18223,34 @@@rimraf: 2.6.3dev: false- resolution: {integrity: sha512-WtnFKrxu9kaoXuiZFSGrcAvvBqAdmKx0SFNmVNYdJamMu9yyN3I/QF0FbH4QcqJQ+y1CJnzxGIKH0cSj+FGYRw==}+ resolution: {integrity: sha512-BKFPWlPDndPs+NGGCr1U59t0XScL5317Y0UReNrHaw9/FwhPENlq6bfgs+4yPfyP51vqC1bQ4rp1EfXW5ZSH9w==}+ engines: {node: '>= 10.13.0'}+ peerDependencies:+ '@swc/core': '*'+ esbuild: '*'+ uglify-js: '*'+ webpack: ^5.1.0+ peerDependenciesMeta:+ '@swc/core':+ optional: true+ esbuild:+ optional: true+ uglify-js:+ optional: true+ dependencies:+ '@jridgewell/trace-mapping': 0.3.22+ '@swc/core': 1.3.101+ esbuild: 0.19.11+ jest-worker: 27.5.1+ schema-utils: 3.3.0+ serialize-javascript: 6.0.2+ terser: 5.27.0+ webpack: 5.89.0(@swc/[email protected])([email protected])+ dev: false+- resolution: {integrity: sha512-WtnFKrxu9kaoXuiZFSGrcAvvBqAdmKx0SFNmVNYdJamMu9yyN3I/QF0FbH4QcqJQ+y1CJnzxGIKH0cSj+FGYRw==}- engines: {node: '>=10'}- hasBin: true- dependencies:- '@jridgewell/source-map': 0.3.5- acorn: 8.10.0- commander: 2.20.3- source-map-support: 0.5.21- dev: false-+ resolution: {integrity: sha512-bi1HRwVRskAjheeYl291n3JC4GgO/Ty4z1nVs5AAsmonJulGxpSektecnNedrwK9C7vpvVtcX3cw00VSLt7U2A==}engines: {node: '>=10'}hasBin: truedependencies: