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.

finally fix the build

Kiran K223be21f87b4
diff --git a/apps/web/lib/types.ts b/apps/web/lib/types.ts
index dbe514e1c3..9c1918c63a 100644
--- a/apps/web/lib/types.ts
+++ b/apps/web/lib/types.ts
@@ -177,16 +177,18 @@ import {
import { workspacePreferencesSchema } from "./zod/schemas/workspace-preferences";
import { workspaceUserSchema } from "./zod/schemas/workspaces";
-export type LinkProps = Link;
+export type LinkProps = Omit<Link, "saleAmount"> & {
+ saleAmount: number;
+};
// used on client side (e.g. Link builder)
// TODO: standardize this with ExpandedLink
-export interface ExpandedLinkProps extends LinkProps {
+export type ExpandedLinkProps = LinkProps & {
tags: TagProps[];
webhookIds: string[];
dashboardId: string | null;
user?: UserProps;
-}
+};
export interface SimpleLinkProps {
domain: string;
diff --git a/apps/web/ui/analytics/use-analytics-filters.tsx b/apps/web/ui/analytics/use-analytics-filters.tsx
index 3f6baea6ba..b771192473 100644
--- a/apps/web/ui/analytics/use-analytics-filters.tsx
+++ b/apps/web/ui/analytics/use-analytics-filters.tsx
@@ -3,7 +3,6 @@ import { VALID_ANALYTICS_FILTERS } from "@/lib/analytics/constants";
import useCustomer from "@/lib/swr/use-customer";
import usePartner from "@/lib/swr/use-partner";
import usePartnerCustomer from "@/lib/swr/use-partner-customer";
-import { LinkProps } from "@/lib/types";
import { readStreamableValue } from "@ai-sdk/rsc";
import {
BlurImage,
@@ -364,20 +363,12 @@ export function useAnalyticsFilters({
return <LinkIcon url={url} />;
},
options:
- links?.map(
- ({
- id,
- domain,
- key,
- url,
- ...rest
- }: LinkProps & { id?: string; count?: number }) => ({
- value: id,
- label: linkConstructor({ domain, key, pretty: true }),
- right: getFilterOptionTotal(rest),
- data: { url, domain, key },
- }),
- ) ?? null,
+ links?.map(({ id, domain, key, url, ...rest }) => ({
+ value: id,
+ label: linkConstructor({ domain, key, pretty: true }),
+ right: getFilterOptionTotal(rest),
+ data: { url, domain, key },
+ })) ?? null,
};
const DomainFilterItem = {
diff --git a/apps/web/ui/links/link-analytics-badge.tsx b/apps/web/ui/links/link-analytics-badge.tsx
index b6a265095c..f5bd17ea0e 100644
--- a/apps/web/ui/links/link-analytics-badge.tsx
+++ b/apps/web/ui/links/link-analytics-badge.tsx
@@ -27,14 +27,12 @@ import { ResponseLink } from "./links-container";
export function LinkAnalyticsBadge({
link,
- url,
sharingEnabled = true,
}: {
link: Omit<ResponseLink, "user">;
- url?: string;
sharingEnabled?: boolean;
}) {
- const { slug, plan } = useWorkspace();
+ const { slug } = useWorkspace();
const { domain, key, trackConversion, clicks, leads, saleAmount } = link;
const { isMobile } = useMediaQuery();
diff --git a/apps/web/ui/links/link-tests.tsx b/apps/web/ui/links/link-tests.tsx
index 2de9fa49e4..92c4b260e2 100644
--- a/apps/web/ui/links/link-tests.tsx
+++ b/apps/web/ui/links/link-tests.tsx
@@ -107,7 +107,6 @@ export const LinkTests = memo(({ link }: { link: ResponseLink }) => {
sales: analytics?.sales ?? 0,
saleAmount: analytics?.saleAmount ?? 0,
}}
- url={test.url}
sharingEnabled={false}
/>
)}
diff --git a/packages/utils/src/functions/nformatter.ts b/packages/utils/src/functions/nformatter.ts
index e95164a36f..484aa144a8 100644
--- a/packages/utils/src/functions/nformatter.ts
+++ b/packages/utils/src/functions/nformatter.ts
@@ -1,10 +1,15 @@
export function nFormatter(
- num?: number,
+ number?: number | bigint,
opts: { digits?: number; full?: boolean } = {
digits: 1,
},
) {
- if (!num) return "0";
+ const num = number !== undefined ? Number(number) : undefined;
+
+ if (!num) {
+ return "0";
+ }
+
if (opts.full) {
return Intl.NumberFormat("en-US").format(num);
}