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.

Merge branch 'main' into analytics-rate-limit

Steven Tey17b9868d6a33
diff --cc apps/web/lib/auth/partner.ts
index 2d81130c42,1558feb6fd..5e90c6da36
--- a/apps/web/lib/auth/partner.ts
+++ b/apps/web/lib/auth/partner.ts
@@@ -1,12 -1,12 +1,13 @@@
import { DubApiError, handleAndReturnErrorResponse } from "@/lib/api/errors";
+ import { withAxiom } from "@/lib/axiom/server";
import { PartnerProps } from "@/lib/types";
import { prisma } from "@dub/prisma";
-import { getSearchParams } from "@dub/utils";
+import { getSearchParams, PARTNERS_DOMAIN } from "@dub/utils";
import { PartnerUser } from "@prisma/client";
- import { AxiomRequest, withAxiom } from "next-axiom";
- import { Permission, throwIfNoPermission } from "./partner-user-permissions";
+ import { Permission } from "./partner-users/partner-user-permissions";
+ import { throwIfNoPermission } from "./partner-users/throw-if-no-permission";
-import { Session, getSession } from "./utils";
+import { rateLimitRequest } from "./rate-limit-request";
+import { getSession, Session } from "./utils";
interface WithPartnerProfileHandler {
({
@@@ -163,11 -123,9 +164,10 @@@ export const withPartnerProfile =
userId: partnerUser.userId,
role: partnerUser.role,
},
+ headers: responseHeaders,
});
} catch (error) {
- req.log.error(error);
- return handleAndReturnErrorResponse(error);
+ return handleAndReturnErrorResponse(error, responseHeaders);
}
},
);
diff --cc apps/web/lib/auth/workspace.ts
index e4945fea1d,282fba8c02..906afb17bc
--- a/apps/web/lib/auth/workspace.ts
+++ b/apps/web/lib/auth/workspace.ts
@@@ -2,9 -2,8 +2,8 @@@ import { DubApiError, handleAndReturnEr
import { BetaFeatures, PlanProps, WorkspaceWithUsers } from "@/lib/types";
import { ratelimit } from "@/lib/upstash";
import { prisma } from "@dub/prisma";
-import { API_DOMAIN, getSearchParams } from "@dub/utils";
+import { API_DOMAIN, getCurrentPlan, getSearchParams } from "@dub/utils";
import { waitUntil } from "@vercel/functions";
- import { AxiomRequest, withAxiom } from "next-axiom";
import { headers } from "next/headers";
import {
PermissionAction,
diff --cc packages/utils/src/constants/pricing.tsx
index 0bddc61657,1f08b96516..a11de96e04
--- a/packages/utils/src/constants/pricing.tsx
+++ b/packages/utils/src/constants/pricing.tsx
@@@ -88,9 -168,21 +169,22 @@@ export const PLANS: PlanDetails[] =
users: 3,
ai: 1_000,
api: 600,
+ analyticsApi: 2,
retention: "1-year",
},
+ tiers: {
+ 2: {
+ price: {
+ monthly: 60,
+ yearly: 50,
+ ids: PRO_TIER_PRICE_IDS[2],
+ },
+ limits: {
+ links: 5_000,
+ clicks: 150_000,
+ },
+ },
+ },
featureTitle: "Everything in Free, plus:",
features: [
{ id: "clicks", text: "50K tracked clicks/mo" },
@@@ -164,9 -256,21 +258,22 @@@
users: 10,
ai: 1_000,
api: 1_200,
+ analyticsApi: 4,
retention: "3-year",
},
+ tiers: {
+ 2: {
+ price: {
+ monthly: 180,
+ yearly: 150,
+ ids: BUSINESS_TIER_PRICE_IDS[2],
+ },
+ limits: {
+ links: 25_000,
+ clicks: 600_000,
+ },
+ },
+ },
featureTitle: "Everything in Pro, plus:",
features: [
{
@@@ -264,9 -363,32 +366,33 @@@
users: 20,
ai: 1_000,
api: 3_000,
+ analyticsApi: 8,
retention: "5-year",
},
+ tiers: {
+ 2: {
+ price: {
+ monthly: 600,
+ yearly: 500,
+ ids: ADVANCED_TIER_PRICE_IDS[2],
+ },
+ limits: {
+ links: 150_000,
+ clicks: 2_000_000,
+ },
+ },
+ 3: {
+ price: {
+ monthly: 900,
+ yearly: 750,
+ ids: ADVANCED_TIER_PRICE_IDS[3],
+ },
+ limits: {
+ links: 300_000,
+ clicks: 3_500_000,
+ },
+ },
+ },
featureTitle: "Everything in Business, plus:",
features: [
{