The open alternative to Salesforce, designed for AI.
TypeScript crmcrm-systemcustomergood-first-issuegraphqlhacktoberfestjavascriptmarketingmonoreponestjsopen-sourcepostgresqlreactreactjssalestypescriptweb
feat(billing): lead the Plans page comparison with plan essentials (#28843)
Etiennef5bd1de67e3c
diff --git a/packages/twenty-front/src/modules/settings/billing/components/internal/SettingsBillingPlanComparisonTableRow.tsx b/packages/twenty-front/src/modules/settings/billing/components/internal/SettingsBillingPlanComparisonTableRow.tsxindex c028d2f04a5..4c1ccd5dd01 100644--- a/packages/twenty-front/src/modules/settings/billing/components/internal/SettingsBillingPlanComparisonTableRow.tsx+++ b/packages/twenty-front/src/modules/settings/billing/components/internal/SettingsBillingPlanComparisonTableRow.tsx@@ -4,6 +4,8 @@ import {} from '@/settings/billing/types/SettingsBillingPlanComparison';import { useLingui } from '@lingui/react/macro';import { styled } from '@linaria/react';+import { Fragment } from 'react';+import { isDefined } from 'twenty-shared/utils';import { IconCheck, IconX } from 'twenty-ui/icon';import { MOBILE_VIEWPORT, themeCssVariables, useTheme } from 'twenty-ui/theme';import { type BillingPlanKey } from '~/generated-metadata/graphql';@@ -27,7 +29,7 @@ const StyledFeatureCell = styled.div<{line-height: 1.4;min-height: 40px;min-width: 0;- padding: 0 ${themeCssVariables.spacing[4]};+ padding: ${themeCssVariables.spacing[2]} ${themeCssVariables.spacing[4]};@media (max-width: ${MOBILE_VIEWPORT}px) {border-top: 0;@@ -70,13 +72,18 @@ const StyledCategoryCell = styled.div<{ hasTopBorder?: boolean }>`const StyledCellText = styled.span`min-width: 0;- overflow: hidden;- text-overflow: ellipsis;- white-space: nowrap;+`;- @media (max-width: ${MOBILE_VIEWPORT}px) {- white-space: normal;- }+const StyledCellTextGroup = styled.div`+ display: flex;+ flex-direction: column;+ min-width: 0;+ overflow-wrap: anywhere;+`;++const StyledCellDetail = styled.span`+ color: ${themeCssVariables.font.color.tertiary};+ font-size: ${themeCssVariables.font.size.sm};`;const StyledComparisonCellIcon = styled.div<{ isIncluded: boolean }>`@@ -87,6 +94,18 @@ const StyledComparisonCellIcon = styled.div<{ isIncluded: boolean }>`display: flex;`;+const renderWithLineBreaksAfterSlashes = (text: string) =>+ text.split('/').map((part, index) => (+ <Fragment key={index}>+ {index > 0 && (+ <>+ /<wbr />+ </>+ )}+ {part}+ </Fragment>+ ));+const SettingsBillingPlanComparisonCellContent = ({cell,}: {@@ -115,7 +134,18 @@ const SettingsBillingPlanComparisonCellContent = ({);}- return <StyledCellText>{i18n._(cell.text)}</StyledCellText>;+ return (+ <StyledCellTextGroup>+ <StyledCellText>+ {renderWithLineBreaksAfterSlashes(i18n._(cell.text))}+ </StyledCellText>+ {isDefined(cell.detail) && (+ <StyledCellDetail>+ {renderWithLineBreaksAfterSlashes(i18n._(cell.detail))}+ </StyledCellDetail>+ )}+ </StyledCellTextGroup>+ );};export const SettingsBillingPlanComparisonTableRow = ({diff --git a/packages/twenty-front/src/modules/settings/billing/components/internal/__stories__/SettingsBillingPlanComparisonTable.stories.tsx b/packages/twenty-front/src/modules/settings/billing/components/internal/__stories__/SettingsBillingPlanComparisonTable.stories.tsxindex a79346a668b..eeacbe3416b 100644--- a/packages/twenty-front/src/modules/settings/billing/components/internal/__stories__/SettingsBillingPlanComparisonTable.stories.tsx+++ b/packages/twenty-front/src/modules/settings/billing/components/internal/__stories__/SettingsBillingPlanComparisonTable.stories.tsx@@ -134,6 +134,9 @@ export const WithLegacyPlan: Story = {await expect(canvas.getAllByRole('button', { name: 'Upgrade' }),).toHaveLength(2);+ await expect(canvas.getByText('Plan essentials')).toBeVisible();+ await expect(canvas.getByText('5 credits/month')).toBeVisible();+ await expect(canvas.getByText('≈ 100 AI tasks/week')).toBeVisible();},};diff --git a/packages/twenty-front/src/modules/settings/billing/constants/SettingsBillingPlanComparisonRows.ts b/packages/twenty-front/src/modules/settings/billing/constants/SettingsBillingPlanComparisonRows.tsindex 22c58562011..bf9cee83d24 100644--- a/packages/twenty-front/src/modules/settings/billing/constants/SettingsBillingPlanComparisonRows.ts+++ b/packages/twenty-front/src/modules/settings/billing/constants/SettingsBillingPlanComparisonRows.ts@@ -4,6 +4,94 @@ import { type SettingsBillingPlanComparisonRow } from '@/settings/billing/types/import { BillingPlanKey } from '~/generated-metadata/graphql';export const SETTINGS_BILLING_PLAN_COMPARISON_ROWS = [+ { title: msg`Plan essentials`, type: 'category' },+ {+ featureLabel: msg`Personal AI usage`,+ plans: {+ [BillingPlanKey.ENTERPRISE]: { kind: 'excluded' },+ [BillingPlanKey.ORGANIZATION_V2]: {+ detail: msg`per member`,+ kind: 'text',+ text: msg`≈ 500 AI tasks/week`,+ },+ [BillingPlanKey.PRO]: { kind: 'excluded' },+ [BillingPlanKey.PRO_V2]: {+ detail: msg`per member`,+ kind: 'text',+ text: msg`≈ 100 AI tasks/week`,+ },+ },+ type: 'feature',+ },+ {+ featureLabel: msg`Workspace credits`,+ plans: {+ [BillingPlanKey.ENTERPRISE]: {+ detail: msg`≈ 50,000 workflow steps`,+ kind: 'text',+ text: msg`5 credits/month`,+ },+ [BillingPlanKey.ORGANIZATION_V2]: {+ detail: msg`≈ 40,000 workflow steps`,+ kind: 'text',+ text: msg`4 credits/user/month`,+ },+ [BillingPlanKey.PRO]: {+ detail: msg`≈ 50,000 workflow steps`,+ kind: 'text',+ text: msg`5 credits/month`,+ },+ [BillingPlanKey.PRO_V2]: {+ detail: msg`≈ 10,000 workflow steps`,+ kind: 'text',+ text: msg`1 credit/user/month`,+ },+ },+ type: 'feature',+ },+ {+ featureLabel: msg`Permissions`,+ plans: {+ [BillingPlanKey.ENTERPRISE]: {+ detail: msg`down to fields and rows`,+ kind: 'text',+ text: msg`Custom roles`,+ },+ [BillingPlanKey.ORGANIZATION_V2]: {+ detail: msg`down to fields and rows`,+ kind: 'text',+ text: msg`Custom roles`,+ },+ [BillingPlanKey.PRO]: {+ detail: msg`down to fields`,+ kind: 'text',+ text: msg`Custom roles`,+ },+ [BillingPlanKey.PRO_V2]: { kind: 'text', text: msg`Admin & Member` },+ },+ type: 'feature',+ },+ {+ featureLabel: msg`SSO`,+ plans: {+ [BillingPlanKey.ENTERPRISE]: { kind: 'text', text: msg`SAML/OIDC` },+ [BillingPlanKey.ORGANIZATION_V2]: { kind: 'text', text: msg`SAML/OIDC` },+ [BillingPlanKey.PRO]: { kind: 'excluded' },+ [BillingPlanKey.PRO_V2]: { kind: 'excluded' },+ },+ type: 'feature',+ },+ {+ featureLabel: msg`Support`,+ plans: {+ [BillingPlanKey.ENTERPRISE]: { kind: 'text', text: msg`Priority` },+ [BillingPlanKey.ORGANIZATION_V2]: { kind: 'text', text: msg`Priority` },+ [BillingPlanKey.PRO]: { kind: 'text', text: msg`Email and chat` },+ [BillingPlanKey.PRO_V2]: { kind: 'text', text: msg`Email and chat` },+ },+ type: 'feature',+ },+ { title: msg`Workspace`, type: 'category' },{featureLabel: msg`Seats limit`,plans: {@@ -14,7 +102,6 @@ export const SETTINGS_BILLING_PLAN_COMPARISON_ROWS = [},type: 'feature',},- { title: msg`Workspace`, type: 'category' },{featureLabel: msg`Custom objects`,plans: {@@ -176,6 +263,32 @@ export const SETTINGS_BILLING_PLAN_COMPARISON_ROWS = [},type: 'feature',},+ {+ featureLabel: msg`Extra credits`,+ plans: {+ [BillingPlanKey.ENTERPRISE]: {+ detail: msg`$1 per credit, from $20/month`,+ kind: 'text',+ text: msg`Credit packs`,+ },+ [BillingPlanKey.ORGANIZATION_V2]: {+ detail: msg`$1 per credit, from $20/month`,+ kind: 'text',+ text: msg`Credit packs`,+ },+ [BillingPlanKey.PRO]: {+ detail: msg`$1 per credit, from $20/month`,+ kind: 'text',+ text: msg`Credit packs`,+ },+ [BillingPlanKey.PRO_V2]: {+ detail: msg`$1 per credit, from $20/month`,+ kind: 'text',+ text: msg`Credit packs`,+ },+ },+ type: 'feature',+ },{ title: msg`Security`, type: 'category' },{featureLabel: msg`Two-factor authentication`,@@ -193,7 +306,7 @@ export const SETTINGS_BILLING_PLAN_COMPARISON_ROWS = [[BillingPlanKey.ENTERPRISE]: { kind: 'text', text: msg`Unlimited` },[BillingPlanKey.ORGANIZATION_V2]: { kind: 'text', text: msg`Unlimited` },[BillingPlanKey.PRO]: { kind: 'text', text: msg`Unlimited` },- [BillingPlanKey.PRO_V2]: { kind: 'text', text: msg`Unlimited` },+ [BillingPlanKey.PRO_V2]: { kind: 'text', text: msg`Admin & Member` },},type: 'feature',},@@ -203,7 +316,7 @@ export const SETTINGS_BILLING_PLAN_COMPARISON_ROWS = [[BillingPlanKey.ENTERPRISE]: { kind: 'text', text: msg`Unlimited` },[BillingPlanKey.ORGANIZATION_V2]: { kind: 'text', text: msg`Unlimited` },[BillingPlanKey.PRO]: { kind: 'text', text: msg`Unlimited` },- [BillingPlanKey.PRO_V2]: { kind: 'text', text: msg`Unlimited` },+ [BillingPlanKey.PRO_V2]: { kind: 'excluded' },},type: 'feature',},@@ -213,7 +326,7 @@ export const SETTINGS_BILLING_PLAN_COMPARISON_ROWS = [[BillingPlanKey.ENTERPRISE]: { kind: 'text', text: msg`Unlimited` },[BillingPlanKey.ORGANIZATION_V2]: { kind: 'text', text: msg`Unlimited` },[BillingPlanKey.PRO]: { kind: 'text', text: msg`Unlimited` },- [BillingPlanKey.PRO_V2]: { kind: 'text', text: msg`Unlimited` },+ [BillingPlanKey.PRO_V2]: { kind: 'excluded' },},type: 'feature',},@@ -227,16 +340,6 @@ export const SETTINGS_BILLING_PLAN_COMPARISON_ROWS = [},type: 'feature',},- {- featureLabel: msg`SSO`,- plans: {- [BillingPlanKey.ENTERPRISE]: { kind: 'included' },- [BillingPlanKey.ORGANIZATION_V2]: { kind: 'included' },- [BillingPlanKey.PRO]: { kind: 'excluded' },- [BillingPlanKey.PRO_V2]: { kind: 'excluded' },- },- type: 'feature',- },{featureLabel: msg`Encryption key rotation`,plans: {@@ -309,6 +412,16 @@ export const SETTINGS_BILLING_PLAN_COMPARISON_ROWS = [},type: 'feature',},+ {+ featureLabel: msg`Data Processing Agreement (DPA)`,+ plans: {+ [BillingPlanKey.ENTERPRISE]: { kind: 'included' },+ [BillingPlanKey.ORGANIZATION_V2]: { kind: 'included' },+ [BillingPlanKey.PRO]: { kind: 'included' },+ [BillingPlanKey.PRO_V2]: { kind: 'included' },+ },+ type: 'feature',+ },{ title: msg`Support`, type: 'category' },{featureLabel: msg`Community`,diff --git a/packages/twenty-front/src/modules/settings/billing/types/SettingsBillingPlanComparison.ts b/packages/twenty-front/src/modules/settings/billing/types/SettingsBillingPlanComparison.tsindex fa2dd455d85..322735b98c0 100644--- a/packages/twenty-front/src/modules/settings/billing/types/SettingsBillingPlanComparison.ts+++ b/packages/twenty-front/src/modules/settings/billing/types/SettingsBillingPlanComparison.ts@@ -18,7 +18,7 @@ export type SettingsBillingPlanPrices = Record<export type SettingsBillingPlanComparisonCell =| { kind: 'excluded' }| { kind: 'included' }- | { kind: 'text'; text: MessageDescriptor };+ | { detail?: MessageDescriptor; kind: 'text'; text: MessageDescriptor };export type SettingsBillingPlanComparisonCategoryRow = {title: MessageDescriptor;