fix(legal): show trial-specific BAA paywall copy for addon trials#60661
Conversation
The /legal/new/baa scene gates BAA generation behind `addon.subscribed`, so orgs on an active Boost/Scale/Enterprise trial hit the same "subscribe first" banner as orgs without an addon. A trial is not a subscription — the user has to cancel it before subscribing, which the generic copy doesn't say. Branch the banner via a new `isOnQualifyingAddonTrial` selector (reads top-level `billing.trial.status` + `target`) so trial orgs get an actionable message pointing at the billing page. Generated-By: PostHog Code Task-Id: 3fa09d97-2a50-4abb-852c-7bf53d21c108
|
Reviews (1): Last reviewed commit: "fix(legal): show trial-specific BAA payw..." | Re-trigger Greptile |
|
Size Change: 0 B Total Size: 80.9 MB ℹ️ View Unchanged
|
|
👋 Visual changes detected for this PR. Review and approve in PostHog Visual Review If these changes are unexpected, they may be caused by a flaky test or a broken snapshot on master. Don't approve — rerun the job or wait for a fix. |
There was a problem hiding this comment.
Nice work, this is a helpful improvement to the BAA flow. I left a few suggestions inline.
FYI I also tested this in the real local frontend. With an org on an active Boost trial, the BAA page showed the new trial-specific banner, the regular add-on subscription copy was not shown, and Send for signature stayed disabled as expected.
Screenshot from the local app test:
| legalDocumentHasErrors, | ||
| isLegalDocumentSubmitting, | ||
| hasQualifyingBaaAddon, | ||
| isOnQualifyingAddonTrial, |
There was a problem hiding this comment.
This looks like it just needs the generated Kea type included. legalDocumentsLogic.ts adds isOnQualifyingAddonTrial, but legalDocumentsLogicType.ts was not regenerated, so TypeScript still reports Property 'isOnQualifyingAddonTrial' does not exist at this destructure. In local development, run pnpm --filter=@posthog/frontend typegen:write from the PostHog repo root, then commit the generated products/legal_documents/frontend/scenes/legalDocumentsLogicType.ts change. That generated file should not be edited by hand.
| Subscribe first, then come back here to generate your BAA. | ||
| {isOnQualifyingAddonTrial ? ( | ||
| <> | ||
| A BAA requires an active paid subscription. Cancel your trial and subscribe on |
There was a problem hiding this comment.
Small UX mismatch here: this copy also applies to Enterprise standard trials, but the billing page hides the cancel-trial action for those (addon.type === 'enterprise' && billing.trial.type !== 'autosubscribe'). That means some users would be told to cancel on billing, but there is no cancel button for them. A good fix would be to branch the banner copy for Enterprise standard trials and send those users to sales/support instead of telling them to cancel the trial.
| if (!billing?.trial) { | ||
| return false | ||
| } | ||
| return billing.trial.status === 'active' && BAA_ADDON_TYPES.has(billing.trial.target as string) |
There was a problem hiding this comment.
This cast is hiding a small type contract drift. Billing can return boost and scale trial targets, but BillingType.trial.target still only allows paid | teams | enterprise. Since this selector now intentionally depends on addon trial targets, it would be cleaner to update the frontend target union to include boost and scale, then remove the broad as string cast here.
…ten trial target type Three review fixes from #60661: - Add a third banner branch for orgs on an active Enterprise 'standard' (sales-managed) trial. The billing page hides the cancel-trial action for these — see BillingProductAddonActions.renderTrialActions — so telling them to "cancel on billing" was a dead end. They now get a copy that opens the support form pre-filled for the billing area. - Extend BillingType.trial.target with 'boost' and 'scale' so the selector no longer needs a string cast. Drop the now-redundant `as any` casts on the same field in SidePanelSupport and supportLogic. - Regenerate the kea logic type so isOnQualifyingAddonTrial and the new isOnEnterpriseStandardTrial are visible to TypeScript. (The .ts type is gitignored, so this is a typegen-only step.) Generated-By: PostHog Code Task-Id: 3fa09d97-2a50-4abb-852c-7bf53d21c108
|
🎭 Playwright report · View test results →
These issues are not necessarily caused by your changes. |
pawel-cebula
left a comment
There was a problem hiding this comment.
looks good, nice work! you'll need to click through from the PR (e.g. CI checks at the bottom) to the visual changes and approve them there
Problem
/legal/new/baagates BAA generation onaddon.subscribed === true(seehasQualifyingBaaAddoninlegalDocumentsLogic.ts). Orgs on an active Boost/Scale/Enterprise trial havesubscribed: false— a trial is not a subscription — so they hit the same banner shown to orgs with no add-on at all:That copy is misleading for trial users: they can't simply "subscribe" — the active trial blocks a real subscription until it's cancelled. They were left guessing what to do.
Changes
isOnQualifyingAddonTrialselector inlegalDocumentsLogic.ts, sourced from the top-levelbilling.trial(status === 'active'ANDtarget ∈ {boost, scale, enterprise}). The selector reuses the existingBAA_ADDON_TYPESset used byhasQualifyingBaaAddon.billing.trialis the runtime source of truth used bySidePanelSupport,PlatformAddonComparison, andBillingProductAddonActions; per-addonaddon.trialis a static eligibility offer and not appropriate here.LegalDocumentNewScene.tsxbranches the gate banner content. Trial orgs now see:NewBAATrialinLegalDocuments.stories.tsxmocking a billing payload with an active boost trial so the new banner can be visually verified in Storybook.How did you test this code?
This PR was authored by an agent (PostHog Code). Verified locally:
pnpm --filter=@posthog/frontend typescript:check— no new errors inproducts/legal_documents/**.Scenes-App/Legal documents/NewBAATrialand confirmed the new banner copy renders with the billing-page link; reloadedNewBAAto confirm subscribed orgs still see the form with no banner.Automatic notifications
Docs update
n/a — UI copy change, no public docs reference this banner.
🤖 Agent context
Authored by PostHog Code (Claude). Tools used: Explore agent (codebase search for the BAA scene, gate logic, and billing trial detection), Plan mode (plan written and approved before edits), Storybook for local visual verification.
Decisions:
billing.trial.status/billing.trial.targetrather than any per-addon field, becauseaddon.subscribedisfalseduring a trial andaddon.trialis a static eligibility descriptor. This matches the existing convention inSidePanelSupport.tsx,PlatformAddonComparison.tsx, andsupportLogic.ts.submitDisabledReason("Subscribe to Boost, Scale, or Enterprise to generate a BAA") untouched — only the banner copy was in scope for this change.billing.trial.target as stringrather thanas anyto widen past the stale'paid' | 'teams' | 'enterprise'annotation intypes.tswhile still lettingBAA_ADDON_TYPES.has(...)do the runtime check.Created with PostHog Code