Skip to content

:hedgehog: PostHog is the leading platform for building self-driving products. Our developer tools – AI observability, analytics, session replay, flags, experiments, error tracking, logs, and more – capture all the context agents need to diagnose problems, uncover opportunities, and ship fixes. Steer it all from Slack, web, desktop, or the MCP.

fix(settings): show one paygate for the organization security section (#118230)

posthog[bot]8a015d95bca0
diff --git a/frontend/src/lib/components/PayGateMini/PayGateMini.tsx b/frontend/src/lib/components/PayGateMini/PayGateMini.tsx
index 033aaf8490dd..34407e36b236 100644
--- a/frontend/src/lib/components/PayGateMini/PayGateMini.tsx
+++ b/frontend/src/lib/components/PayGateMini/PayGateMini.tsx
@@ -60,7 +60,7 @@ export function PayGateMini({
loadingSkeleton,
handleSubmit,
}: PayGateMiniProps): JSX.Element | null {
- const { productWithFeature, featureInfo, gateVariant, bypassPaywall, ctaLabel } = useValues(
+ const { productWithFeature, gateVariant, isGated, ctaLabel } = useValues(
payGateMiniLogic({ feature, currentUsage })
)
const { setBypassPaywall } = useActions(payGateMiniLogic({ feature, currentUsage }))
@@ -120,7 +120,7 @@ export function PayGateMini({
return null // Don't show anything if paid features are explicitly disabled
}
- if (gateVariant && productWithFeature && featureInfo && !overrideShouldShowGate && !bypassPaywall) {
+ if (isGated && !overrideShouldShowGate) {
return (
<PayGateContent
feature={feature}
diff --git a/frontend/src/lib/components/PayGateMini/payGateMiniLogic.tsx b/frontend/src/lib/components/PayGateMini/payGateMiniLogic.tsx
index 561e87bb295e..4a42d1749532 100644
--- a/frontend/src/lib/components/PayGateMini/payGateMiniLogic.tsx
+++ b/frontend/src/lib/components/PayGateMini/payGateMiniLogic.tsx
@@ -34,6 +34,7 @@ export interface payGateMiniLogicValues {
featureInfoOnNextPlan: BillingFeatureType | undefined
gateVariant: 'add-card' | 'contact-sales' | 'move-to-cloud' | null
isAddonProduct: boolean | undefined
+ isGated: boolean
isPaymentEntryFlow: boolean
minimumPlanWithFeature: BillingPlanType | undefined
nextPlanWithFeature: BillingPlanType | null | undefined
@@ -102,6 +103,12 @@ export interface payGateMiniLogicMeta {
billing: BillingType | null
) => boolean
ctaDisabledReason: (isPaymentEntryFlow: boolean, selfServeBillingDisabledReason: string | null) => string | null
+ isGated: (
+ gateVariant: 'add-card' | 'contact-sales' | 'move-to-cloud' | null,
+ productWithFeature: BillingProductV2AddonType | BillingProductV2Type | undefined,
+ featureInfo: BillingFeatureType | undefined,
+ bypassPaywall: boolean
+ ) => boolean
}
}
@@ -305,5 +312,14 @@ export const payGateMiniLogic = kea<payGateMiniLogicType>([
(isPaymentEntryFlow: boolean, selfServeBillingDisabledReason: string | null): string | null =>
isPaymentEntryFlow ? selfServeBillingDisabledReason : null,
],
+ isGated: [
+ (s) => [s.gateVariant, s.productWithFeature, s.featureInfo, s.bypassPaywall],
+ (
+ gateVariant: 'add-card' | 'contact-sales' | 'move-to-cloud' | null,
+ productWithFeature: BillingProductV2AddonType | BillingProductV2Type | undefined,
+ featureInfo: import('~/types').BillingFeatureType | undefined,
+ bypassPaywall: boolean
+ ): boolean => !!gateVariant && !!productWithFeature && !!featureInfo && !bypassPaywall,
+ ],
})),
])
diff --git a/frontend/src/scenes/settings/organization/OrganizationMCPAccess.tsx b/frontend/src/scenes/settings/organization/OrganizationMCPAccess.tsx
index d17a4389427c..2aa661359757 100644
--- a/frontend/src/scenes/settings/organization/OrganizationMCPAccess.tsx
+++ b/frontend/src/scenes/settings/organization/OrganizationMCPAccess.tsx
@@ -3,13 +3,12 @@ import { useActions, useValues } from 'kea'
import { IconInfo } from '@posthog/icons'
import { LemonSwitch } from '@posthog/lemon-ui'
-import { PayGateMini } from 'lib/components/PayGateMini/PayGateMini'
import { useRestrictedArea } from 'lib/components/RestrictedArea'
import { OrganizationMembershipLevel } from 'lib/constants'
import { Tooltip } from 'lib/lemon-ui/Tooltip'
import { organizationLogic } from 'scenes/organizationLogic'
-import { AvailableFeature } from '~/types'
+import { OrganizationSecuritySettingGate } from './OrganizationSecuritySettingGate'
export function OrganizationMCPAccess(): JSX.Element {
const { currentOrganization, currentOrganizationLoading } = useValues(organizationLogic)
@@ -20,7 +19,7 @@ export function OrganizationMCPAccess(): JSX.Element {
})
return (
- <PayGateMini feature={AvailableFeature.ORGANIZATION_SECURITY_SETTINGS}>
+ <OrganizationSecuritySettingGate featureDetail="organization-mcp-access">
<LemonSwitch
label={
<span>
@@ -39,6 +38,6 @@ export function OrganizationMCPAccess(): JSX.Element {
disabled={currentOrganizationLoading}
disabledReason={adminRestrictionReason}
/>
- </PayGateMini>
+ </OrganizationSecuritySettingGate>
)
}
diff --git a/frontend/src/scenes/settings/organization/OrganizationPersonalAPIKeys.tsx b/frontend/src/scenes/settings/organization/OrganizationPersonalAPIKeys.tsx
index f1f8db5e6a45..d3fa44dcf930 100644
--- a/frontend/src/scenes/settings/organization/OrganizationPersonalAPIKeys.tsx
+++ b/frontend/src/scenes/settings/organization/OrganizationPersonalAPIKeys.tsx
@@ -1,6 +1,5 @@
import { useValues } from 'kea'
-import { PayGateMini } from 'lib/components/PayGateMini/PayGateMini'
import { useRestrictedArea } from 'lib/components/RestrictedArea'
import { OrganizationMembershipLevel } from 'lib/constants'
import { userLogic } from 'scenes/userLogic'
@@ -8,6 +7,7 @@ import { userLogic } from 'scenes/userLogic'
import { AvailableFeature } from '~/types'
import { OrganizationPersonalAPIKeysTable } from './OrganizationPersonalAPIKeysTable'
+import { OrganizationSecuritySettingGate } from './OrganizationSecuritySettingGate'
export function OrganizationPersonalAPIKeys(): JSX.Element {
const { hasAvailableFeature } = useValues(userLogic)
@@ -23,11 +23,8 @@ export function OrganizationPersonalAPIKeys(): JSX.Element {
}
return (
- <PayGateMini
- feature={AvailableFeature.ORGANIZATION_SECURITY_SETTINGS}
- featureDetail="organization-personal-api-keys"
- >
+ <OrganizationSecuritySettingGate featureDetail="organization-personal-api-keys">
{entitled ? <OrganizationPersonalAPIKeysTable /> : null}
- </PayGateMini>
+ </OrganizationSecuritySettingGate>
)
}
diff --git a/frontend/src/scenes/settings/organization/OrganizationSecuritySettingGate.tsx b/frontend/src/scenes/settings/organization/OrganizationSecuritySettingGate.tsx
new file mode 100644
index 000000000000..c9fdd7deb921
--- /dev/null
+++ b/frontend/src/scenes/settings/organization/OrganizationSecuritySettingGate.tsx
@@ -0,0 +1,56 @@
+import { useValues } from 'kea'
+import posthog from 'posthog-js'
+
+import { PayGateButton } from 'lib/components/PayGateMini/PayGateButton'
+import { PayGateMini } from 'lib/components/PayGateMini/PayGateMini'
+import { payGateMiniLogic } from 'lib/components/PayGateMini/payGateMiniLogic'
+import { preflightLogic } from 'lib/logic/preflightLogic'
+
+import { AvailableFeature } from '~/types'
+
+const FEATURE = AvailableFeature.ORGANIZATION_SECURITY_SETTINGS
+
+// The organization security setting shows the full upgrade card for this section.
+// Other settings in the section show one short line, so the card does not repeat.
+export function OrganizationSecuritySettingGate({
+ featureDetail,
+ children,
+}: {
+ featureDetail: string
+ children: React.ReactNode
+}): JSX.Element | null {
+ const { isGated, productWithFeature, gateVariant, ctaLabel } = useValues(payGateMiniLogic({ feature: FEATURE }))
+ const { preflight } = useValues(preflightLogic)
+
+ if (!isGated) {
+ return (
+ <PayGateMini feature={FEATURE} featureDetail={featureDetail}>
+ {children}
+ </PayGateMini>
+ )
+ }
+
+ if (preflight?.instance_preferences?.disable_paid_fs) {
+ return null
+ }
+
+ return (
+ <div className="flex flex-wrap items-center gap-2">
+ <span className="text-sm text-secondary">Upgrade your plan to use this setting.</span>
+ <PayGateButton
+ feature={FEATURE}
+ type="secondary"
+ size="small"
+ onClick={() =>
+ posthog.capture('pay gate CTA clicked', {
+ product_key: productWithFeature?.type,
+ feature: FEATURE,
+ feature_detail: featureDetail,
+ gate_variant: gateVariant,
+ cta_label: ctaLabel,
+ })
+ }
+ />
+ </div>
+ )
+}