diff --git a/apps/web/app/(auth)/login/new/page.tsx b/apps/web/app/(auth)/login/new/page.tsx index 4fc7536be..59a0cbdbb 100644 --- a/apps/web/app/(auth)/login/new/page.tsx +++ b/apps/web/app/(auth)/login/new/page.tsx @@ -2,7 +2,7 @@ import { signIn } from "@lib/auth" import { usePostHog } from "@lib/posthog" -import { TextSeparator } from "@repo/ui/components/text-separator" +import { TextSeparator } from "@ui/components/text-separator" import { ExternalAuthButton } from "@ui/button/external-auth" import { Button } from "@ui/components/button" import { Badge } from "@ui/components/badge" diff --git a/apps/web/app/(navigation)/layout.tsx b/apps/web/app/(navigation)/layout.tsx index 68a67a93c..89328dcde 100644 --- a/apps/web/app/(navigation)/layout.tsx +++ b/apps/web/app/(navigation)/layout.tsx @@ -15,7 +15,7 @@ export default function NavigationLayout({ const [showAddMemoryView, setShowAddMemoryView] = useState(false) const pathname = usePathname() const router = useRouter() - const flagEnabled = useFeatureFlagEnabled("nova-alpha-access") + const flagEnabled = true useEffect(() => { if (flagEnabled && !pathname.includes("/new")) { diff --git a/apps/web/app/(navigation)/page.tsx b/apps/web/app/(navigation)/page.tsx index 39b6f47c6..8047f2edf 100644 --- a/apps/web/app/(navigation)/page.tsx +++ b/apps/web/app/(navigation)/page.tsx @@ -16,7 +16,7 @@ import { useFeatureFlagEnabled } from "posthog-js/react" export default function Page() { const { user, session } = useAuth() const router = useRouter() - const flagEnabled = useFeatureFlagEnabled("nova-alpha-access") + const flagEnabled = true // TODO: remove this flow after the feature flag is removed // Old app: localStorage-backed onboarding diff --git a/apps/web/app/new/layout.tsx b/apps/web/app/new/layout.tsx index f0cc0c1ef..ae9990e82 100644 --- a/apps/web/app/new/layout.tsx +++ b/apps/web/app/new/layout.tsx @@ -7,7 +7,7 @@ import { MobileBanner } from "@/components/new/mobile-banner" export default function NewLayout({ children }: { children: React.ReactNode }) { const router = useRouter() - const flagEnabled = useFeatureFlagEnabled("nova-alpha-access") + const flagEnabled = true useEffect(() => { if (!flagEnabled) { diff --git a/apps/web/components/menu.tsx b/apps/web/components/menu.tsx index 7d7dffe52..330ef187f 100644 --- a/apps/web/components/menu.tsx +++ b/apps/web/components/menu.tsx @@ -1,10 +1,7 @@ "use client" import { useIsMobile } from "@hooks/use-mobile" -import { - fetchConsumerProProduct, - fetchMemoriesFeature, -} from "@repo/lib/queries" +import { fetchApiProProduct, fetchMemoriesFeature } from "@repo/lib/queries" import { Button } from "@repo/ui/components/button" import { ConnectAIModal } from "./connect-ai-modal" import { HeadingH2Bold } from "@repo/ui/text/heading/heading-h2-bold" @@ -74,7 +71,7 @@ function Menu({ id }: { id?: string }) { const memoriesUsed = memoriesCheck?.usage ?? 0 const memoriesLimit = memoriesCheck?.included_usage ?? 0 - const { data: proCheck } = fetchConsumerProProduct(autumn) + const { data: proCheck } = fetchApiProProduct(autumn) useEffect(() => { if (memoriesCheck) { diff --git a/apps/web/components/new/add-document/connections.tsx b/apps/web/components/new/add-document/connections.tsx index b146fb4ca..e5cb22eef 100644 --- a/apps/web/components/new/add-document/connections.tsx +++ b/apps/web/components/new/add-document/connections.tsx @@ -59,9 +59,8 @@ export function ConnectContent({ selectedProject }: ConnectContentProps) { useEffect(() => { if (!autumn.isLoading) { setIsProUser( - autumn.customer?.products.some( - (product) => product.id === "consumer_pro", - ) ?? false, + autumn.customer?.products.some((product) => product.id === "api_pro") ?? + false, ) } }, [autumn.isLoading, autumn.customer]) @@ -70,7 +69,7 @@ export function ConnectContent({ selectedProject }: ConnectContentProps) { setIsUpgrading(true) try { await autumn.attach({ - productId: "consumer_pro", + productId: "api_pro", successUrl: window.location.href, }) } catch (error) { diff --git a/apps/web/components/new/settings/account.tsx b/apps/web/components/new/settings/account.tsx index 35194a162..696b43f69 100644 --- a/apps/web/components/new/settings/account.tsx +++ b/apps/web/components/new/settings/account.tsx @@ -4,7 +4,8 @@ import { dmSans125ClassName } from "@/lib/fonts" import { cn } from "@lib/utils" import { useAuth } from "@lib/auth-context" import { Avatar, AvatarFallback, AvatarImage } from "@ui/components/avatar" -import { useMemoriesUsage } from "@/hooks/use-memories-usage" +import { useTokenUsage } from "@/hooks/use-token-usage" +import { formatUsageNumber, tokensToCredits } from "@/lib/billing-utils" import { Dialog, DialogContent, @@ -107,19 +108,31 @@ export default function Account() { } const { - memoriesUsed, - memoriesLimit, - hasProProduct, + tokensUsed, + tokensLimit, + tokensPercent, + searchesUsed, + searchesLimit, + searchesPercent, + currentPlan, + hasPaidPlan, isLoading: isCheckingStatus, - usagePercent, - } = useMemoriesUsage(autumn) + daysRemaining, + } = useTokenUsage(autumn) + + const planDisplayNames: Record = { + free: "Free", + pro: "Pro", + scale: "Scale", + enterprise: "Enterprise", + } // Handlers const handleUpgrade = async () => { setIsUpgrading(true) try { await autumn.attach({ - productId: "consumer_pro", + productId: "api_pro", successUrl: "https://app.supermemory.ai/new/settings#account", }) window.location.reload() @@ -222,8 +235,6 @@ export default function Account() { {allOrgs.map((organization) => { const isCurrent = organization.id === org?.id const isSwitching = switchingOrgId === organization.id - const isConsumer = - organization.metadata?.isConsumer === true return ( ) })} @@ -295,7 +301,7 @@ export default function Account() { Billing & Subscription
- {hasProProduct ? ( + {hasPaidPlan ? ( <>
@@ -305,7 +311,7 @@ export default function Account() { "font-semibold text-[20px] tracking-[-0.2px] text-[#FAFAFA]", )} > - Pro plan + {planDisplayNames[currentPlan]} plan

ACTIVE @@ -321,7 +327,8 @@ export default function Account() {

-
+ {/* Credits Usage Progress */} +

- Unlimited Memories + Credits Used

-
- - {memoriesUsed}/ - - - ∞ - -
+ + {tokensToCredits(tokensUsed)} /{" "} + {tokensToCredits(tokensLimit)} +
-
+
80 + ? "#ef4444" + : "linear-gradient(to right, #4BA0FA 80%, #002757 100%)", }} />
+ {/* Search Queries Progress */} +
+
+

+ Search Queries +

+ + {formatUsageNumber(searchesUsed)} /{" "} + {formatUsageNumber(searchesLimit)} + +
+
+
80 + ? "#ef4444" + : "linear-gradient(to right, #4BA0FA 80%, #002757 100%)", + }} + /> +
+
+ + {/* Days remaining indicator */} + {daysRemaining !== null && ( +

+ Resets in {daysRemaining} day + {daysRemaining !== 1 ? "s" : ""} +

+ )} +
- {/* Pro plan card - highlighted */} + {/* Current plan card - highlighted */}
- {/* Header with ACTIVE badge */}

- Pro plan + {planDisplayNames[currentPlan]} plan

ACTIVE @@ -422,17 +475,17 @@ export default function Account() {
- {/* Inset highlight */}
@@ -467,6 +519,7 @@ export default function Account() {

+ {/* Credits Usage Progress */}

- Memories + Credits Used

- {memoriesUsed}/{memoriesLimit} + {tokensToCredits(tokensUsed)} /{" "} + {tokensToCredits(tokensLimit)}

- {/* Progress bar */} -
+
80 ? "#ef4444" : "#0054AD", + }} />
+ {/* Search Queries Progress */} +
+
+

+ Search Queries +

+

+ {formatUsageNumber(searchesUsed)} /{" "} + {formatUsageNumber(searchesLimit)} +

+
+
+
80 ? "#ef4444" : "#0054AD", + }} + /> +
+
+ + {/* Days remaining indicator */} + {daysRemaining !== null && ( +

+ Resets in {daysRemaining} day + {daysRemaining !== 1 ? "s" : ""} +

+ )} +