diff --git a/apps/web/components/add-document/connections.tsx b/apps/web/components/add-document/connections.tsx index 221a7329..f37af299 100644 --- a/apps/web/components/add-document/connections.tsx +++ b/apps/web/components/add-document/connections.tsx @@ -328,11 +328,11 @@ export function ConnectContent({ selectedProject }: ConnectContentProps) { const projects = (queryClient.getQueryData(["projects"]) || []) as Project[] - const handleUpgrade = async () => { + const handleUpgrade = async (planId: "api_pro" | "api_max" = "api_pro") => { setIsUpgrading(true) try { const result = await autumn.attach({ - planId: "api_pro", + planId, successUrl: window.location.href, }) if (result?.paymentUrl) { @@ -614,11 +614,21 @@ export function ConnectContent({ selectedProject }: ConnectContentProps) { )} ) : ( @@ -783,8 +793,14 @@ export function ConnectContent({ selectedProject }: ConnectContentProps) { setGranolaModalOpen(true)} + disabled={isUpgrading || autumn.isLoading} + onClick={() => { + if (!isMaxUser) { + handleUpgrade("api_max") + return + } + setGranolaModalOpen(true) + }} className="flex items-start gap-2.5 px-3 py-2.5 rounded-md cursor-pointer text-white opacity-60 hover:opacity-100 hover:bg-[#293952]/40 focus:bg-[#293952]/40 focus:opacity-100 data-disabled:opacity-40 data-disabled:cursor-not-allowed data-disabled:hover:bg-transparent" > @@ -798,7 +814,9 @@ export function ConnectContent({ selectedProject }: ConnectContentProps) { )} - Meeting notes & transcripts + {isMaxUser + ? "Meeting notes & transcripts" + : "Upgrade to Max"} diff --git a/apps/web/components/integrations-view.tsx b/apps/web/components/integrations-view.tsx index 6379aa89..57c6aeb7 100644 --- a/apps/web/components/integrations-view.tsx +++ b/apps/web/components/integrations-view.tsx @@ -2425,10 +2425,11 @@ export function IntegrationsView({ } } - const handleUpgrade = async (planId: "api_pro" | "api_max" = "api_pro") => { + const handleUpgrade = async (planId?: unknown) => { + const checkoutPlanId = planId === "api_max" ? "api_max" : "api_pro" try { const result = await autumn.attach({ - planId, + planId: checkoutPlanId, successUrl: `${window.location.origin}/?view=integrations`, }) if (result?.paymentUrl) { @@ -2741,7 +2742,7 @@ export function IntegrationsView({ } if (claudeCodeConnected) return if (claudeCodeNeedsPro) { - handleUpgrade() + handleUpgrade("api_pro") return } createPluginKeyMutation.mutate("claude_code") @@ -2818,7 +2819,7 @@ export function IntegrationsView({ title="Connect another agent" onClick={() => { if (needsProUpgrade) { - handleUpgrade() + handleUpgrade("api_pro") return } trackCard(item) @@ -2843,6 +2844,11 @@ export function IntegrationsView({ { trackCard(item) + if (!PLUGIN_CATALOG[item.pluginId]?.usesOAuth) { + if (connectingPlugin) return + createPluginKeyMutation.mutate(item.pluginId) + return + } setFinishSetupPluginId(item.pluginId) }} /> @@ -2850,7 +2856,7 @@ export function IntegrationsView({ } if (needsProUpgrade) { return ( - handleUpgrade()}> + handleUpgrade("api_pro")}> Upgrade ) @@ -3020,7 +3026,7 @@ export function IntegrationsView({ { if (needsProUpgrade) { - handleUpgrade() + handleUpgrade("api_pro") return } trackCard(item) @@ -3465,7 +3471,7 @@ export function IntegrationsView({
{connectedDialogNeedsPro ? ( - handleUpgrade()}> + handleUpgrade("api_pro")}> Upgrade to connect more