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.

exceededClicks → exceededEvents

Steven Tey75b3a1649c61
diff --git a/apps/web/app/app.dub.co/(dashboard)/[slug]/(ee)/program/analytics/page.tsx b/apps/web/app/app.dub.co/(dashboard)/[slug]/(ee)/program/analytics/page.tsx
index 013a9eacc1..fa9ebad73d 100644
--- a/apps/web/app/app.dub.co/(dashboard)/[slug]/(ee)/program/analytics/page.tsx
+++ b/apps/web/app/app.dub.co/(dashboard)/[slug]/(ee)/program/analytics/page.tsx
@@ -3,7 +3,7 @@
import useWorkspace from "@/lib/swr/use-workspace";
import { PageContent } from "@/ui/layout/page-content";
import { PageWidthWrapper } from "@/ui/layout/page-width-wrapper";
-import WorkspaceExceededClicks from "@/ui/workspaces/workspace-exceeded-clicks";
+import WorkspaceExceededEvents from "@/ui/workspaces/workspace-exceeded-events";
import { ProgramAnalyticsPageClient } from "./page-client";
export default function ProgramAnalytics() {
@@ -24,10 +24,10 @@ export default function ProgramAnalytics() {
}
function ProgramAnalyticsPageWrapper() {
- const { exceededClicks } = useWorkspace();
+ const { exceededEvents } = useWorkspace();
- if (exceededClicks) {
- return <WorkspaceExceededClicks />;
+ if (exceededEvents) {
+ return <WorkspaceExceededEvents />;
}
return <ProgramAnalyticsPageClient />;
diff --git a/apps/web/app/app.dub.co/(dashboard)/[slug]/(ee)/program/overview-chart.tsx b/apps/web/app/app.dub.co/(dashboard)/[slug]/(ee)/program/overview-chart.tsx
index d54b45d0a3..febf16c7ab 100644
--- a/apps/web/app/app.dub.co/(dashboard)/[slug]/(ee)/program/overview-chart.tsx
+++ b/apps/web/app/app.dub.co/(dashboard)/[slug]/(ee)/program/overview-chart.tsx
@@ -32,7 +32,7 @@ export function OverviewChart() {
const { queryString, start, end, interval } = useContext(AnalyticsContext);
const [viewType, setViewType] = useState<ViewType>("sales");
- const { slug, exceededClicks } = useWorkspace();
+ const { slug, exceededEvents } = useWorkspace();
const { program } = useProgram();
useEffect(() => {
if (program?.primaryRewardEvent === "lead") {
@@ -49,7 +49,7 @@ export function OverviewChart() {
saleAmount: number;
}[]
>(
- !exceededClicks &&
+ !exceededEvents &&
(viewType === "sales" || viewType === "leads") &&
`/api/analytics?${editQueryString(queryString, {
event: viewType,
@@ -93,7 +93,7 @@ export function OverviewChart() {
return (
<div className="flex size-full flex-col gap-6">
- {!exceededClicks && (
+ {!exceededEvents && (
<div className="flex items-start justify-between">
<div className="flex flex-col">
<Combobox
@@ -144,7 +144,7 @@ export function OverviewChart() {
)}
<div className="relative min-h-0 grow">
- {exceededClicks ? (
+ {exceededEvents ? (
<ExceededEventsLimit />
) : isLoading ? (
<div className="flex size-full items-center justify-center">
diff --git a/apps/web/app/app.dub.co/(dashboard)/[slug]/(ee)/program/page-client.tsx b/apps/web/app/app.dub.co/(dashboard)/[slug]/(ee)/program/page-client.tsx
index a74a5edf79..bfb7940abf 100644
--- a/apps/web/app/app.dub.co/(dashboard)/[slug]/(ee)/program/page-client.tsx
+++ b/apps/web/app/app.dub.co/(dashboard)/[slug]/(ee)/program/page-client.tsx
@@ -32,7 +32,7 @@ const BLOCKS = [
];
export default function ProgramOverviewPageClient() {
- const { defaultProgramId, id: workspaceId, exceededClicks } = useWorkspace();
+ const { defaultProgramId, id: workspaceId, exceededEvents } = useWorkspace();
const { searchParamsObj } = useRouterStuff();
@@ -55,7 +55,7 @@ export default function ProgramOverviewPageClient() {
const { data: totalEvents, isLoading: totalEventsLoading } = useSWR<{
[key in AnalyticsResponseOptions]: number;
}>(
- !exceededClicks &&
+ !exceededEvents &&
`/api/analytics?${editQueryString(queryString, {
event: "composite",
// saleType: "new", // TODO: Add this back once we fix sales by type
diff --git a/apps/web/app/app.dub.co/(dashboard)/[slug]/analytics/client.tsx b/apps/web/app/app.dub.co/(dashboard)/[slug]/analytics/client.tsx
index 232a11e678..e3d4697b83 100644
--- a/apps/web/app/app.dub.co/(dashboard)/[slug]/analytics/client.tsx
+++ b/apps/web/app/app.dub.co/(dashboard)/[slug]/analytics/client.tsx
@@ -2,7 +2,7 @@
import useWorkspace from "@/lib/swr/use-workspace";
import LayoutLoader from "@/ui/layout/layout-loader";
-import WorkspaceExceededClicks from "@/ui/workspaces/workspace-exceeded-clicks";
+import WorkspaceExceededEvents from "@/ui/workspaces/workspace-exceeded-events";
import { ReactNode } from "react";
export default function AnalyticsClient({
@@ -12,14 +12,14 @@ export default function AnalyticsClient({
children: ReactNode;
eventsPage?: boolean;
}) {
- const { exceededClicks, loading, plan } = useWorkspace();
+ const { exceededEvents, loading, plan } = useWorkspace();
if (loading) {
return <LayoutLoader />;
}
- if (exceededClicks && !(plan === "pro" && eventsPage)) {
- return <WorkspaceExceededClicks />;
+ if (exceededEvents && !(plan === "pro" && eventsPage)) {
+ return <WorkspaceExceededEvents />;
}
return children;
diff --git a/apps/web/lib/swr/use-workspace.ts b/apps/web/lib/swr/use-workspace.ts
index 8006749ac5..5b424500ed 100644
--- a/apps/web/lib/swr/use-workspace.ts
+++ b/apps/web/lib/swr/use-workspace.ts
@@ -33,7 +33,7 @@ export default function useWorkspace({
nextPlan: workspace?.plan ? getNextPlan(workspace.plan) : PRO_PLAN,
role: (workspace?.users && workspace.users[0].role) || "member",
isOwner: workspace?.users && workspace.users[0].role === "owner",
- exceededClicks: workspace && workspace.usage >= workspace.usageLimit,
+ exceededEvents: workspace && workspace.usage >= workspace.usageLimit,
exceededLinks: workspace && workspace.linksUsage >= workspace.linksLimit,
exceededPayouts:
workspace?.payoutsLimit &&
diff --git a/apps/web/ui/layout/upgrade-banner.tsx b/apps/web/ui/layout/upgrade-banner.tsx
index 43fee7149c..af97f07049 100644
--- a/apps/web/ui/layout/upgrade-banner.tsx
+++ b/apps/web/ui/layout/upgrade-banner.tsx
@@ -8,18 +8,18 @@ import Link from "next/link";
import ManageSubscriptionButton from "../workspaces/manage-subscription-button";
export function useUpgradeBannerVisible() {
- const { exceededClicks, exceededLinks, exceededPayouts, paymentFailedAt } =
+ const { exceededEvents, exceededLinks, exceededPayouts, paymentFailedAt } =
useWorkspace();
- const needsUpgrade = exceededClicks || exceededLinks || exceededPayouts;
+ const needsUpgrade = exceededEvents || exceededLinks || exceededPayouts;
return needsUpgrade || !!paymentFailedAt;
}
export function UpgradeBanner() {
- const { slug, exceededClicks, exceededLinks, exceededPayouts } =
+ const { slug, exceededEvents, exceededLinks, exceededPayouts } =
useWorkspace();
- const needsUpgrade = exceededClicks || exceededLinks || exceededPayouts;
+ const needsUpgrade = exceededEvents || exceededLinks || exceededPayouts;
const isVisible = useUpgradeBannerVisible();
if (!isVisible) return null;
@@ -37,7 +37,7 @@ export function UpgradeBanner() {
You&rsquo;ve hit the{" "}
<Link href={`/${slug}/settings/billing`} className="underline">
monthly{" "}
- {exceededClicks ? "events" : exceededLinks ? "links" : "payouts"}{" "}
+ {exceededEvents ? "events" : exceededLinks ? "links" : "payouts"}{" "}
limit
</Link>
<span className="xs:inline hidden">&nbsp;on your current plan</span>
diff --git a/apps/web/ui/partners/overview/blocks/conversion-block.tsx b/apps/web/ui/partners/overview/blocks/conversion-block.tsx
index a729ce3341..ffc4d00945 100644
--- a/apps/web/ui/partners/overview/blocks/conversion-block.tsx
+++ b/apps/web/ui/partners/overview/blocks/conversion-block.tsx
@@ -9,7 +9,7 @@ import { ExceededEventsLimit } from "../exceeded-events-limit";
import { ProgramOverviewBlock } from "../program-overview-block";
export function ConversionBlock() {
- const { slug: workspaceSlug, exceededClicks } = useWorkspace();
+ const { slug: workspaceSlug, exceededEvents } = useWorkspace();
const { program } = useProgram();
const { getQueryString } = useRouterStuff();
@@ -62,7 +62,7 @@ export function ConversionBlock() {
contentClassName="px-0 mt-1"
>
<div className="h-full min-h-48">
- {exceededClicks ? (
+ {exceededEvents ? (
<ExceededEventsLimit />
) : totalEventsLoading ? (
<div className="flex size-full items-center justify-center py-4">
diff --git a/apps/web/ui/partners/overview/blocks/countries-block.tsx b/apps/web/ui/partners/overview/blocks/countries-block.tsx
index db41a0f5f0..e1b8ff33a6 100644
--- a/apps/web/ui/partners/overview/blocks/countries-block.tsx
+++ b/apps/web/ui/partners/overview/blocks/countries-block.tsx
@@ -11,7 +11,7 @@ import { ExceededEventsLimit } from "../exceeded-events-limit";
import { ProgramOverviewBlock } from "../program-overview-block";
export function CountriesBlock() {
- const { slug: workspaceSlug, exceededClicks } = useWorkspace();
+ const { slug: workspaceSlug, exceededEvents } = useWorkspace();
const { program } = useProgram();
const { getQueryString } = useRouterStuff();
@@ -25,7 +25,7 @@ export function CountriesBlock() {
saleAmount: number;
}[]
>(
- !exceededClicks &&
+ !exceededEvents &&
`/api/analytics?${editQueryString(queryString, {
groupBy: "countries",
event: program?.primaryRewardEvent === "lead" ? "leads" : "sales",
@@ -44,7 +44,7 @@ export function CountriesBlock() {
)}`}
>
<div className="divide-border-subtle @2xl:h-60 flex h-auto flex-col divide-y">
- {exceededClicks ? (
+ {exceededEvents ? (
<ExceededEventsLimit />
) : isLoading ? (
<div className="flex size-full items-center justify-center py-4">
diff --git a/apps/web/ui/partners/overview/blocks/links-block.tsx b/apps/web/ui/partners/overview/blocks/links-block.tsx
index 2779e9c8ec..06dbd7b2ea 100644
--- a/apps/web/ui/partners/overview/blocks/links-block.tsx
+++ b/apps/web/ui/partners/overview/blocks/links-block.tsx
@@ -22,7 +22,7 @@ import { ExceededEventsLimit } from "../exceeded-events-limit";
import { ProgramOverviewBlock } from "../program-overview-block";
export function LinksBlock() {
- const { slug: workspaceSlug, exceededClicks } = useWorkspace();
+ const { slug: workspaceSlug, exceededEvents } = useWorkspace();
const { program } = useProgram();
const { getQueryString } = useRouterStuff();
@@ -39,7 +39,7 @@ export function LinksBlock() {
saleAmount: number;
}[]
>(
- !exceededClicks &&
+ !exceededEvents &&
`/api/analytics?${editQueryString(queryString, {
groupBy: "top_links",
event: program?.primaryRewardEvent === "lead" ? "leads" : "sales",
@@ -58,7 +58,7 @@ export function LinksBlock() {
)}`}
>
<div className="divide-border-subtle @2xl:h-60 flex h-auto flex-col divide-y">
- {exceededClicks ? (
+ {exceededEvents ? (
<ExceededEventsLimit />
) : isLoading ? (
<div className="flex size-full items-center justify-center py-4">
diff --git a/apps/web/ui/partners/overview/blocks/partners-block.tsx b/apps/web/ui/partners/overview/blocks/partners-block.tsx
index 48592c7a88..741c854748 100644
--- a/apps/web/ui/partners/overview/blocks/partners-block.tsx
+++ b/apps/web/ui/partners/overview/blocks/partners-block.tsx
@@ -17,7 +17,7 @@ import useSWR from "swr";
import { ProgramOverviewBlock } from "../program-overview-block";
export function PartnersBlock() {
- const { slug: workspaceSlug, exceededClicks } = useWorkspace();
+ const { slug: workspaceSlug, exceededEvents } = useWorkspace();
const { program } = useProgram();
const { queryString } = useContext(AnalyticsContext);
@@ -30,7 +30,7 @@ export function PartnersBlock() {
partner: Pick<PartnerProps, "name" | "image">;
}[]
>(
- !exceededClicks &&
+ !exceededEvents &&
`/api/analytics?${editQueryString(queryString, {
groupBy: "top_partners",
event: program?.primaryRewardEvent === "lead" ? "leads" : "sales",
@@ -44,7 +44,7 @@ export function PartnersBlock() {
viewAllHref={`/${workspaceSlug}/program/partners`}
>
<div className="divide-border-subtle @2xl:h-60 flex h-auto flex-col divide-y">
- {exceededClicks ? (
+ {exceededEvents ? (
<ExceededEventsLimit />
) : isLoading ? (
<div className="flex size-full items-center justify-center py-4">
diff --git a/apps/web/ui/partners/overview/blocks/sale-type-block.tsx b/apps/web/ui/partners/overview/blocks/sale-type-block.tsx
index e9e418bc63..0942fdadf6 100644
--- a/apps/web/ui/partners/overview/blocks/sale-type-block.tsx
+++ b/apps/web/ui/partners/overview/blocks/sale-type-block.tsx
@@ -10,7 +10,7 @@ import useSWR from "swr";
import { ProgramOverviewBlock } from "../program-overview-block";
export function SaleTypeBlock() {
- const { slug: workspaceSlug, exceededClicks } = useWorkspace();
+ const { slug: workspaceSlug, exceededEvents } = useWorkspace();
const { getQueryString } = useRouterStuff();
const {
queryString,
@@ -27,7 +27,7 @@ export function SaleTypeBlock() {
} = useSWR<{
[key in AnalyticsResponseOptions]: number;
}>(
- !exceededClicks &&
+ !exceededEvents &&
`/api/analytics?${editQueryString(queryString, {
event: "sales",
saleType: "recurring",
diff --git a/apps/web/ui/partners/overview/blocks/traffic-sources-block.tsx b/apps/web/ui/partners/overview/blocks/traffic-sources-block.tsx
index cb01e311c7..415fa157c8 100644
--- a/apps/web/ui/partners/overview/blocks/traffic-sources-block.tsx
+++ b/apps/web/ui/partners/overview/blocks/traffic-sources-block.tsx
@@ -22,7 +22,7 @@ import { ExceededEventsLimit } from "../exceeded-events-limit";
import { ProgramOverviewBlock } from "../program-overview-block";
export function TrafficSourcesBlock() {
- const { slug: workspaceSlug, exceededClicks } = useWorkspace();
+ const { slug: workspaceSlug, exceededEvents } = useWorkspace();
const { program } = useProgram();
const { getQueryString } = useRouterStuff();
@@ -36,7 +36,7 @@ export function TrafficSourcesBlock() {
saleAmount: number;
}[]
>(
- !exceededClicks &&
+ !exceededEvents &&
`/api/analytics?${editQueryString(queryString, {
groupBy: "referers",
event: program?.primaryRewardEvent === "lead" ? "leads" : "sales",
@@ -55,7 +55,7 @@ export function TrafficSourcesBlock() {
)}`}
>
<div className="divide-border-subtle @2xl:h-60 flex h-auto flex-col divide-y">
- {exceededClicks ? (
+ {exceededEvents ? (
<ExceededEventsLimit />
) : isLoading ? (
<div className="flex size-full items-center justify-center py-4">
diff --git a/apps/web/ui/workspaces/workspace-exceeded-clicks.tsx b/apps/web/ui/workspaces/workspace-exceeded-events.tsx
similarity index 95%
rename from apps/web/ui/workspaces/workspace-exceeded-clicks.tsx
rename to apps/web/ui/workspaces/workspace-exceeded-events.tsx
index 8fd5ce609e..4e727c3c4e 100644
--- a/apps/web/ui/workspaces/workspace-exceeded-clicks.tsx
+++ b/apps/web/ui/workspaces/workspace-exceeded-events.tsx
@@ -5,7 +5,7 @@ import { MaxWidthWrapper } from "@dub/ui";
import { CursorRays } from "../layout/sidebar/icons/cursor-rays";
import { AnimatedEmptyState } from "../shared/animated-empty-state";
-export default function WorkspaceExceededClicks() {
+export default function WorkspaceExceededEvents() {
const { slug } = useWorkspace();
return (