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.

feat(onboarding): show platform packages on plans step behind flag (#64399)

Mike Warren6ff9753d040d
diff --git a/frontend/snapshots.yml b/frontend/snapshots.yml
index 08112119aa11..7aaefba104c3 100644
--- a/frontend/snapshots.yml
+++ b/frontend/snapshots.yml
@@ -6805,9 +6805,9 @@ snapshots:
scenes-other-account-connected--invalid-link--light:
hash: v1.k794b7964.2dc322602c4ce0d0e4a05eec0c9272f8135865fe997c74be40acb8689ae2ab93.Njo6bfTfz0F2y1VdKSM_2soIiGEIsKi3vZvz_HwMW_M
scenes-other-billing--billing--dark:
- hash: v1.k794b7964.7d8d15966d60d5c51ac111ecad259fb4bbe471cbc293fc270ebf2f56809c8d85.90swJKlcQ3DfRle4imvs1QT0vP0TYxJsqA_8dQEbl2E
+ hash: v1.k794b7964.a9557b94ba60ce9af1aa6fa099daf363368d83528ed43fbdcbbb8469bf1e0d35.4_gyvOJBFvlaJcCkguUD9TTdMPLjtCdJaBgFYcY2LjM
scenes-other-billing--billing--light:
- hash: v1.k794b7964.50ab945fccfc7839f092829b0c11d948d32743916a84b6692d2ff64f0802dc35.kUQ7v-S8ANgYS99Xyi4mLb0oYTlDa7zqQkEr8q-298w
+ hash: v1.k794b7964.0acf9f6b6c07ec2281dd42bcbcc41e89b1847d236d470ba39529c9758c86add2._YqXXoNjAJqfVJ_Uo9gQV_HjeU4sWjZos6N22QttSZM
scenes-other-billing--billing-purchase-credits-modal--dark:
hash: v1.k794b7964.dc9b77730db0685138240858a0c550db9765c172321e54304e9f297d0bd00adc.v7awXXbWH1-_a9mzHgVKs99YvwpmU6dHZQgLI_OW9k4
scenes-other-billing--billing-purchase-credits-modal--light:
@@ -6817,9 +6817,9 @@ snapshots:
scenes-other-billing--billing-unsubscribe-modal--light:
hash: v1.k794b7964.b676dda14727516b10f340ebb626babaee98152329868ac8aa8c5a3a90ee26d1.MxyCnRf692V5gtPnmOsCTnxMCAAt__URa4rJQJENBZw
scenes-other-billing--billing-with-credit-cta--dark:
- hash: v1.k794b7964.f027901c551fefc309467e357708702657f59c1139e1373784231bc1fc77b894.5qfmzAj0onFZ8nLq8V1nrLNNWer8xRn9Y0rR6uv72Lo
+ hash: v1.k794b7964.959bdf4d047f8c5f1af0453848d5632b2dfcaaab80fe6d9cb3aa58dcb08fe760.vLS-1KEmdcBoEcV4l87e7jlR2VMAMvykgIITrkvqLCM
scenes-other-billing--billing-with-credit-cta--light:
- hash: v1.k794b7964.7b58cfc361ce6931755b0f72a40ea689c0d54045a94ec1a0e5f1433d8cfa6abb.KLMJgDlCQcWBWudUXBx8UesSNqUlnwljzU7_-31nkwg
+ hash: v1.k794b7964.1844987347ba636efdb6459a12b4e60fa521034e9f167fea4847a0fdf491a7b1.XD1RzrnBVf0xunRwFoBmIKSgA1FL5vn7nx_mrhDVCm0
scenes-other-billing--billing-with-credits--dark:
hash: v1.k794b7964.457257072f4ee70056be2e1a4551fc098644ce363246c8ce4727a636d6231a06.RvIsfP2a2yPEOYspq28VMp3DZx-mY_nAbnb5OsRGHVU
scenes-other-billing--billing-with-credits--light:
@@ -6833,29 +6833,29 @@ snapshots:
scenes-other-billing--billing-with-limit-and-100-percent-discount--light:
hash: v1.k794b7964.c60133947fb5ef34eaf37fa21bb0390bccff77b1b5fe49e01e9f5a7b239a7c04.oIDvDkc41HCJUBwamg0ahQQYn3NNsIX7cLFMOTjk4VE
scenes-other-billing--billing-without-icon-keys--dark:
- hash: v1.k794b7964.63f3b3219654c4a0d4e51ddb159ba03c1fc398d34a93284bada4e661b0c8f50f.BI4VJSEkVAXi_kI1NGcHmtiJHDT8AJUlFdSR_45X9d8
+ hash: v1.k794b7964.936ddaa92724f9f5153fead60e6fbf67b8f54169f65cc6e740f6ff70bdffdd12.ZQUvk2TUg70Atx6kKgI7yZZHZ-pwXrXyqE0V842hSrQ
scenes-other-billing--billing-without-icon-keys--light:
- hash: v1.k794b7964.2cb9ec40b586321cdf938f7b81ee9f8e02150b8ea22d210ad564fcc9943c89bf.4wnhJJr-IdlW6Zf93k3TxFlb3YXJaoEk4LpSM85kHqA
+ hash: v1.k794b7964.b5b777b1127c3d1390bfe75ea23cf88622b83402a583872bccc7e9aadd394509.n_jk5sPQXtL-sZTdNpdlQke_UyHxa5VsutZGNgtNScs
scenes-other-billing-product--billing-product-inclusion-only-with-addon--dark:
- hash: v1.k794b7964.e89a6dd81cab92e698b48df14551e13c7eeb3780fb7995c278d1d8bc3c7a3a1b.p9KdLWg_7XmhaCJDcL51QlrV4XLx4MJr_bmWWAH4Z8I
+ hash: v1.k794b7964.d93e21210ecd7d2f1bff3ea8ce7b4e33148d615a1b0ac97587b744f1e99ed753.5TPZcpMoUB2SDUipZlaec7zRNswNaFEagINpHL-4CrE
scenes-other-billing-product--billing-product-inclusion-only-with-addon--light:
- hash: v1.k794b7964.be1b6b47e48233c3db4510f102fa515bde864d846222d1cbb673a48c18fdaf3a.otOrusrEQpnWmMH4bqCjTyKKb8CTtlflSV8oV71TicQ
+ hash: v1.k794b7964.25960f4eea0a953164453dd67b1b1ad9271e27bb4be5ca4761ac157b8d3c3fb8.X22Pk34PI-GlumKasReLIlpSvXCHYHJGlGuN3yL--c4
scenes-other-billing-product--billing-product-platform-addons-on-legacy-teams--dark:
- hash: v1.k794b7964.e2a6e21d6647d29ddac2722b891c9c91524cd6ce1e78ed7f5e36d71d7e413c6e.7ldJwJp-u5x2S6OfxNd8gW_GAZqMwKUxQpF3Y84KbgM
+ hash: v1.k794b7964.0ad37ae1093044f74ff793b12706c4c51ef9160f926c5a7122309da045d9629d.5EBIR22-NE47xc3VvY8aunwZQMeyspaS0l1WRAUX6bI
scenes-other-billing-product--billing-product-platform-addons-on-legacy-teams--light:
- hash: v1.k794b7964.ae113b23608f9538187b220ce4facac01bbb4a892f68ae22e6898ea5b6271f7f.WVCQy1LPPyN0NxwK0Icwg_73YOTGntCUuDZfGxQ6JHY
+ hash: v1.k794b7964.b8d005a19b3deac2c745867ed189ea0458668e869c0ae26d5e1a1eac876be75a.uJvBe9puYhHfT-R7TQuE2CzpBdPyWgQ_5e9o3S4Unqc
scenes-other-billing-product--billing-product-platform-addons-on-scale--dark:
- hash: v1.k794b7964.0e508c0e1bc4df5963bdf7363bda159b2001e92b5d824c11a400976c32cb2184.-k1bs1b-3_BlShmgtvLv3E23ls_5Or8f87sUz-TUxpU
+ hash: v1.k794b7964.96044843b9cfe21e1ca5383bfef51f2f8c0f18a6a71bce2bbfe51a0a5513a5c8.x20E-uq3tVHTNwlKkyIgGSL77Li8jjTP919q70v5eM4
scenes-other-billing-product--billing-product-platform-addons-on-scale--light:
- hash: v1.k794b7964.744f0a5e6d616aaf5ff33fdbb261372fc314dd8b601a717e2ea856d57d47d106.LOYvSZx0yGirsDJv9nM7OiZ9YQ8o2qD08xxZZjlYd38
+ hash: v1.k794b7964.bbffe4cccf6332790332616656ea077878dc8f0a277416aed75fd2a56ec6a0eb.vA_Q6lvF9QfIekDqdx8Hg-E1JbNkSOo6piwYd8bAiFY
scenes-other-billing-product--billing-product-platform-addons-trial-available--dark:
- hash: v1.k794b7964.e89a6dd81cab92e698b48df14551e13c7eeb3780fb7995c278d1d8bc3c7a3a1b.d1stZOJWTwfDm1g3wzuhoD2XmEeflGDBp8JFlncBmuk
+ hash: v1.k794b7964.d93e21210ecd7d2f1bff3ea8ce7b4e33148d615a1b0ac97587b744f1e99ed753.RqSX4vBVyAFxIkclK6qXYE2srubc2aWdsC-0YQkLMuw
scenes-other-billing-product--billing-product-platform-addons-trial-available--light:
- hash: v1.k794b7964.be1b6b47e48233c3db4510f102fa515bde864d846222d1cbb673a48c18fdaf3a.IPgG5lyUjq42WtgrlJxxBEI3_svRzd0Ki2ZHR9N8ak8
+ hash: v1.k794b7964.25960f4eea0a953164453dd67b1b1ad9271e27bb4be5ca4761ac157b8d3c3fb8.frS8y3MiN5VhI7iuoo_2KSmb2yXsaaACWMEyPzdbI14
scenes-other-billing-product--billing-product-platform-addons-trial-used--dark:
- hash: v1.k794b7964.7cdccf06fea640e727e971f361d5b3c88b4995c15a977f6d3534f9fbdd977396.ecEskd1d1tETrJqFzz_4pTRamKqtHyqnXOY-3ZkeZpE
+ hash: v1.k794b7964.fa790f01c9258ad35e8edae1601c83c25098b4abcb822c7978a2b0debe5efa9c.xO3StO1zHSXwkCMLaGld9a_zfseXbFLzrEDsI8Xyf54
scenes-other-billing-product--billing-product-platform-addons-trial-used--light:
- hash: v1.k794b7964.0073a1307ee06197d6b436baa800399cd3145dc3268295a04cd217c09cd36ee2.Zxf1K6OEnB5nrM4k7twwfLGNNB7DtRbT7Eigx-OJvjc
+ hash: v1.k794b7964.ebb16c829a1035818029cdaf4dfa3466833c80f3be37ec14aae5504ed48d5673.uNpaGXf6VDNcAS8A5w7ddLGoN-C40D0IyvfF2UeAug8
scenes-other-billing-product--billing-product-temporarily-free--dark:
hash: v1.k794b7964.abfc609467b20b57eb791b21f873cfc492a6759d2e665fc2c1e33cb5f7dde4dd.4kZgG10YvmglygsAJNnEmLdEEHV_i-o1fD4HTZPQ-bE
scenes-other-billing-product--billing-product-temporarily-free--light:
diff --git a/frontend/src/lib/constants.tsx b/frontend/src/lib/constants.tsx
index 2b5e9d2080a7..ca93adfb19e8 100644
--- a/frontend/src/lib/constants.tsx
+++ b/frontend/src/lib/constants.tsx
@@ -392,6 +392,7 @@ export const FEATURE_FLAGS = {
ONBOARDING_FLOW_VARIANT: 'onboarding-flow-variant', // owner: @fercgomes #team-growth multivariate=legacy,redesign — selects the whole onboarding experience; legacy is the existing flow
ONBOARDING_HIDE_BREADCRUMBS: 'onboarding-hide-breadcrumbs', // owner: @fercgomes #team-growth, multivariate=true, hides breadcrumbs during onboarding to reduce distractions
ONBOARDING_MOBILE_INSTALL_HELPER: 'onboarding-mobile-install-helper', // owner: @fercgomes #team-growth multivariate=control,test — target $device_type=Mobile at the flag level
+ ONBOARDING_PLATFORM_PACKAGES: 'onboarding-platform-packages', // owner: @mjwarren3 #team-growth multivariate=control,test — surfaces platform packages with a free trial on the plans step after subscribing
ONBOARDING_NAVBAR: 'onboarding-navbar', // owner: #team-growth, hides the navbar during onboarding to reduce distractions multivariate=true
ONBOARDING_PRODUCT_SELECTION_HEADING: 'onboarding-product-selection-heading', // owner: #team-growth, payload overrides the heading copy on the first onboarding page
ONBOARDING_SESSION_REPLAY_MEDIA: 'onboarding-session-replay-media', // owner: @fercgomes #team-growth multivariate=control,screenshot,demo
diff --git a/frontend/src/scenes/billing/BillingProductAddonActions.tsx b/frontend/src/scenes/billing/BillingProductAddonActions.tsx
index 605b1059031d..d8c6e2dd12e4 100644
--- a/frontend/src/scenes/billing/BillingProductAddonActions.tsx
+++ b/frontend/src/scenes/billing/BillingProductAddonActions.tsx
@@ -28,6 +28,10 @@ interface BillingProductAddonActionsProps {
align?: 'left' | 'right'
/** Collapse pricing into the CTA: hide the paragraph below and swap the next-to-button flat rate for the prorated amount when it applies. */
hidePricingNote?: boolean
+ /** Disable the purchase/trial CTA (e.g. while a sibling package is being activated). */
+ purchaseDisabledReason?: string
+ /** Called when the purchase/trial CTA is clicked, before the activation fires. */
+ onPurchaseClick?: () => void
}
export const BillingProductAddonActions = ({
@@ -37,6 +41,8 @@ export const BillingProductAddonActions = ({
ctaTextOverride,
align = 'right',
hidePricingNote = false,
+ purchaseDisabledReason,
+ onPurchaseClick,
}: BillingProductAddonActionsProps): JSX.Element => {
const { billing, billingError, currentPlatformAddon, unusedPlatformAddonAmount, switchPlanLoading } =
useValues(billingLogic)
@@ -115,7 +121,7 @@ export const BillingProductAddonActions = ({
<>
{hasFlatRate ? (
showLabel ? (
- <h4 className="leading-5 font-bold mb-0 flex gap-x-0.5">
+ <h4 className="leading-5 font-bold mb-0 flex gap-x-0.5 whitespace-nowrap">
{isTrialEligible ? (
<span>{addon.trial?.length} day free trial</span>
) : hidePricingNote && isProrated ? (
@@ -139,14 +145,18 @@ export const BillingProductAddonActions = ({
disableClientSideRouting
disabledReason={
(billingError && billingError.message) ||
- (billing?.subscription_level === 'free' && 'Upgrade to add add-ons')
+ (billing?.subscription_level === 'free' && 'Upgrade to add add-ons') ||
+ purchaseDisabledReason
}
loading={billingProductLoading === addon.type || trialLoading}
- onClick={
- isTrialEligible
- ? () => activateTrial()
- : () => initiateProductUpgrade(addon, currentAndUpgradePlans?.upgradePlan, '')
- }
+ onClick={() => {
+ onPurchaseClick?.()
+ if (isTrialEligible) {
+ activateTrial()
+ } else {
+ initiateProductUpgrade(addon, currentAndUpgradePlans?.upgradePlan, '')
+ }
+ }}
>
{ctaTextOverride ?? (isTrialEligible ? 'Start trial' : 'Add')}
</LemonButton>
@@ -238,7 +248,7 @@ export const BillingProductAddonActions = ({
return (
<>
{showLabel && (
- <h4 className="leading-5 font-bold mb-0 flex gap-x-0.5">
+ <h4 className="leading-5 font-bold mb-0 flex gap-x-0.5 whitespace-nowrap">
{hidePricingNote && isProrated ? (
<span>${amountDue.toFixed(2)} today (prorated)</span>
) : (
@@ -273,12 +283,35 @@ export const BillingProductAddonActions = ({
} else if (billing?.trial && billing?.trial?.target === addon.type) {
// Current trial on this addon
content = renderTrialActions()
- } else if (addon.type === 'enterprise' && !preflight?.is_debug) {
- // In local development, show the standard "Add" purchase flow instead of the sales "Contact us" button.
+ } else if (addon.type === 'enterprise') {
+ // Enterprise is sales-led — always route to sales (matches prod). In local dev, also offer an
+ // explicit override so engineers can still start the self-serve trial; it's gated on is_debug so
+ // it never renders in production.
content = (
- <LemonButton type="primary" to="https://posthog.com/talk-to-a-human" targetBlank>
- Contact us
- </LemonButton>
+ <>
+ <LemonButton type="primary" to="https://posthog.com/talk-to-a-human" targetBlank>
+ Contact us
+ </LemonButton>
+ {preflight?.is_debug && (
+ <LemonButton
+ type="secondary"
+ size="xsmall"
+ loading={trialLoading || billingProductLoading === addon.type}
+ disabledReason={purchaseDisabledReason}
+ tooltip="Local dev only — starts the self-serve trial. Never shown in production."
+ onClick={() => {
+ onPurchaseClick?.()
+ if (isTrialEligible) {
+ activateTrial()
+ } else {
+ initiateProductUpgrade(addon, currentAndUpgradePlans?.upgradePlan, '')
+ }
+ }}
+ >
+ Local dev override
+ </LemonButton>
+ )}
+ </>
)
} else if (addon.contact_support) {
content = (
@@ -301,7 +334,7 @@ export const BillingProductAddonActions = ({
<div className={clsx(align === 'right' && 'min-w-64')}>
<div
className={clsx(
- 'mt-2 self-center flex items-center gap-x-3 whitespace-nowrap justify-end',
+ 'mt-2 self-center flex flex-wrap items-center gap-x-3 gap-y-1 justify-end',
align === 'left' ? 'flex-row-reverse' : 'ml-4'
)}
>
diff --git a/frontend/src/scenes/billing/PlatformAddonComparison.tsx b/frontend/src/scenes/billing/PlatformAddonComparison.tsx
index c9edb6a66a04..ee18f41a59ea 100644
--- a/frontend/src/scenes/billing/PlatformAddonComparison.tsx
+++ b/frontend/src/scenes/billing/PlatformAddonComparison.tsx
@@ -1,6 +1,6 @@
import clsx from 'clsx'
import { useActions, useValues } from 'kea'
-import { useState } from 'react'
+import { useEffect, useState } from 'react'
import {
IconActivity,
@@ -99,9 +99,13 @@ const PlanPrice = ({
const PlanCard = ({
addon,
onExpandCompare,
+ purchaseDisabledReason,
+ onPurchaseClick,
}: {
addon: BillingProductV2AddonType
onExpandCompare: () => void
+ purchaseDisabledReason?: string
+ onPurchaseClick?: () => void
}): JSX.Element => {
const { billing } = useValues(billingLogic)
const pricedPlan = addon.plans?.find((p) => p.flat_rate)
@@ -152,11 +156,27 @@ const PlanCard = ({
</Link>
</div>
)}
- {pricedPlan?.flat_rate && addon.type !== BillingPlan.Enterprise && (
- <PlanPrice addon={addon} unit_amount_usd={pricedPlan.unit_amount_usd} unit_label={pricedPlan.unit} />
- )}
- <div className="mt-auto">
- <BillingProductAddonActions addon={addon} buttonSize="small" align="left" hidePricingNote />
+ {/* Pin price + actions to the bottom. The action area reserves a fixed height with the
+ button bottom-aligned so prices line up across cards regardless of trial state (the
+ "Start trial" label/button stack is taller than a lone "Cancel trial" button). */}
+ <div className="mt-auto flex flex-col gap-3">
+ {pricedPlan?.flat_rate && addon.type !== BillingPlan.Enterprise && (
+ <PlanPrice
+ addon={addon}
+ unit_amount_usd={pricedPlan.unit_amount_usd}
+ unit_label={pricedPlan.unit}
+ />
+ )}
+ <div className="flex min-h-16 flex-col justify-end">
+ <BillingProductAddonActions
+ addon={addon}
+ buttonSize="small"
+ align="left"
+ hidePricingNote
+ purchaseDisabledReason={purchaseDisabledReason}
+ onPurchaseClick={onPurchaseClick}
+ />
+ </div>
</div>
</div>
)
@@ -220,7 +240,7 @@ const ComparisonTable = ({
}
return (
- <div>
+ <div className="overflow-x-auto">
<div className="grid" style={gridStyle}>
<div className="px-4 py-4 text-sm font-semibold text-secondary">Feature</div>
{addons.map((addon) => (
@@ -270,12 +290,26 @@ const ComparisonTable = ({
)
}
-export const PlatformAddonComparison = ({ product }: { product: BillingProductV2Type }): JSX.Element | null => {
+export const PlatformAddonComparison = ({
+ product,
+ actionsSlot,
+}: {
+ product: BillingProductV2Type
+ /** Optional content rendered between the package cards and the feature-comparison table (e.g. onboarding nav). */
+ actionsSlot?: JSX.Element
+}): JSX.Element | null => {
+ const { billing } = useValues(billingLogic)
const comparableAddons = (Object.keys(COMPARISON_PLANS) as BillingPlan[])
.map((type) => product.addons?.find((addon) => addon.type === type && !addon.legacy_product))
.filter((addon): addon is BillingProductV2AddonType => !!addon)
const legacyAddon = product.addons?.find((addon) => addon.legacy_product && addon.subscribed) ?? null
const [isCompareOpen, setIsCompareOpen] = useState(false)
+ // One activation at a time: the cards' loading state is per-addon, so without this a fast click on
+ // one package then another fires two activate calls before the page reloads. The first click flips
+ // this, disabling every card's CTA. Reset when billing reloads so the error path re-enables them
+ // (success reloads the whole page, so the flag doesn't need clearing there).
+ const [activating, setActivating] = useState(false)
+ useEffect(() => setActivating(false), [billing])
if (comparableAddons.length === 0) {
return null
@@ -309,12 +343,20 @@ export const PlatformAddonComparison = ({ product }: { product: BillingProductV2
<div className="flex flex-col gap-4">
{legacyAddon && <LegacyPlanHero addon={legacyAddon} />}
- <div className="grid gap-3 grid-cols-3">
+ <div className="grid gap-3 grid-cols-1 md:grid-cols-3">
{comparableAddons.map((addon) => (
- <PlanCard key={addon.type} addon={addon} onExpandCompare={() => setIsCompareOpen(true)} />
+ <PlanCard
+ key={addon.type}
+ addon={addon}
+ onExpandCompare={() => setIsCompareOpen(true)}
+ purchaseDisabledReason={activating ? 'Please wait…' : undefined}
+ onPurchaseClick={() => setActivating(true)}
+ />
))}
</div>
+ {actionsSlot}
+
{features.length > 0 && (
<LemonCollapse
activeKey={isCompareOpen ? 'compare' : undefined}
diff --git a/frontend/src/scenes/onboarding/legacy/OnboardingStep.tsx b/frontend/src/scenes/onboarding/legacy/OnboardingStep.tsx
index eace227cfce0..78c57beff523 100644
--- a/frontend/src/scenes/onboarding/legacy/OnboardingStep.tsx
+++ b/frontend/src/scenes/onboarding/legacy/OnboardingStep.tsx
@@ -27,6 +27,7 @@ export const OnboardingStep = ({
continueText,
continueDisabledReason,
hideHeader,
+ hideTitle = false,
fullWidth = false,
actions,
}: {
@@ -42,6 +43,8 @@ export const OnboardingStep = ({
continueText?: string
continueDisabledReason?: string
hideHeader?: boolean
+ /** Hide just the <h1> title (keeps breadcrumbs and the actions slot). */
+ hideTitle?: boolean
fullWidth?: boolean
actions?: JSX.Element
}): JSX.Element => {
@@ -87,9 +90,11 @@ export const OnboardingStep = ({
<div className={`text-secondary max-w-screen-md mx-auto ${hideHeader && 'hidden'}`}>
<OnboardingBreadcrumbs />
<div className="flex flex-col sm:flex-row sm:justify-between sm:items-center items-start gap-2 mt-3 px-4 sm:px-0">
- <h1 className={clsx('font-bold m-0 px-0 sm:px-2', fullWidth && 'text-center')}>
- {title || stepKeyToTitle(stepKey)}
- </h1>
+ {!hideTitle && (
+ <h1 className={clsx('font-bold m-0 px-0 sm:px-2', fullWidth && 'text-center')}>
+ {title || stepKeyToTitle(stepKey)}
+ </h1>
+ )}
{actions && <div className="flex flex-row flex-wrap sm:flex-nowrap gap-2">{actions}</div>}
</div>
</div>
diff --git a/frontend/src/scenes/onboarding/legacy/billing/OnboardingUpgradeStep.tsx b/frontend/src/scenes/onboarding/legacy/billing/OnboardingUpgradeStep.tsx
index 10ca3334495c..9a779ecdaea6 100644
--- a/frontend/src/scenes/onboarding/legacy/billing/OnboardingUpgradeStep.tsx
+++ b/frontend/src/scenes/onboarding/legacy/billing/OnboardingUpgradeStep.tsx
@@ -1,15 +1,21 @@
-import { useValues } from 'kea'
+import { useActions, useValues } from 'kea'
import { useEffect } from 'react'
-import { Spinner } from '@posthog/lemon-ui'
+import { IconArrowRight } from '@posthog/icons'
+import { LemonButton, Spinner } from '@posthog/lemon-ui'
import { SupermanHog } from 'lib/components/hedgehogs'
import { useHogfetti } from 'lib/components/Hogfetti/Hogfetti'
+import { FEATURE_FLAGS } from 'lib/constants'
+import { featureFlagLogic } from 'lib/logic/featureFlagLogic'
+import { eventUsageLogic } from 'lib/utils/eventUsageLogic'
import { billingLogic } from 'scenes/billing/billingLogic'
+import { PlatformAddonComparison } from 'scenes/billing/PlatformAddonComparison'
+import { ProductKey } from '~/queries/schema/schema-general'
import { type BillingProductV2Type, OnboardingStepKey } from '~/types'
-import { OnboardingStepComponentType } from '../onboardingLogic'
+import { onboardingLogic, OnboardingStepComponentType } from '../onboardingLogic'
import { OnboardingStep } from '../OnboardingStep'
import PlanCards from './PlanCards'
@@ -18,7 +24,10 @@ type OnboardingUpgradeStepProps = {
}
export const OnboardingUpgradeStep: OnboardingStepComponentType<OnboardingUpgradeStepProps> = ({ product }) => {
- const { billingLoading } = useValues(billingLogic)
+ const { billing, billingLoading } = useValues(billingLogic)
+ const { featureFlags } = useValues(featureFlagLogic)
+ const { goToNextStep } = useActions(onboardingLogic)
+ const { reportOnboardingStepSkipped, reportOnboardingStepCompleted } = useActions(eventUsageLogic)
if (billingLoading) {
return (
@@ -28,16 +37,49 @@ export const OnboardingUpgradeStep: OnboardingStepComponentType<OnboardingUpgrad
)
}
+ const platformProduct = billing?.products?.find((p) => p.type === ProductKey.PLATFORM_AND_SUPPORT)
+ const showPlatformPackages =
+ !!product.subscribed && featureFlags[FEATURE_FLAGS.ONBOARDING_PLATFORM_PACKAGES] === 'test' && !!platformProduct
+ // The platform package the org is now on, whether via a free trial (billing.trial.target — a
+ // 'paid'-plan trial won't match a platform addon) or a direct subscribe ("Add" when no trial is left).
+ const trialAddon = platformProduct?.addons?.find((addon) => addon.type === billing?.trial?.target)
+ const activeAddon = trialAddon ?? platformProduct?.addons?.find((addon) => addon.subscribed)
+
+ const skipPlatformPackages = (): void => {
+ reportOnboardingStepSkipped(OnboardingStepKey.PLANS)
+ goToNextStep()
+ }
+ const continueFromPlatformPackages = (): void => {
+ reportOnboardingStepCompleted(OnboardingStepKey.PLANS)
+ goToNextStep()
+ }
+
return (
- <OnboardingStep title="Select a plan" stepKey={OnboardingStepKey.PLANS} showContinue={!!product.subscribed}>
+ <OnboardingStep
+ title="Select a plan"
+ stepKey={OnboardingStepKey.PLANS}
+ // The packages screen carries its own heading and its own Skip/Next nav (below the cards),
+ // so the "Select a plan" title (misleading once subscribed) and the bottom Next are dropped there.
+ hideTitle={showPlatformPackages}
+ showContinue={!!product.subscribed && !showPlatformPackages}
+ >
{!product.subscribed && <PlanCards product={product} />}
- {product.subscribed && <ProductSubscribed product={product} />}
+ {product.subscribed && !showPlatformPackages && <SubscribedCelebration product={product} />}
+ {showPlatformPackages && platformProduct && (
+ <PlatformPackagesUpsell
+ platformProduct={platformProduct}
+ activePackageName={activeAddon?.name}
+ isTrial={!!trialAddon}
+ onSkip={skipPlatformPackages}
+ onContinue={continueFromPlatformPackages}
+ />
+ )}
</OnboardingStep>
)
}
OnboardingUpgradeStep.stepKey = OnboardingStepKey.PLANS
-const ProductSubscribed = ({ product }: { product: BillingProductV2Type }): JSX.Element => {
+const SubscribedCelebration = ({ product }: { product: BillingProductV2Type }): JSX.Element => {
const { trigger, HogfettiComponent } = useHogfetti({ count: 100, duration: 3000 })
useEffect(() => {
@@ -61,7 +103,6 @@ const ProductSubscribed = ({ product }: { product: BillingProductV2Type }): JSX.
<SupermanHog className="w-full h-full object-contain" />
</div>
- {/* Text Below */}
<h3 className="text-2xl font-bold mt-6">Go forth and build amazing products!</h3>
<p className="text-gray-700 dark:text-gray-400">
You've unlocked all features for <strong>{product.name}</strong>.
@@ -69,3 +110,102 @@ const ProductSubscribed = ({ product }: { product: BillingProductV2Type }): JSX.
</div>
)
}
+
+const PlatformPackagesUpsell = ({
+ platformProduct,
+ activePackageName,
+ isTrial,
+ onSkip,
+ onContinue,
+}: {
+ platformProduct: BillingProductV2Type
+ /** Name of the package the org is now on (trialing or subscribed), if any. */
+ activePackageName?: string
+ isTrial: boolean
+ onSkip: () => void
+ onContinue: () => void
+}): JSX.Element => {
+ const { trigger, HogfettiComponent } = useHogfetti({ count: 100, duration: 3000 })
+ const onPackage = !!activePackageName
+
+ useEffect(() => {
+ // Celebrate the package the user just got — starting a trial or adding a package lands them on
+ // this state, so fire the hedgehogs when they do.
+ if (!onPackage) {
+ return
+ }
+ const run = async (): Promise<void> => {
+ trigger()
+ await new Promise((resolve) => setTimeout(resolve, 1000))
+ trigger()
+ await new Promise((resolve) => setTimeout(resolve, 1000))
+ trigger()
+ }
+
+ void run()
+ }, [trigger, onPackage])
+
+ // Skip for now + a Next that stays disabled until they're on a package (mirrors the standard
+ // onboarding footer), placed below the cards but above the comparison table. Once they're on a
+ // package, "Skip for now" no longer makes sense, so drop it and enable Next.
+ const nav = (
+ <div className="flex justify-end gap-x-2">
+ {!onPackage && (
+ <LemonButton type="secondary" onClick={onSkip} data-attr="onboarding-skip-button">
+ Skip for now
+ </LemonButton>
+ )}
+ <LemonButton
+ type="primary"
+ status="alt"
+ sideIcon={<IconArrowRight />}
+ onClick={onContinue}
+ disabledReason={onPackage ? undefined : 'Start a trial or add a package above, or skip for now'}
+ data-attr="onboarding-continue"
+ >
+ Next
+ </LemonButton>
+ </div>
+ )
+
+ return (
+ <div className="relative flex flex-col items-center">
+ <HogfettiComponent />
+
+ {/* Superman Hog floating animation */}
+ <div className="w-24 h-24 animate-float">
+ <SupermanHog className="w-full h-full object-contain" />
+ </div>
+
+ <div className="w-full max-w-4xl mt-2">
+ <div className="text-center mb-6">
+ {!onPackage ? (
+ <>
+ <h3 className="text-xl font-bold mb-1">
+ You're signed up! Now level up with a platform package
+ </h3>
+ <p className="text-gray-700 dark:text-gray-400 mb-0">
+ Start a free trial of a platform package — cancel anytime, with no charge until it ends.
+ </p>
+ </>
+ ) : isTrial ? (
+ <>
+ <h3 className="text-xl font-bold mb-1">You're on a trial of {activePackageName}</h3>
+ <p className="text-gray-700 dark:text-gray-400 mb-0">
+ Enjoy your trial — cancel anytime before it ends, or explore the other packages below.
+ </p>
+ </>
+ ) : (
+ <>
+ <h3 className="text-xl font-bold mb-1">You're on {activePackageName}</h3>
+ <p className="text-gray-700 dark:text-gray-400 mb-0">
+ Nice choice! Continue when you're ready, or explore the other packages below.
+ </p>
+ </>
+ )}
+ </div>
+ <PlatformAddonComparison product={platformProduct} actionsSlot={nav} />
+ </div>
+ </div>
+ )
+}
diff --git a/frontend/src/scenes/onboarding/legacy/billing/PlanCards.tsx b/frontend/src/scenes/onboarding/legacy/billing/PlanCards.tsx
index 4d993c95ff10..0fc1d2b63c86 100644
--- a/frontend/src/scenes/onboarding/legacy/billing/PlanCards.tsx
+++ b/frontend/src/scenes/onboarding/legacy/billing/PlanCards.tsx
@@ -9,6 +9,8 @@ import { LemonButton } from '@posthog/lemon-ui'
import { BillingUpgradeCTA } from 'lib/components/BillingUpgradeCTA'
import { HeartHog } from 'lib/components/hedgehogs'
+import { FEATURE_FLAGS } from 'lib/constants'
+import { featureFlagLogic } from 'lib/logic/featureFlagLogic'
import { eventUsageLogic } from 'lib/utils/eventUsageLogic'
import { pluralize } from 'lib/utils/strings'
import { billingLogic } from 'scenes/billing/billingLogic'
@@ -63,9 +65,17 @@ export function formatDataRetentionFeature(feature?: BillingFeatureType): string
export const PlanCard: React.FC<PlanCardProps> = ({ planData, product, highlight, hogPosition = 'top-right' }) => {
const { billing } = useValues(billingLogic)
+ const { featureFlags } = useValues(featureFlagLogic)
const { billingProductLoading } = useValues(billingProductLogic({ product }))
const { reportOnboardingStepCompleted } = useActions(eventUsageLogic)
+ // When platform packages are surfaced after subscribing (experiment on), there are more features
+ // to unlock beyond pay-as-you-go, so soften the paid CTA from "Unlock all features".
+ const ctaText =
+ planData.plan === Plan.RIDICULOUSLY_CHEAP && featureFlags[FEATURE_FLAGS.ONBOARDING_PLATFORM_PACKAGES] === 'test'
+ ? 'Unlock more features'
+ : planData.ctaText
+
const [isHovering, setIsHovering] = useState<boolean | undefined>(undefined)
const { goToNextStep } = useActions(onboardingLogic)
const { startPaymentEntryFlow } = useActions(paymentEntryLogic)
@@ -203,7 +213,7 @@ export const PlanCard: React.FC<PlanCardProps> = ({ planData, product, highlight
fullWidth
tabIndex={-1}
>
- {planData.ctaText}
+ {ctaText}
</BillingUpgradeCTA>
)}
{planData.ctaAction === 'next' && (
diff --git a/frontend/src/scenes/onboarding/legacy/onboardingLogic.tsx b/frontend/src/scenes/onboarding/legacy/onboardingLogic.tsx
index 2f82833bb5ea..7f7ef7f26da1 100644
--- a/frontend/src/scenes/onboarding/legacy/onboardingLogic.tsx
+++ b/frontend/src/scenes/onboarding/legacy/onboardingLogic.tsx
@@ -185,12 +185,17 @@ export const onboardingLogic = kea<onboardingLogicType>([
(billing, productKey) => billing?.products?.find((p) => p.type === productKey) ?? null,
],
shouldShowBillingStep: [
- (s) => [s.product, s.subscribedDuringOnboarding, s.isCloudOrDev, s.billing, s.billingProduct],
- (_product, subscribedDuringOnboarding, isCloudOrDev, billing, billingProduct): boolean => {
+ (s) => [s.subscribedDuringOnboarding, s.isCloudOrDev, s.billing, s.billingProduct, s.stepId],
+ (subscribedDuringOnboarding, isCloudOrDev, billing, billingProduct, stepId): boolean => {
if (!isCloudOrDev || !billing?.products || !billingProduct) {
return false
}
- return !billingProduct?.subscribed || subscribedDuringOnboarding
+ // Keep the plans step in the flow whenever the URL explicitly targets it — otherwise an
+ // already-subscribed user landing here (e.g. after a trial cancel reloads without
+ // `?success=true`) would drop the step from the flow and get stuck on a spinner.
+ const onPlansStep =
+ stepId === OnboardingStepKey.PLANS || stepId.startsWith(`${OnboardingStepKey.PLANS}:`)
+ return !billingProduct?.subscribed || subscribedDuringOnboarding || onPlansStep
},
],
flow: [