From 92e17ce307a577c4233d4ab252eebc6c2207a5ee Mon Sep 17 00:00:00 2001 From: Raquel Smith Date: Fri, 29 Mar 2024 09:37:40 -0700 Subject: [PATCH] feat: hide integrated persons / personfull addon (#21238) * hide addon from billing page * hide from plan comparison and don't include in upgrade link * rename * fix types * fix type --- frontend/src/mocks/fixtures/_billing_v2.tsx | 2 ++ frontend/src/scenes/billing/Billing.stories.tsx | 1 + frontend/src/scenes/billing/BillingProduct.tsx | 8 +++++--- frontend/src/scenes/billing/PlanComparison.tsx | 1 + frontend/src/scenes/billing/billing-utils.ts | 6 +++++- frontend/src/types.ts | 1 + 6 files changed, 15 insertions(+), 4 deletions(-) diff --git a/frontend/src/mocks/fixtures/_billing_v2.tsx b/frontend/src/mocks/fixtures/_billing_v2.tsx index 43b499844eb70..835a663425e4a 100644 --- a/frontend/src/mocks/fixtures/_billing_v2.tsx +++ b/frontend/src/mocks/fixtures/_billing_v2.tsx @@ -333,6 +333,7 @@ export const billingJson: BillingV2Type = { addons: [ { name: 'Group analytics', + inclusion_only: false, description: 'Associate events with a group or entity - such as a company, community, or project. Analyze these events as if they were sent by that entity itself. Great for B2B, marketplaces, and more.', price_description: null, @@ -512,6 +513,7 @@ export const billingJson: BillingV2Type = { }, { name: 'Data pipelines', + inclusion_only: false, description: 'Get your PostHog data into your data warehouse or other tools like BigQuery, Redshift, Customer.io, and more.', price_description: null, diff --git a/frontend/src/scenes/billing/Billing.stories.tsx b/frontend/src/scenes/billing/Billing.stories.tsx index 7ccd862eb111a..2af69adb82100 100644 --- a/frontend/src/scenes/billing/Billing.stories.tsx +++ b/frontend/src/scenes/billing/Billing.stories.tsx @@ -117,6 +117,7 @@ export const BillingUnsubscribeModal_DataPipelines = (): JSX.Element => { plans: [], usage_key: '', contact_support: false, + inclusion_only: false, }, ] diff --git a/frontend/src/scenes/billing/BillingProduct.tsx b/frontend/src/scenes/billing/BillingProduct.tsx index 39e5fc0c3d63e..ae078bc851ae6 100644 --- a/frontend/src/scenes/billing/BillingProduct.tsx +++ b/frontend/src/scenes/billing/BillingProduct.tsx @@ -586,9 +586,11 @@ export const BillingProduct = ({ product }: { product: BillingProductV2Type }):

Addons

- {product.addons.map((addon, i) => { - return - })} + {product.addons + .filter((addon) => !addon.inclusion_only) + .map((addon, i) => { + return + })}
)} diff --git a/frontend/src/scenes/billing/PlanComparison.tsx b/frontend/src/scenes/billing/PlanComparison.tsx index a185b4df0277f..e7b577300b2ca 100644 --- a/frontend/src/scenes/billing/PlanComparison.tsx +++ b/frontend/src/scenes/billing/PlanComparison.tsx @@ -288,6 +288,7 @@ export const PlanComparison = ({ )} {includeAddons && product.addons?.map((addon) => { + // TODO: integrated_persons addon will show up here when we add a price plan. Make sure this can handle it. return addon.tiered ? ( diff --git a/frontend/src/scenes/billing/billing-utils.ts b/frontend/src/scenes/billing/billing-utils.ts index b6b152c099fe4..bf690d0174a0c 100644 --- a/frontend/src/scenes/billing/billing-utils.ts +++ b/frontend/src/scenes/billing/billing-utils.ts @@ -169,7 +169,11 @@ export const getUpgradeProductLink = ( url += `${product.type}:${upgradeToPlanKey},` if (includeAddons && product.addons?.length) { for (const addon of product.addons) { - if (addon.plans?.[0]?.plan_key) { + if ( + // TODO: this breaks if we support multiple plans per addon due to just grabbing the first plan + addon.plans?.[0]?.plan_key && + !addon.inclusion_only + ) { url += `${addon.type}:${addon.plans[0].plan_key},` } } diff --git a/frontend/src/types.ts b/frontend/src/types.ts index a583fe34c26d2..3fc125fe4f86c 100644 --- a/frontend/src/types.ts +++ b/frontend/src/types.ts @@ -1427,6 +1427,7 @@ export interface BillingProductV2AddonType { subscribed: boolean // sometimes addons are included with the base product, but they aren't subscribed individually included_with_main_product?: boolean + inclusion_only: boolean | null contact_support: boolean | null unit: string | null unit_amount_usd: string | null