Repository navigation
feat(integrations): free organizations get the Pro Features dialog for Linear and GitHub #8048
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
db636da
bb850a2
6a3aed8
3e60106
b9a01af
74b60d3
6ba1f3f
045f409
47ed79c
bd6f25e
6fd05e1
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change | ||||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
|
|
@@ -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"; | ||||||||||||||||||||
|
|
@@ -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"; | ||||||||||||||||||||
|
|
@@ -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; | ||||||||||||||||||||
|
|
@@ -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, | ||||||||||||||||||||
|
|
@@ -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} | ||||||||||||||||||||
|
|
@@ -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} | ||||||||||||||||||||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe 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
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe 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 Prompt for AI agents
Suggested change
|
||||||||||||||||||||
| /> | ||||||||||||||||||||
| ); | ||||||||||||||||||||
| })} | ||||||||||||||||||||
|
|
@@ -245,6 +260,7 @@ interface IntegrationRowProps { | |||||||||||||||||||
| isConnected: boolean; | ||||||||||||||||||||
| connectedOrgName?: string | null; | ||||||||||||||||||||
| isLoading?: boolean; | ||||||||||||||||||||
| showProBadge?: boolean; | ||||||||||||||||||||
| onManage: () => void; | ||||||||||||||||||||
| } | ||||||||||||||||||||
|
|
||||||||||||||||||||
|
|
@@ -255,6 +271,7 @@ function IntegrationRow({ | |||||||||||||||||||
| isConnected, | ||||||||||||||||||||
| connectedOrgName, | ||||||||||||||||||||
| isLoading, | ||||||||||||||||||||
| showProBadge = false, | ||||||||||||||||||||
| onManage, | ||||||||||||||||||||
| }: IntegrationRowProps) { | ||||||||||||||||||||
| const status = isLoading ? ( | ||||||||||||||||||||
|
|
@@ -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> | ||||||||||||||||||||
|
|
||||||||||||||||||||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -13,6 +13,7 @@ export interface IntegrationCardProps { | |
| icon: ReactNode; | ||
| accentColor: string; | ||
| disabled?: boolean; | ||
| onClick?: () => void; | ||
| } | ||
|
|
||
| export function IntegrationCard({ | ||
|
|
@@ -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 }); | ||
|
|
@@ -107,5 +109,13 @@ export function IntegrationCard({ | |
| return card; | ||
| } | ||
|
|
||
| if (onClick) { | ||
| return ( | ||
| <button type="button" onClick={onClick} className="w-full text-left"> | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. P3: The Prompt for AI agents |
||
| {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); | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe 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 Prompt for AI agents |
||
| 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", { | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe 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 Prompt for AI agents |
||
| 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"; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Prompt To Fix With AI