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.

Reorganize postback modules under lib/postback (#3781)

Kiran Kb50def47111c
diff --git a/apps/web/app/(ee)/api/partner-profile/postbacks/[postbackId]/events/route.ts b/apps/web/app/(ee)/api/partner-profile/postbacks/[postbackId]/events/route.ts
index 1231e2c1a9..ecbda16b12 100644
--- a/apps/web/app/(ee)/api/partner-profile/postbacks/[postbackId]/events/route.ts
+++ b/apps/web/app/(ee)/api/partner-profile/postbacks/[postbackId]/events/route.ts
@@ -1,6 +1,6 @@
-import { getPostbackOrThrow } from "@/lib/api/postbacks/get-postback-or-throw";
import { withPartnerProfile } from "@/lib/auth/partner";
-import { getPostbackEvents } from "@/lib/postback/api/get-postback-events";
+import { getPostbackEvents } from "@/lib/postback/get-postback-events";
+import { getPostbackOrThrow } from "@/lib/postback/get-postback-or-throw";
import { NextResponse } from "next/server";
// GET /api/partner-profile/postbacks/[postbackId]/events
diff --git a/apps/web/app/(ee)/api/partner-profile/postbacks/[postbackId]/rotate-secret/route.ts b/apps/web/app/(ee)/api/partner-profile/postbacks/[postbackId]/rotate-secret/route.ts
index 5a63450327..09ad1f7405 100644
--- a/apps/web/app/(ee)/api/partner-profile/postbacks/[postbackId]/rotate-secret/route.ts
+++ b/apps/web/app/(ee)/api/partner-profile/postbacks/[postbackId]/rotate-secret/route.ts
@@ -1,10 +1,10 @@
import { createToken } from "@/lib/api/oauth/utils";
-import { getPostbackOrThrow } from "@/lib/api/postbacks/get-postback-or-throw";
import { withPartnerProfile } from "@/lib/auth/partner";
import {
POSTBACK_SECRET_LENGTH,
POSTBACK_SECRET_PREFIX,
} from "@/lib/postback/constants";
+import { getPostbackOrThrow } from "@/lib/postback/get-postback-or-throw";
import { prisma } from "@dub/prisma";
import { NextResponse } from "next/server";
diff --git a/apps/web/app/(ee)/api/partner-profile/postbacks/[postbackId]/route.ts b/apps/web/app/(ee)/api/partner-profile/postbacks/[postbackId]/route.ts
index 0e29517e86..eb1d016598 100644
--- a/apps/web/app/(ee)/api/partner-profile/postbacks/[postbackId]/route.ts
+++ b/apps/web/app/(ee)/api/partner-profile/postbacks/[postbackId]/route.ts
@@ -1,6 +1,6 @@
-import { getPostbackOrThrow } from "@/lib/api/postbacks/get-postback-or-throw";
import { parseRequestBody } from "@/lib/api/utils";
import { withPartnerProfile } from "@/lib/auth/partner";
+import { getPostbackOrThrow } from "@/lib/postback/get-postback-or-throw";
import {
postbackSchema,
updatePostbackInputSchema,
diff --git a/apps/web/app/(ee)/api/partner-profile/postbacks/[postbackId]/send-test/route.ts b/apps/web/app/(ee)/api/partner-profile/postbacks/[postbackId]/send-test/route.ts
index 3626b2a1ba..453919f051 100644
--- a/apps/web/app/(ee)/api/partner-profile/postbacks/[postbackId]/send-test/route.ts
+++ b/apps/web/app/(ee)/api/partner-profile/postbacks/[postbackId]/send-test/route.ts
@@ -1,12 +1,12 @@
import { DubApiError } from "@/lib/api/errors";
-import { getPostbackOrThrow } from "@/lib/api/postbacks/get-postback-or-throw";
import { parseRequestBody } from "@/lib/api/utils";
import { withPartnerProfile } from "@/lib/auth/partner";
-import { sendPartnerPostback } from "@/lib/postback/api/send-partner-postback";
+import { getPostbackOrThrow } from "@/lib/postback/get-postback-or-throw";
import commissionCreated from "@/lib/postback/sample-events/commission-created.json";
import leadCreated from "@/lib/postback/sample-events/lead-created.json";
import saleCreated from "@/lib/postback/sample-events/sale-created.json";
import { sendTestPostbackInputSchema } from "@/lib/postback/schemas";
+import { sendPartnerPostback } from "@/lib/postback/send-partner-postback";
import { PostbackTrigger } from "@/lib/types";
import { NextResponse } from "next/server";
diff --git a/apps/web/app/(ee)/api/partner-profile/postbacks/route.ts b/apps/web/app/(ee)/api/partner-profile/postbacks/route.ts
index b8019cbb63..c226419dcb 100644
--- a/apps/web/app/(ee)/api/partner-profile/postbacks/route.ts
+++ b/apps/web/app/(ee)/api/partner-profile/postbacks/route.ts
@@ -3,7 +3,6 @@ import { DubApiError } from "@/lib/api/errors";
import { createToken } from "@/lib/api/oauth/utils";
import { parseRequestBody } from "@/lib/api/utils";
import { withPartnerProfile } from "@/lib/auth/partner";
-import { identifyPostbackChannel } from "@/lib/postback/api/utils";
import {
MAX_POSTBACKS,
POSTBACK_SECRET_LENGTH,
@@ -14,6 +13,7 @@ import {
createPostbackOutputSchema,
postbackSchema,
} from "@/lib/postback/schemas";
+import { identifyPostbackChannel } from "@/lib/postback/utils";
import { prisma } from "@dub/prisma";
import { NextResponse } from "next/server";
import * as z from "zod/v4";
diff --git a/apps/web/app/(ee)/api/stripe/integration/webhook/checkout-session-completed.ts b/apps/web/app/(ee)/api/stripe/integration/webhook/checkout-session-completed.ts
index 2915c5c4a6..1627cd2477 100644
--- a/apps/web/app/(ee)/api/stripe/integration/webhook/checkout-session-completed.ts
+++ b/apps/web/app/(ee)/api/stripe/integration/webhook/checkout-session-completed.ts
@@ -7,7 +7,7 @@ import { syncPartnerLinksStats } from "@/lib/api/partners/sync-partner-links-sta
import { executeWorkflows } from "@/lib/api/workflows/execute-workflows";
import { generateRandomName } from "@/lib/names";
import { createPartnerCommission } from "@/lib/partners/create-partner-commission";
-import { sendPartnerPostback } from "@/lib/postback/api/send-partner-postback";
+import { sendPartnerPostback } from "@/lib/postback/send-partner-postback";
import {
getClickEvent,
getLeadEvent,
diff --git a/apps/web/app/(ee)/api/stripe/integration/webhook/invoice-paid.ts b/apps/web/app/(ee)/api/stripe/integration/webhook/invoice-paid.ts
index 7d55570096..64bf076b01 100644
--- a/apps/web/app/(ee)/api/stripe/integration/webhook/invoice-paid.ts
+++ b/apps/web/app/(ee)/api/stripe/integration/webhook/invoice-paid.ts
@@ -5,7 +5,7 @@ import { includeTags } from "@/lib/api/links/include-tags";
import { syncPartnerLinksStats } from "@/lib/api/partners/sync-partner-links-stats";
import { executeWorkflows } from "@/lib/api/workflows/execute-workflows";
import { createPartnerCommission } from "@/lib/partners/create-partner-commission";
-import { sendPartnerPostback } from "@/lib/postback/api/send-partner-postback";
+import { sendPartnerPostback } from "@/lib/postback/send-partner-postback";
import { getLeadEvent, recordSale } from "@/lib/tinybird";
import { StripeMode } from "@/lib/types";
import { redis } from "@/lib/upstash";
diff --git a/apps/web/app/(ee)/api/stripe/integration/webhook/utils/create-new-customer.ts b/apps/web/app/(ee)/api/stripe/integration/webhook/utils/create-new-customer.ts
index 46d6f0a60b..2d698f12f3 100644
--- a/apps/web/app/(ee)/api/stripe/integration/webhook/utils/create-new-customer.ts
+++ b/apps/web/app/(ee)/api/stripe/integration/webhook/utils/create-new-customer.ts
@@ -3,7 +3,7 @@ import { includeTags } from "@/lib/api/links/include-tags";
import { syncPartnerLinksStats } from "@/lib/api/partners/sync-partner-links-stats";
import { executeWorkflows } from "@/lib/api/workflows/execute-workflows";
import { generateRandomName } from "@/lib/names";
-import { sendPartnerPostback } from "@/lib/postback/api/send-partner-postback";
+import { sendPartnerPostback } from "@/lib/postback/send-partner-postback";
import { getClickEvent, recordLead } from "@/lib/tinybird";
import { redis } from "@/lib/upstash";
import { sendWorkspaceWebhook } from "@/lib/webhook/publish";
diff --git a/apps/web/app/(ee)/partners.dub.co/(onboarding)/layout.tsx b/apps/web/app/(ee)/partners.dub.co/(onboarding)/layout.tsx
index a5f0e3cbe6..7780c1f00b 100644
--- a/apps/web/app/(ee)/partners.dub.co/(onboarding)/layout.tsx
+++ b/apps/web/app/(ee)/partners.dub.co/(onboarding)/layout.tsx
@@ -65,7 +65,9 @@ export default function PartnerOnboardingLayout({
</div>
<div className="w-full flex-1 overflow-y-auto md:flex-none md:overflow-visible">
- <div className="w-full pt-8 pb-8 sm:pb-4 md:py-16 px-5 md:px-0">{children}</div>
+ <div className="w-full px-5 pb-8 pt-8 sm:pb-4 md:px-0 md:py-16">
+ {children}
+ </div>
</div>
<div className="w-full md:hidden">
diff --git a/apps/web/app/(ee)/partners.dub.co/(onboarding)/onboarding/onboarding-form.tsx b/apps/web/app/(ee)/partners.dub.co/(onboarding)/onboarding/onboarding-form.tsx
index 254b59547d..019a14185c 100644
--- a/apps/web/app/(ee)/partners.dub.co/(onboarding)/onboarding/onboarding-form.tsx
+++ b/apps/web/app/(ee)/partners.dub.co/(onboarding)/onboarding/onboarding-form.tsx
@@ -165,9 +165,7 @@ export function OnboardingForm({
<p className="text-xs font-medium text-neutral-600">
Visible to programs and helps with approvals
</p>
- <p className="mt-0.5 text-xs text-neutral-500">
- Max 2 MB
- </p>
+ <p className="mt-0.5 text-xs text-neutral-500">Max 2 MB</p>
</div>
</div>
</label>
diff --git a/apps/web/app/(ee)/partners.dub.co/(onboarding)/onboarding/payouts/page.tsx b/apps/web/app/(ee)/partners.dub.co/(onboarding)/onboarding/payouts/page.tsx
index 5bc75fcc98..eb82c71c8d 100644
--- a/apps/web/app/(ee)/partners.dub.co/(onboarding)/onboarding/payouts/page.tsx
+++ b/apps/web/app/(ee)/partners.dub.co/(onboarding)/onboarding/payouts/page.tsx
@@ -9,7 +9,7 @@ import { Suspense } from "react";
export default function OnboardingVerificationPage() {
return (
<div className="relative mx-auto flex w-full max-w-[600px] flex-col items-center text-center md:mt-6">
- <h1 className="animate-slide-up-fade text-content-emphasis text-xl text-center font-semibold [--offset:8px] [animation-delay:250ms] [animation-duration:1s] [animation-fill-mode:both]">
+ <h1 className="animate-slide-up-fade text-content-emphasis text-center text-xl font-semibold [--offset:8px] [animation-delay:250ms] [animation-duration:1s] [animation-fill-mode:both]">
Connect payouts
</h1>
<p className="animate-slide-up-fade mt-1 text-center text-base text-neutral-500 [--offset:8px] [animation-delay:250ms] [animation-duration:1s] [animation-fill-mode:both]">
diff --git a/apps/web/app/api/postbacks/callback/route.ts b/apps/web/app/api/postbacks/callback/route.ts
index c250cdb4fd..951729454a 100644
--- a/apps/web/app/api/postbacks/callback/route.ts
+++ b/apps/web/app/api/postbacks/callback/route.ts
@@ -1,5 +1,5 @@
import { verifyQstashSignature } from "@/lib/cron/verify-qstash";
-import { recordPostbackEvent } from "@/lib/postback/api/record-postback-event";
+import { recordPostbackEvent } from "@/lib/postback/record-postback-event";
import {
postbackCallbackBodySchema,
postbackCallbackParamsSchema,
diff --git a/apps/web/app/app.dub.co/(dashboard)/[slug]/(ee)/program/partners/invite-partner-sheet.tsx b/apps/web/app/app.dub.co/(dashboard)/[slug]/(ee)/program/partners/invite-partner-sheet.tsx
index 3c46c3746d..e84a04fd70 100644
--- a/apps/web/app/app.dub.co/(dashboard)/[slug]/(ee)/program/partners/invite-partner-sheet.tsx
+++ b/apps/web/app/app.dub.co/(dashboard)/[slug]/(ee)/program/partners/invite-partner-sheet.tsx
@@ -668,8 +668,14 @@ function InvitePreviewProgramDetails() {
</div>
<div className="mt-3 grid grid-cols-2 gap-3">
- <PreviewInfoCard icon={<Gift className="size-5" />} label="Eligible Rewards" />
- <PreviewInfoCard icon={<Trophy className="size-5" />} label="Eligible Bounties" />
+ <PreviewInfoCard
+ icon={<Gift className="size-5" />}
+ label="Eligible Rewards"
+ />
+ <PreviewInfoCard
+ icon={<Trophy className="size-5" />}
+ label="Eligible Bounties"
+ />
</div>
<Button
@@ -681,13 +687,7 @@ function InvitePreviewProgramDetails() {
);
}
-function PreviewInfoCard({
- icon,
- label,
-}: {
- icon: ReactNode;
- label: string;
-}) {
+function PreviewInfoCard({ icon, label }: { icon: ReactNode; label: string }) {
return (
<div className="flex flex-col items-center justify-center rounded-lg border border-blue-100 bg-blue-100 px-4 pb-3 pt-4 text-center text-blue-900">
<div className="mb-1.5">{icon}</div>
diff --git a/apps/web/app/app.dub.co/(onboarding)/onboarding/(steps)/layout.tsx b/apps/web/app/app.dub.co/(onboarding)/onboarding/(steps)/layout.tsx
index b3fc7389f2..1645e76e53 100644
--- a/apps/web/app/app.dub.co/(onboarding)/onboarding/(steps)/layout.tsx
+++ b/apps/web/app/app.dub.co/(onboarding)/onboarding/(steps)/layout.tsx
@@ -44,7 +44,7 @@ export default function Layout({ children }: PropsWithChildren) {
))}
</div>
- <div className="relative flex min-h-screen min-h-[100dvh] w-full flex-col items-center overflow-hidden md:justify-between">
+ <div className="relative flex min-h-[100dvh] min-h-screen w-full flex-col items-center overflow-hidden md:justify-between">
<div className="w-full px-4 pt-4 md:grow md:basis-0 md:px-0">
<div className="flex justify-center pt-4">
<Link href="https://dub.co/home" target="_blank" className="block">
@@ -54,7 +54,7 @@ export default function Layout({ children }: PropsWithChildren) {
</div>
<div className="w-full flex-1 overflow-y-auto md:flex-none md:overflow-visible">
- <div className="w-full px-5 pb-8 pt-8 lg:px-0 md:py-16">
+ <div className="w-full px-5 pb-8 pt-8 md:py-16 lg:px-0">
{children}
</div>
</div>
diff --git a/apps/web/app/app.dub.co/(onboarding)/onboarding/(steps)/plan/plan-selector.tsx b/apps/web/app/app.dub.co/(onboarding)/onboarding/(steps)/plan/plan-selector.tsx
index 0f6b3c6b22..a74f1271ed 100644
--- a/apps/web/app/app.dub.co/(onboarding)/onboarding/(steps)/plan/plan-selector.tsx
+++ b/apps/web/app/app.dub.co/(onboarding)/onboarding/(steps)/plan/plan-selector.tsx
@@ -48,8 +48,8 @@ export function PlanSelector({ product }: { product: OnboardingProduct }) {
className={cn(
"mx-auto grid max-w-[calc(var(--cols)*342px)] grid-cols-[repeat(var(--cols),1fr)]",
- // Mobile
- "max-lg:w-[calc(var(--cols)*100cqw+(var(--cols)-1)*32px)] max-lg:max-w-none max-lg:translate-x-[calc(-1*var(--index)*(100cqw+32px))] max-lg:gap-x-8 max-lg:transition-transform",
+ // Mobile
+ "max-lg:w-[calc(var(--cols)*100cqw+(var(--cols)-1)*32px)] max-lg:max-w-none max-lg:translate-x-[calc(-1*var(--index)*(100cqw+32px))] max-lg:gap-x-8 max-lg:transition-transform",
)}
style={
{
@@ -59,10 +59,11 @@ export function PlanSelector({ product }: { product: OnboardingProduct }) {
}
>
{plans.map((plan) => {
- const features = PRICING_PLAN_MAIN_FEATURES[product][plan.name] || [];
+ const features =
+ PRICING_PLAN_MAIN_FEATURES[product][plan.name] || [];
- return (
- <div
+ return (
+ <div
key={plan.name}
className={cn(
"flex flex-col border-y border-l border-neutral-200 bg-white first:rounded-l-lg last:rounded-r-lg last:border-r",
@@ -75,227 +76,230 @@ export function PlanSelector({ product }: { product: OnboardingProduct }) {
"bg-gradient-to-b from-violet-50 to-40%",
)}
>
- <div className="flex grow flex-col gap-6 p-5 pb-3">
- <div>
- <div className="flex items-center gap-2">
- <h2 className="text-xl font-semibold text-neutral-800">
- {plan.name}
- </h2>
- {product === "links" && plan.name === "Business" && (
- <div className="w-fit whitespace-nowrap rounded-full bg-orange-900 px-2 py-1.5 text-center text-[0.5rem] font-medium uppercase leading-none text-white">
- Popular
- </div>
- )}
- {product === "partners" && plan.name === "Advanced" && (
- <div className="w-fit whitespace-nowrap rounded-full bg-violet-900 px-2 py-1.5 text-center text-[0.5rem] font-medium uppercase leading-none text-white">
- Best Value
+ <div className="flex grow flex-col gap-6 p-5 pb-3">
+ <div>
+ <div className="flex items-center gap-2">
+ <h2 className="text-xl font-semibold text-neutral-800">
+ {plan.name}
+ </h2>
+ {product === "links" && plan.name === "Business" && (
+ <div className="w-fit whitespace-nowrap rounded-full bg-orange-900 px-2 py-1.5 text-center text-[0.5rem] font-medium uppercase leading-none text-white">
+ Popular
+ </div>
+ )}
+ {product === "partners" && plan.name === "Advanced" && (
+ <div className="w-fit whitespace-nowrap rounded-full bg-violet-900 px-2 py-1.5 text-center text-[0.5rem] font-medium uppercase leading-none text-white">
+ Best Value
+ </div>
+ )}
+ </div>
+ <div className="mt-1">
+ {plan.name === "Enterprise" ? (
+ <span className="block text-base text-neutral-700">
+ Custom
+ </span>
+ ) : (
+ <>
+ <NumberFlow
+ value={plan.price[period]!}
+ className="text-base tabular-nums text-neutral-700"
+ format={{
+ style: "currency",
+ currency: "USD",
+ minimumFractionDigits: 0,
+ }}
+ continuous
+ />
+ <span className="text-sm text-neutral-400">
+ {" "}
+ per month
+ </span>
+ </>
+ )}
+ </div>
+
+ {plan.name === "Enterprise" ? (
+ <div className="mt-4 flex items-center gap-1.5 text-neutral-400">
+ <CalendarRefresh className="size-4 shrink-0" />
+ <span className="text-sm font-medium">
+ Tailored pricing terms
+ </span>
</div>
+ ) : (
+ <label className="mt-4 flex items-center gap-1.5">
+ <Switch
+ checked={period === "yearly"}
+ fn={(checked) =>
+ setPeriod(checked ? "yearly" : "monthly")
+ }
+ trackDimensions="radix-state-checked:bg-black focus-visible:ring-black/20 w-7 h-4"
+ thumbDimensions="size-3"
+ thumbTranslate="translate-x-3"
+ />
+ <div className="flex items-center gap-1 text-sm font-medium text-neutral-600">
+ <span>Billed yearly</span>
+ <Badge
+ variant="outline"
+ size="sm"
+ className={cn(
+ "animate-in fade-in-0 slide-in-from-right-2 duration-150",
+ period === "monthly" &&
+ "-translate-x-2 opacity-0",
+ )}
+ >
+ Save 17%
+ </Badge>
+ </div>
+ </label>
)}
</div>
- <div className="mt-1">
+
+ <p className="min-h-10 text-sm text-neutral-600">
+ {PRICING_PLAN_TAGLINES[product][plan.name]}
+ </p>
+
+ <div className="flex gap-2">
+ <button
+ type="button"
+ className="h-full w-fit rounded-lg bg-neutral-100 px-2.5 transition-colors duration-75 hover:bg-neutral-200/80 enabled:active:bg-neutral-200 disabled:opacity-30 lg:hidden"
+ disabled={mobilePlanIndex === 0}
+ onClick={() => setMobilePlanIndex(mobilePlanIndex - 1)}
+ >
+ <ChevronLeft className="size-5 text-neutral-800" />
+ </button>
{plan.name === "Enterprise" ? (
- <span className="block text-base text-neutral-700">
- Custom
- </span>
- ) : (
- <>
- <NumberFlow
- value={plan.price[period]!}
- className="text-base tabular-nums text-neutral-700"
- format={{
- style: "currency",
- currency: "USD",
- minimumFractionDigits: 0,
- }}
- continuous
+ <a
+ href="https://dub.co/contact/sales"
+ target="_blank"
+ className="w-full"
+ >
+ <Button
+ text="Contact us"
+ className="h-10 rounded-lg shadow-sm"
/>
- <span className="text-sm text-neutral-400">
- {" "}
- per month
- </span>
- </>
+ </a>
+ ) : (
+ <UpgradePlanButton
+ plan={plan.name.toLowerCase()}
+ period={period}
+ text="Get started"
+ className="h-10 rounded-lg shadow-sm"
+ />
)}
+ <button
+ type="button"
+ className="h-full w-fit rounded-lg bg-neutral-100 px-2.5 transition-colors duration-75 hover:bg-neutral-200/80 active:bg-neutral-200 disabled:opacity-30 lg:hidden"
+ disabled={mobilePlanIndex >= plans.length - 1}
+ onClick={() => setMobilePlanIndex(mobilePlanIndex + 1)}
+ >
+ <ChevronRight className="size-5 text-neutral-800" />
+ </button>
</div>
+ <div className="flex flex-col gap-3 text-sm">
+ {features.map(({ title, subtitle, features }, idx) => (
+ <div key={idx} className="relative flex flex-col">
+ {title && (
+ <h4 className="mb-3 font-medium text-neutral-700">
+ {title}
+ </h4>
+ )}
+ {subtitle && (
+ <p className="mb-2.5 text-neutral-500">{subtitle}</p>
+ )}
+ <ul className="flex flex-col gap-2.5 pb-3">
+ {features.map(
+ ({ id, text, tooltip, disabled }, idx) => {
+ const Icon =
+ id && PLAN_FEATURE_ICONS[id]
+ ? PLAN_FEATURE_ICONS[id]
+ : Check;
- {plan.name === "Enterprise" ? (
- <div className="mt-4 flex items-center gap-1.5 text-neutral-400">
- <CalendarRefresh className="size-4 shrink-0" />
- <span className="text-sm font-medium">
- Tailored pricing terms
- </span>
- </div>
- ) : (
- <label className="mt-4 flex items-center gap-1.5">
- <Switch
- checked={period === "yearly"}
- fn={(checked) =>
- setPeriod(checked ? "yearly" : "monthly")
- }
- trackDimensions="radix-state-checked:bg-black focus-visible:ring-black/20 w-7 h-4"
- thumbDimensions="size-3"
- thumbTranslate="translate-x-3"
- />
- <div className="flex items-center gap-1 text-sm font-medium text-neutral-600">
- <span>Billed yearly</span>
- <Badge
- variant="outline"
- size="sm"
- className={cn(
- "animate-in fade-in-0 slide-in-from-right-2 duration-150",
- period === "monthly" && "-translate-x-2 opacity-0",
+ return (
+ <li
+ key={idx}
+ className={cn(
+ "flex items-center gap-2 text-neutral-600",
+ disabled && "opacity-40",
+ )}
+ >
+ {disabled ? (
+ <X className="size-3 shrink-0" />
+ ) : Icon ? (
+ <Icon className="size-4 shrink-0" />
+ ) : (
+ <Check className="size-3 shrink-0" />
+ )}
+ {tooltip ? (
+ <Tooltip
+ content={
+ typeof tooltip === "string" ||
+ isReactNode(tooltip)
+ ? tooltip
+ : `${tooltip.title}${tooltip.cta && tooltip.href ? ` [${tooltip.cta}](${tooltip.href})` : ""}`
+ }
+ >
+ <p className="cursor-help underline decoration-dotted underline-offset-2">
+ {text}
+ </p>
+ </Tooltip>
+ ) : (
+ <p>{text}</p>
+ )}
+ </li>
+ );
+ },
)}
- >
- Save 17%
- </Badge>
+ </ul>
</div>
- </label>
- )}
+ ))}
+ </div>
</div>
- <p className="min-h-10 text-sm text-neutral-600">
- {PRICING_PLAN_TAGLINES[product][plan.name]}
- </p>
-
- <div className="flex gap-2">
- <button
- type="button"
- className="h-full w-fit rounded-lg bg-neutral-100 px-2.5 transition-colors duration-75 hover:bg-neutral-200/80 enabled:active:bg-neutral-200 disabled:opacity-30 lg:hidden"
- disabled={mobilePlanIndex === 0}
- onClick={() => setMobilePlanIndex(mobilePlanIndex - 1)}
- >
- <ChevronLeft className="size-5 text-neutral-800" />
- </button>
- {plan.name === "Enterprise" ? (
- <a
- href="https://dub.co/contact/sales"
- target="_blank"
- className="w-full"
- >
- <Button
- text="Contact us"
- className="h-10 rounded-lg shadow-sm"
- />
- </a>
- ) : (
- <UpgradePlanButton
- plan={plan.name.toLowerCase()}
- period={period}
- text="Get started"
- className="h-10 rounded-lg shadow-sm"
- />
- )}
- <button
- type="button"
- className="h-full w-fit rounded-lg bg-neutral-100 px-2.5 transition-colors duration-75 hover:bg-neutral-200/80 active:bg-neutral-200 disabled:opacity-30 lg:hidden"
- disabled={mobilePlanIndex >= plans.length - 1}
- onClick={() => setMobilePlanIndex(mobilePlanIndex + 1)}
- >
- <ChevronRight className="size-5 text-neutral-800" />
- </button>
- </div>
- <div className="flex flex-col gap-3 text-sm">
- {features.map(({ title, subtitle, features }, idx) => (
- <div key={idx} className="relative flex flex-col">
- {title && (
- <h4 className="mb-3 font-medium text-neutral-700">
- {title}
- </h4>
- )}
- {subtitle && (
- <p className="mb-2.5 text-neutral-500">{subtitle}</p>
- )}
- <ul className="flex flex-col gap-2.5 pb-3">
- {features.map(
- ({ id, text, tooltip, disabled }, idx) => {
- const Icon =
- id && PLAN_FEATURE_ICONS[id]
- ? PLAN_FEATURE_ICONS[id]
- : Check;
+ {Boolean(
+ (product === "links" && plan.limits.payouts) ||
+ product === "partners",
+ ) && (
+ <div className="flex grow flex-col justify-end">
+ <div className="relative z-0 bg-neutral-100">
+ <div className="border-border-subtle pointer-events-none relative z-10 -mx-px h-2.5 rounded-b-[0.625rem] border-x border-b bg-white" />
+ <a
+ href={`https://dub.co/${product === "links" ? "partners" : "links"}`}
+ target="_blank"
+ rel="noopener noreferrer"
+ className="group peer relative z-10 flex items-center justify-center px-5 py-2.5 transition-transform duration-100 active:scale-[0.97]"
+ >
+ <div className="relative flex items-center gap-2 transition-[transform,opacity] group-hover:-translate-y-1 group-hover:opacity-0">
+ <DubProductIcon
+ product={product === "links" ? "partners" : "links"}
+ className="size-[1.125rem]"
+ />
+ <span className="text-content-default block text-sm">
+ Includes{" "}
+ <strong className="font-semibold">
+ Dub {product === "links" ? "Partners" : "Links"}
+ </strong>
+ </span>
+ </div>
- return (
- <li
- key={idx}
- className={cn(
- "flex items-center gap-2 text-neutral-600",
- disabled && "opacity-40",
- )}
- >
- {disabled ? (
- <X className="size-3 shrink-0" />
- ) : Icon ? (
- <Icon className="size-4 shrink-0" />
- ) : (
- <Check className="size-3 shrink-0" />
- )}
- {tooltip ? (
- <Tooltip
- content={
- typeof tooltip === "string" ||
- isReactNode(tooltip)
- ? tooltip
- : `${tooltip.title}${tooltip.cta && tooltip.href ? ` [${tooltip.cta}](${tooltip.href})` : ""}`
- }
- >
- <p className="cursor-help underline decoration-dotted underline-offset-2">
- {text}
- </p>
- </Tooltip>
- ) : (
- <p>{text}</p>
- )}
- </li>
- );
- },
+ <div className="absolute inset-0 flex translate-y-1 items-center justify-center opacity-0 transition-[transform,opacity] group-hover:translate-y-0 group-hover:opacity-100">
+ <span className="text-content-default block whitespace-nowrap text-sm font-medium">
+ Learn more ↗
+ </span>
+ </div>
+ </a>
+ <div
+ className={cn(
+ "pointer-events-none absolute inset-0 opacity-0 duration-100 peer-hover:opacity-5",
+ product === "links"
+ ? "bg-violet-700"
+ : "bg-orange-700",
)}
- </ul>
+ />
</div>
- ))}
- </div>
- </div>
-
- {Boolean(
- (product === "links" && plan.limits.payouts) ||
- product === "partners",
- ) && (
- <div className="flex grow flex-col justify-end">
- <div className="relative z-0 bg-neutral-100">
- <div className="border-border-subtle pointer-events-none relative z-10 -mx-px h-2.5 rounded-b-[0.625rem] border-x border-b bg-white" />
- <a
- href={`https://dub.co/${product === "links" ? "partners" : "links"}`}
- target="_blank"
- rel="noopener noreferrer"
- className="group peer relative z-10 flex items-center justify-center px-5 py-2.5 transition-transform duration-100 active:scale-[0.97]"
- >
- <div className="relative flex items-center gap-2 transition-[transform,opacity] group-hover:-translate-y-1 group-hover:opacity-0">
- <DubProductIcon
- product={product === "links" ? "partners" : "links"}
- className="size-[1.125rem]"
- />
- <span className="text-content-default block text-sm">
- Includes{" "}
- <strong className="font-semibold">
- Dub {product === "links" ? "Partners" : "Links"}
- </strong>
- </span>
- </div>
-
- <div className="absolute inset-0 flex translate-y-1 items-center justify-center opacity-0 transition-[transform,opacity] group-hover:translate-y-0 group-hover:opacity-100">
- <span className="text-content-default block whitespace-nowrap text-sm font-medium">
- Learn more ↗
- </span>
- </div>
- </a>
- <div
- className={cn(
- "pointer-events-none absolute inset-0 opacity-0 duration-100 peer-hover:opacity-5",
- product === "links" ? "bg-violet-700" : "bg-orange-700",
- )}
- />
</div>
- </div>
- )}
- </div>
- );
+ )}
+ </div>
+ );
})}
</div>
</div>
diff --git a/apps/web/lib/api/conversions/track-lead.ts b/apps/web/lib/api/conversions/track-lead.ts
index 07fc8acaf5..e500fd8354 100644
--- a/apps/web/lib/api/conversions/track-lead.ts
+++ b/apps/web/lib/api/conversions/track-lead.ts
@@ -4,7 +4,7 @@ import { detectAndRecordFraudEvent } from "@/lib/api/fraud/detect-record-fraud-e
import { includeTags } from "@/lib/api/links/include-tags";
import { generateRandomName } from "@/lib/names";
import { createPartnerCommission } from "@/lib/partners/create-partner-commission";
-import { sendPartnerPostback } from "@/lib/postback/api/send-partner-postback";
+import { sendPartnerPostback } from "@/lib/postback/send-partner-postback";
import { isStored, storage } from "@/lib/storage";
import { getClickEvent, recordLead } from "@/lib/tinybird";
import { CustomerSource, WorkspaceProps } from "@/lib/types";
diff --git a/apps/web/lib/api/conversions/track-sale.ts b/apps/web/lib/api/conversions/track-sale.ts
index 0b3495a712..400f5d04e9 100644
--- a/apps/web/lib/api/conversions/track-sale.ts
+++ b/apps/web/lib/api/conversions/track-sale.ts
@@ -5,7 +5,7 @@ import { detectAndRecordFraudEvent } from "@/lib/api/fraud/detect-record-fraud-e
import { includeTags } from "@/lib/api/links/include-tags";
import { generateRandomName } from "@/lib/names";
import { createPartnerCommission } from "@/lib/partners/create-partner-commission";
-import { sendPartnerPostback } from "@/lib/postback/api/send-partner-postback";
+import { sendPartnerPostback } from "@/lib/postback/send-partner-postback";
import { isStored, storage } from "@/lib/storage";
import {
getClickEvent,
diff --git a/apps/web/lib/integrations/shopify/create-lead.ts b/apps/web/lib/integrations/shopify/create-lead.ts
index 298322e944..ef9a3da087 100644
--- a/apps/web/lib/integrations/shopify/create-lead.ts
+++ b/apps/web/lib/integrations/shopify/create-lead.ts
@@ -3,7 +3,7 @@ import { DubApiError } from "@/lib/api/errors";
import { includeTags } from "@/lib/api/links/include-tags";
import { syncPartnerLinksStats } from "@/lib/api/partners/sync-partner-links-stats";
import { generateRandomName } from "@/lib/names";
-import { sendPartnerPostback } from "@/lib/postback/api/send-partner-postback";
+import { sendPartnerPostback } from "@/lib/postback/send-partner-postback";
import { getClickEvent, recordLead } from "@/lib/tinybird";
import { sendWorkspaceWebhook } from "@/lib/webhook/publish";
import { transformLeadEventData } from "@/lib/webhook/transform";
diff --git a/apps/web/lib/integrations/shopify/create-sale.ts b/apps/web/lib/integrations/shopify/create-sale.ts
index f94ddecda7..18a5c14b09 100644
--- a/apps/web/lib/integrations/shopify/create-sale.ts
+++ b/apps/web/lib/integrations/shopify/create-sale.ts
@@ -4,7 +4,7 @@ import { includeTags } from "@/lib/api/links/include-tags";
import { syncPartnerLinksStats } from "@/lib/api/partners/sync-partner-links-stats";
import { executeWorkflows } from "@/lib/api/workflows/execute-workflows";
import { createPartnerCommission } from "@/lib/partners/create-partner-commission";
-import { sendPartnerPostback } from "@/lib/postback/api/send-partner-postback";
+import { sendPartnerPostback } from "@/lib/postback/send-partner-postback";
import { recordSale } from "@/lib/tinybird";
import { LeadEventTB } from "@/lib/types";
import { redis } from "@/lib/upstash";
diff --git a/apps/web/lib/partners/create-partner-commission.ts b/apps/web/lib/partners/create-partner-commission.ts
index b742dc181e..5d191217d1 100644
--- a/apps/web/lib/partners/create-partner-commission.ts
+++ b/apps/web/lib/partners/create-partner-commission.ts
@@ -18,7 +18,7 @@ import { getProgramEnrollmentOrThrow } from "../api/programs/get-program-enrollm
import { calculateSaleEarnings } from "../api/sales/calculate-sale-earnings";
import { executeWorkflows } from "../api/workflows/execute-workflows";
import { Session } from "../auth";
-import { sendPartnerPostback } from "../postback/api/send-partner-postback";
+import { sendPartnerPostback } from "../postback/send-partner-postback";
import { RewardContext, RewardProps } from "../types";
import { sendWorkspaceWebhook } from "../webhook/publish";
import { CommissionWebhookSchema } from "../zod/schemas/commissions";
diff --git a/apps/web/lib/postback/api/get-postback-events.ts b/apps/web/lib/postback/get-postback-events.ts
similarity index 86%
rename from apps/web/lib/postback/api/get-postback-events.ts
rename to apps/web/lib/postback/get-postback-events.ts
index 6340d49b8d..ef21bb8f3d 100644
--- a/apps/web/lib/postback/api/get-postback-events.ts
+++ b/apps/web/lib/postback/get-postback-events.ts
@@ -1,6 +1,6 @@
import { postbackEventOutputSchemaTB } from "@/lib/postback/schemas";
import * as z from "zod/v4";
-import { tb } from "../../tinybird/client";
+import { tb } from "../tinybird/client";
export const getPostbackEvents = tb.buildPipe({
pipe: "get_postback_events",
diff --git a/apps/web/lib/api/postbacks/get-postback-or-throw.ts b/apps/web/lib/postback/get-postback-or-throw.ts
similarity index 93%
rename from apps/web/lib/api/postbacks/get-postback-or-throw.ts
rename to apps/web/lib/postback/get-postback-or-throw.ts
index 541d97eb06..ece6317674 100644
--- a/apps/web/lib/api/postbacks/get-postback-or-throw.ts
+++ b/apps/web/lib/postback/get-postback-or-throw.ts
@@ -1,5 +1,5 @@
import { prisma } from "@dub/prisma";
-import { DubApiError } from "../errors";
+import { DubApiError } from "../api/errors";
interface GetPostbackOrThrowParams {
postbackId: string;
diff --git a/apps/web/lib/postback/api/postback-adapter-custom.ts b/apps/web/lib/postback/postback-adapter-custom.ts
similarity index 100%
rename from apps/web/lib/postback/api/postback-adapter-custom.ts
rename to apps/web/lib/postback/postback-adapter-custom.ts
diff --git a/apps/web/lib/postback/api/postback-adapter-slack.ts b/apps/web/lib/postback/postback-adapter-slack.ts
similarity index 98%
rename from apps/web/lib/postback/api/postback-adapter-slack.ts
rename to apps/web/lib/postback/postback-adapter-slack.ts
index 9f04e2986f..0805eb8bd7 100644
--- a/apps/web/lib/postback/api/postback-adapter-slack.ts
+++ b/apps/web/lib/postback/postback-adapter-slack.ts
@@ -1,12 +1,12 @@
import { PostbackTrigger } from "@/lib/types";
import { Postback } from "@dub/prisma/client";
import type { z } from "zod/v4";
+import { PostbackAdapter } from "./postback-adapters";
import {
commissionEventPostbackSchema,
leadEventPostbackSchema,
saleEventPostbackSchema,
-} from "../schemas";
-import { PostbackAdapter } from "./postback-adapters";
+} from "./schemas";
type LeadEventPostback = z.infer<typeof leadEventPostbackSchema>;
type SaleEventPostback = z.infer<typeof saleEventPostbackSchema>;
diff --git a/apps/web/lib/postback/api/postback-adapters.ts b/apps/web/lib/postback/postback-adapters.ts
similarity index 100%
rename from apps/web/lib/postback/api/postback-adapters.ts
rename to apps/web/lib/postback/postback-adapters.ts
diff --git a/apps/web/lib/postback/api/postback-event-enrichers.ts b/apps/web/lib/postback/postback-event-enrichers.ts
similarity index 99%
rename from apps/web/lib/postback/api/postback-event-enrichers.ts
rename to apps/web/lib/postback/postback-event-enrichers.ts
index 6e6b5db91d..e8ac15e792 100644
--- a/apps/web/lib/postback/api/postback-event-enrichers.ts
+++ b/apps/web/lib/postback/postback-event-enrichers.ts
@@ -5,7 +5,7 @@ import {
commissionEventPostbackSchema,
leadEventPostbackSchema,
saleEventPostbackSchema,
-} from "../schemas";
+} from "./schemas";
interface PostbackEventEnricher {
enrich(data: Record<string, unknown>): Record<string, unknown>;
diff --git a/apps/web/lib/postback/api/postback-event-transformers.ts b/apps/web/lib/postback/postback-event-transformers.ts
similarity index 100%
rename from apps/web/lib/postback/api/postback-event-transformers.ts
rename to apps/web/lib/postback/postback-event-transformers.ts
diff --git a/apps/web/lib/postback/api/record-postback-event.ts b/apps/web/lib/postback/record-postback-event.ts
similarity index 84%
rename from apps/web/lib/postback/api/record-postback-event.ts
rename to apps/web/lib/postback/record-postback-event.ts
index 7dac12df7c..9a8e19eedc 100644
--- a/apps/web/lib/postback/api/record-postback-event.ts
+++ b/apps/web/lib/postback/record-postback-event.ts
@@ -1,5 +1,5 @@
import { postbackEventInputSchemaTB } from "@/lib/postback/schemas";
-import { tb } from "../../tinybird/client";
+import { tb } from "../tinybird/client";
export const recordPostbackEvent = tb.buildIngestEndpoint({
datasource: "dub_postback_events",
diff --git a/apps/web/lib/postback/api/send-partner-postback.ts b/apps/web/lib/postback/send-partner-postback.ts
similarity index 100%
rename from apps/web/lib/postback/api/send-partner-postback.ts
rename to apps/web/lib/postback/send-partner-postback.ts
diff --git a/apps/web/lib/postback/api/utils.ts b/apps/web/lib/postback/utils.ts
similarity index 100%
rename from apps/web/lib/postback/api/utils.ts
rename to apps/web/lib/postback/utils.ts
diff --git a/apps/web/tests/misc/site-visit-tracking-settings.test.ts b/apps/web/tests/misc/site-visit-tracking-settings.test.ts
index 4b77be50a7..6c6cb72b14 100644
--- a/apps/web/tests/misc/site-visit-tracking-settings.test.ts
+++ b/apps/web/tests/misc/site-visit-tracking-settings.test.ts
@@ -25,11 +25,16 @@ describe("parseSiteVisitTrackingSettings", () => {
});
it("keeps at most MAX_TRACKED_SITEMAPS_PER_WORKSPACE entries (deterministic slice)", () => {
- const many = Array.from({ length: MAX_TRACKED_SITEMAPS_PER_WORKSPACE + 5 }, (_, i) => ({
- url: `https://example.com/s${i}.xml`,
- }));
+ const many = Array.from(
+ { length: MAX_TRACKED_SITEMAPS_PER_WORKSPACE + 5 },
+ (_, i) => ({
+ url: `https://example.com/s${i}.xml`,
+ }),
+ );
const parsed = parseSiteVisitTrackingSettings({ trackedSitemaps: many });
- expect(parsed.trackedSitemaps).toHaveLength(MAX_TRACKED_SITEMAPS_PER_WORKSPACE);
+ expect(parsed.trackedSitemaps).toHaveLength(
+ MAX_TRACKED_SITEMAPS_PER_WORKSPACE,
+ );
expect(parsed.trackedSitemaps[0]?.url).toBe("https://example.com/s0.xml");
expect(parsed.trackedSitemaps.at(-1)?.url).toBe(
`https://example.com/s${MAX_TRACKED_SITEMAPS_PER_WORKSPACE - 1}.xml`,