The modern link attribution platform. Loved by world-class engineering teams at Twilio, Zillow, Jobber, Vercel, Raycast, and more.
TypeScript clickhousemysqlnextjsopen-sourceplanetscaleprismatailwindcsstinybirdtypescriptupstashvercel
remove script, fix stripe past_due subscription
Steven Teyc40b51f02a68
diff --git a/apps/web/app/api/workspaces/[idOrSlug]/billing/upgrade/route.ts b/apps/web/app/api/workspaces/[idOrSlug]/billing/upgrade/route.tsindex 8a118c2d8f..313acac0cf 100644--- a/apps/web/app/api/workspaces/[idOrSlug]/billing/upgrade/route.ts+++ b/apps/web/app/api/workspaces/[idOrSlug]/billing/upgrade/route.ts@@ -40,18 +40,12 @@ export const POST = withWorkspace(}const existingSubscription = workspace.stripeId- ? await Promise.all([- stripe.subscriptions.list({+ ? await stripe.subscriptions+ .list({customer: workspace.stripeId,- status: "active",limit: 1,- }),- stripe.subscriptions.list({- customer: workspace.stripeId,- status: "trialing",- limit: 1,- }),- ]).then(([active, trialing]) => active.data[0] ?? trialing.data[0])+ })+ .then((res) => res.data[0]): null;if (process.env.VERCEL === "1" && process.env.VERCEL_ENV === "preview") {diff --git a/apps/web/scripts/misc/remove-dub-domain-targeting.ts b/apps/web/scripts/misc/remove-dub-domain-targeting.tsdeleted file mode 100644index 04d139b153..0000000000--- a/apps/web/scripts/misc/remove-dub-domain-targeting.ts+++ /dev/null@@ -1,82 +0,0 @@-import { prisma } from "@/lib/prisma";-import { DUB_DOMAINS } from "@dub/utils";-import { Prisma } from "@prisma/client";-import "dotenv-flow/config";-import { linkCache } from "../../lib/api/links/cache";--const RESTRICTED_DOMAINS = DUB_DOMAINS.filter(- (d) => d.allowedHostnames.length > 0,-).map((d) => d.slug);--async function main() {- console.log(- `Looking for links on [${RESTRICTED_DOMAINS.join(", ")}] with targeting configured...`,- );-- let totalCleared = 0;-- while (true) {- const links = await prisma.link.findMany({- where: {- domain: { in: RESTRICTED_DOMAINS },- OR: [- { ios: { not: null } },- { android: { not: null } },- { geo: { not: Prisma.DbNull } },- { testVariants: { not: Prisma.DbNull } },- ],- },- select: {- id: true,- domain: true,- key: true,- ios: true,- android: true,- geo: true,- testVariants: true,- },- take: 500,- });-- if (links.length === 0) {- console.log("No more links to clean up. Exiting...");- break;- }-- console.table(- links.map((link) => ({- id: link.id,- domain: link.domain,- key: link.key,- ios: Boolean(link.ios),- android: Boolean(link.android),- geo: Boolean(link.geo),- testVariants: Boolean(link.testVariants),- })),- );-- const { count } = await prisma.link.updateMany({- where: {- id: { in: links.map((link) => link.id) },- },- data: {- ios: null,- android: null,- geo: Prisma.DbNull,- testVariants: Prisma.DbNull,- testStartedAt: null,- testCompletedAt: null,- },- });-- console.log(`Cleared targeting fields on ${count} links`);- totalCleared += count;-- const res = await linkCache.expireMany(links);- console.log("Expired Redis cache:", res);- }-- console.log(`Done. Cleared targeting on ${totalCleared} links total.`);-}--main();diff --git a/packages/email/src/templates/workspace-disabled.tsx b/packages/email/src/templates/workspace-disabled.tsxindex 349cfbb682..6b0457e7ed 100644--- a/packages/email/src/templates/workspace-disabled.tsx+++ b/packages/email/src/templates/workspace-disabled.tsx@@ -70,9 +70,9 @@ export default function WorkspaceDisabled({><strong>{name}</strong></Link>{" "}- has used <strong>{percentage}%</strong> of the monthly events- limit included in the {capitalize(plan)} plan, which is in- violation of our{" "}+ has used <strong>{percentage}%</strong> of the events limit+ included in the {capitalize(plan)} plan, which is in violation of+ our{" "}<Linkhref="https://dub.co/legal/terms"className="font-semibold text-black underline"@@ -81,8 +81,7 @@ export default function WorkspaceDisabled({</Link>. You have used a total of{" "}<strong>{nFormatter(usage, { full: true })} events</strong> (out- of a maximum of {nFormatter(usageLimit, { full: true })} events)- in your current billing cycle.+ of a maximum of {nFormatter(usageLimit, { full: true })} events).</Text><Text className="text-sm leading-6 text-black">