Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 3 additions & 1 deletion apps/api/src/app/api/github/install/route.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,9 @@ export async function GET(request: Request) {
if (member instanceof Response) return member;

if (!(await organizationSyncsNow(member.organizationId))) {
return Response.redirect(`${env.NEXT_PUBLIC_WEB_URL}/settings/billing`);
return Response.redirect(
`${env.NEXT_PUBLIC_WEB_URL}/integrations?pro=github`,
);
}

if (!env.GH_APP_ID) {
Expand Down
4 changes: 3 additions & 1 deletion apps/api/src/app/api/integrations/linear/connect/route.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,9 @@ export async function GET(request: Request) {
if (member instanceof Response) return member;

if (!(await organizationSyncsNow(member.organizationId))) {
return Response.redirect(`${env.NEXT_PUBLIC_WEB_URL}/settings/billing`);
return Response.redirect(
`${env.NEXT_PUBLIC_WEB_URL}/integrations?pro=linear`,
);
}

return beginOAuthFlow({
Expand Down
43 changes: 13 additions & 30 deletions apps/desktop/src/renderer/components/Paywall/Paywall.tsx
Original file line number Diff line number Diff line change
@@ -1,13 +1,12 @@
import { Trans } from "@lingui/react/macro";
import { Button } from "@superset/ui/button";
import { Dialog, DialogContent } from "@superset/ui/dialog";
import {
PRO_FEATURES,
ProFeaturesDialog,
} from "@superset/ui/pro-features-dialog";
import { useNavigate } from "@tanstack/react-router";
import { useEffect, useRef, useState } from "react";
import { track } from "renderer/lib/analytics";
import { FeaturePreview } from "./components/FeaturePreview";
import { FeatureSidebar } from "./components/FeatureSidebar";
import type { GatedFeature } from "./constants";
import { FEATURE_ID_MAP, PRO_FEATURES } from "./constants";
import { FEATURE_ID_MAP } from "./constants";

type PaywallOptions = {
feature: GatedFeature;
Expand Down Expand Up @@ -122,30 +121,14 @@ export const Paywall = () => {
};

return (
<Dialog open={isOpen} onOpenChange={handleOpenChange}>
<DialogContent
className="!w-[744px] !max-w-[744px] p-0 gap-0 overflow-hidden !rounded-none"
showCloseButton={false}
>
<div className="flex">
<FeatureSidebar
selectedFeatureId={selectedFeatureId}
highlightedFeatureId={initialFeatureId}
onSelectFeature={handleSelectFeature}
/>
<FeaturePreview selectedFeature={selectedFeature} />
</div>

<div className="box-border flex items-center justify-between border-t bg-background px-5 py-4">
<Button variant="outline" onClick={() => handleOpenChange(false)}>
<Trans>Cancel</Trans>
</Button>
<Button onClick={handleUpgrade}>
<Trans>Get Superset Pro</Trans>
</Button>
</div>
</DialogContent>
</Dialog>
<ProFeaturesDialog
open={isOpen}
onOpenChange={handleOpenChange}
selectedFeatureId={selectedFeatureId}
highlightedFeatureId={initialFeatureId}
onSelectFeature={handleSelectFeature}
onUpgrade={handleUpgrade}
/>
);
};

Expand Down
103 changes: 0 additions & 103 deletions apps/desktop/src/renderer/components/Paywall/constants.ts
Original file line number Diff line number Diff line change
@@ -1,15 +1,3 @@
import type { MessageDescriptor } from "@lingui/core";
import { msg } from "@lingui/core/macro";
import type { IconType } from "react-icons";
import { FaSlack } from "react-icons/fa";
import {
HiDevicePhoneMobile,
HiOutlineClipboardDocumentList,
HiOutlineClock,
HiOutlineSignal,
HiUsers,
} from "react-icons/hi2";

export const GATED_FEATURES = {
INVITE_MEMBERS: "invite-members",
TASKS: "tasks",
Expand All @@ -20,97 +8,6 @@ export const GATED_FEATURES = {

export type GatedFeature = (typeof GATED_FEATURES)[keyof typeof GATED_FEATURES];

export interface ProFeature {
id: string;
title: MessageDescriptor;
description: MessageDescriptor;
icon: IconType;
iconColor: string;
gradientColors: readonly [string, string, string, string];
comingSoon?: boolean;
}

export const PRO_FEATURES: ProFeature[] = [
{
id: "remote-access",
title: msg({
message: "Remote Access",
}),
description: msg({
message:
"Reach this Mac from anywhere via the Superset relay, or spin up cloud workspaces. Connect from any client.",
}),
icon: HiOutlineSignal,
iconColor: "text-pink-500",
gradientColors: ["#be185d", "#9d174d", "#831843", "#1a1a2e"],
},
{
id: "automations",
title: msg({
message: "Automations",
}),
description: msg({
message:
"Put recurring work on a schedule or an event. Agents run on their own and land in a workspace for you to review.",
}),
icon: HiOutlineClock,
iconColor: "text-amber-500",
gradientColors: ["#b45309", "#92400e", "#78350f", "#1a1a2e"],
},
{
id: "team-collaboration",
title: msg({
message: "Team Collaboration",
}),
description: msg({
message:
"Invite your team to shared workspaces. See real-time updates, sync configurations, and manage team access across agents.",
}),
icon: HiUsers,
iconColor: "text-blue-500",
gradientColors: ["#1e40af", "#1e3a8a", "#172554", "#1a1a2e"],
},
{
id: "tasks",
title: msg({
message: "Tasks",
}),
description: msg({
message:
"Track and manage tasks synced from Linear. Stay on top of your work without leaving Superset.",
}),
icon: HiOutlineClipboardDocumentList,
iconColor: "text-emerald-500",
gradientColors: ["#047857", "#065f46", "#064e3b", "#1a1a2e"],
},
{
id: "slack-integration",
title: msg({
message: "Slack Integration",
}),
description: msg({
message:
"Turn Slack conversations into tasks, run agents from your workspace, and keep teammates in the loop where work starts.",
}),
icon: FaSlack,
iconColor: "text-violet-500",
gradientColors: ["#7c3aed", "#4f46e5", "#0f766e", "#1a1a2e"],
},
{
id: "mobile-app",
title: msg({
message: "Mobile App",
}),
description: msg({
message:
"Monitor workspaces and manage tasks on the go. Continue conversations from anywhere.",
}),
icon: HiDevicePhoneMobile,
iconColor: "text-red-500",
gradientColors: ["#7f1d1d", "#991b1b", "#450a0a", "#1a1a2e"],
},
];

// Map gated feature IDs to the feature to highlight in the paywall dialog
export const FEATURE_ID_MAP: Record<GatedFeature, string> = {
[GATED_FEATURES.INVITE_MEMBERS]: "team-collaboration",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ import {
type IntegrationProvider,
offeredIntegrations,
} from "@superset/shared/integrations";
import { Badge } from "@superset/ui/badge";
import { Button } from "@superset/ui/button";
import { Skeleton } from "@superset/ui/skeleton";
import { useFeatureFlagPayload } from "posthog-js/react";
Expand All @@ -12,6 +13,11 @@ import { BsMicrosoftTeams } from "react-icons/bs";
import { FaGithub, FaGoogle, FaSlack } from "react-icons/fa";
import { HiOutlineArrowTopRightOnSquare } from "react-icons/hi2";
import { SiLinear, SiNotion, SiSentry } from "react-icons/si";
import {
GATED_FEATURES,
type GatedFeature,
usePaywall,
} from "renderer/components/Paywall";
import { env } from "renderer/env.renderer";
import { useActiveOrganizationId } from "renderer/hooks/useActiveOrganizationId";
import { apiTrpcClient } from "renderer/lib/api-trpc-client";
Expand Down Expand Up @@ -47,6 +53,11 @@ const INTEGRATION_ICONS: Record<IntegrationProvider, React.ReactNode> = {
google: <FaGoogle className="size-5" />,
};

const PRO_GATED: Partial<Record<IntegrationProvider, GatedFeature>> = {
linear: GATED_FEATURES.TASKS,
github: GATED_FEATURES.REMOTE_ACCESS,
};

interface ProviderState {
isConnected: boolean;
connectedOrgName?: string | null;
Expand All @@ -61,6 +72,7 @@ export function IntegrationsSettings({
// window against the other one's organization.
const activeOrganizationId = useActiveOrganizationId();
const searchQuery = useSettingsSearchQuery();
const { gateFeature, hasAccess, isReady: planReady } = usePaywall();

const enabledTriggerKinds = useFeatureFlagPayload(
FEATURE_FLAGS.AUTOMATION_EVENT_TRIGGERS,
Expand Down Expand Up @@ -212,6 +224,8 @@ export function IntegrationsSettings({
const itemId = integrationSettingItemId(integration.provider);
if (!isItemVisible(itemId, visibleItems)) return null;
const state = providerStates[integration.provider];
const gate = PRO_GATED[integration.provider];
const openWeb = () => handleOpenWeb(integration.webPath);
return (
<IntegrationRow
key={integration.provider}
Expand All @@ -223,7 +237,8 @@ export function IntegrationsSettings({
isConnected={state.isConnected}
connectedOrgName={state.connectedOrgName}
isLoading={state.isLoading}
onManage={() => handleOpenWeb(integration.webPath)}
showProBadge={!!gate && planReady && !hasAccess(gate)}
onManage={gate ? () => gateFeature(gate, openWeb) : openWeb}
Comment on lines +240 to +241

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P1 Grace-period access is blocked During the seven days after a paid subscription is canceled, the API still allows integration sync. The desktop plan check instead treats the organization as free, so this gate shows a PRO badge and opens the paywall rather than the Linear or GitHub management page.

Prompt To Fix With AI
This is a comment left during a code review.
Path: apps/desktop/src/renderer/routes/_authenticated/settings/integrations/components/IntegrationsSettings/IntegrationsSettings.tsx
Line: 240-241

Comment:
**Grace-period access is blocked** During the seven days after a paid subscription is canceled, the API still allows integration sync. The desktop plan check instead treats the organization as free, so this gate shows a PRO badge and opens the paywall rather than the Linear or GitHub management page.

---

For each issue above, determine whether it is valid and should be fixed. If so, fix it directly.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2: Honor the sync grace period when gating these rows; canceled Pro organizations otherwise see the paywall instead of reaching integration management while sync remains allowed.

Prompt for AI agents
Check if this issue is valid — if so, understand the root cause and fix it. When an issue isn't valid or won't be fixed in this PR, reply in its thread with the reason and then resolve the thread. At apps/desktop/src/renderer/routes/_authenticated/settings/integrations/components/IntegrationsSettings/IntegrationsSettings.tsx, line 241:

<comment>Honor the sync grace period when gating these rows; canceled Pro organizations otherwise see the paywall instead of reaching integration management while sync remains allowed.</comment>

<file context>
@@ -223,7 +237,8 @@ export function IntegrationsSettings({
 							isLoading={state.isLoading}
-							onManage={() => handleOpenWeb(integration.webPath)}
+							showProBadge={!!gate && planReady && !hasAccess(gate)}
+							onManage={gate ? () => gateFeature(gate, openWeb) : openWeb}
 						/>
 					);
</file context>

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P3: The Manage/Connect click for Linear and GitHub now opens the web page only after gateFeature awaits the plan check. Previously window.open ran synchronously inside the click handler; now it runs inside gateFeature's async IIFE after await resolvePlanWhenKnown() (usePaywall.ts), which can hit billing.activePlan.ensureData()/fetch() on a cold start. When the plan is not yet loaded, window.open fires after a network await, outside the user-gesture context, so the popup can be suppressed and a paying user's click silently does nothing. Keep the synchronous path for users whose access is already known at render time, and defer to gateFeature only while the plan is still resolving.

Prompt for AI agents
Check if this issue is valid — if so, understand the root cause and fix it. When an issue isn't valid or won't be fixed in this PR, reply in its thread with the reason and then resolve the thread. At apps/desktop/src/renderer/routes/_authenticated/settings/integrations/components/IntegrationsSettings/IntegrationsSettings.tsx, line 241:

<comment>The Manage/Connect click for Linear and GitHub now opens the web page only after `gateFeature` awaits the plan check. Previously `window.open` ran synchronously inside the click handler; now it runs inside `gateFeature`'s async IIFE after `await resolvePlanWhenKnown()` (usePaywall.ts), which can hit `billing.activePlan.ensureData()/fetch()` on a cold start. When the plan is not yet loaded, `window.open` fires after a network await, outside the user-gesture context, so the popup can be suppressed and a paying user's click silently does nothing. Keep the synchronous path for users whose access is already known at render time, and defer to `gateFeature` only while the plan is still resolving.</comment>

<file context>
@@ -223,7 +237,8 @@ export function IntegrationsSettings({
 							isLoading={state.isLoading}
-							onManage={() => handleOpenWeb(integration.webPath)}
+							showProBadge={!!gate && planReady && !hasAccess(gate)}
+							onManage={gate ? () => gateFeature(gate, openWeb) : openWeb}
 						/>
 					);
</file context>
Suggested change
onManage={gate ? () => gateFeature(gate, openWeb) : openWeb}
onManage={
gate
? () =>
planReady && hasAccess(gate)
? openWeb()
: gateFeature(gate, openWeb)
: openWeb
}

/>
);
})}
Expand All @@ -245,6 +260,7 @@ interface IntegrationRowProps {
isConnected: boolean;
connectedOrgName?: string | null;
isLoading?: boolean;
showProBadge?: boolean;
onManage: () => void;
}

Expand All @@ -255,6 +271,7 @@ function IntegrationRow({
isConnected,
connectedOrgName,
isLoading,
showProBadge = false,
onManage,
}: IntegrationRowProps) {
const status = isLoading ? (
Expand Down Expand Up @@ -289,7 +306,14 @@ function IntegrationRow({
{icon}
</div>
<div className="min-w-0">
<div className="text-sm font-medium">{name}</div>
<div className="flex items-center gap-2 text-sm font-medium">
{name}
{showProBadge && (
<Badge variant="default">
<Trans>PRO</Trans>
</Badge>
)}
</div>
<div className="text-xs text-muted-foreground mt-0.5 truncate">
{description}
</div>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ export interface IntegrationCardProps {
icon: ReactNode;
accentColor: string;
disabled?: boolean;
onClick?: () => void;
}

export function IntegrationCard({
Expand All @@ -23,6 +24,7 @@ export function IntegrationCard({
icon,
accentColor,
disabled = false,
onClick,
}: IntegrationCardProps) {
const cardRef = useRef<HTMLDivElement>(null);
const [mousePosition, setMousePosition] = useState({ x: 0, y: 0 });
Expand Down Expand Up @@ -107,5 +109,13 @@ export function IntegrationCard({
return card;
}

if (onClick) {
return (
<button type="button" onClick={onClick} className="w-full text-left">

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P3: The card element is a block-level div, which is not phrasing content, so it is non-conforming inside a <button> (whose content model only allows phrasing content). Browsers render it anyway, but it fails HTML validity and leaves the layout without a spec-guaranteed behavior. Either keep the interactive semantics by swapping the inner wrapper to phrasing-level elements (spans) inside the button, or make the card itself the clickable interactive element (e.g. a div with role/tabIndex and keyboard handlers) instead of nesting block markup.

Prompt for AI agents
Check if this issue is valid — if so, understand the root cause and fix it. When an issue isn't valid or won't be fixed in this PR, reply in its thread with the reason and then resolve the thread. At apps/web/src/app/(app)/(page)/integrations/components/IntegrationCard/IntegrationCard.tsx, line 114:

<comment>The `card` element is a block-level `div`, which is not phrasing content, so it is non-conforming inside a `<button>` (whose content model only allows phrasing content). Browsers render it anyway, but it fails HTML validity and leaves the layout without a spec-guaranteed behavior. Either keep the interactive semantics by swapping the inner wrapper to phrasing-level elements (spans) inside the button, or make the card itself the clickable interactive element (e.g. a div with role/tabIndex and keyboard handlers) instead of nesting block markup.</comment>

<file context>
@@ -107,5 +109,13 @@ export function IntegrationCard({
 
+	if (onClick) {
+		return (
+			<button type="button" onClick={onClick} className="w-full text-left">
+				{card}
+			</button>
</file context>

{card}
</button>
);
}

return <Link href={`/integrations/${id}`}>{card}</Link>;
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,75 @@
"use client";

import {
PRO_FEATURES,
ProFeaturesDialog,
} from "@superset/ui/pro-features-dialog";
import { useRouter } from "next/navigation";
import posthog from "posthog-js";
import { useEffect, useRef, useState } from "react";

interface ProFeaturesPaywallProps {
featureId: string | null;
triggerSource: string | null;
onClose: () => void;
}

export function ProFeaturesPaywall({
featureId,
triggerSource,
onClose,
}: ProFeaturesPaywallProps) {
const router = useRouter();
const [selectedFeatureId, setSelectedFeatureId] = useState(
featureId ?? PRO_FEATURES[0]?.id ?? "",
);
const openedAt = useRef(0);

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P3: This component reimplements the desktop Paywall's analytics lifecycle (paywall_opened / paywall_cancelled / paywall_feature_clicked / paywall_upgrade_clicked plus the openedAt and viewed refs) even though the dialog UI itself was just extracted into @superset/ui/pro-features-dialog. Desktop Paywall.tsx (openedAt/viewed refs, event captures) is now duplicated almost verbatim in the web component, so behavior will drift. Extract the shared orchestration (e.g. a useProFeaturesPaywall hook in the ui package) and have both platforms consume it, keeping only platform-specific bits (track vs posthog-js, navigation) as callbacks.

Prompt for AI agents
Check if this issue is valid — if so, understand the root cause and fix it. When an issue isn't valid or won't be fixed in this PR, reply in its thread with the reason and then resolve the thread. At apps/web/src/app/(app)/(page)/integrations/components/ProFeaturesPaywall/ProFeaturesPaywall.tsx, line 26:

<comment>This component reimplements the desktop Paywall's analytics lifecycle (paywall_opened / paywall_cancelled / paywall_feature_clicked / paywall_upgrade_clicked plus the openedAt and viewed refs) even though the dialog UI itself was just extracted into @superset/ui/pro-features-dialog. Desktop `Paywall.tsx` (openedAt/viewed refs, event captures) is now duplicated almost verbatim in the web component, so behavior will drift. Extract the shared orchestration (e.g. a `useProFeaturesPaywall` hook in the ui package) and have both platforms consume it, keeping only platform-specific bits (track vs posthog-js, navigation) as callbacks.</comment>

<file context>
@@ -0,0 +1,75 @@
+	const [selectedFeatureId, setSelectedFeatureId] = useState(
+		featureId ?? PRO_FEATURES[0]?.id ?? "",
+	);
+	const openedAt = useRef(0);
+	const viewed = useRef(new Set<string>());
+
</file context>

const viewed = useRef(new Set<string>());

useEffect(() => {
if (!featureId) return;
setSelectedFeatureId(featureId);
openedAt.current = Date.now();
viewed.current = new Set([featureId]);
posthog.capture("paywall_opened", {

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P3: The web captures for the shared event names (paywall_opened, paywall_feature_clicked, paywall_upgrade_clicked) omit the feature_title property that the desktop's identical events send, so PostHog receives different schemas for the same events depending on platform. Resolve the title from PRO_FEATURES (PRO_FEATURES.find((f) => f.id === id)?.title.message) and include it in all three web captures.

Prompt for AI agents
Check if this issue is valid — if so, understand the root cause and fix it. When an issue isn't valid or won't be fixed in this PR, reply in its thread with the reason and then resolve the thread. At apps/web/src/app/(app)/(page)/integrations/components/ProFeaturesPaywall/ProFeaturesPaywall.tsx, line 34:

<comment>The web captures for the shared event names (paywall_opened, paywall_feature_clicked, paywall_upgrade_clicked) omit the `feature_title` property that the desktop's identical events send, so PostHog receives different schemas for the same events depending on platform. Resolve the title from PRO_FEATURES (`PRO_FEATURES.find((f) => f.id === id)?.title.message`) and include it in all three web captures.</comment>

<file context>
@@ -0,0 +1,75 @@
+		setSelectedFeatureId(featureId);
+		openedAt.current = Date.now();
+		viewed.current = new Set([featureId]);
+		posthog.capture("paywall_opened", {
+			trigger_source: triggerSource,
+			feature_id: featureId,
</file context>

trigger_source: triggerSource,
feature_id: featureId,
});
}, [featureId, triggerSource]);

const summary = () => ({
trigger_source: triggerSource,
feature_id: selectedFeatureId,
features_viewed_count: viewed.current.size,
time_spent_ms: Date.now() - openedAt.current,
});

return (
<ProFeaturesDialog
open={featureId !== null}
onOpenChange={(open) => {
if (open) return;
posthog.capture("paywall_cancelled", summary());
onClose();
}}
selectedFeatureId={selectedFeatureId}
highlightedFeatureId={featureId ?? selectedFeatureId}
onSelectFeature={(id) => {
if (id !== selectedFeatureId) {
posthog.capture("paywall_feature_clicked", {
trigger_source: triggerSource,
feature_id: id,
previous_feature_id: selectedFeatureId,
});
viewed.current.add(id);
}
setSelectedFeatureId(id);
}}
onUpgrade={() => {
posthog.capture("paywall_upgrade_clicked", summary());
onClose();
router.push("/settings/billing");
}}
/>
);
}
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
export { ProFeaturesPaywall } from "./ProFeaturesPaywall";
Loading
Loading