diff --git a/apps/web/components/header.tsx b/apps/web/components/header.tsx index fd81bf52e..c70c62d07 100644 --- a/apps/web/components/header.tsx +++ b/apps/web/components/header.tsx @@ -19,6 +19,7 @@ import { import { Button } from "@ui/components/button" import { cn } from "@lib/utils" import { dmSansClassName } from "@/lib/fonts" +import { getBillingSettingsUrl } from "@/lib/url-helpers" import { GraphIcon, IntegrationsIcon } from "@/components/integration-icons" import { DropdownMenu, @@ -80,6 +81,7 @@ export function Header({ onAddMemory, onOpenSearch }: HeaderProps) { feedbackParam, ) const { viewMode, setViewMode } = useViewMode() + const billingSettingsUrl = getBillingSettingsUrl() const handleFeedback = () => setFeedbackOpen(true) @@ -352,6 +354,15 @@ export function Header({ onAddMemory, onOpenSearch }: HeaderProps) { "linear-gradient(180deg, #0A0E14 0%, #05070A 100%)", }} > + + + + Upgrade + + ) : ( <> + + + + + + Upgrade + + + ) + } + + if (isCurrentPlan) { + return ( + + ) + } + + if (isIncludedPlan) { + return ( + + ) + } + + if (plan.isContactSales) { + return ( + + Contact sales + + ) + } + + const checkoutPlanId = + plan.productId === "api_pro" || plan.productId === "api_scale" + ? plan.productId + : null + if (!checkoutPlanId) return null + + return ( + + ) + } + return (
@@ -671,32 +943,91 @@ export default function Billing() { : "Usage resets with your billing cycle"}

- - {!hasPaidPlan ? ( - - ) : null} +
+ + + + + ) : undefined + } + > + Plans + +
+
+
+ {PLAN_CARDS.map((plan) => ( + + ))} +
+
+ {ADVANCED_PLAN_CARDS.map((plan) => ( + + ))} +
+
+
+ {isPlanCarouselActive ? null : ( +
+ +
+ )} +
+ { setShowApiKeyModal(open) if (!open) { @@ -331,7 +340,7 @@ export default function Integrations() { -
+
handleShortcutClick("add")} disabled={createApiKeyMutation.isPending} @@ -342,11 +351,14 @@ export default function Integrations() { ) : ( )} - - {createApiKeyMutation.isPending && - selectedShortcutType === "add" - ? "Creating..." - : "Add memory shortcut"} + + {addShortcutLabel} + + {createApiKeyMutation.isPending && + selectedShortcutType === "add" + ? "Creating..." + : "Add memory shortcut"} + )} - - {createApiKeyMutation.isPending && - selectedShortcutType === "search" - ? "Creating..." - : "Search memory shortcut"} + + {searchShortcutLabel} + + {createApiKeyMutation.isPending && + selectedShortcutType === "search" + ? "Creating..." + : "Search memory shortcut"} +
@@ -397,7 +412,7 @@ export default function Integrations() {
-
+
)} - + {createRaycastApiKeyMutation.isPending ? "Generating..." : "Get API key"} @@ -415,7 +430,7 @@ export default function Integrations() { - + Install extension diff --git a/apps/web/lib/url-helpers.ts b/apps/web/lib/url-helpers.ts index cfd57209e..8fc7d29ee 100644 --- a/apps/web/lib/url-helpers.ts +++ b/apps/web/lib/url-helpers.ts @@ -1,4 +1,22 @@ const PROXY_LOCAL_HOSTS = new Set(["localhost", "127.0.0.1", "::1"]) +const DEV_APP_ORIGIN = "https://app.dev.supermemory.ai" +const PROD_APP_ORIGIN = "https://app.supermemory.ai" + +export function getAppOriginForCurrentEnvironment(hostname?: string): string { + const currentHostname = + hostname ?? (typeof window !== "undefined" ? window.location.hostname : "") + const normalized = currentHostname.toLowerCase() + const isLocalOrDev = + process.env.NODE_ENV !== "production" || + PROXY_LOCAL_HOSTS.has(normalized) || + normalized.includes("app.dev.supermemory") + + return isLocalOrDev ? DEV_APP_ORIGIN : PROD_APP_ORIGIN +} + +export function getBillingSettingsUrl(hostname?: string): string { + return `${getAppOriginForCurrentEnvironment(hostname)}/settings#billing` +} /** Reconstruct the browser-facing URL when running behind portless (or similar). */ export function getPublicRequestUrl(request: Request): URL {