: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.
Python ab-testingai-analyticsanalyticscdpdata-warehouseexperimentsfeature-flagsjavascriptproduct-analyticspythonreactsession-replaysurveystypescriptweb-analytics
fix(legal): show trial-specific BAA paywall copy for addon trials (#60661)
eleftheriatrivyzaki5166aeffb8fa
diff --git a/frontend/src/layout/navigation-3000/sidepanel/panels/support/SidePanelSupport.tsx b/frontend/src/layout/navigation-3000/sidepanel/panels/support/SidePanelSupport.tsxindex 7c2c45e91eff..0c486113b26e 100644--- a/frontend/src/layout/navigation-3000/sidepanel/panels/support/SidePanelSupport.tsx+++ b/frontend/src/layout/navigation-3000/sidepanel/panels/support/SidePanelSupport.tsx@@ -117,8 +117,8 @@ const SupportResponseTimesTable = ({const knownEnterpriseOrgIds = ['018713f3-8d56-0000-32fa-75ce97e6662f']const isKnownEnterpriseOrg = knownEnterpriseOrgIds.includes(user?.organization?.id || '')- const hasBoostTrial = billing?.trial?.status === 'active' && (billing.trial?.target as any) === 'boost'- const hasScaleTrial = billing?.trial?.status === 'active' && (billing.trial?.target as any) === 'scale'+ const hasBoostTrial = billing?.trial?.status === 'active' && billing.trial?.target === 'boost'+ const hasScaleTrial = billing?.trial?.status === 'active' && billing.trial?.target === 'scale'const hasEnterpriseTrial = billing?.trial?.status === 'active' && billing.trial?.target === 'enterprise'const hasExpiredTrial = billing?.trial?.status === 'expired'@@ -323,8 +323,8 @@ export function SidePanelSupport(): JSX.Element {const useProductSupportSidePanel = featureFlags[FEATURE_FLAGS.PRODUCT_SUPPORT_SIDE_PANEL]- const hasBoostTrial = billing?.trial?.status === 'active' && (billing.trial?.target as any) === 'boost'- const hasScaleTrial = billing?.trial?.status === 'active' && (billing.trial?.target as any) === 'scale'+ const hasBoostTrial = billing?.trial?.status === 'active' && billing.trial?.target === 'boost'+ const hasScaleTrial = billing?.trial?.status === 'active' && billing.trial?.target === 'scale'const hasEnterpriseTrial = billing?.trial?.status === 'active' && billing.trial?.target === 'enterprise'const hasActiveTrial = hasBoostTrial || hasScaleTrial || hasEnterpriseTrialdiff --git a/frontend/src/lib/components/Support/supportLogic.ts b/frontend/src/lib/components/Support/supportLogic.tsindex c688a73f9349..f0c7b4fad34b 100644--- a/frontend/src/lib/components/Support/supportLogic.ts+++ b/frontend/src/lib/components/Support/supportLogic.ts@@ -587,8 +587,8 @@ export const supportLogic = kea<supportLogicType>([const isNewOrganization = values.isCurrentOrganizationNew- const hasBoostTrial = billing?.trial?.status === 'active' && (billing.trial?.target as any) === 'boost'- const hasScaleTrial = billing?.trial?.status === 'active' && (billing.trial?.target as any) === 'scale'+ const hasBoostTrial = billing?.trial?.status === 'active' && billing.trial?.target === 'boost'+ const hasScaleTrial = billing?.trial?.status === 'active' && billing.trial?.target === 'scale'const hasEnterpriseTrial = billing?.trial?.status === 'active' && billing.trial?.target === 'enterprise'if (isKnownEnterpriseOrg || hasEnterpriseTrial || billingPlan === BillingPlan.Enterprise) {diff --git a/frontend/src/types.ts b/frontend/src/types.tsindex a66d21cabf79..3b8029dd0f72 100644--- a/frontend/src/types.ts+++ b/frontend/src/types.ts@@ -2217,7 +2217,7 @@ export interface BillingType {trial?: {type: 'autosubscribe' | 'standard'status: 'active' | 'expired' | 'cancelled' | 'converted'- target: 'paid' | 'teams' | 'enterprise'+ target: 'paid' | 'teams' | 'enterprise' | 'boost' | 'scale'expires_at: string}billing_plan: BillingPlan | nulldiff --git a/products/legal_documents/frontend/scenes/LegalDocumentNewScene.tsx b/products/legal_documents/frontend/scenes/LegalDocumentNewScene.tsxindex 0813d4a21949..f82a34afae41 100644--- a/products/legal_documents/frontend/scenes/LegalDocumentNewScene.tsx+++ b/products/legal_documents/frontend/scenes/LegalDocumentNewScene.tsx@@ -4,6 +4,7 @@ import { Form } from 'kea-forms'import { IconBalance, IconSend } from '@posthog/icons'import { LemonBanner, LemonButton, LemonInput, LemonSelect, Link } from '@posthog/lemon-ui'+import { supportLogic } from 'lib/components/Support/supportLogic'import { useFeatureFlag } from 'lib/hooks/useFeatureFlag'import { LemonField } from 'lib/lemon-ui/LemonField'import { LemonRadio } from 'lib/lemon-ui/LemonRadio'@@ -74,6 +75,8 @@ export function LegalDocumentNewScene(): JSX.Element {legalDocumentHasErrors,isLegalDocumentSubmitting,hasQualifyingBaaAddon,+ isOnQualifyingAddonTrial,+ isOnEnterpriseStandardTrial,isDpaModeSubmittable,existingDocumentOfCurrentType,existingDocumentTypes,@@ -81,6 +84,7 @@ export function LegalDocumentNewScene(): JSX.Element {const { isAdminOrOwner } = useValues(organizationLogic)const { isCloudOrDev } = useValues(preflightLogic)const { setDocumentType, setDpaMode } = useActions(legalDocumentsLogic)+ const { openSupportForm } = useActions(supportLogic)const isEnabled = useFeatureFlag('LEGAL_DOCUMENTS')if (!isCloudOrDev) {@@ -198,9 +202,37 @@ export function LegalDocumentNewScene(): JSX.Element {{baaBlocked && (<LemonBanner type="warning">- A BAA requires an active{' '}- <Link to={urls.organizationBilling()}>Boost, Scale, or Enterprise add-on</Link>.- Subscribe first, then come back here to generate your BAA.+ {isOnEnterpriseStandardTrial ? (+ <>+ A BAA requires an active paid subscription. Your Enterprise trial is+ sales-managed, so please{' '}+ <Link+ to=""+ onClick={() =>+ openSupportForm({+ target_area: 'billing',+ isEmailFormOpen: true,+ })+ }+ >+ contact billing support+ </Link>{' '}+ to convert your trial into a subscription, then come back here to generate your+ BAA.+ </>+ ) : isOnQualifyingAddonTrial ? (+ <>+ A BAA requires an active paid subscription. Cancel your trial and subscribe on+ your <Link to={urls.organizationBilling()}>billing page</Link>, then come back+ here to generate your BAA.+ </>+ ) : (+ <>+ A BAA requires an active{' '}+ <Link to={urls.organizationBilling()}>Boost, Scale, or Enterprise add-on</Link>.+ Subscribe first, then come back here to generate your BAA.+ </>+ )}</LemonBanner>)}diff --git a/products/legal_documents/frontend/scenes/LegalDocuments.stories.tsx b/products/legal_documents/frontend/scenes/LegalDocuments.stories.tsxindex ceb89985612b..a05afc15ddf3 100644--- a/products/legal_documents/frontend/scenes/LegalDocuments.stories.tsx+++ b/products/legal_documents/frontend/scenes/LegalDocuments.stories.tsx@@ -97,6 +97,72 @@ export const NewBAA: Story = {],}+/**+ * New-document page for a BAA when the org is on an active addon trial. The+ * billing payload includes a top-level `trial` block targeting `boost`, so the+ * paywall banner swaps to the trial-specific copy that instructs the user to+ * cancel the trial and subscribe before generating the BAA.+ */+export const NewBAATrial: Story = {+ parameters: {+ pageUrl: urls.legalDocumentNew('BAA'),+ },+ decorators: [+ mswDecorator({+ get: {+ '/api/billing/': {+ products: [+ {+ type: 'platform_and_support',+ addons: [{ type: 'boost', subscribed: false }],+ },+ ],+ trial: {+ type: 'standard',+ status: 'active',+ target: 'boost',+ expires_at: '2026-06-15T00:00:00Z',+ },+ has_active_subscription: false,+ },+ },+ }),+ ],+}++/**+ * New-document page for a BAA when the org is on a sales-managed Enterprise+ * trial. The billing page hides the cancel-trial button for these, so the+ * banner directs users to contact billing support instead of cancelling on+ * billing.+ */+export const NewBAAEnterpriseTrial: Story = {+ parameters: {+ pageUrl: urls.legalDocumentNew('BAA'),+ },+ decorators: [+ mswDecorator({+ get: {+ '/api/billing/': {+ products: [+ {+ type: 'platform_and_support',+ addons: [{ type: 'enterprise', subscribed: false }],+ },+ ],+ trial: {+ type: 'standard',+ status: 'active',+ target: 'enterprise',+ expires_at: '2026-06-15T00:00:00Z',+ },+ has_active_subscription: false,+ },+ },+ }),+ ],+}+/*** New-document page for a DPA in the default "pretty" mode (legally binding,* rendered with a color PostHog logo at the top).diff --git a/products/legal_documents/frontend/scenes/legalDocumentsLogic.ts b/products/legal_documents/frontend/scenes/legalDocumentsLogic.tsindex e3246099135f..e994bced15b8 100644--- a/products/legal_documents/frontend/scenes/legalDocumentsLogic.ts+++ b/products/legal_documents/frontend/scenes/legalDocumentsLogic.ts@@ -164,6 +164,31 @@ export const legalDocumentsLogic = kea<legalDocumentsLogicType>([)},],+ isOnQualifyingAddonTrial: [+ (s) => [s.billing],+ (billing: BillingType | null): boolean => {+ if (!billing?.trial) {+ return false+ }+ return billing.trial.status === 'active' && BAA_ADDON_TYPES.has(billing.trial.target)+ },+ ],+ // Enterprise 'standard' trials are sales-managed: the billing page hides+ // the cancel-trial button for them (see BillingProductAddonActions.tsx),+ // so users need to go through support to convert their trial.+ isOnEnterpriseStandardTrial: [+ (s) => [s.billing],+ (billing: BillingType | null): boolean => {+ if (!billing?.trial) {+ return false+ }+ return (+ billing.trial.status === 'active' &&+ billing.trial.target === 'enterprise' &&+ billing.trial.type !== 'autosubscribe'+ )+ },+ ],isDpaModeSubmittable: [(s) => [s.legalDocument],(form: LegalDocumentFormValues): boolean => DPA_SUBMITTABLE_MODES.has(form.dpa_mode as DPAMode),