📈 Open source, privacy-first web analytics — a cookie-less Google Analytics alternative with built-in error tracking and performance monitoring. Self-host it or use our cloud. Get started for free!
TypeScript chartsclickhousedockergdprgoogle-analyticsmetricsmonitoringmysqlnestjsprivacyredisself-hostedselfhostedstatisticstailwindcssweb-analyticswebanalyticswebsite
Introduce billing tiers, bundles; rework pricing
Blue Mouse32ca7ceff52f
diff --git a/admin/src/billing/pricing.ts b/admin/src/billing/pricing.tsnew file mode 100644index 000000000..b07ca8ba6--- /dev/null+++ b/admin/src/billing/pricing.ts@@ -0,0 +1,111 @@+import { PlanCode, PlanType, User } from '../entities/user.entity.js'++const paidPlanCodes = new Set<string>([+ PlanCode.hobby,+ PlanCode.freelancer,+ PlanCode['50k'],+ PlanCode['100k'],+ PlanCode['200k'],+ PlanCode['500k'],+ PlanCode.startup,+ PlanCode['2m'],+ PlanCode.enterprise,+ PlanCode['10m'],+ PlanCode['15m'],+ PlanCode['20m'],+ PlanCode['30m'],+ PlanCode['40m'],+ PlanCode['50m'],+])++export const eventBuckets: Record<string, number> = {+ [PlanCode.none]: 0,+ [PlanCode.free]: 5000,+ [PlanCode.trial]: 10000000,+ [PlanCode.hobby]: 10000,+ [PlanCode['50k']]: 50000,+ [PlanCode.freelancer]: 100000,+ [PlanCode['100k']]: 100000,+ [PlanCode['200k']]: 200000,+ [PlanCode['500k']]: 500000,+ [PlanCode.startup]: 1000000,+ [PlanCode['2m']]: 2000000,+ [PlanCode.enterprise]: 5000000,+ [PlanCode['10m']]: 10000000,+ [PlanCode['15m']]: 15000000,+ [PlanCode['20m']]: 20000000,+ [PlanCode['30m']]: 30000000,+ [PlanCode['40m']]: 40000000,+ [PlanCode['50m']]: 50000000,+}++export const planEntitlements = {+ [PlanType.standard]: {+ websites: 50,+ teamMembers: 10,+ organisations: 3,+ apiRateLimitPerHour: 600,+ sessionReplaysIncluded: 0,+ },+ [PlanType.plus]: {+ websites: 100,+ teamMembers: 25,+ organisations: 10,+ apiRateLimitPerHour: 5000,+ sessionReplaysIncluded: 50000,+ },+ [PlanType.enterprise]: {+ websites: 'custom',+ teamMembers: 'custom',+ organisations: 'custom',+ apiRateLimitPerHour: 'custom',+ sessionReplaysIncluded: 'custom',+ },+} as const++const numberValue = (source: Record<string, unknown> | null, key: string) =>+ source && typeof source[key] === 'number' ? (source[key] as number) : null++export const getEffectivePlanType = (user: User): PlanType | null => {+ if (user.planType) return user.planType+ if (paidPlanCodes.has(user.planCode)) return PlanType.standard+ return null+}++export const getEffectiveLimits = (user: User) => {+ const planType = getEffectivePlanType(user) || PlanType.standard+ const entitlements = planEntitlements[planType]+ const addonWebsites =+ numberValue(user.addonOverrides, 'websites') ||+ numberValue(user.addonOverrides, 'additionalWebsites') ||+ 0+ const websiteOverride = numberValue(user.entitlementOverrides, 'websites')+ const apiOverride = numberValue(+ user.entitlementOverrides,+ 'apiRateLimitPerHour',+ )+ const replayOverride = numberValue(+ user.entitlementOverrides,+ 'sessionReplaysIncluded',+ )+ const websites =+ websiteOverride ??+ (typeof entitlements.websites === 'number'+ ? entitlements.websites+ : user.maxProjects)+ const apiRateLimitPerHour =+ apiOverride ??+ (typeof entitlements.apiRateLimitPerHour === 'number'+ ? entitlements.apiRateLimitPerHour+ : user.maxApiKeyRequestsPerHour)++ return {+ planType,+ eventBucket: eventBuckets[user.planCode] || 0,+ websitesIncluded:+ typeof websites === 'number' ? websites + addonWebsites : websites,+ purchasedWebsiteAddons: addonWebsites,+ replayQuota: replayOverride ?? entitlements.sessionReplaysIncluded,+ apiRateLimitPerHour,+ }+}diff --git a/admin/src/commands/UsersCommand.tsx b/admin/src/commands/UsersCommand.tsxindex ee724af37..8de73602a 100644--- a/admin/src/commands/UsersCommand.tsx+++ b/admin/src/commands/UsersCommand.tsx@@ -6,6 +6,12 @@ import { Spinner } from '../components/Spinner.js'import { Table } from '../components/Table.js'import { AppDataSource, User, Project, OrganisationMember } from '../db/mysql.js'import { getProjectEventCount } from '../db/clickhouse.js'+import { PlanType } from '../entities/user.entity.js'+import {+ getEffectiveLimits,+ getEffectivePlanType,+ planEntitlements,+} from '../billing/pricing.js'interface UsersCommandProps {onBack: () => void@@ -13,7 +19,14 @@ interface UsersCommandProps {showListOnBack?: boolean}-type Mode = 'list' | 'search' | 'detail' | 'project-detail'+type Mode =+ | 'list'+ | 'search'+ | 'detail'+ | 'project-detail'+ | 'edit-plan-type'+ | 'edit-addon-overrides'+ | 'edit-entitlement-overrides'interface UserWithProjectCount extends User {projectCount?: number@@ -32,6 +45,7 @@ export function UsersCommand({ onBack, initialUser, showListOnBack = true }: Useconst [filter, setFilter] = useState<'all' | 'active' | 'inactive'>('all')const [selectedProject, setSelectedProject] = useState<Project | null>(null)const [projectEventCount, setProjectEventCount] = useState<number>(0)+ const [jsonInput, setJsonInput] = useState('')const pageSize = 10useEffect(() => {@@ -45,6 +59,12 @@ export function UsersCommand({ onBack, initialUser, showListOnBack = true }: Useif (mode === 'project-detail') {setMode('detail')setSelectedProject(null)+ } else if (+ mode === 'edit-plan-type' ||+ mode === 'edit-addon-overrides' ||+ mode === 'edit-entitlement-overrides'+ ) {+ setMode('detail')} else if (mode === 'detail') {if (showListOnBack) {setMode('list')@@ -62,6 +82,17 @@ export function UsersCommand({ onBack, initialUser, showListOnBack = true }: Useif (input === 'f' && mode === 'list') {setFilter(f => f === 'all' ? 'active' : f === 'active' ? 'inactive' : 'all')}+ if (input === 'p' && mode === 'detail') {+ setMode('edit-plan-type')+ }+ if (input === 'a' && mode === 'detail' && selectedUser) {+ setJsonInput(JSON.stringify(selectedUser.addonOverrides || {}))+ setMode('edit-addon-overrides')+ }+ if (input === 'e' && mode === 'detail' && selectedUser) {+ setJsonInput(JSON.stringify(selectedUser.entitlementOverrides || {}))+ setMode('edit-entitlement-overrides')+ }if (key.leftArrow && page > 0) {setPage(p => p - 1)}@@ -166,6 +197,61 @@ export function UsersCommand({ onBack, initialUser, showListOnBack = true }: Use}}+ async function updateSelectedUser(update: Partial<User>) {+ if (!selectedUser) return++ setLoading(true)+ setError(null)+ try {+ const repo = AppDataSource.getRepository(User)+ await repo.update({ id: selectedUser.id }, update as any)+ setSelectedUser({ ...selectedUser, ...update })+ setMode('detail')+ } catch (err) {+ setError(err instanceof Error ? err.message : 'Failed to update user')+ } finally {+ setLoading(false)+ }+ }++ async function handlePlanTypeSelect(item: { value: string }) {+ const nextPlanType =+ item.value === 'clear' ? null : (item.value as PlanType)+ const update: Partial<User> = { planType: nextPlanType }++ if (nextPlanType) {+ const entitlements = planEntitlements[nextPlanType]+ if (typeof entitlements.websites === 'number') {+ update.maxProjects = entitlements.websites+ }+ if (typeof entitlements.apiRateLimitPerHour === 'number') {+ update.maxApiKeyRequestsPerHour = entitlements.apiRateLimitPerHour+ }+ }++ await updateSelectedUser(update)+ }++ async function handleJsonSubmit(target: 'addonOverrides' | 'entitlementOverrides') {+ const trimmed = jsonInput.trim()+ let parsed: Record<string, unknown> | null = null++ try {+ if (trimmed && trimmed !== 'null') {+ const value = JSON.parse(trimmed)+ if (!value || typeof value !== 'object' || Array.isArray(value)) {+ throw new Error('Overrides must be a JSON object')+ }+ parsed = value+ }+ } catch (err) {+ setError(err instanceof Error ? err.message : 'Invalid JSON')+ return+ }++ await updateSelectedUser({ [target]: parsed } as Partial<User>)+ }+if (loading) {return <Spinner text="Loading users..." />}@@ -236,7 +322,70 @@ export function UsersCommand({ onBack, initialUser, showListOnBack = true }: Use)}+ if (mode === 'edit-plan-type' && selectedUser) {+ const items = [+ { label: 'Clear plan type (legacy fallback)', value: 'clear' },+ { label: 'Standard', value: PlanType.standard },+ { label: 'Plus', value: PlanType.plus },+ { label: 'Enterprise (manual)', value: PlanType.enterprise },+ ]++ return (+ <Box flexDirection="column">+ <Text bold color="yellow">Edit Plan Type</Text>+ <Text>+ <Text color="cyan">User:</Text> {selectedUser.email}+ </Text>+ <Text>+ <Text color="cyan">Current:</Text>{' '}+ {selectedUser.planType || `${getEffectivePlanType(selectedUser) || 'none'} fallback`}+ </Text>+ <Box marginTop={1}>+ <SelectInput items={items} onSelect={handlePlanTypeSelect} />+ </Box>+ <Box marginTop={1}>+ <Text color="gray">Press ESC to cancel</Text>+ </Box>+ </Box>+ )+ }++ if (+ (mode === 'edit-addon-overrides' ||+ mode === 'edit-entitlement-overrides') &&+ selectedUser+ ) {+ const target =+ mode === 'edit-addon-overrides'+ ? 'addonOverrides'+ : 'entitlementOverrides'++ return (+ <Box flexDirection="column">+ <Text bold color="yellow">+ Edit {target === 'addonOverrides' ? 'Add-on' : 'Entitlement'} Overrides+ </Text>+ <Text>+ <Text color="cyan">User:</Text> {selectedUser.email}+ </Text>+ <Box marginTop={1}>+ <Text>JSON: </Text>+ <TextInput+ value={jsonInput}+ onChange={setJsonInput}+ onSubmit={() => handleJsonSubmit(target)}+ placeholder='{"websites":50}'+ />+ </Box>+ <Box marginTop={1}>+ <Text color="gray">Submit an empty value to clear. Press ESC to cancel</Text>+ </Box>+ </Box>+ )+ }+if (mode === 'detail' && selectedUser) {+ const effectiveLimits = getEffectiveLimits(selectedUser)const projectItems = userProjects.map(project => ({label: `📁 [${project.id}] ${project.name} ${project.isArchived ? '(archived)' : ''}`,value: project.id,@@ -256,7 +405,12 @@ export function UsersCommand({ onBack, initialUser, showListOnBack = true }: Use{selectedUser.isActive ? 'Active' : 'Inactive'}</Text></Text>- <Text><Text color="cyan">Plan:</Text> {selectedUser.planCode}</Text>+ <Text><Text color="cyan">Event Bucket:</Text> {selectedUser.planCode}</Text>+ <Text><Text color="cyan">Plan Type:</Text> {selectedUser.planType || `${effectiveLimits.planType} fallback`}</Text>+ <Text><Text color="cyan">Websites Included:</Text> {effectiveLimits.websitesIncluded}</Text>+ <Text><Text color="cyan">Purchased Website Add-ons:</Text> {effectiveLimits.purchasedWebsiteAddons}</Text>+ <Text><Text color="cyan">Replay Quota:</Text> {effectiveLimits.replayQuota}</Text>+ <Text><Text color="cyan">API Rate Limit:</Text> {effectiveLimits.apiRateLimitPerHour}/hour</Text><Text><Text color="cyan">Created:</Text> {new Date(selectedUser.created).toLocaleString()}</Text><Text><Text color="cyan">2FA Enabled:</Text> {selectedUser.isTwoFactorAuthenticationEnabled ? 'Yes' : 'No'}</Text><Text><Text color="cyan">Max Projects:</Text> {selectedUser.maxProjects}</Text>@@ -319,7 +473,7 @@ export function UsersCommand({ onBack, initialUser, showListOnBack = true }: Use)}<Box marginTop={1}>- <Text color="gray">Press ESC to go back</Text>+ <Text color="gray">Press P to edit plan type | A to edit add-on overrides | E to edit entitlement overrides | ESC to go back</Text></Box></Box>)@@ -327,7 +481,7 @@ export function UsersCommand({ onBack, initialUser, showListOnBack = true }: Use// List modeconst userItems = users.map(user => ({- label: `${user.email} (${user.planCode}, ${user.projectCount || 0} projects) ${user.isActive ? '' : '[inactive]'}`,+ label: `${user.email} (${user.planType || getEffectivePlanType(user) || 'none'} / ${user.planCode}, ${user.projectCount || 0} projects) ${user.isActive ? '' : '[inactive]'}`,value: user.id,}))diff --git a/admin/src/entities/user.entity.ts b/admin/src/entities/user.entity.tsindex ad1419a2f..6b8fa8ca4 100644--- a/admin/src/entities/user.entity.ts+++ b/admin/src/entities/user.entity.ts@@ -24,6 +24,15 @@ export enum PlanCode {'10m' = '10m','15m' = '15m','20m' = '20m',+ '30m' = '30m',+ '40m' = '40m',+ '50m' = '50m',+}++export enum PlanType {+ standard = 'standard',+ plus = 'plus',+ enterprise = 'enterprise',}export enum DashboardBlockReason {@@ -45,6 +54,20 @@ export class User {})planCode: PlanCode+ @Column({+ type: 'enum',+ enum: PlanType,+ nullable: true,+ default: null,+ })+ planType: PlanType | null++ @Column({ type: 'json', nullable: true })+ addonOverrides: Record<string, unknown> | null++ @Column({ type: 'json', nullable: true })+ entitlementOverrides: Record<string, unknown> | null+@Column('varchar', { length: 100, nullable: true, default: null })nickname: string | null@@ -66,6 +89,9 @@ export class User {@Column('int', { default: 50 })maxProjects: number+ @Column('int', { default: 600 })+ maxApiKeyRequestsPerHour: number+@Column({type: 'enum',enum: DashboardBlockReason,diff --git a/backend/apps/cloud/src/user/dto/change-plan.dto.ts b/backend/apps/cloud/src/user/dto/change-plan.dto.tsindex 26897663f..eed8b87de 100644--- a/backend/apps/cloud/src/user/dto/change-plan.dto.ts+++ b/backend/apps/cloud/src/user/dto/change-plan.dto.ts@@ -1,8 +1,20 @@import { ApiProperty } from '@nestjs/swagger'-import { IsNumber } from 'class-validator'+import { IsIn, IsNumber, IsOptional, IsString } from 'class-validator'++const PLAN_TYPES = ['standard', 'plus', 'enterprise'] as constexport class IChangePlanDTO {@ApiProperty({ example: 12345, required: true })@IsNumber()planId: number++ @ApiProperty({ example: 'standard', required: false })+ @IsOptional()+ @IsIn(PLAN_TYPES)+ planType?: string++ @ApiProperty({ example: '100k', required: false })+ @IsOptional()+ @IsString()+ eventTier?: string}diff --git a/backend/apps/cloud/src/user/entities/user.entity.ts b/backend/apps/cloud/src/user/entities/user.entity.tsindex 3e1beaa3b..64271b3be 100644--- a/backend/apps/cloud/src/user/entities/user.entity.ts+++ b/backend/apps/cloud/src/user/entities/user.entity.ts@@ -28,6 +28,15 @@ export enum PlanCode {'10m' = '10m','15m' = '15m','20m' = '20m',+ '30m' = '30m',+ '40m' = '40m',+ '50m' = '50m',+}++export enum PlanType {+ standard = 'standard',+ plus = 'plus',+ enterprise = 'enterprise',}export enum DashboardBlockReason {@@ -46,6 +55,58 @@ interface PlanSignature {ypid?: string}+export const PLAN_TYPE_ENTITLEMENTS = {+ [PlanType.standard]: {+ websites: 50,+ teamMembers: 10,+ organisations: 3,+ apiRateLimitPerHour: 600,+ sessionReplaysIncluded: 0,+ },+ [PlanType.plus]: {+ websites: 100,+ teamMembers: 25,+ organisations: 10,+ apiRateLimitPerHour: 5000,+ sessionReplaysIncluded: 50000,+ },+ [PlanType.enterprise]: {+ websites: 'custom',+ teamMembers: 'custom',+ organisations: 'custom',+ apiRateLimitPerHour: 'custom',+ sessionReplaysIncluded: 'custom',+ },+} as const++export const getEffectivePlanType = (+ user?: {+ planCode?: PlanCode | null+ planType?: PlanType | null+ } | null,+): PlanType | null => {+ if (!user) {+ return null+ }++ if (user.planType) {+ return user.planType+ }++ if (+ user.planCode &&+ ![PlanCode.none, PlanCode.free, PlanCode.trial].includes(user.planCode)+ ) {+ return PlanType.standard+ }++ return null+}++export const getPlanTypeEntitlements = (+ planType?: PlanType | null,+) => PLAN_TYPE_ENTITLEMENTS[planType || PlanType.standard]+export const ACCOUNT_PLANS = {[PlanCode.none]: {id: PlanCode.none,@@ -152,6 +213,27 @@ export const ACCOUNT_PLANS = {ypid: '916454',maxAlerts: 50,},+ [PlanCode['30m']]: {+ id: PlanCode['30m'],+ monthlyUsageLimit: 30000000,+ pid: null,+ ypid: null,+ maxAlerts: 50,+ },+ [PlanCode['40m']]: {+ id: PlanCode['40m'],+ monthlyUsageLimit: 40000000,+ pid: null,+ ypid: null,+ maxAlerts: 50,+ },+ [PlanCode['50m']]: {+ id: PlanCode['50m'],+ monthlyUsageLimit: 50000000,+ pid: null,+ ypid: null,+ maxAlerts: 50,+ },}export const getNextPlan = (planCode: PlanCode): PlanSignature | undefined => {@@ -235,6 +317,20 @@ export class User {})planCode: PlanCode+ @Column({+ type: 'enum',+ enum: PlanType,+ nullable: true,+ default: null,+ })+ planType: PlanType | null++ @Column({ type: 'json', nullable: true })+ addonOverrides: Record<string, unknown> | null++ @Column({ type: 'json', nullable: true })+ entitlementOverrides: Record<string, unknown> | null+@Column('varchar', { length: 100, nullable: true, default: null })nickname: string | nulldiff --git a/backend/apps/cloud/src/user/interfaces/usage-info.ts b/backend/apps/cloud/src/user/interfaces/usage-info.tsindex 3020f52ee..f34a209db 100644--- a/backend/apps/cloud/src/user/interfaces/usage-info.ts+++ b/backend/apps/cloud/src/user/interfaces/usage-info.ts@@ -7,6 +7,7 @@ export interface IUsageInfoRedis {}export interface IUsageInfo extends IUsageInfoRedis {+ projects: numbertrafficPerc: numbercustomEventsPerc: numbercaptchaPerc: numberdiff --git a/backend/apps/cloud/src/user/user.controller.ts b/backend/apps/cloud/src/user/user.controller.tsindex db1f4492c..a442adc0f 100644--- a/backend/apps/cloud/src/user/user.controller.ts+++ b/backend/apps/cloud/src/user/user.controller.ts@@ -798,14 +798,33 @@ export class UserController {@Get('usageinfo')async getUsageInfo(@CurrentUserId() uid: string): Promise<IUsageInfo> {- const rawInfo = await this.projectService.getRedisUsageInfo(uid)+ const [rawInfo, projects] = await Promise.all([+ this.projectService.getRedisUsageInfo(uid),+ this.projectService.countByAdminId(uid),+ ])+ const usage = rawInfo || {+ total: 0,+ traffic: 0,+ customEvents: 0,+ captcha: 0,+ errors: 0,+ }const info: IUsageInfo = {- ...rawInfo,- trafficPerc: _round((rawInfo.traffic / rawInfo.total) * 100, 2),- customEventsPerc: _round((rawInfo.customEvents / rawInfo.total) * 100, 2),- captchaPerc: _round((rawInfo.captcha / rawInfo.total) * 100, 2),- errorsPerc: _round((rawInfo.errors / rawInfo.total) * 100, 2),+ ...usage,+ projects,+ trafficPerc: usage.total+ ? _round((usage.traffic / usage.total) * 100, 2)+ : 0,+ customEventsPerc: usage.total+ ? _round((usage.customEvents / usage.total) * 100, 2)+ : 0,+ captchaPerc: usage.total+ ? _round((usage.captcha / usage.total) * 100, 2)+ : 0,+ errorsPerc: usage.total+ ? _round((usage.errors / usage.total) * 100, 2)+ : 0,}return info@@ -818,9 +837,9 @@ export class UserController {@Body() body: IChangePlanDTO,): Promise<void> {this.logger.log({ body, id }, 'POST /change-plan')- const { planId } = body+ const { planId, planType } = body- await this.userService.updateSubscription(id, planId)+ await this.userService.updateSubscription(id, planId, planType)await this.projectService.clearProjectsRedisCache(id)}@@ -831,9 +850,12 @@ export class UserController {@Body() body: IChangePlanDTO,): Promise<any> {this.logger.log({ body, id }, 'POST /generate-pay-link')- const { planId } = body+ const { planId, planType, eventTier } = body- return this.userService.generatePayLink(id, planId)+ return this.userService.generatePayLink(id, planId, {+ planType,+ eventTier,+ })}@ApiBearerAuth()@@ -843,9 +865,9 @@ export class UserController {@Body() body: IChangePlanDTO,): Promise<any> {this.logger.log({ body, id }, 'POST /preview-plan')- const { planId } = body+ const { planId, planType } = body- return this.userService.previewSubscription(id, planId)+ return this.userService.previewSubscription(id, planId, planType)}@ApiBearerAuth()diff --git a/backend/apps/cloud/src/user/user.service.ts b/backend/apps/cloud/src/user/user.service.tsindex 371ee31f8..0981a02a4 100644--- a/backend/apps/cloud/src/user/user.service.ts+++ b/backend/apps/cloud/src/user/user.service.ts@@ -32,6 +32,9 @@ import {TRIAL_DURATION,BillingFrequency,PlanCode,+ PlanType,+ getEffectivePlanType,+ getPlanTypeEntitlements,} from './entities/user.entity'import { UserProfileDTO } from './dto/user.dto'import { RefreshToken } from './entities/refresh-token.entity'@@ -210,10 +213,56 @@ export class UserService {omitSensitiveData(user: Partial<User>): Partial<User> {const maxEventsCount = ACCOUNT_PLANS[user?.planCode]?.monthlyUsageLimit || 0+ const effectivePlanType = getEffectivePlanType(user)+ const entitlements = getPlanTypeEntitlements(effectivePlanType)+ const entitlementOverrides = user?.entitlementOverrides || {}+ const addonOverrides = user?.addonOverrides || {}+ const numberOverride = (source: Record<string, unknown>, key: string) =>+ typeof source[key] === 'number' ? (source[key] as number) : null++ const purchasedWebsiteAddons =+ numberOverride(addonOverrides, 'websites') ||+ numberOverride(addonOverrides, 'additionalWebsites') ||+ 0+ const websiteOverride = numberOverride(entitlementOverrides, 'websites')+ const apiOverride = numberOverride(+ entitlementOverrides,+ 'apiRateLimitPerHour',+ )+ const replayOverride = numberOverride(+ entitlementOverrides,+ 'sessionReplaysIncluded',+ )+ const includedWebsites =+ websiteOverride ??+ (typeof entitlements.websites === 'number'+ ? entitlements.websites+ : user?.maxProjects)+ const apiRateLimitPerHour =+ apiOverride ??+ (typeof entitlements.apiRateLimitPerHour === 'number'+ ? entitlements.apiRateLimitPerHour+ : user?.maxApiKeyRequestsPerHour)+ const sessionReplaysIncluded =+ replayOverride ?? entitlements.sessionReplaysIncludedconst enhancedUser = {...user,+ effectivePlanType,maxEventsCount,+ maxProjects:+ typeof includedWebsites === 'number'+ ? Math.max(+ user?.maxProjects || 0,+ includedWebsites + purchasedWebsiteAddons,+ )+ : user?.maxProjects,+ maxApiKeyRequestsPerHour:+ typeof apiRateLimitPerHour === 'number'+ ? Math.max(user?.maxApiKeyRequestsPerHour || 0, apiRateLimitPerHour)+ : user?.maxApiKeyRequestsPerHour,+ sessionReplaysIncluded,+ purchasedWebsiteAddons,}return _omit(enhancedUser, [@@ -455,7 +504,30 @@ export class UserService {return CURRENCY_BY_COUNTRY[country] || USD}- getPlanById(planId: number) {+ private normalizePlanType(planType?: string | null): PlanType {+ if (planType && Object.values(PlanType).includes(planType as PlanType)) {+ return planType as PlanType+ }++ return PlanType.standard+ }++ private getAccountLimitUpdates(planType?: PlanType | null) {+ const entitlements = getPlanTypeEntitlements(planType)+ const updates: Record<string, unknown> = {}++ if (typeof entitlements.websites === 'number') {+ updates.maxProjects = entitlements.websites+ }++ if (typeof entitlements.apiRateLimitPerHour === 'number') {+ updates.maxApiKeyRequestsPerHour = entitlements.apiRateLimitPerHour+ }++ return updates+ }++ getPlanById(planId: number, requestedPlanType?: string | null) {if (!planId) {return null}@@ -485,25 +557,31 @@ export class UserService {return {planCode,billingFrequency,+ planType: this.normalizePlanType(requestedPlanType),}}return null}- async previewSubscription(id: string, planID: number) {+ async previewSubscription(+ id: string,+ planID: number,+ requestedPlanType?: string | null,+ ) {const user = await this.findOne({ where: { id } })- const plan = this.getPlanById(planID)+ const plan = this.getPlanById(planID, requestedPlanType)if (!plan) {throw new BadRequestException('Plan not found')}- const { planCode, billingFrequency } = plan+ const { planCode, billingFrequency, planType } = planif (user.planCode === planCode &&- user.billingFrequency === billingFrequency+ user.billingFrequency === billingFrequency &&+ getEffectivePlanType(user) === planType) {throw new BadRequestException('You are already subscribed to this plan')}@@ -614,19 +692,24 @@ export class UserService {}}- async updateSubscription(id: string, planID: number) {+ async updateSubscription(+ id: string,+ planID: number,+ requestedPlanType?: string | null,+ ) {const user = await this.findOne({ where: { id } })- const plan = this.getPlanById(planID)+ const plan = this.getPlanById(planID, requestedPlanType)if (!plan) {throw new BadRequestException('Plan not found')}- const { planCode, billingFrequency } = plan+ const { planCode, billingFrequency, planType } = planif (user.planCode === planCode &&- user.billingFrequency === billingFrequency+ user.billingFrequency === billingFrequency &&+ getEffectivePlanType(user) === planType) {throw new BadRequestException('You are already subscribed to this plan')}@@ -656,6 +739,7 @@ export class UserService {keep_modifiers: false,passthrough: JSON.stringify({uid: id,+ planType,}),}),})@@ -681,21 +765,32 @@ export class UserService {const updateParams = {planCode,+ planType,subID,nextBillDate: date,billingFrequency,tierCurrency: currency,+ ...this.getAccountLimitUpdates(planType),}await this.update(id, updateParams)}- async generatePayLink(id: string, productId: number) {+ async generatePayLink(+ id: string,+ productId: number,+ context: { planType?: string | null; eventTier?: string | null } = {},+ ) {const user = await this.findOne({ where: { id } })if (!user) {throw new BadRequestException('User not found')}+ const plan = this.getPlanById(productId, context.planType)+ if (!plan) {+ throw new BadRequestException('Plan not found')+ }+const url = 'https://vendors.paddle.com/api/2.0/product/generate_pay_link'let result: any = {}@@ -711,7 +806,11 @@ export class UserService {vendor_auth_code: PADDLE_API_KEY,product_id: productId,customer_email: user.email,- passthrough: JSON.stringify({ uid: id }),+ passthrough: JSON.stringify({+ uid: id,+ planType: plan.planType,+ eventTier: context.eventTier || null,+ }),...(isTrial? {trial_days: TRIAL_DURATION,diff --git a/backend/apps/cloud/src/webhook/webhook.controller.ts b/backend/apps/cloud/src/webhook/webhook.controller.tsindex 89c13638f..35479e1a4 100644--- a/backend/apps/cloud/src/webhook/webhook.controller.ts+++ b/backend/apps/cloud/src/webhook/webhook.controller.ts@@ -17,6 +17,8 @@ import {ACCOUNT_PLANS,BillingFrequency,DashboardBlockReason,+ PlanType,+ getPlanTypeEntitlements,isNextPlan,} from '../user/entities/user.entity'import { UserService } from '../user/user.service'@@ -101,9 +103,17 @@ export class WebhookController {status,} = bodylet uid+ let requestedPlanType: PlanType | null = nulltry {- uid = JSON.parse(passthrough)?.uid+ const passthroughData = JSON.parse(passthrough)+ uid = passthroughData?.uid+ if (+ passthroughData?.planType &&+ Object.values(PlanType).includes(passthroughData.planType)+ ) {+ requestedPlanType = passthroughData.planType+ }} catch {this.logger.error(`[${body.alert_name}] Cannot parse the uid: ${JSON.stringify(body)}`,@@ -160,8 +170,22 @@ export class WebhookController {}: {}+ const planType = requestedPlanType || PlanType.standard+ const entitlements = getPlanTypeEntitlements(planType)+ const limitParams: Record<string, any> = {}++ if (typeof entitlements.websites === 'number') {+ limitParams.maxProjects = entitlements.websites+ }++ if (typeof entitlements.apiRateLimitPerHour === 'number') {+ limitParams.maxApiKeyRequestsPerHour =+ entitlements.apiRateLimitPerHour+ }+const updateParams: Record<string, any> = {planCode: plan.id,+ planType,subID,subUpdateURL,subCancelURL,@@ -172,6 +196,7 @@ export class WebhookController {tierCurrency: currency,cancellationEffectiveDate: null,...statusParams,+ ...limitParams,}if (isTrialing && nextBillDate) {diff --git a/backend/migrations/mysql/2026_05_30_pricing_plan_types.sql b/backend/migrations/mysql/2026_05_30_pricing_plan_types.sqlnew file mode 100644index 000000000..a12d9f7fe--- /dev/null+++ b/backend/migrations/mysql/2026_05_30_pricing_plan_types.sql@@ -0,0 +1,7 @@+ALTER TABLE `user` MODIFY COLUMN `planCode` enum('none','free','trial','hobby','freelancer','50k','100k','200k','500k','startup','2m','enterprise','10m','15m','20m','30m','40m','50m') NOT NULL DEFAULT 'none';++ALTER TABLE `user` ADD COLUMN `planType` enum('standard','plus','enterprise') DEFAULT NULL AFTER `planCode`;++ALTER TABLE `user` ADD COLUMN `addonOverrides` json DEFAULT NULL AFTER `planType`;++ALTER TABLE `user` ADD COLUMN `entitlementOverrides` json DEFAULT NULL AFTER `addonOverrides`;diff --git a/web/app/components/pricing/BillingPricing.tsx b/web/app/components/pricing/BillingPricing.tsxindex a1d18cf71..f9dc43965 100644--- a/web/app/components/pricing/BillingPricing.tsx+++ b/web/app/components/pricing/BillingPricing.tsx@@ -1,34 +1,45 @@import dayjs from 'dayjs'-import _includes from 'lodash/includes'import _isNil from 'lodash/isNil'-import _map from 'lodash/map'import _round from 'lodash/round'-import { QuestionIcon } from '@phosphor-icons/react'-import React, { memo, useEffect, useMemo, useState } from 'react'+import { ArrowRightIcon, CheckIcon } from '@phosphor-icons/react'+import type { TFunction } from 'i18next'+import React, { memo, useCallback, useEffect, useMemo, useState } from 'react'import { Trans, useTranslation } from 'react-i18next'import { useFetcher } from 'react-router'import { toast } from 'sonner'import {BillingFrequency,- CURRENCIES,CONTACT_EMAIL,- PLAN_LIMITS,- STANDARD_PLANS,- PURCHASABLE_LEGACY_PLANS,+ CURRENCIES,paddleLanguageMapping,+ PLAN_LIMITS,} from '~/lib/constants'import { Metainfo, DEFAULT_METAINFO } from '~/lib/models/Metainfo'+import {+ ADDONS,+ EVENT_TIER_CODES,+ EVENT_TIERS,+ PLAN_ENTITLEMENTS,+ PLAN_TYPES,+ getEffectivePlanType,+ getEventTierByPlanCode,+ getIncludedSessionReplays,+ getPlanMonthlyPrice,+ getPlanPrice,+ type BillingInterval,+ type CurrencyCode,+ type EventTierCode,+ type PlanTypeCode,+} from '~/lib/pricing/catalog'import { useAuth } from '~/providers/AuthProvider'import { useTheme } from '~/providers/ThemeProvider'import type { UserSettingsActionData } from '~/routes/user-settings'-import { Badge } from '~/ui/Badge'import Button from '~/ui/Button'import Loader from '~/ui/Loader'import Modal from '~/ui/Modal'import { Switch } from '~/ui/Switch'import { Text } from '~/ui/Text'-import Tooltip from '~/ui/Tooltip'import { cn } from '~/utils/generic'import routes from '~/utils/routes'@@ -38,9 +49,52 @@ interface BillingPricingProps {openCheckout: (options: Record<string, any>) => boolean}+interface PendingSelection {+ planType: PlanTypeCode+ eventTier: EventTierCode+ billingFrequency: BillingInterval+ currency: CurrencyCode+}++const planTypeOptions: PlanTypeCode[] = ['standard', 'plus', 'enterprise']+const formatEventsLong = (value: number): string =>value.toLocaleString('en-US')+const formatPrice = (amount: number | null) => {+ if (amount === null) return null+ return Number.isInteger(amount) ? amount.toFixed(0) : amount.toFixed(2)+}++const formatReplayQuota = (value: number | string, t: TFunction) => {+ if (value === 0) return t('pricing.sessionReplay.none')+ if (typeof value === 'number') {+ return t('pricing.sessionReplay.included', {+ amount: formatEventsLong(value),+ })+ }+ return t('pricing.sessionReplay.customQuota')+}++const getPlanName = (planType: PlanTypeCode, t: TFunction) =>+ t(`pricing.planTypes.${planType}.name`)++const getCheckoutErrorMessage = (+ error: string | undefined,+ t: TFunction,+) => {+ if (error?.startsWith('billing.')) {+ return t(error)+ }++ return error || t('billing.checkoutPreparationError')+}++const getSelectionRank = (+ planType: PlanTypeCode,+ eventTier: EventTierCode,+) => PLAN_TYPES[planType].sortOrder * 100 + EVENT_TIERS[eventTier].sortOrder+const BillingPricing = ({lastEvent,metainfo = DEFAULT_METAINFO,@@ -57,24 +111,34 @@ const BillingPricing = ({const changePlanFetcher = useFetcher<UserSettingsActionData>()const generatePayLinkFetcher = useFetcher<UserSettingsActionData>()- const [planCodeLoading, setPlanCodeLoading] = useState<string | null>(null)- const [loadingTier, setLoadingTier] = useState<any>(null)+ const currentPlanType = getEffectivePlanType(user?.planType, user?.planCode)+ const currentEventTier =+ getEventTierByPlanCode(user?.planCode)?.code || '100k'++ const [selectedPlanType, setSelectedPlanType] =+ useState<PlanTypeCode>(currentPlanType)+ const [selectedEventTier, setSelectedEventTier] =+ useState<EventTierCode>(currentEventTier)+ const [selectedBillingFrequency, setSelectedBillingFrequency] =+ useState<BillingInterval>(+ (user?.billingFrequency as BillingInterval) || BillingFrequency.monthly,+ )+ const [selectionLoading, setSelectionLoading] = useState(false)const [isNewPlanConfirmationModalOpened,setIsNewPlanConfirmationModalOpened,] = useState(false)- const [newPlanId, setNewPlanId] = useState<number | null>(null)- const [downgradeTo, setDowngradeTo] = useState<{- planCode: string- name: string- pid: string- ypid: string- } | null>(null)+ const [pendingSelection, setPendingSelection] =+ useState<PendingSelection | null>(null)const [showDowngradeModal, setShowDowngradeModal] = useState(false)- const [billingFrequency, setBillingFrequency] = useState(- user?.billingFrequency || BillingFrequency.monthly,- )- const [enableLegacyPlans, setEnableLegacyPlans] = useState(false)++ useEffect(() => {+ setSelectedPlanType(currentPlanType)+ setSelectedEventTier(currentEventTier)+ setSelectedBillingFrequency(+ (user?.billingFrequency as BillingInterval) || BillingFrequency.monthly,+ )+ }, [currentEventTier, currentPlanType, user?.billingFrequency])const subUpdatePreview = useMemo(() => {if (@@ -96,15 +160,15 @@ const BillingPricing = ({changePlanFetcher.state === 'submitting' ||changePlanFetcher.state === 'loading'- useEffect(() => {- const urlParams = new URLSearchParams(window.location.search)- const legacyParam = urlParams.get('__ENABLE_LEGACY_PLANS')- if (legacyParam === 'true') {- setEnableLegacyPlans(true)- }- }, [])+ const closeUpdateModal = useCallback(+ (force?: boolean) => {+ if (isSubUpdating && !force) return+ setIsNewPlanConfirmationModalOpened(false)+ setPendingSelection(null)+ },+ [isSubUpdating],+ )- // Handle change plan fetcher responseuseEffect(() => {if (changePlanFetcher.data?.success) {loadUser()@@ -115,26 +179,21 @@ const BillingPricing = ({'[ERROR] An error occured while updating subscription:',changePlanFetcher.data.error,)- toast.error('An error occured while updating subscription')+ toast.error(t('billing.subscriptionUpdateError'))closeUpdateModal(true)}- // eslint-disable-next-line react-hooks/exhaustive-deps- }, [changePlanFetcher.data])+ }, [changePlanFetcher.data, closeUpdateModal, loadUser, t])- // Handle preview fetcher erroruseEffect(() => {if (previewFetcher.data?.error) {console.error('[ERROR] An error occured while loading subscription update pricing preview:',previewFetcher.data.error,)- toast.error(- 'An error occured while loading subscription update pricing preview',- )+ toast.error(t('billing.pricingPreviewError'))}- }, [previewFetcher.data?.error])+ }, [previewFetcher.data?.error, t])- // Handle generate pay link fetcher responseuseEffect(() => {if (generatePayLinkFetcher.data?.success &&@@ -145,89 +204,143 @@ const BillingPricing = ({const opened = openCheckout({override: url,locale: paddleLanguageMapping[language] || language,- title: loadingTier?.name,+ title: t('pricing.selectedPlanWithEvents', {+ plan: getPlanName(selectedPlanType, t),+ events: formatEventsLong(EVENT_TIERS[selectedEventTier].monthlyEvents),+ }),displayModeTheme: theme,country: metainfo.country,})if (!opened) {toast.error(t('billing.paddleStillLoading'))- setPlanCodeLoading(null)- setLoadingTier(null)+ setSelectionLoading(false)}- // Clear data to prevent infinite loops if re-rendering occursgeneratePayLinkFetcher.data = undefined} else if (generatePayLinkFetcher.data?.error) {console.error('[ERROR] An error occured while generating pay link:',generatePayLinkFetcher.data.error,)- toast.error('An error occured while preparing checkout')- setPlanCodeLoading(null)- setLoadingTier(null)- }- // eslint-disable-next-line react-hooks/exhaustive-deps- }, [generatePayLinkFetcher.data])-- const PLAN_CODES_ARRAY = useMemo(() => {- let basePlans = STANDARD_PLANS-- if (enableLegacyPlans) {- basePlans = [...PURCHASABLE_LEGACY_PLANS, ...STANDARD_PLANS]- }-- if (!isAuthenticated) return basePlans-- const userPlan = user?.planCode-- if (userPlan === 'trial' || userPlan === 'none') {- return basePlans+ toast.error(+ getCheckoutErrorMessage(generatePayLinkFetcher.data.error, t),+ )+ setSelectionLoading(false)}-- return _includes(basePlans, userPlan) ? basePlans : [userPlan, ...basePlans]- }, [isAuthenticated, user?.planCode, enableLegacyPlans])-- const currencyCode = user?.tierCurrency || metainfo.code+ }, [+ generatePayLinkFetcher.data,+ language,+ metainfo.country,+ openCheckout,+ selectedEventTier,+ selectedPlanType,+ t,+ theme,+ ])++ const currencyCode = (+ (user?.tierCurrency || metainfo.code) in CURRENCIES+ ? user?.tierCurrency || metainfo.code+ : 'USD'+ ) as CurrencyCodeconst currency = CURRENCIES[currencyCode]+ const selectedPrice = getPlanPrice(+ selectedPlanType,+ selectedEventTier,+ selectedBillingFrequency,+ currencyCode,+ )+ const selectedMonthlyPrice = getPlanMonthlyPrice(+ selectedPlanType,+ selectedEventTier,+ selectedBillingFrequency,+ currencyCode,+ )+ const currentPlanLimit = user?.planCode ? PLAN_LIMITS[user.planCode] : null+ const currentEvents = currentPlanLimit?.monthlyUsageLimit || 0+ const selectedEvents = EVENT_TIERS[selectedEventTier].monthlyEvents+ const selectedReplayQuota = getIncludedSessionReplays(+ selectedPlanType,+ selectedEventTier,+ )+ const isTrialingPaidPlan =+ !!user?.trialEndDate &&+ !['none', 'trial', 'free'].includes(user?.planCode || '') &&+ dayjs(user.trialEndDate).isAfter(dayjs())+ const sameSelection =+ user?.planCode === EVENT_TIERS[selectedEventTier].planCode &&+ currentPlanType === selectedPlanType &&+ user?.billingFrequency === selectedBillingFrequency+ const currentRank = getSelectionRank(currentPlanType, currentEventTier)+ const selectedRank = getSelectionRank(selectedPlanType, selectedEventTier)+ const isDowngrade =+ !user?.cancellationEffectiveDate && selectedRank < currentRank+ const isUnpaid = ['free', 'trial', 'none'].includes(user?.planCode || '')+ const cannotSelfServe =+ selectedPlanType === 'enterprise' || !selectedPrice?.paddlePlanIduseEffect(() => {if (!lastEvent) return- const lastEventHandler = async (data: { event: string }) => {- if (_isNil(data)) return- if (data.event === 'Checkout.Complete') {+ const lastEventHandler = async (eventData: { event: string }) => {+ if (_isNil(eventData)) return+ if (eventData.event === 'Checkout.Complete') {setTimeout(async () => {await loadUser()toast.success(t('apiNotifications.subscriptionUpdated'))}, 3000)- setPlanCodeLoading(null)- setDowngradeTo(null)- } else if (data.event === 'Checkout.Close') {- setPlanCodeLoading(null)- setDowngradeTo(null)+ setSelectionLoading(false)+ } else if (eventData.event === 'Checkout.Close') {+ setSelectionLoading(false)}}lastEventHandler(lastEvent)}, [lastEvent, t, loadUser])- const loadSubUpdatePreview = (planId: number) => {- setIsNewPlanConfirmationModalOpened(true)- previewFetcher.submit(- { intent: 'preview-subscription-update', planId: String(planId) },- { method: 'POST', action: '/user-settings' },- )+ const submitSelection = (+ intent:+ | 'preview-subscription-update'+ | 'change-subscription-plan'+ | 'generate-pay-link',+ selection: PendingSelection,+ ) => {+ const formData = new FormData()+ formData.set('intent', intent)+ formData.set('planType', selection.planType)+ formData.set('eventTier', selection.eventTier)+ formData.set('billingFrequency', selection.billingFrequency)+ formData.set('currency', selection.currency)++ if (intent === 'preview-subscription-update') {+ previewFetcher.submit(formData, { method: 'POST', action: '/user-settings' })+ } else if (intent === 'change-subscription-plan') {+ changePlanFetcher.submit(formData, {+ method: 'POST',+ action: '/user-settings',+ })+ } else {+ generatePayLinkFetcher.submit(formData, {+ method: 'POST',+ action: '/user-settings',+ })+ }}- const onPlanChange = async (tier: any) => {- if (!user) return+ const selectedSelection: PendingSelection = {+ planType: selectedPlanType,+ eventTier: selectedEventTier,+ billingFrequency: selectedBillingFrequency,+ currency: currencyCode,+ }- const isSelectingDifferentPlan =- user.planCode !== tier.planCode ||- user.billingFrequency !== billingFrequency ||- !isUnselectablePlanCode(user.planCode)+ const onPlanChange = async () => {+ if (!user || selectionLoading || sameSelection) return- if (planCodeLoading || !isSelectingDifferentPlan) return+ if (cannotSelfServe || !selectedPrice?.paddlePlanId) {+ toast.error(t('billing.planNotConfiguredForCheckout'))+ return+ }if (user.subID &&@@ -239,144 +352,101 @@ const BillingPricing = ({return}- const planId = Number(- billingFrequency === BillingFrequency.monthly ? tier.pid : tier.ypid,- )- setNewPlanId(planId)- loadSubUpdatePreview(planId)+ setPendingSelection(selectedSelection)+ setIsNewPlanConfirmationModalOpened(true)+ submitSelection('preview-subscription-update', selectedSelection)return}- setPlanCodeLoading(tier.planCode)- setLoadingTier(tier)-- const planId = Number(- billingFrequency === BillingFrequency.monthly ? tier.pid : tier.ypid,- )-- generatePayLinkFetcher.submit(- { intent: 'generate-pay-link', planId: String(planId) },- { method: 'POST', action: '/user-settings' },- )- }-- const closeUpdateModal = (force?: boolean) => {- if (isSubUpdating && !force) return- setIsNewPlanConfirmationModalOpened(false)- setNewPlanId(null)+ setSelectionLoading(true)+ submitSelection('generate-pay-link', selectedSelection)}const updateSubscription = () => {- changePlanFetcher.submit(- { intent: 'change-subscription-plan', planId: String(newPlanId) },- { method: 'POST', action: '/user-settings' },- )+ if (!pendingSelection) return+ submitSelection('change-subscription-plan', pendingSelection)}- const downgradeHandler = (tier: any) => {- if (!user) return-- if (isTrialingPaidPlan) {- toast.error(t('billing.cannotChangePlanDuringTrial'))- return+ const getActionLabel = (): string => {+ if (selectedPlanType === 'enterprise') {+ return t('pricing.contactUs')}- if (planCodeLoading === null && user.planCode !== tier.planCode) {- setDowngradeTo(tier)- setShowDowngradeModal(true)+ if (!selectedPrice?.paddlePlanId) {+ return t('pricing.contactUs')}- }-- const isUnselectablePlanCode = (planCode: any): boolean => {- return ['free', 'trial', 'none'].includes(planCode)- }-- const isTrialingPaidPlan =- !!user?.trialEndDate &&- !['none', 'trial', 'free'].includes(user?.planCode || '') &&- dayjs(user.trialEndDate).isAfter(dayjs())-- const userPlancodeID = user?.planCode ? PLAN_LIMITS[user.planCode]?.index : 0- const getActionLabel = (tier: any): string => {- const planCodeID = tier.index- const downgrade =- !user?.cancellationEffectiveDate && planCodeID < userPlancodeID- if (- user?.cancellationEffectiveDate ||- isUnselectablePlanCode(user?.planCode)- ) {+ if (user?.cancellationEffectiveDate || isUnpaid) {return t('pricing.subscribe')}- if (planCodeID > userPlancodeID) {++ if (sameSelection) {+ return t('pricing.yourPlan')+ }++ if (selectedRank > currentRank) {return t('pricing.upgrade')}- if (downgrade) {++ if (isDowngrade) {return t('pricing.downgrade')}- if (- user?.billingFrequency === billingFrequency &&- user?.planCode === tier.planCode- ) {- return t('pricing.yourPlan')- }- return billingFrequency === BillingFrequency.monthly++ return selectedBillingFrequency === BillingFrequency.monthly? t('pricing.switchToMonthly'): t('pricing.switchToYearly')}- const isDisabledForTier = (tier: any): boolean => {- return (- planCodeLoading !== null ||- (tier.planCode === user?.planCode &&- (user?.billingFrequency === billingFrequency ||- isUnselectablePlanCode(user?.planCode)))- )- }-- const tiers = useMemo(() => {- const validCodes = PLAN_CODES_ARRAY.filter(- (code): code is keyof typeof PLAN_LIMITS =>- typeof code === 'string' && code in PLAN_LIMITS,- )- return validCodes.map((code) => PLAN_LIMITS[code])- }, [PLAN_CODES_ARRAY])-const yearlyDiscount = useMemo(() => {- const firstTier = tiers[0]- if (!firstTier) return 0-- const monthlyPrice = firstTier.price[currencyCode]?.monthly ?? 0- const yearlyPrice = firstTier.price[currencyCode]?.yearly ?? 0-- if (monthlyPrice === 0) return 0+ const monthlyPrice = getPlanPrice(+ selectedPlanType,+ selectedEventTier,+ 'monthly',+ currencyCode,+ )?.amount+ const yearlyPrice = getPlanPrice(+ selectedPlanType,+ selectedEventTier,+ 'yearly',+ currencyCode,+ )?.amount++ if (!monthlyPrice || !yearlyPrice) return 0const annualCostIfMonthly = monthlyPrice * 12const savings = annualCostIfMonthly - yearlyPriceconst discountPercentage = (savings / annualCostIfMonthly) * 100return _round(discountPercentage, 0)- }, [tiers, currencyCode])+ }, [currencyCode, selectedEventTier, selectedPlanType])const toggleBillingFrequency = () => {- setBillingFrequency((currentFrequency) =>- currentFrequency === BillingFrequency.yearly- ? BillingFrequency.monthly- : BillingFrequency.yearly,+ setSelectedBillingFrequency((currentFrequency) =>+ currentFrequency === 'yearly' ? 'monthly' : 'yearly',)}+ const actionLabel = getActionLabel()+return (<>- <div className='rounded-xl border border-gray-200 p-4 sm:p-6 dark:border-white/10'>- <div className='mb-3 flex items-center justify-between'>- <Text as='h2' size='2xl' weight='bold' tracking='tight'>- {t('common.billing')}- </Text>+ <div className='rounded-xl border border-gray-200 bg-white p-4 sm:p-6 dark:border-white/10 dark:bg-slate-950'>+ <div className='flex flex-col gap-4 sm:flex-row sm:items-start sm:justify-between'>+ <div>+ <Text as='h2' size='2xl' weight='bold'>+ {t('common.billing')}+ </Text>+ <Text as='p' size='sm' colour='secondary' className='mt-1'>+ {t('pricing.planWithEvents', {+ plan: getPlanName(currentPlanType, t),+ events: formatEventsLong(currentEvents),+ })}+ </Text>+ </div><buttontype='button'onClick={toggleBillingFrequency}- className='flex cursor-pointer items-center gap-2 rounded-lg border border-gray-200 bg-gray-100 px-3 py-2 transition-colors hover:bg-gray-200 dark:border-white/10 dark:bg-slate-950 dark:hover:bg-slate-900'+ className='flex cursor-pointer items-center gap-2 rounded-lg border border-gray-200 bg-gray-100 px-3 py-2 transition-colors hover:bg-gray-200 dark:border-white/10 dark:bg-slate-900 dark:hover:bg-slate-800'><span className='text-sm font-medium text-gray-700 dark:text-gray-200'>{t('pricing.billedYearly')}@@ -387,120 +457,213 @@ const BillingPricing = ({</span>) : null}<Switch- checked={billingFrequency === BillingFrequency.yearly}+ checked={selectedBillingFrequency === BillingFrequency.yearly}visualOnly/></button></div>- <div className='space-y-2'>- {_map(tiers, (tier) => (- <div- key={tier.planCode}- className={cn(- 'flex items-center justify-between rounded-xl border px-4 py-3 text-black backdrop-blur-sm dark:bg-white/2 dark:text-white',- {- 'border-gray-200 dark:border-white/10':- user?.planCode !== tier.planCode ||- isUnselectablePlanCode(tier.planCode),- 'border-indigo-500 dark:border-gray-50':- user?.planCode === tier.planCode &&- !isUnselectablePlanCode(tier.planCode),- },- )}- >- <div>- <span className='text-base font-medium'>- {formatEventsLong(tier.monthlyUsageLimit)}- </span>- - <span className='text-sm text-gray-500 dark:text-gray-400'>- {t('pricing.eventsPerMonth')}- </span>- </div>- <div className='flex items-center gap-3 text-sm'>- {tier.legacy ? (- <Badge- label={- <Tooltip- text={t('pricing.legacyDescription')}- tooltipNode={- <span className='flex items-center gap-1'>- {t('pricing.legacy')}- <QuestionIcon className='size-4 stroke-yellow-800 dark:stroke-yellow-500' />- </span>- }- />- }- colour='yellow'- />- ) : null}- <div className='text-sm'>- <span className='font-semibold text-black dark:text-white'>- {currency.symbol}- {Number(- (billingFrequency === BillingFrequency.monthly- ? tier.price[currencyCode]?.monthly- : tier.price[currencyCode]?.yearly) ?? 0,- ).toFixed(2)}- </span>- - <span className='text-sm'>- /- {t(- billingFrequency === BillingFrequency.monthly- ? 'pricing.perMonth'- : 'pricing.perYear',- )}- </span>+ <div className='mt-5 grid gap-3 lg:grid-cols-3'>+ {planTypeOptions.map((planType) => {+ const entitlements = PLAN_ENTITLEMENTS[planType]+ const isSelected = selectedPlanType === planType+ const planMonthlyPrice =+ planType === 'enterprise'+ ? null+ : getPlanMonthlyPrice(+ planType,+ selectedEventTier,+ selectedBillingFrequency,+ currencyCode,+ )++ return (+ <button+ key={planType}+ type='button'+ onClick={() => setSelectedPlanType(planType)}+ className={cn(+ 'rounded-lg p-4 text-left ring-1 ring-inset transition-all duration-150',+ planType === 'enterprise'+ ? 'bg-slate-900 text-gray-50 ring-slate-700 dark:bg-slate-900 dark:text-gray-50 dark:ring-slate-700'+ : 'bg-gray-50 text-gray-950 ring-gray-200 hover:ring-gray-300 dark:bg-slate-900 dark:text-gray-50 dark:ring-slate-700 dark:hover:ring-slate-600',+ isSelected && 'ring-2 ring-slate-900 dark:ring-slate-100',+ )}+ >+ <div className='flex items-center justify-between gap-2'>+ <Text as='span' size='base' weight='semibold' colour='inherit'>+ {getPlanName(planType, t)}+ </Text></div>- <Button+ <Text as='span' size='sm' colour='inherit' className='mt-3 block'>+ {planType === 'enterprise'+ ? t('pricing.custom')+ : `${currency.symbol}${formatPrice(planMonthlyPrice)}/${t(+ 'pricing.perMonth',+ )}`}+ </Text>+ <Text+ as='span'size='xs'- onClick={() => {- const action = getActionLabel(tier)+ colour='inherit'+ className='mt-1 block text-gray-500 dark:text-gray-400'+ >+ {typeof entitlements.websites === 'number'+ ? t('pricing.websiteCount', {+ count: entitlements.websites,+ })+ : t('pricing.customLimits')}+ </Text>+ </button>+ )+ })}+ </div>++ <div className='mt-6'>+ <Text as='p' size='sm' weight='medium' colour='secondary'>+ {t('pricing.eventVolume')}+ </Text>+ <div className='mt-3 grid gap-2 sm:grid-cols-3 lg:grid-cols-6'>+ {EVENT_TIER_CODES.map((eventTier) => {+ const tier = EVENT_TIERS[eventTier]+ const isSelected = selectedEventTier === eventTier+ return (+ <button+ key={eventTier}+ type='button'+ onClick={() => setSelectedEventTier(eventTier)}+ className={cn(+ 'rounded-lg px-3 py-2 text-left text-sm font-medium ring-1 ring-inset transition-colors',+ isSelected+ ? 'bg-slate-900 text-gray-50 ring-slate-900 dark:bg-slate-100 dark:text-slate-950 dark:ring-slate-100'+ : 'bg-gray-50 text-gray-700 ring-gray-200 hover:bg-gray-100 dark:bg-slate-900 dark:text-gray-200 dark:ring-slate-700 dark:hover:bg-slate-800',+ )}+ >+ {formatEventsLong(tier.monthlyEvents)}+ </button>+ )+ })}+ </div>+ </div>- if (action === t('pricing.downgrade')) {- downgradeHandler(tier)+ <div className='mt-6 rounded-lg bg-gray-50 p-4 ring-1 ring-gray-200 ring-inset dark:bg-slate-900 dark:ring-slate-700'>+ <div className='flex flex-col gap-4 sm:flex-row sm:items-center sm:justify-between'>+ <div>+ <Text as='p' size='base' weight='semibold'>+ {t('pricing.selectedPlanWithEvents', {+ plan: getPlanName(selectedPlanType, t),+ events: formatEventsLong(selectedEvents),+ })}+ </Text>+ <Text as='p' size='sm' colour='secondary' className='mt-1'>+ {typeof PLAN_ENTITLEMENTS[selectedPlanType].websites === 'number'+ ? t('pricing.websiteCount', {+ count: PLAN_ENTITLEMENTS[selectedPlanType].websites,+ })+ : t('pricing.customLimits')}+ , {formatReplayQuota(selectedReplayQuota, t)}+ </Text>+ </div>+ <div className='flex flex-col items-start gap-3 sm:items-end'>+ <Text as='p' size='2xl' weight='bold'>+ {selectedPlanType === 'enterprise'+ ? t('pricing.custom')+ : `${currency.symbol}${formatPrice(selectedMonthlyPrice)}/${t(+ 'pricing.perMonth',+ )}`}+ </Text>+ {cannotSelfServe ? (+ <Button to={routes.contact} size='sm' className='gap-1'>+ {t('pricing.contactUs')}+ <ArrowRightIcon className='size-4' />+ </Button>+ ) : (+ <Button+ size='sm'+ onClick={() => {+ if (actionLabel === t('pricing.downgrade')) {+ setShowDowngradeModal(true)} else {- onPlanChange(tier)+ onPlanChange()}}}type='button'- loading={planCodeLoading === tier.planCode}- disabled={isDisabledForTier(tier)}+ loading={selectionLoading}+ disabled={selectionLoading || sameSelection || !isAuthenticated}+ className='gap-1'>- {getActionLabel(tier)}+ {actionLabel}+ {!sameSelection ? <ArrowRightIcon className='size-4' /> : null}</Button>- </div>+ )}</div>- ))}+ </div>+ </div>- <a- href={routes.contact}- target='_blank'- rel='noopener noreferrer'- className='group flex items-center justify-between rounded-xl border border-gray-200 px-4 py-3 text-black backdrop-blur-sm dark:border-white/10 dark:bg-white/2 dark:text-white'- >- <span className='text-base font-medium'>- {t('pricing.overXEvents', { amount: formatEventsLong(20000000) })}- </span>- <Text as='p' size='sm' className='group-hover:underline'>- {t('pricing.contactUs')}+ <div className='mt-6 grid gap-4 lg:grid-cols-2'>+ <div>+ <Text as='p' size='sm' weight='semibold'>+ {t('pricing.addons.websiteTitle')}</Text>- </a>+ <div className='mt-3 space-y-2'>+ {ADDONS.websiteBundles.map((bundle) => (+ <div+ key={bundle.code}+ className='flex items-center justify-between rounded-lg bg-gray-50 px-3 py-2 ring-1 ring-gray-200 ring-inset dark:bg-slate-900 dark:ring-slate-700'+ >+ <div className='flex items-center gap-2'>+ <CheckIcon className='size-4 text-gray-500 dark:text-gray-400' />+ <Text as='span' size='sm'>+ {t(bundle.labelKey, {+ amount: formatEventsLong(bundle.quantity),+ })}+ </Text>+ </div>+ <Text as='span' size='sm' colour='secondary'>+ {currency.symbol}+ {formatPrice(bundle.monthly[currencyCode])}/{t('pricing.perMonth')}+ </Text>+ </div>+ ))}+ </div>+ </div>++ <div>+ <Text as='p' size='sm' weight='semibold'>+ {t('pricing.addons.sessionReplayTitle')}+ </Text>+ <div className='mt-3 space-y-2'>+ {ADDONS.sessionReplayBundles.map((bundle) => (+ <div+ key={bundle.code}+ className='flex items-center justify-between rounded-lg bg-gray-50 px-3 py-2 ring-1 ring-gray-200 ring-inset dark:bg-slate-900 dark:ring-slate-700'+ >+ <div className='flex items-center gap-2'>+ <CheckIcon className='size-4 text-gray-500 dark:text-gray-400' />+ <Text as='span' size='sm'>+ {t(bundle.labelKey, {+ amount: formatEventsLong(bundle.quantity),+ })}+ </Text>+ </div>+ <Text as='span' size='sm' colour='secondary'>+ {currency.symbol}+ {formatPrice(bundle.monthly[currencyCode])}/{t('pricing.perMonth')}+ </Text>+ </div>+ ))}+ </div>+ </div></div></div><div className='checkout-container' id='checkout-container' /><Modal- onClose={() => {- setDowngradeTo(null)- setShowDowngradeModal(false)- }}+ onClose={() => setShowDowngradeModal(false)}onSubmit={() => {setShowDowngradeModal(false)- if (downgradeTo) onPlanChange(downgradeTo)+ onPlanChange()}}submitText={t('common.yes')}closeText={t('common.no')}@@ -537,7 +700,9 @@ const BillingPricing = ({components={{mail: (<a- title={`Email us at ${CONTACT_EMAIL}`}+ title={t('ariaLabels.emailSupportTitle', {+ email: CONTACT_EMAIL,+ })}aria-label={t('ariaLabels.emailSupport')}href={`mailto:${CONTACT_EMAIL}`}className='font-medium underline decoration-dashed hover:decoration-solid'diff --git a/web/app/components/pricing/MarketingPricing.tsx b/web/app/components/pricing/MarketingPricing.tsxindex a21595c98..06eab46cd 100644--- a/web/app/components/pricing/MarketingPricing.tsx+++ b/web/app/components/pricing/MarketingPricing.tsx@@ -1,258 +1,565 @@-import _map from 'lodash/map'-import _round from 'lodash/round'-import { ArrowRightIcon, QuestionIcon, CheckIcon } from '@phosphor-icons/react'-import { useState, useMemo } from 'react'+import {+ ArrowLeftIcon,+ ArrowRightIcon,+ CaretDownIcon,+ CaretUpIcon,+ CheckIcon,+} from '@phosphor-icons/react'+import NumberFlow, { NumberFlowGroup } from '@number-flow/react'+import type { TFunction } from 'i18next'+import { useMemo, useState } from 'react'import { useTranslation } from 'react-i18next'-import { Link } from '~/ui/Link'-import {- CURRENCIES,- PLAN_LIMITS,- STANDARD_PLANS,- BillingFrequency,- TRIAL_DAYS,-} from '~/lib/constants'+import { CURRENCIES, TRIAL_DAYS } from '~/lib/constants'import { DEFAULT_METAINFO, Metainfo } from '~/lib/models/Metainfo'+import {+ EVENT_TIER_CODES,+ EVENT_TIERS,+ PLAN_ENTITLEMENTS,+ getIncludedSessionReplays,+ getPlanPrice,+ type BillingInterval,+ type CurrencyCode,+ type EventTierCode,+ type PlanTypeCode,+} from '~/lib/pricing/catalog'import { useAuth } from '~/providers/AuthProvider'+import { Link } from '~/ui/Link'import { Switch } from '~/ui/Switch'import { Text } from '~/ui/Text'-import Tooltip from '~/ui/Tooltip'+import { cn } from '~/utils/generic'import routes from '~/utils/routes'-const formatEventsLong = (value: number) => value.toLocaleString('en-US')-interface MarketingPricingProps {metainfo?: Metainfo}+interface Benefit {+ label: string+ inherited?: boolean+}++const planCards: PlanTypeCode[] = ['standard', 'plus', 'enterprise']++const visibleBenefitsCount = 7++const formatEvents = (value: number) => value.toLocaleString('en-US')++const formatCompactEvents = (value: number) => {+ if (value >= 1000000) {+ return `${value / 1000000}M`+ }++ if (value >= 1000) {+ return `${value / 1000}K`+ }++ return value.toString()+}++const eventTierLabels = EVENT_TIER_CODES.map((tierCode) =>+ formatCompactEvents(EVENT_TIERS[tierCode].monthlyEvents),+)++const formatEntitlement = (value: number | string) =>+ typeof value === 'number' ? value.toLocaleString('en-US') : value++const getPriceFormat = (value: number) => ({+ minimumFractionDigits: Number.isInteger(value) ? 0 : 2,+ maximumFractionDigits: Number.isInteger(value) ? 0 : 2,+})++const formatPrice = (value: number | null, currencySymbol: string) =>+ value === null+ ? ''+ : `${currencySymbol}${value.toLocaleString('en-US', getPriceFormat(value))}`++const PriceAmount = ({+ value,+ currencySymbol,+ className,+}: {+ value: number | null+ currencySymbol: string+ className?: string+}) => {+ if (value === null) return null++ return (+ <NumberFlow+ value={value}+ prefix={currencySymbol}+ format={getPriceFormat(value)}+ className={className}+ willChange+ />+ )+}++const getPlanName = (planType: PlanTypeCode, t: TFunction) =>+ t(`pricing.planTypes.${planType}.name`)++const formatReplayBenefit = (+ replayQuota: number | string,+ t: TFunction,+) =>+ typeof replayQuota === 'number'+ ? t('pricing.sessionReplay.recordedSessions', {+ amount: formatEvents(replayQuota),+ })+ : t('pricing.sessionReplay.customQuota')++const getBenefits = (+ planType: PlanTypeCode,+ eventTier: EventTierCode,+ t: TFunction,+): Benefit[] => {+ const entitlements = PLAN_ENTITLEMENTS[planType]+ const replayQuota = getIncludedSessionReplays(planType, eventTier)++ const planLimits = [+ t('pricing.benefits.upToWebsites', {+ amount: formatEntitlement(entitlements.websites),+ }),+ t('pricing.benefits.upToTeamMembers', {+ amount: formatEntitlement(entitlements.teamMembers),+ }),+ t('pricing.benefits.upToOrganisations', {+ amount: formatEntitlement(entitlements.organisations),+ }),+ ]++ if (planType === 'standard') {+ return [+ ...planLimits.map((label) => ({ label })),+ { label: t('pricing.benefits.customEvents') },+ { label: t('pricing.benefits.goals') },+ { label: t('pricing.benefits.webVitals') },+ { label: t('pricing.benefits.errorTracking') },+ { label: t('pricing.benefits.emailReports') },+ { label: t('pricing.benefits.funnels') },+ { label: t('pricing.benefits.journeys') },+ { label: t('pricing.benefits.sessionsProfiles') },+ { label: t('pricing.benefits.featureFlags') },+ { label: t('pricing.benefits.abTests') },+ { label: t('pricing.benefits.revenueAnalytics') },+ { label: t('pricing.benefits.standardApi') },+ ]+ }++ if (planType === 'plus') {+ return [+ { label: t('pricing.benefits.everythingInStandard'), inherited: true },+ ...planLimits.map((label) => ({ label })),+ { label: formatReplayBenefit(replayQuota, t) },+ { label: t('pricing.benefits.prioritySupport') },+ { label: t('pricing.benefits.higherApiLimits') },+ { label: t('pricing.benefits.dataExports') },+ { label: t('pricing.benefits.agencyOrganisations') },+ { label: t('pricing.benefits.advancedExperiments') },+ { label: t('pricing.benefits.revenueAnalytics') },+ ]+ }++ return [+ { label: t('pricing.benefits.everythingInPlus'), inherited: true },+ { label: t('pricing.benefits.customUserLimit') },+ { label: t('pricing.benefits.customSiteLimit') },+ { label: t('pricing.benefits.customOrganisationLimit') },+ { label: t('pricing.benefits.customEventVolume') },+ { label: t('pricing.benefits.ssoSaml') },+ { label: t('pricing.benefits.dedicatedInstance') },+ { label: t('pricing.benefits.onPremise') },+ { label: t('pricing.benefits.manualInvoicing') },+ { label: t('pricing.benefits.sla') },+ { label: t('pricing.benefits.whitelabeling') },+ { label: t('pricing.benefits.securityLegalSupport') },+ ]+}++const BenefitRow = ({+ benefit,+ isEnterprise,+}: {+ benefit: Benefit+ isEnterprise: boolean+}) => {+ if (benefit.inherited) {+ return (+ <div className='flex items-center gap-2.5'>+ <ArrowLeftIcon+ className={cn(+ 'size-4 shrink-0',+ isEnterprise ? 'text-gray-300' : 'text-gray-400 dark:text-gray-500',+ )}+ />+ <Text+ as='p'+ size='sm'+ weight='medium'+ colour={isEnterprise ? 'inherit' : 'muted'}+ className='italic'+ >+ {benefit.label}+ </Text>+ </div>+ )+ }++ return (+ <div className='flex items-center gap-2.5'>+ <CheckIcon className='size-4 shrink-0 text-emerald-600 dark:text-emerald-400' />+ <Text as='p' size='sm' colour={isEnterprise ? 'inherit' : 'primary'}>+ {benefit.label}+ </Text>+ </div>+ )+}+const MarketingPricing = ({metainfo = DEFAULT_METAINFO,}: MarketingPricingProps) => {const { isAuthenticated } = useAuth()const { t } = useTranslation('common')- const [billingFrequency, setBillingFrequency] = useState(- BillingFrequency.monthly,- )+ const [billingFrequency, setBillingFrequency] =+ useState<BillingInterval>('monthly')+ const [selectedTierIndex, setSelectedTierIndex] = useState(0)+ const [showAllBenefits, setShowAllBenefits] = useState(false)- const currencyCode = metainfo.code+ const currencyCode = (+ metainfo.code in CURRENCIES ? metainfo.code : 'USD'+ ) as CurrencyCodeconst currency = CURRENCIES[currencyCode]+ const selectedTier = EVENT_TIER_CODES[selectedTierIndex]+ const selectedMonthlyEvents = EVENT_TIERS[selectedTier].monthlyEvents+ const isYearly = billingFrequency === 'yearly'- const plans = STANDARD_PLANS.map(- (code) => PLAN_LIMITS[code as keyof typeof PLAN_LIMITS],- )-- const yearlyDiscount = useMemo(() => {- const firstPlan = plans[0]- if (!firstPlan) return 0-- const monthlyPrice = firstPlan.price[currencyCode]?.monthly ?? 0- const yearlyPrice = firstPlan.price[currencyCode]?.yearly ?? 0+ const sliderPercent = useMemo(() => {+ if (EVENT_TIER_CODES.length <= 1) return 0+ return (selectedTierIndex / (EVENT_TIER_CODES.length - 1)) * 100+ }, [selectedTierIndex])- if (monthlyPrice === 0) return 0-- const annualCostIfMonthly = monthlyPrice * 12- const savings = annualCostIfMonthly - yearlyPrice- const discountPercentage = (savings / annualCostIfMonthly) * 100-- return _round(discountPercentage, 0)- }, [plans, currencyCode])+ const proMonthlyPrice = getPlanPrice(+ 'standard',+ selectedTier,+ 'monthly',+ currencyCode,+ )?.amount+ const proYearlyPrice = getPlanPrice(+ 'standard',+ selectedTier,+ 'yearly',+ currencyCode,+ )?.amount+ const yearlyDiscount =+ proMonthlyPrice && proYearlyPrice+ ? Math.round(+ ((proMonthlyPrice * 12 - proYearlyPrice) / (proMonthlyPrice * 12)) *+ 100,+ )+ : 0const toggleBillingFrequency = () => {setBillingFrequency((currentFrequency) =>- currentFrequency === BillingFrequency.yearly- ? BillingFrequency.monthly- : BillingFrequency.yearly,+ currentFrequency === 'yearly' ? 'monthly' : 'yearly',)}return (- <section id='pricing' className='relative p-2'>- <div className='rounded-xl bg-slate-900 py-16 sm:py-20 dark:bg-slate-900/50'>- <div className='mx-auto grid max-w-7xl grid-cols-1 gap-6 px-4 sm:px-6 lg:grid-cols-12 lg:gap-10 lg:px-8'>- <div className='col-span-12 lg:col-span-5'>- <Text- as='h2'- size='3xl'- weight='bold'- tracking='tight'- colour='inherit'- className='text-white sm:text-4xl'- >- {t('pricing.title')}- </Text>- <Text- as='p'- size='sm'- colour='inherit'- className='mt-2 max-w-md text-gray-100'- >- {t('pricing.adv', {- amount: TRIAL_DAYS,- })}- </Text>-- <div className='mt-8 space-y-3'>- {[- {- label: (- <div className='flex items-center gap-2'>- <span>- {t('pricing.tiers.upToXWebsites', { amount: 50 })}- </span>- <Tooltip- text={t('pricing.tiers.moreWebsitesForFee', {- amount: 50,- })}- tooltipNode={- <QuestionIcon className='size-4 stroke-gray-50' />- }- />- </div>- ),- key: 'upToXWebsites',- },- {- label: t('pricing.tiers.trafficWebAnalytics'),- key: 'trafficWebAnalytics',- },- {- label: t('pricing.tiers.sessionAnalysis'),- key: 'sessionAnalysis',- },- {- label: t('pricing.tiers.websiteSpeedAnalytics'),- key: 'websiteSpeedAnalytics',- },- {- label: t('pricing.tiers.errorTracking'),- key: 'errorTracking',- },- {- label: t('pricing.tiers.funnels'),- key: 'funnels',- },- {- label: t('pricing.tiers.featureFlags'),- key: 'featureFlags',- },- {- label: t('pricing.tiers.experiments'),- key: 'experiments',- },- {- label: t('pricing.tiers.captcha'),- key: 'captcha',- },- {- label: t('pricing.tiers.apiAccess'),- key: 'apiAccess',- },- {- label: t('pricing.tiers.teamMembers'),- key: 'teamMembers',- },- ].map(({ label, key }) => (- <div key={key} className='flex items-center text-gray-100'>- <CheckIcon className='mr-3 size-5' />- <span className='text-sm'>{label}</span>- </div>- ))}- </div>+ <section+ id='pricing'+ className='relative bg-gray-50 px-4 py-20 dark:bg-slate-950'+ >+ <div className='mx-auto max-w-7xl'>+ <div className='mx-auto max-w-3xl text-center'>+ <Text as='h2' size='4xl' weight='bold' className='sm:text-5xl'>+ {t('pricing.title')}+ </Text>+ <Text+ as='p'+ size='base'+ colour='secondary'+ className='mt-4 whitespace-pre-line'+ >+ {t('pricing.adv', { amount: TRIAL_DAYS })}+ </Text>+ </div>- <Link- to={isAuthenticated ? routes.billing : routes.signup}- className='mt-8 flex max-w-max items-center justify-center rounded-md border-2 border-slate-50 bg-gray-50 px-8 py-4 text-slate-900 transition-all hover:bg-transparent hover:text-gray-50'- aria-label={- isAuthenticated- ? t('main.goToBilling')- : t('main.startAXDayFreeTrial', { amount: TRIAL_DAYS })- }- >- <span className='mr-1 text-center text-base font-semibold'>- {isAuthenticated- ? t('main.goToBilling')- : t('main.startAXDayFreeTrial', { amount: TRIAL_DAYS })}- </span>- <ArrowRightIcon className='mt-px h-4 w-5' />- </Link>- </div>+ <div className='mx-auto mt-10 max-w-xl'>+ <div className='mb-6 flex flex-col gap-4 sm:flex-row sm:items-center sm:justify-between'>+ <div>+ <Text as='h3' size='lg' weight='semibold'>+ {t('pricing.monthlyEvents')}+ </Text>+ <Text+ as='p'+ size='3xl'+ weight='bold'+ className='mt-1 text-blue-600 dark:text-blue-400'+ >+ {formatEvents(selectedMonthlyEvents)}+ </Text>+ </div>- <div className='col-span-12 lg:col-span-7'>- <div className='mb-3 flex justify-end'>+ <div className='flex justify-start sm:justify-end'><buttontype='button'onClick={toggleBillingFrequency}- className='flex cursor-pointer items-center gap-2 rounded-lg border border-white/10 bg-slate-900 px-3 py-2 transition-colors hover:bg-slate-800'+ className='flex cursor-pointer items-center gap-2 rounded-lg border border-gray-200 bg-white px-3 py-2 text-gray-700 transition-colors hover:bg-gray-100 dark:border-slate-700 dark:bg-slate-900 dark:text-gray-200 dark:hover:bg-slate-800'>- <span className='text-sm font-medium text-gray-100'>+ <Text as='span' size='sm' weight='medium' colour='inherit'>{t('pricing.billedYearly')}- </span>+ </Text>{yearlyDiscount > 0 ? (- <span className='rounded-md bg-emerald-500/20 px-1.5 py-0.5 text-xs font-semibold text-emerald-300'>+ <Text+ as='span'+ size='xs'+ weight='semibold'+ colour='success'+ className='rounded-md bg-emerald-500/20 px-1.5 py-0.5'+ >-{yearlyDiscount} %- </span>+ </Text>) : null}- <Switch- checked={billingFrequency === BillingFrequency.yearly}- visualOnly- />+ <Switch checked={isYearly} visualOnly /></button></div>- <div className='space-y-3'>- {_map(plans, (tier) => (+ </div>++ <input+ aria-label={t('pricing.monthlyEventVolume')}+ type='range'+ min={0}+ max={EVENT_TIER_CODES.length - 1}+ step={1}+ value={selectedTierIndex}+ onChange={(event) =>+ setSelectedTierIndex(Number(event.target.value))+ }+ className='h-2 w-full cursor-pointer appearance-none rounded-full bg-gray-200 accent-blue-600 dark:bg-slate-700 dark:accent-blue-400 [&::-moz-range-thumb]:size-5 [&::-moz-range-thumb]:border-2 [&::-moz-range-thumb]:border-blue-600 [&::-moz-range-thumb]:bg-white [&::-moz-range-thumb]:shadow-sm dark:[&::-moz-range-thumb]:border-blue-400 dark:[&::-moz-range-thumb]:bg-slate-950 [&::-webkit-slider-thumb]:size-5 [&::-webkit-slider-thumb]:appearance-none [&::-webkit-slider-thumb]:rounded-full [&::-webkit-slider-thumb]:border-2 [&::-webkit-slider-thumb]:border-blue-600 [&::-webkit-slider-thumb]:bg-white [&::-webkit-slider-thumb]:shadow-sm dark:[&::-webkit-slider-thumb]:border-blue-400 dark:[&::-webkit-slider-thumb]:bg-slate-950'+ style={{+ background: `linear-gradient(to right, rgb(37 99 235) 0%, rgb(37 99 235) ${sliderPercent}%, rgb(209 213 219) ${sliderPercent}%, rgb(209 213 219) 100%)`,+ }}+ />++ <div+ className='mt-3 grid gap-1'+ style={{+ gridTemplateColumns: `repeat(${EVENT_TIER_CODES.length}, minmax(0, 1fr))`,+ }}+ >+ {eventTierLabels.map((label, index) => (+ <Text+ key={label}+ as='button'+ type='button'+ size='xs'+ weight={index === selectedTierIndex ? 'bold' : 'medium'}+ colour={index === selectedTierIndex ? 'primary' : 'muted'}+ className={cn(+ 'text-center',+ index === selectedTierIndex && 'text-blue-600 dark:text-blue-400',+ )}+ onClick={() => setSelectedTierIndex(index)}+ >+ {label}+ </Text>+ ))}+ </div>+ </div>++ <NumberFlowGroup>+ <div className='mx-auto mt-6 grid max-w-7xl gap-4 px-4 sm:px-6 lg:grid-cols-3 lg:px-8'>+ {planCards.map((planType) => {+ const isEnterprise = planType === 'enterprise'+ const benefits = getBenefits(planType, selectedTier, t)+ const visibleBenefits = showAllBenefits+ ? benefits+ : benefits.slice(0, visibleBenefitsCount)+ const hiddenBenefitsCount = Math.max(+ 0,+ benefits.length - visibleBenefits.length,+ )+ const monthlyPrice = getPlanPrice(+ planType,+ selectedTier,+ 'monthly',+ currencyCode,+ )?.amount+ const yearlyPrice = getPlanPrice(+ planType,+ selectedTier,+ 'yearly',+ currencyCode,+ )?.amount+ const yearlyMonthlyPrice = yearlyPrice+ ? Math.round((yearlyPrice / 12) * 100) / 100+ : null+ const monthlyPlan = getPlanPrice(+ planType,+ selectedTier,+ 'monthly',+ currencyCode,+ )+ const yearlyPlan = getPlanPrice(+ planType,+ selectedTier,+ 'yearly',+ currencyCode,+ )+ const hasPublishedPrice = Boolean(monthlyPrice && yearlyPrice)+ const canSelfServe = Boolean(+ monthlyPlan?.paddlePlanId && yearlyPlan?.paddlePlanId,+ )++ return (<div- key={tier.planCode}- className='flex items-center justify-between rounded-xl border border-white/10 bg-slate-900 px-4 py-3 text-white backdrop-blur-sm transition-all hover:bg-slate-800 dark:bg-transparent dark:hover:bg-slate-900'+ key={planType}+ className={cn(+ 'flex min-h-[520px] flex-col rounded-2xl p-5 ring-1',+ isEnterprise+ ? 'bg-slate-900 text-gray-50 ring-slate-700 dark:bg-slate-900 dark:text-gray-50 dark:ring-slate-700'+ : 'bg-white text-gray-950 ring-gray-200 dark:bg-slate-900 dark:text-gray-50 dark:ring-slate-700/70',+ )}>- <div>- <span className='text-base font-medium'>- {formatEventsLong(tier.monthlyUsageLimit)}- </span>- - <span className='text-sm text-gray-400'>- {t('pricing.eventsPerMonth')}- </span>+ <div className='flex items-start justify-between gap-3'>+ <Text+ as='h3'+ size='lg'+ weight='bold'+ colour={isEnterprise ? 'inherit' : 'primary'}+ >+ {getPlanName(planType, t)}+ </Text></div>- <div className='text-sm'>- <span className='font-semibold text-white'>- {currency.symbol}- {(billingFrequency === BillingFrequency.monthly- ? tier.price[currencyCode].monthly- : tier.price[currencyCode].yearly- ).toFixed(2)}- </span>- - <span className='text-sm text-gray-400'>- /- {t(- billingFrequency === BillingFrequency.monthly- ? 'pricing.perMonth'- : 'pricing.perYear',- )}- </span>++ <div className='mt-2 min-h-[72px]'>+ {hasPublishedPrice ? (+ <>+ <div className='flex min-h-10 flex-wrap items-end gap-2'>+ <Text+ as='p'+ size='3xl'+ weight='bold'+ colour={isEnterprise ? 'inherit' : 'primary'}+ >+ <PriceAmount+ value={+ isYearly ? yearlyPrice ?? null : monthlyPrice ?? null+ }+ currencySymbol={currency.symbol}+ />+ </Text>+ <Text+ as='p'+ size='base'+ weight='semibold'+ colour={isEnterprise ? 'inherit' : 'secondary'}+ className='pb-1'+ >+ {`/${t(+ isYearly+ ? 'pricing.intervals.year'+ : 'pricing.intervals.month',+ )}`}+ </Text>+ </div>+ {isYearly ? (+ <div className='mt-2 flex h-6 flex-wrap items-baseline gap-1'>+ <Text+ as='span'+ size='sm'+ weight='semibold'+ colour={isEnterprise ? 'inherit' : 'secondary'}+ className='line-through'+ >+ {formatPrice(monthlyPrice ?? null, currency.symbol)}+ </Text>+ <Text+ as='span'+ size='sm'+ weight='bold'+ colour={isEnterprise ? 'inherit' : 'primary'}+ >+ {formatPrice(yearlyMonthlyPrice, currency.symbol)}+ </Text>+ <Text+ as='span'+ size='sm'+ weight='semibold'+ colour={isEnterprise ? 'inherit' : 'secondary'}+ >+ /{t('pricing.intervals.month')}+ </Text>+ </div>+ ) : (+ <div className='mt-2 h-6' aria-hidden='true' />+ )}+ </>+ ) : (+ <Text as='p' size='3xl' weight='bold' colour='inherit'>+ {t('pricing.custom')}+ </Text>+ )}+ </div>++ <Link+ to={+ canSelfServe+ ? isAuthenticated+ ? routes.billing+ : routes.signup+ : routes.contact+ }+ className={cn(+ 'mt-5 inline-flex items-center justify-center gap-2 rounded-md px-4 py-2.5 transition-colors',+ isEnterprise+ ? 'bg-gray-50 text-slate-950 hover:bg-gray-200 dark:bg-gray-50 dark:text-slate-950 dark:hover:bg-gray-200'+ : 'bg-slate-900 text-gray-50 hover:bg-slate-700 dark:bg-slate-100 dark:text-slate-950 dark:hover:bg-white',+ )}+ >+ <Text as='span' size='sm' weight='semibold' colour='inherit'>+ {canSelfServe+ ? t('pricing.startFreeTrial')+ : t('pricing.contactUs')}+ </Text>+ <ArrowRightIcon className='size-4' />+ </Link>++ <div className='mt-5 space-y-3'>+ {visibleBenefits.map((benefit) => (+ <BenefitRow+ key={benefit.label}+ benefit={benefit}+ isEnterprise={isEnterprise}+ />+ ))}+ {hiddenBenefitsCount > 0 || showAllBenefits ? (+ <button+ type='button'+ onClick={() => setShowAllBenefits((value) => !value)}+ className='flex items-center gap-2.5 underline-animate'+ >+ {showAllBenefits ? (+ <CaretUpIcon className='size-4 text-gray-700 dark:text-gray-200' />+ ) : (+ <CaretDownIcon className='size-4 text-gray-700 dark:text-gray-200' />+ )}+ <Text as='span' size='sm' weight='medium' colour='primary'>+ {showAllBenefits+ ? t('common.showLess')+ : t('common.showMore', {+ count: hiddenBenefitsCount,+ })}+ </Text>+ </button>+ ) : null}</div></div>- ))}-- <a- href={routes.contact}- target='_blank'- rel='noopener noreferrer'- aria-label={`${t('footer.contact')} (opens in a new tab)`}- className='group flex items-center justify-between rounded-xl border border-white/10 bg-slate-900 px-4 py-3 text-white backdrop-blur-sm transition-all hover:bg-slate-800 dark:bg-transparent dark:hover:bg-slate-900'- >- <span className='text-base font-medium'>- {t('pricing.overXEvents', {- amount: formatEventsLong(20000000),- })}- </span>- <Text as='p' size='sm' className='group-hover:underline'>- {t('pricing.contactUs')}- </Text>- </a>- </div>+ )+ })}</div>- </div>+ </NumberFlowGroup></div></section>)diff --git a/web/app/lib/constants/index.ts b/web/app/lib/constants/index.tsindex 282c8854e..460ec9f75 100644--- a/web/app/lib/constants/index.ts+++ b/web/app/lib/constants/index.ts@@ -648,362 +648,11 @@ export const BillingFrequency = {yearly: 'yearly',}-// TODO: Eventually this should be fetched from the API, e.g. GET /config route-export const PLAN_LIMITS = {- none: {- index: 0, // 'downgrade' or 'upgrade' logic depends on this- planCode: 'none',- monthlyUsageLimit: 0,- legacy: false,- price: {- USD: {- monthly: 0,- yearly: 0,- },- EUR: {- monthly: 0,- yearly: 0,- },- GBP: {- monthly: 0,- yearly: 0,- },- },- maxAlerts: 0,- },- free: {- index: 0, // 'downgrade' or 'upgrade' logic depends on this- planCode: 'free',- monthlyUsageLimit: 5000,- legacy: true,- price: {- USD: {- monthly: 0,- yearly: 0,- },- EUR: {- monthly: 0,- yearly: 0,- },- GBP: {- monthly: 0,- yearly: 0,- },- },- maxAlerts: 1,- },- trial: {- index: 0, // 'downgrade' or 'upgrade' logic depends on this- planCode: 'trial',- monthlyUsageLimit: 10000000,- legacy: false,- price: {- USD: {- monthly: 0,- yearly: 0,- },- EUR: {- monthly: 0,- yearly: 0,- },- GBP: {- monthly: 0,- yearly: 0,- },- },- maxAlerts: 50,- },- hobby: {- index: 1, // 'downgrade' or 'upgrade' logic depends on this- planCode: 'hobby',- monthlyUsageLimit: 10000,- legacy: true,- price: {- USD: {- monthly: 5,- yearly: 50,- },- EUR: {- monthly: 5,- yearly: 50,- },- GBP: {- monthly: 4,- yearly: 40,- },- },- pid: 813694, // plan ID- ypid: 813695, // yearly plan ID- maxAlerts: 50,- },- '50k': {- index: 1.5, // 'downgrade' or 'upgrade' logic depends on this- planCode: '50k',- monthlyUsageLimit: 50000,- legacy: true,- price: {- USD: {- monthly: 12,- yearly: 120,- },- EUR: {- monthly: 10,- yearly: 100,- },- GBP: {- monthly: 10,- yearly: 100,- },- },- pid: 918109,- ypid: 918110,- maxAlerts: 50,- },- freelancer: {- index: 2, // 'downgrade' or 'upgrade' logic depends on this- planCode: 'freelancer',- monthlyUsageLimit: 100000,- legacy: true,- price: {- USD: {- monthly: 15,- yearly: 150,- },- EUR: {- monthly: 15,- yearly: 150,- },- GBP: {- monthly: 14,- yearly: 140,- },- },- pid: 752316,- ypid: 776469,- maxAlerts: 50,- },- '100k': {- index: 2.5, // 'downgrade' or 'upgrade' logic depends on this- planCode: '100k',- monthlyUsageLimit: 100000,- legacy: false,- price: {- USD: {- monthly: 19,- yearly: 190,- },- EUR: {- monthly: 17,- yearly: 170,- },- GBP: {- monthly: 15,- yearly: 150,- },- },- pid: 916455,- ypid: 916456,- maxAlerts: 50,- },- '200k': {- index: 3, // 'downgrade' or 'upgrade' logic depends on this- planCode: '200k',- monthlyUsageLimit: 200000,- legacy: false,- price: {- USD: {- monthly: 29,- yearly: 290,- },- EUR: {- monthly: 25,- yearly: 250,- },- GBP: {- monthly: 23,- yearly: 230,- },- },- pid: 854654,- ypid: 854655,- maxAlerts: 50,- },- '500k': {- index: 4, // 'downgrade' or 'upgrade' logic depends on this- planCode: '500k',- monthlyUsageLimit: 500000,- legacy: false,- price: {- USD: {- monthly: 49,- yearly: 490,- },- EUR: {- monthly: 42,- yearly: 420,- },- GBP: {- monthly: 39,- yearly: 390,- },- },- pid: 854656,- ypid: 854657,- maxAlerts: 50,- },- startup: {- index: 5, // 'downgrade' or 'upgrade' logic depends on this- planCode: 'startup',- monthlyUsageLimit: 1000000,- legacy: false,- price: {- USD: {- monthly: 79,- yearly: 790,- },- EUR: {- monthly: 69,- yearly: 690,- },- GBP: {- monthly: 59,- yearly: 590,- },- },- pid: 752317,- ypid: 776470,- maxAlerts: 50,- },- '2m': {- index: 6, // 'downgrade' or 'upgrade' logic depends on this- planCode: '2m',- monthlyUsageLimit: 2000000,- legacy: false,- price: {- USD: {- monthly: 119,- yearly: 1190,- },- EUR: {- monthly: 99,- yearly: 990,- },- GBP: {- monthly: 89,- yearly: 890,- },- },- pid: 854663,- ypid: 854664,- maxAlerts: 50,- },- enterprise: {- index: 7, // 'downgrade' or 'upgrade' logic depends on this- planCode: 'enterprise',- monthlyUsageLimit: 5000000,- legacy: false,- price: {- USD: {- monthly: 179,- yearly: 1790,- },- EUR: {- monthly: 149,- yearly: 1490,- },- GBP: {- monthly: 139,- yearly: 1390,- },- },- pid: 752318,- ypid: 776471,- maxAlerts: 50,- },- '10m': {- index: 8, // 'downgrade' or 'upgrade' logic depends on this- planCode: '10m',- monthlyUsageLimit: 10000000,- legacy: false,- price: {- USD: {- monthly: 249,- yearly: 2490,- },- EUR: {- monthly: 209,- yearly: 2090,- },- GBP: {- monthly: 189,- yearly: 1890,- },- },- pid: 854665,- ypid: 854666,- maxAlerts: 50,- },- '15m': {- index: 9, // 'downgrade' or 'upgrade' logic depends on this- planCode: '15m',- monthlyUsageLimit: 15000000,- legacy: false,- price: {- USD: {- monthly: 349,- yearly: 3490,- },- EUR: {- monthly: 299,- yearly: 2990,- },- GBP: {- monthly: 259,- yearly: 2590,- },- },- pid: 916451,- ypid: 916452,- maxAlerts: 50,- },- '20m': {- index: 10, // 'downgrade' or 'upgrade' logic depends on this- planCode: '20m',- monthlyUsageLimit: 20000000,- legacy: false,- price: {- USD: {- monthly: 419,- yearly: 4190,- },- EUR: {- monthly: 359,- yearly: 3590,- },- GBP: {- monthly: 319,- yearly: 3190,- },- },- pid: 916453,- ypid: 916454,- maxAlerts: 50,- },-}--export const STANDARD_PLANS = [- '100k',- '200k',- '500k',- 'startup',- '2m',- 'enterprise',- '10m',- '15m',- '20m',-]--export const PURCHASABLE_LEGACY_PLANS = ['hobby', '50k']+export {+ PLAN_LIMITS,+ STANDARD_PLANS,+ PURCHASABLE_LEGACY_PLANS,+} from '../pricing/catalog'export const TRIAL_DAYS = 14diff --git a/web/app/lib/models/Usageinfo.ts b/web/app/lib/models/Usageinfo.tsindex 66a1b56cf..592c54a76 100644--- a/web/app/lib/models/Usageinfo.ts+++ b/web/app/lib/models/Usageinfo.ts@@ -4,6 +4,7 @@ export interface UsageInfo {customEvents: numbercaptcha: numbererrors: number+ projects: numbertrafficPerc: numbercustomEventsPerc: numbercaptchaPerc: numberdiff --git a/web/app/lib/models/User.ts b/web/app/lib/models/User.tsindex 999c0b29c..ef9b0568d 100644--- a/web/app/lib/models/User.ts+++ b/web/app/lib/models/User.ts@@ -14,12 +14,25 @@ enum PlanCode {trial = 'trial',hobby = 'hobby',freelancer = 'freelancer',+ '50k' = '50k',+ '100k' = '100k','200k' = '200k','500k' = '500k',startup = 'startup','2m' = '2m',enterprise = 'enterprise','10m' = '10m',+ '15m' = '15m',+ '20m' = '20m',+ '30m' = '30m',+ '40m' = '40m',+ '50m' = '50m',+}++export enum PlanType {+ standard = 'standard',+ plus = 'plus',+ enterprise = 'enterprise',}enum OnboardingStep {@@ -38,6 +51,10 @@ enum OnboardingStep {export interface User {id: stringplanCode: PlanCode+ planType: PlanType | null+ effectivePlanType: PlanType | null+ addonOverrides: Record<string, unknown> | null+ entitlementOverrides: Record<string, unknown> | nullnickname: stringemail: stringisActive: boolean@@ -68,6 +85,10 @@ export interface User {githubId: number | nullregisteredWithGithub: booleanmaxEventsCount: number+ maxProjects: number+ maxApiKeyRequestsPerHour: number+ sessionReplaysIncluded: number | string+ purchasedWebsiteAddons: numbertierCurrency: 'USD' | 'EUR' | 'GBP' | nullshowLiveVisitorsInTitle: booleanreceiveLoginNotifications: booleandiff --git a/web/app/lib/pricing/catalog.ts b/web/app/lib/pricing/catalog.tsnew file mode 100644index 000000000..f617e513b--- /dev/null+++ b/web/app/lib/pricing/catalog.ts@@ -0,0 +1,584 @@+export type CurrencyCode = 'USD' | 'EUR' | 'GBP'+export type BillingInterval = 'monthly' | 'yearly'+export type PlanTypeCode = 'standard' | 'plus' | 'enterprise'+export type EventTierCode =+ | '100k'+ | '200k'+ | '500k'+ | '1m'+ | '2m'+ | '5m'+ | '10m'+ | '15m'+ | '20m'+ | '30m'+ | '40m'+ | '50m'++export type PlanCode =+ | 'none'+ | 'free'+ | 'trial'+ | 'hobby'+ | '50k'+ | 'freelancer'+ | '100k'+ | '200k'+ | '500k'+ | 'startup'+ | '2m'+ | 'enterprise'+ | '10m'+ | '15m'+ | '20m'+ | '30m'+ | '40m'+ | '50m'++export interface PlanPrice {+ amount: number+ paddlePlanId: number | null+}++export interface PlanLimit {+ index: number+ planCode: PlanCode+ monthlyUsageLimit: number+ legacy: boolean+ price: Record<CurrencyCode, Record<BillingInterval, number>>+ pid?: number+ ypid?: number+ maxAlerts: number+}++type PlanPriceCatalog = Record<+ PlanTypeCode,+ Partial<+ Record<EventTierCode, Record<BillingInterval, Record<CurrencyCode, PlanPrice>>>+ >+>++export const PLAN_TYPES = {+ standard: {+ nameKey: 'pricing.planTypes.standard.name',+ sortOrder: 1,+ descriptionKey: 'pricing.planTypes.standard.description',+ ctaKey: 'pricing.planTypes.standard.cta',+ },+ plus: {+ nameKey: 'pricing.planTypes.plus.name',+ sortOrder: 2,+ descriptionKey: 'pricing.planTypes.plus.description',+ ctaKey: 'pricing.planTypes.plus.cta',+ },+ enterprise: {+ nameKey: 'pricing.planTypes.enterprise.name',+ sortOrder: 3,+ contactSales: true,+ descriptionKey: 'pricing.planTypes.enterprise.description',+ ctaKey: 'pricing.planTypes.enterprise.cta',+ },+} as const satisfies Record<+ PlanTypeCode,+ {+ nameKey: string+ sortOrder: number+ descriptionKey: string+ ctaKey: string+ contactSales?: boolean+ }+>++export const EVENT_TIERS = {+ '100k': { monthlyEvents: 100000, sortOrder: 1, planCode: '100k' },+ '200k': { monthlyEvents: 200000, sortOrder: 2, planCode: '200k' },+ '500k': { monthlyEvents: 500000, sortOrder: 3, planCode: '500k' },+ '1m': { monthlyEvents: 1000000, sortOrder: 4, planCode: 'startup' },+ '2m': { monthlyEvents: 2000000, sortOrder: 5, planCode: '2m' },+ '5m': { monthlyEvents: 5000000, sortOrder: 6, planCode: 'enterprise' },+ '10m': { monthlyEvents: 10000000, sortOrder: 7, planCode: '10m' },+ '15m': { monthlyEvents: 15000000, sortOrder: 8, planCode: '15m' },+ '20m': { monthlyEvents: 20000000, sortOrder: 9, planCode: '20m' },+ '30m': { monthlyEvents: 30000000, sortOrder: 10, planCode: '30m' },+ '40m': { monthlyEvents: 40000000, sortOrder: 11, planCode: '40m' },+ '50m': { monthlyEvents: 50000000, sortOrder: 12, planCode: '50m' },+} as const satisfies Record<+ EventTierCode,+ { monthlyEvents: number; sortOrder: number; planCode: PlanCode }+>++export const EVENT_TIER_CODES = Object.keys(EVENT_TIERS) as EventTierCode[]+export const PLAN_TYPE_CODES = Object.keys(PLAN_TYPES) as PlanTypeCode[]+export const SELF_SERVE_PLAN_TYPES: PlanTypeCode[] = ['standard', 'plus']++const price = (+ monthly: Record<CurrencyCode, number>,+ yearly: Record<CurrencyCode, number>,+ paddleMonthly: number | null = null,+ paddleYearly: number | null = null,+): Record<BillingInterval, Record<CurrencyCode, PlanPrice>> => ({+ monthly: {+ USD: { amount: monthly.USD, paddlePlanId: paddleMonthly },+ EUR: { amount: monthly.EUR, paddlePlanId: paddleMonthly },+ GBP: { amount: monthly.GBP, paddlePlanId: paddleMonthly },+ },+ yearly: {+ USD: { amount: yearly.USD, paddlePlanId: paddleYearly },+ EUR: { amount: yearly.EUR, paddlePlanId: paddleYearly },+ GBP: { amount: yearly.GBP, paddlePlanId: paddleYearly },+ },+})++export const PLAN_PRICES: PlanPriceCatalog = {+ standard: {+ '100k': price(+ { USD: 19, EUR: 17, GBP: 15 },+ { USD: 190, EUR: 170, GBP: 150 },+ 916455,+ 916456,+ ),+ '200k': price(+ { USD: 29, EUR: 25, GBP: 23 },+ { USD: 290, EUR: 250, GBP: 230 },+ 854654,+ 854655,+ ),+ '500k': price(+ { USD: 49, EUR: 42, GBP: 39 },+ { USD: 490, EUR: 420, GBP: 390 },+ 854656,+ 854657,+ ),+ '1m': price(+ { USD: 79, EUR: 69, GBP: 59 },+ { USD: 790, EUR: 690, GBP: 590 },+ 752317,+ 776470,+ ),+ '2m': price(+ { USD: 119, EUR: 99, GBP: 89 },+ { USD: 1190, EUR: 990, GBP: 890 },+ 854663,+ 854664,+ ),+ '5m': price(+ { USD: 179, EUR: 149, GBP: 139 },+ { USD: 1790, EUR: 1490, GBP: 1390 },+ 752318,+ 776471,+ ),+ '10m': price(+ { USD: 249, EUR: 209, GBP: 189 },+ { USD: 2490, EUR: 2090, GBP: 1890 },+ 854665,+ 854666,+ ),+ '15m': price(+ { USD: 349, EUR: 299, GBP: 259 },+ { USD: 3490, EUR: 2990, GBP: 2590 },+ 916451,+ 916452,+ ),+ '20m': price(+ { USD: 419, EUR: 359, GBP: 319 },+ { USD: 4190, EUR: 3590, GBP: 3190 },+ 916453,+ 916454,+ ),+ '30m': price(+ { USD: 579, EUR: 499, GBP: 449 },+ { USD: 5790, EUR: 4990, GBP: 4490 },+ ),+ '40m': price(+ { USD: 739, EUR: 639, GBP: 579 },+ { USD: 7390, EUR: 6390, GBP: 5790 },+ ),+ '50m': price(+ { USD: 899, EUR: 779, GBP: 699 },+ { USD: 8990, EUR: 7790, GBP: 6990 },+ ),+ },+ plus: {+ '100k': price(+ { USD: 49, EUR: 42, GBP: 39 },+ { USD: 490, EUR: 420, GBP: 390 },+ ),+ '200k': price(+ { USD: 79, EUR: 69, GBP: 59 },+ { USD: 790, EUR: 690, GBP: 590 },+ ),+ '500k': price(+ { USD: 129, EUR: 109, GBP: 99 },+ { USD: 1290, EUR: 1090, GBP: 990 },+ ),+ '1m': price(+ { USD: 199, EUR: 169, GBP: 149 },+ { USD: 1990, EUR: 1690, GBP: 1490 },+ ),+ '2m': price(+ { USD: 299, EUR: 249, GBP: 229 },+ { USD: 2990, EUR: 2490, GBP: 2290 },+ ),+ '5m': price(+ { USD: 449, EUR: 379, GBP: 349 },+ { USD: 4490, EUR: 3790, GBP: 3490 },+ ),+ '10m': price(+ { USD: 649, EUR: 549, GBP: 499 },+ { USD: 6490, EUR: 5490, GBP: 4990 },+ ),+ '15m': price(+ { USD: 899, EUR: 759, GBP: 679 },+ { USD: 8990, EUR: 7590, GBP: 6790 },+ ),+ '20m': price(+ { USD: 1099, EUR: 929, GBP: 829 },+ { USD: 10990, EUR: 9290, GBP: 8290 },+ ),+ '30m': price(+ { USD: 1499, EUR: 1299, GBP: 1199 },+ { USD: 14990, EUR: 12990, GBP: 11990 },+ ),+ '40m': price(+ { USD: 1899, EUR: 1649, GBP: 1499 },+ { USD: 18990, EUR: 16490, GBP: 14990 },+ ),+ '50m': price(+ { USD: 2299, EUR: 1999, GBP: 1799 },+ { USD: 22990, EUR: 19990, GBP: 17990 },+ ),+ },+ enterprise: {},+}++export const PLAN_ENTITLEMENTS = {+ standard: {+ websites: 50,+ teamMembers: 10,+ organisations: 3,+ apiRateLimitPerHour: 600,+ sessionReplaysIncluded: 0,+ featureKeys: [+ 'pricing.benefits.coreAnalytics',+ 'pricing.benefits.customEventsAndGoals',+ 'pricing.benefits.webVitals',+ 'pricing.benefits.errorTracking',+ 'pricing.benefits.emailReports',+ 'pricing.benefits.funnelsAndJourneys',+ 'pricing.benefits.visitorSessionsAndProfiles',+ 'pricing.benefits.featureFlags',+ 'pricing.benefits.experiments',+ 'pricing.benefits.revenueAnalytics',+ 'pricing.benefits.standardApi',+ ],+ },+ plus: {+ websites: 100,+ teamMembers: 25,+ organisations: 10,+ apiRateLimitPerHour: 5000,+ sessionReplaysIncluded: 'byEventTier',+ sessionReplayQuota: {+ '100k': 5000,+ '200k': 10000,+ '500k': 25000,+ '1m': 50000,+ '2m': 100000,+ '5m': 250000,+ '10m': 500000,+ '15m': 750000,+ '20m': 1000000,+ '30m': 1500000,+ '40m': 2000000,+ '50m': 2500000,+ },+ featureKeys: [+ 'pricing.benefits.everythingInStandard',+ 'pricing.benefits.sessionReplay',+ 'pricing.benefits.moreOrganisations',+ 'pricing.benefits.higherApiLimits',+ 'pricing.benefits.dataExportWorkflows',+ 'pricing.benefits.largerReplayQuota',+ 'pricing.benefits.prioritySupport',+ ],+ },+ enterprise: {+ websites: 'custom',+ teamMembers: 'custom',+ organisations: 'custom',+ apiRateLimitPerHour: 'custom',+ sessionReplaysIncluded: 'custom',+ featureKeys: [+ 'pricing.benefits.everythingInPlus',+ 'pricing.benefits.ssoSaml',+ 'pricing.benefits.dedicatedInstance',+ 'pricing.benefits.onPremise',+ 'pricing.benefits.manualInvoicing',+ 'pricing.benefits.sla',+ 'pricing.benefits.whitelabeling',+ 'pricing.benefits.securityLegalSupport',+ ],+ },+} as const++export const ADDONS = {+ websiteBundles: [+ {+ code: 'websites_50',+ quantity: 50,+ labelKey: 'pricing.addons.websiteBundle',+ monthly: { USD: 7.5, EUR: 7, GBP: 6 },+ },+ {+ code: 'websites_250',+ quantity: 250,+ labelKey: 'pricing.addons.websiteBundle',+ monthly: { USD: 30, EUR: 27, GBP: 24 },+ },+ {+ code: 'websites_1000',+ quantity: 1000,+ labelKey: 'pricing.addons.websiteBundle',+ monthly: { USD: 99, EUR: 89, GBP: 79 },+ },+ ],+ sessionReplayBundles: [+ {+ code: 'replays_5000',+ quantity: 5000,+ labelKey: 'pricing.addons.sessionReplayBundle',+ monthly: { USD: 19, EUR: 17, GBP: 15 },+ },+ {+ code: 'replays_25000',+ quantity: 25000,+ labelKey: 'pricing.addons.sessionReplayBundle',+ monthly: { USD: 79, EUR: 69, GBP: 59 },+ },+ {+ code: 'replays_100000',+ quantity: 100000,+ labelKey: 'pricing.addons.sessionReplayBundle',+ monthly: { USD: 249, EUR: 209, GBP: 189 },+ },+ ],+} as const++export const LEGACY_PLAN_LIMITS = {+ none: {+ index: 0,+ planCode: 'none',+ monthlyUsageLimit: 0,+ legacy: false,+ price: {+ USD: { monthly: 0, yearly: 0 },+ EUR: { monthly: 0, yearly: 0 },+ GBP: { monthly: 0, yearly: 0 },+ },+ maxAlerts: 0,+ },+ free: {+ index: 0,+ planCode: 'free',+ monthlyUsageLimit: 5000,+ legacy: true,+ price: {+ USD: { monthly: 0, yearly: 0 },+ EUR: { monthly: 0, yearly: 0 },+ GBP: { monthly: 0, yearly: 0 },+ },+ maxAlerts: 1,+ },+ trial: {+ index: 0,+ planCode: 'trial',+ monthlyUsageLimit: 10000000,+ legacy: false,+ price: {+ USD: { monthly: 0, yearly: 0 },+ EUR: { monthly: 0, yearly: 0 },+ GBP: { monthly: 0, yearly: 0 },+ },+ maxAlerts: 50,+ },+ hobby: {+ index: 1,+ planCode: 'hobby',+ monthlyUsageLimit: 10000,+ legacy: true,+ price: {+ USD: { monthly: 5, yearly: 50 },+ EUR: { monthly: 5, yearly: 50 },+ GBP: { monthly: 4, yearly: 40 },+ },+ pid: 813694,+ ypid: 813695,+ maxAlerts: 50,+ },+ '50k': {+ index: 1.5,+ planCode: '50k',+ monthlyUsageLimit: 50000,+ legacy: true,+ price: {+ USD: { monthly: 12, yearly: 120 },+ EUR: { monthly: 10, yearly: 100 },+ GBP: { monthly: 10, yearly: 100 },+ },+ pid: 918109,+ ypid: 918110,+ maxAlerts: 50,+ },+ freelancer: {+ index: 2,+ planCode: 'freelancer',+ monthlyUsageLimit: 100000,+ legacy: true,+ price: {+ USD: { monthly: 15, yearly: 150 },+ EUR: { monthly: 15, yearly: 150 },+ GBP: { monthly: 14, yearly: 140 },+ },+ pid: 752316,+ ypid: 776469,+ maxAlerts: 50,+ },+} as const satisfies Partial<Record<PlanCode, PlanLimit>>++const createPlanLimit = (+ eventTierCode: EventTierCode,+ index: number,+): PlanLimit => {+ const tier = EVENT_TIERS[eventTierCode]+ const monthly = PLAN_PRICES.standard[eventTierCode]?.monthly+ const yearly = PLAN_PRICES.standard[eventTierCode]?.yearly++ return {+ index,+ planCode: tier.planCode,+ monthlyUsageLimit: tier.monthlyEvents,+ legacy: false,+ price: {+ USD: {+ monthly: monthly?.USD.amount ?? 0,+ yearly: yearly?.USD.amount ?? 0,+ },+ EUR: {+ monthly: monthly?.EUR.amount ?? 0,+ yearly: yearly?.EUR.amount ?? 0,+ },+ GBP: {+ monthly: monthly?.GBP.amount ?? 0,+ yearly: yearly?.GBP.amount ?? 0,+ },+ },+ ...(monthly?.USD.paddlePlanId ? { pid: monthly.USD.paddlePlanId } : {}),+ ...(yearly?.USD.paddlePlanId ? { ypid: yearly.USD.paddlePlanId } : {}),+ maxAlerts: 50,+ }+}++export const PLAN_LIMITS = {+ ...LEGACY_PLAN_LIMITS,+ ...EVENT_TIER_CODES.reduce(+ (limits, tierCode, index) => ({+ ...limits,+ [EVENT_TIERS[tierCode].planCode]: createPlanLimit(tierCode, index + 2.5),+ }),+ {} as Record<PlanCode, PlanLimit>,+ ),+} as Record<PlanCode, PlanLimit>++export const STANDARD_PLANS = EVENT_TIER_CODES.map(+ (tierCode) => EVENT_TIERS[tierCode].planCode,+)++export const PURCHASABLE_LEGACY_PLANS: PlanCode[] = ['hobby', '50k']++export const isPaidPlanCode = (planCode?: string | null) =>+ !!planCode && !['none', 'free', 'trial'].includes(planCode)++export const getEffectivePlanType = (+ planType?: string | null,+ planCode?: string | null,+): PlanTypeCode => {+ if (planType && planType in PLAN_TYPES) {+ return planType as PlanTypeCode+ }++ if (isPaidPlanCode(planCode)) {+ return 'standard'+ }++ return 'standard'+}++export const getEventTierByPlanCode = (planCode?: string | null) =>+ EVENT_TIER_CODES.map((code) => ({ code, ...EVENT_TIERS[code] })).find(+ (tier) => tier.planCode === planCode,+ )++export const getPlanPrice = (+ planType: PlanTypeCode,+ eventTier: EventTierCode,+ billingInterval: BillingInterval,+ currencyCode: CurrencyCode,+) =>+ PLAN_PRICES[planType]?.[eventTier]?.[billingInterval]?.[currencyCode] ??+ PLAN_PRICES[planType]?.[eventTier]?.[billingInterval]?.USD ??+ null++export const getPlanMonthlyPrice = (+ planType: PlanTypeCode,+ eventTier: EventTierCode,+ billingInterval: BillingInterval,+ currencyCode: CurrencyCode,+) => {+ const planPrice = getPlanPrice(+ planType,+ eventTier,+ billingInterval,+ currencyCode,+ )++ if (!planPrice) return null+ return billingInterval === 'yearly'+ ? Math.round((planPrice.amount / 12) * 100) / 100+ : planPrice.amount+}++export const getIncludedSessionReplays = (+ planType: PlanTypeCode,+ eventTier: EventTierCode,+) => {+ const entitlements = PLAN_ENTITLEMENTS[planType]++ if (typeof entitlements.sessionReplaysIncluded === 'number') {+ return entitlements.sessionReplaysIncluded+ }++ if (+ entitlements.sessionReplaysIncluded === 'byEventTier' &&+ 'sessionReplayQuota' in entitlements+ ) {+ return entitlements.sessionReplayQuota[eventTier] ?? 0+ }++ return entitlements.sessionReplaysIncluded+}++export const formatEventTier = (eventTier: EventTierCode) =>+ EVENT_TIERS[eventTier].monthlyEvents.toLocaleString('en-US')++export const formatCompactNumber = (value: number) => {+ if (value >= 1000000) {+ const compact = value / 1000000+ return `${Number.isInteger(compact) ? compact : compact.toFixed(1)}M`+ }++ if (value >= 1000) {+ return `${value / 1000}k`+ }++ return String(value)+}diff --git a/web/app/pages/Subscribe/Subscribe.tsx b/web/app/pages/Subscribe/Subscribe.tsxindex c19a79812..acaa1362e 100644--- a/web/app/pages/Subscribe/Subscribe.tsx+++ b/web/app/pages/Subscribe/Subscribe.tsx@@ -1,41 +1,85 @@import {- RocketLaunchIcon,+ ArrowRightIcon,BellIcon,- CreditCardIcon,CheckIcon,+ CreditCardIcon,+ RocketLaunchIcon,StarIcon,- ArrowRightIcon,} from '@phosphor-icons/react'+import type { TFunction } from 'i18next'import { useCallback, useEffect, useMemo, useRef, useState } from 'react'import { Trans, useTranslation } from 'react-i18next'-import { useFetcher, useNavigate, useLoaderData } from 'react-router'+import { useFetcher, useLoaderData, useNavigate } from 'react-router'import { toast } from 'sonner'import { usePaddle } from '~/hooks/usePaddle'import {- BillingFrequency,- CONTACT_EMAIL,CURRENCIES,paddleLanguageMapping,- PLAN_LIMITS,- STANDARD_PLANS,TRIAL_DAYS,} from '~/lib/constants'+import {+ EVENT_TIER_CODES,+ EVENT_TIERS,+ PLAN_ENTITLEMENTS,+ SELF_SERVE_PLAN_TYPES,+ getIncludedSessionReplays,+ getPlanMonthlyPrice,+ getPlanPrice,+ type BillingInterval,+ type CurrencyCode,+ type EventTierCode,+ type PlanTypeCode,+} from '~/lib/pricing/catalog'import { useAuth } from '~/providers/AuthProvider'import { useTheme } from '~/providers/ThemeProvider'import type { SubscribeLoaderData } from '~/routes/subscribe'import Button from '~/ui/Button'import { FAQ } from '~/ui/FAQ'-import { Text } from '~/ui/Text'import { Switch } from '~/ui/Switch'+import { Text } from '~/ui/Text'+import { trackCustom } from '~/utils/analytics'import { cn } from '~/utils/generic'import routes from '~/utils/routes'-import { trackCustom } from '~/utils/analytics'-const INITIAL_VISIBLE_PLANS = 3+const INITIAL_VISIBLE_TIERS = 4+const formatEventsLong = (value: number, locale = 'en-US') =>value.toLocaleString(locale)+const formatPrice = (amount: number | null) => {+ if (amount === null) return null+ return Number.isInteger(amount) ? amount.toFixed(0) : amount.toFixed(2)+}++const formatReplayQuota = (+ value: number | string,+ t: TFunction,+ locale = 'en-US',+) => {+ if (value === 0) return t('pricing.sessionReplay.none')+ if (typeof value === 'number') {+ return t('pricing.sessionReplay.included', {+ amount: formatEventsLong(value, locale),+ })+ }+ return t('pricing.sessionReplay.customQuota')+}++const getPlanName = (planType: PlanTypeCode, t: TFunction) =>+ t(`pricing.planTypes.${planType}.name`)++const getCheckoutErrorMessage = (+ error: string | undefined,+ t: TFunction,+) => {+ if (error?.startsWith('billing.')) {+ return t(error)+ }++ return error || t('billing.checkoutPreparationError')+}+const Subscribe = () => {const { t, i18n } = useTranslation('common')const { theme } = useTheme()@@ -43,12 +87,13 @@ const Subscribe = () => {const navigate = useNavigate()const { metainfo } = useLoaderData<SubscribeLoaderData>()- const [selectedPlan, setSelectedPlan] = useState('100k')- const [selectedBillingFrequency, setSelectedBillingFrequency] = useState<- 'monthly' | 'yearly'- >('monthly')- const [showAllPlans, setShowAllPlans] = useState(false)-+ const [selectedPlanType, setSelectedPlanType] =+ useState<PlanTypeCode>('standard')+ const [selectedEventTier, setSelectedEventTier] =+ useState<EventTierCode>('100k')+ const [selectedBillingFrequency, setSelectedBillingFrequency] =+ useState<BillingInterval>('monthly')+ const [showAllTiers, setShowAllTiers] = useState(false)const [hasCompletedCheckout, setHasCompletedCheckout] = useState(false)const onPaddleEvent = useCallback(@@ -64,15 +109,28 @@ const Subscribe = () => {onEvent: onPaddleEvent,})- const currencyCode = user?.tierCurrency || metainfo.code+ const currencyCode = (+ (user?.tierCurrency || metainfo.code) in CURRENCIES+ ? user?.tierCurrency || metainfo.code+ : 'USD'+ ) as CurrencyCodeconst currency = CURRENCIES[currencyCode] || CURRENCIES.USD- const tier = PLAN_LIMITS[selectedPlan as keyof typeof PLAN_LIMITS]- const monthlyPrice =- tier?.price?.[currencyCode]?.monthly ?? tier?.price?.USD?.monthly- const yearlyPrice =- tier?.price?.[currencyCode]?.yearly ?? tier?.price?.USD?.yearly- const displayPrice =- selectedBillingFrequency === 'yearly' ? yearlyPrice : monthlyPrice+ const selectedPrice = getPlanPrice(+ selectedPlanType,+ selectedEventTier,+ selectedBillingFrequency,+ currencyCode,+ )+ const monthlyPrice = getPlanMonthlyPrice(+ selectedPlanType,+ selectedEventTier,+ selectedBillingFrequency,+ currencyCode,+ )+ const replayQuota = getIncludedSessionReplays(+ selectedPlanType,+ selectedEventTier,+ )const pollRef = useRef<ReturnType<typeof setInterval> | null>(null)@@ -80,7 +138,7 @@ const Subscribe = () => {if (!hasCompletedCheckout) returnlet attempts = 0- const MAX_POLL_ATTEMPTS = 30+ const maxPollAttempts = 30pollRef.current = setInterval(async () => {attempts += 1@@ -93,11 +151,11 @@ const Subscribe = () => {navigate(routes.dashboard)return}- } catch {- // ignore, keep polling+ } catch (error) {+ void error}- if (attempts >= MAX_POLL_ATTEMPTS) {+ if (attempts >= maxPollAttempts) {if (pollRef.current) clearInterval(pollRef.current)navigate(routes.dashboard)}@@ -110,7 +168,6 @@ const Subscribe = () => {const generatePayLinkFetcher = useFetcher<any>()- // Handle generate pay link fetcher responseuseEffect(() => {if (generatePayLinkFetcher.data?.success &&@@ -129,10 +186,11 @@ const Subscribe = () => {toast.error(t('apiNotifications.somethingWentWrong'))}- // Clear datageneratePayLinkFetcher.data = undefined} else if (generatePayLinkFetcher.data?.error) {- toast.error('An error occured while preparing checkout')+ toast.error(+ getCheckoutErrorMessage(generatePayLinkFetcher.data.error, t),+ )}}, [generatePayLinkFetcher.data,@@ -145,7 +203,8 @@ const Subscribe = () => {const handleStartCheckout = () => {trackCustom('SUBSCRIBE_START_CHECKOUT', {- plan: selectedPlan,+ planType: selectedPlanType,+ eventTier: selectedEventTier,billingFrequency: selectedBillingFrequency,currency: currencyCode,paddleLoadError,@@ -153,6 +212,11 @@ const Subscribe = () => {paddleWindowExists: !!(window as any).Paddle,})+ if (!selectedPrice?.paddlePlanId) {+ toast.error(t('billing.planNotConfiguredForCheckout'))+ return+ }+if (paddleLoadError) {toast.error(t('billing.paddleLoadError'))return@@ -163,27 +227,14 @@ const Subscribe = () => {return}- if (!tier) return-- const hasPid = 'pid' in tier && typeof tier.pid === 'number'- const hasYpid = 'ypid' in tier && typeof tier.ypid === 'number'-- const product =- selectedBillingFrequency === BillingFrequency.monthly- ? hasPid- ? tier.pid- : undefined- : hasYpid- ? tier.ypid- : undefined-- if (!product) {- toast.error(t('apiNotifications.somethingWentWrong'))- return- }-generatePayLinkFetcher.submit(- { intent: 'generate-pay-link', planId: String(product) },+ {+ intent: 'generate-pay-link',+ planType: selectedPlanType,+ eventTier: selectedEventTier,+ billingFrequency: selectedBillingFrequency,+ currency: currencyCode,+ },{ method: 'POST', action: '/user-settings' },)}@@ -198,12 +249,16 @@ const Subscribe = () => {new Date(Date.now() + TRIAL_DAYS * 24 * 60 * 60 * 1000),)+ const dueEndAmount = selectedPrice?.amount ?? 0+const faqItems = useMemo(() => {const faqValues = {- lowestPlanEventsAmount:- PLAN_LIMITS['100k'].monthlyUsageLimit.toLocaleString('en-US'),- moderatePlanEventsAmount:- PLAN_LIMITS['500k'].monthlyUsageLimit.toLocaleString('en-US'),+ lowestPlanEventsAmount: EVENT_TIERS['100k'].monthlyEvents.toLocaleString(+ 'en-US',+ ),+ moderatePlanEventsAmount: EVENT_TIERS[+ '500k'+ ].monthlyEvents.toLocaleString('en-US'),}return [0, 1, 4].map((idx) => ({@@ -216,13 +271,16 @@ const Subscribe = () => {}))}, [t])+ const visibleTiers = showAllTiers+ ? EVENT_TIER_CODES+ : EVENT_TIER_CODES.slice(0, INITIAL_VISIBLE_TIERS)+return (<div className='flex min-h-screen flex-col items-center bg-gray-50 p-4 lg:p-8 dark:bg-slate-950'>- <div className='grid w-full max-w-5xl grid-cols-1 items-start gap-12 lg:grid-cols-[1fr_380px] lg:gap-16'>- {/* Left Column */}+ <div className='grid w-full max-w-6xl grid-cols-1 items-start gap-12 lg:grid-cols-[1fr_380px] lg:gap-16'><div className='flex flex-col gap-8'><div>- <Text as='h1' size='4xl' weight='bold' tracking='tight'>+ <Text as='h1' size='4xl' weight='bold'>{t('checkout.title')}</Text><Text as='p' size='lg' colour='secondary' className='mt-2'>@@ -252,15 +310,15 @@ const Subscribe = () => {</div><div>- <div className='mb-3 flex items-center justify-between'>+ <div className='mb-3 flex items-center justify-between gap-3'><Text as='p' size='sm' colour='secondary'>{t('checkout.selectPlan')}</Text><buttontype='button'onClick={() =>- setSelectedBillingFrequency((f) =>- f === 'monthly' ? 'yearly' : 'monthly',+ setSelectedBillingFrequency((frequency) =>+ frequency === 'monthly' ? 'yearly' : 'monthly',)}className='flex shrink-0 cursor-pointer items-center gap-2 rounded-lg border border-gray-200 px-2.5 py-1.5 transition-colors hover:bg-gray-100 dark:border-slate-700 dark:hover:bg-slate-900'@@ -278,118 +336,135 @@ const Subscribe = () => {</button></div>- <div className='space-y-2'>- {STANDARD_PLANS.slice(- 0,- showAllPlans ? undefined : INITIAL_VISIBLE_PLANS,- ).map((planCode) => {- const planTier =- PLAN_LIMITS[planCode as keyof typeof PLAN_LIMITS]- if (!planTier) return null- const isSelected = selectedPlan === planCode- const monthlyPrice =- planTier.price?.[currencyCode]?.monthly ??- planTier.price?.USD?.monthly- const yearlyPrice =- planTier.price?.[currencyCode]?.yearly ??- planTier.price?.USD?.yearly-- const displayPrice =- selectedBillingFrequency === 'monthly'- ? monthlyPrice- : Math.round((yearlyPrice || 0) / 12)+ <div className='grid gap-2 sm:grid-cols-2'>+ {SELF_SERVE_PLAN_TYPES.map((planType) => {+ const entitlements = PLAN_ENTITLEMENTS[planType]+ const isSelected = selectedPlanType === planType+ const price = getPlanMonthlyPrice(+ planType,+ selectedEventTier,+ selectedBillingFrequency,+ currencyCode,+ )return (<button- key={planCode}+ key={planType}type='button'- onClick={() => setSelectedPlan(planCode)}+ onClick={() => setSelectedPlanType(planType)}className={cn(- 'flex w-full items-center justify-between rounded-lg bg-white px-4 py-3 text-left ring-1 transition-all duration-150 ring-inset dark:bg-slate-950',+ 'rounded-lg bg-white p-4 text-left ring-1 ring-inset transition-all duration-150 dark:bg-slate-950',isSelected- ? 'ring-2 ring-indigo-500 dark:ring-slate-200'+ ? 'ring-2 ring-slate-900 dark:ring-slate-200': 'ring-gray-200 hover:ring-gray-300 dark:ring-slate-700 dark:hover:ring-slate-600',)}>- <div className='flex flex-col items-start'>+ <div className='flex items-center justify-between gap-2'><Text as='span' size='base' weight='semibold'>- {currency.symbol}- {displayPrice}- <Text- as='span'- size='sm'- colour='secondary'- weight='medium'- >- /{t('pricing.perMonth')}- </Text>- </Text>- <Text as='span' size='xs' colour='secondary'>- {selectedBillingFrequency === 'monthly'- ? t('pricing.billedMonthly')- : t('pricing.billedAnnuallyAt', {- amount: `${currency.symbol}${yearlyPrice}`,- })}+ {getPlanName(planType, t)}</Text></div>- <Text as='span' size='sm' colour='secondary'>- {t('pricing.upToXEvents', {- amount: formatEventsLong(- planTier.monthlyUsageLimit,- i18n.language,- ),+ <Text as='span' size='sm' colour='secondary' className='mt-3 block'>+ {currency.symbol}+ {formatPrice(price)}+ /{t('pricing.perMonth')}+ </Text>+ <Text as='span' size='xs' colour='muted' className='mt-1 block'>+ {t('pricing.websiteCount', {+ count: entitlements.websites,+ })}+ ,{' '}+ {t('pricing.teamMemberCount', {+ count: entitlements.teamMembers,})}</Text></button>)})}</div>+ </div>- {showAllPlans && (- <div className='mt-2 rounded-lg bg-gray-50 px-4 py-3 ring-1 ring-gray-200 ring-inset dark:bg-slate-900/50 dark:ring-slate-800'>- <Text as='p' size='sm' weight='medium' colour='primary'>- {t('checkout.customPlanTitle')}- </Text>- <Text as='p' size='sm' colour='secondary' className='mt-1'>- <Trans- t={t}- i18nKey='checkout.customPlanDesc'- values={{- count: formatEventsLong(- PLAN_LIMITS['20m'].monthlyUsageLimit,- i18n.language,- ),- }}- components={{- contact: (- <a- href={`mailto:${CONTACT_EMAIL}`}- aria-label={t('ariaLabels.contactSupport')}- className='font-medium underline decoration-dashed hover:decoration-solid'- />- ),- }}- />- </Text>- </div>- )}+ <div>+ <Text as='p' size='sm' colour='secondary' className='mb-3'>+ {t('pricing.eventVolume')}+ </Text>+ <div className='grid gap-2 sm:grid-cols-2'>+ {visibleTiers.map((eventTier) => {+ const tier = EVENT_TIERS[eventTier]+ const isSelected = selectedEventTier === eventTier+ const price = getPlanMonthlyPrice(+ selectedPlanType,+ eventTier,+ selectedBillingFrequency,+ currencyCode,+ )++ return (+ <button+ key={eventTier}+ type='button'+ onClick={() => setSelectedEventTier(eventTier)}+ className={cn(+ 'flex items-center justify-between rounded-lg bg-white px-4 py-3 text-left ring-1 ring-inset transition-all duration-150 dark:bg-slate-950',+ isSelected+ ? 'ring-2 ring-slate-900 dark:ring-slate-200'+ : 'ring-gray-200 hover:ring-gray-300 dark:ring-slate-700 dark:hover:ring-slate-600',+ )}+ >+ <Text as='span' size='sm' weight='semibold'>+ {formatEventsLong(tier.monthlyEvents, i18n.language)}+ </Text>+ <Text as='span' size='sm' colour='secondary'>+ {currency.symbol}+ {formatPrice(price)}+ /{t('pricing.perMonth')}+ </Text>+ </button>+ )+ })}+ </div><div className='mt-3'><Buttonvariant='ghost'size='xs'- onClick={() => setShowAllPlans((v) => !v)}- className='rounded-full'+ onClick={() => setShowAllTiers((value) => !value)}>- {showAllPlans+ {showAllTiers? t('common.showLess'): t('common.showMore', {- count: STANDARD_PLANS.length - INITIAL_VISIBLE_PLANS,+ count: EVENT_TIER_CODES.length - INITIAL_VISIBLE_TIERS,})}</Button></div></div>+ <div className='rounded-lg bg-white p-4 ring-1 ring-gray-200 ring-inset dark:bg-slate-950 dark:ring-slate-800'>+ <div className='flex flex-wrap items-center justify-between gap-3'>+ <div>+ <Text as='p' size='base' weight='semibold'>+ {getPlanName(selectedPlanType, t)}+ </Text>+ <Text as='p' size='sm' colour='secondary' className='mt-1'>+ {formatEventsLong(+ EVENT_TIERS[selectedEventTier].monthlyEvents,+ i18n.language,+ )}{' '}+ {t('pricing.eventsWithReplay', {+ replayQuota: formatReplayQuota(replayQuota, t, i18n.language),+ })}+ </Text>+ </div>+ <Text as='p' size='2xl' weight='bold'>+ {currency.symbol}+ {formatPrice(monthlyPrice)}+ <Text as='span' size='sm' colour='secondary' weight='medium'>+ /{t('pricing.perMonth')}+ </Text>+ </Text>+ </div>+ </div>+<div className='flex flex-col gap-3 border-t border-gray-200 pt-6 dark:border-slate-800'><div className='flex items-center justify-between'><Text as='p' size='base' weight='semibold'>@@ -410,7 +485,10 @@ const Subscribe = () => {</Text><Text as='p' size='base'>{currency.symbol}- {displayPrice}+ {formatPrice(dueEndAmount)}+ {selectedBillingFrequency === 'yearly'+ ? `/${t('pricing.perYear')}`+ : `/${t('pricing.perMonth')}`}</Text></div></div>@@ -430,7 +508,7 @@ const Subscribe = () => {</Text></div></div>- ) : (+ ) : selectedPrice?.paddlePlanId ? (<Buttonsize='xl'className='flex w-full items-center justify-center gap-1'@@ -441,13 +519,22 @@ const Subscribe = () => {<span>{t('checkout.next')}</span><ArrowRightIcon className='size-4 translate-y-px' /></Button>+ ) : (+ <Button+ to={routes.contact}+ size='xl'+ variant='secondary'+ className='flex w-full items-center justify-center gap-1'+ >+ <span>{t('pricing.contactUs')}</span>+ <ArrowRightIcon className='size-4 translate-y-px' />+ </Button>)}</div><FAQ items={faqItems} /></div>- {/* Right Column (Timeline) */}<div className='hidden lg:block lg:pt-16'><div className='rounded-lg bg-white p-6 ring-1 ring-gray-200 ring-inset dark:bg-slate-950 dark:ring-slate-800'><div className='flex items-start gap-5'>diff --git a/web/app/pages/UserSettings/UserSettings.tsx b/web/app/pages/UserSettings/UserSettings.tsxindex 15cd73279..95aaf9e3b 100644--- a/web/app/pages/UserSettings/UserSettings.tsx+++ b/web/app/pages/UserSettings/UserSettings.tsx@@ -181,6 +181,7 @@ const DEFAULT_USAGE_INFO: UsageInfo = {errors: 0,customEvents: 0,captcha: 0,+ projects: 0,trafficPerc: 0,errorsPerc: 0,customEventsPerc: 0,@@ -272,7 +273,11 @@ const UserSettings = () => {cancellationEffectiveDate,subCancelURL,maxEventsCount = 0,- } = user || {}+ maxProjects = 0,+ maxApiKeyRequestsPerHour = 0,+ sessionReplaysIncluded = 0,+ purchasedWebsiteAddons = 0,+ } = user || ({} as Partial<User>)const isSubscriber = !['none', 'trial', 'free'].includes(planCode || '')const isLegacyTrial = planCode === 'trial'@@ -291,6 +296,16 @@ const UserSettings = () => {return Math.min(100, Math.max(0, raw))})()const remainingUsage = _round(Math.max(0, 100 - totalUsage), 2)+ const projectsUsage =+ maxProjects > 0+ ? Math.min(100, _round((usageInfo.projects / maxProjects) * 100, 2))+ : 0+ const replayLimitLabel =+ typeof sessionReplaysIncluded === 'number'+ ? sessionReplaysIncluded.toLocaleString()+ : sessionReplaysIncluded === 'custom'+ ? t('pricing.custom')+ : sessionReplaysIncluded || '0'const isTrialEnded = (() => {if (!trialEndDate) {@@ -1651,6 +1666,61 @@ const UserSettings = () => {</Text></div>+ <div className='mt-5 grid gap-4 border-t border-gray-200 pt-4 sm:grid-cols-3 dark:border-slate-800'>+ <div>+ <Text as='p' size='xs' colour='muted'>+ {t('billing.websites')}+ </Text>+ <Text as='p' size='sm' weight='semibold' className='mt-1'>+ {(usageInfo.projects || 0).toLocaleString()} /{' '}+ {(maxProjects || 0).toLocaleString()}+ </Text>+ {purchasedWebsiteAddons ? (+ <Text as='p' size='xs' colour='muted' className='mt-1'>+ {t('billing.addedWebsites', {+ amount: purchasedWebsiteAddons.toLocaleString(),+ })}+ </Text>+ ) : null}+ <div className='mt-2 h-1.5 overflow-hidden rounded-full bg-gray-200 dark:bg-slate-800'>+ <div+ className='h-full rounded-full bg-slate-900 dark:bg-slate-100'+ style={{ width: `${projectsUsage}%` }}+ />+ </div>+ </div>++ <div>+ <Text as='p' size='xs' colour='muted'>+ {t('billing.sessionReplays')}+ </Text>+ <Text as='p' size='sm' weight='semibold' className='mt-1'>+ {t('billing.perMonthQuota', {+ amount: replayLimitLabel,+ })}+ </Text>+ <Text as='p' size='xs' colour='muted' className='mt-1'>+ {t('billing.recordedSessionsQuota')}+ </Text>+ </div>++ <div>+ <Text as='p' size='xs' colour='muted'>+ {t('billing.api')}+ </Text>+ <Text as='p' size='sm' weight='semibold' className='mt-1'>+ {t('billing.perHourQuota', {+ amount: (+ maxApiKeyRequestsPerHour || 0+ ).toLocaleString(),+ })}+ </Text>+ <Text as='p' size='xs' colour='muted' className='mt-1'>+ {t('billing.currentRateLimit')}+ </Text>+ </div>+ </div>+<Textas='p'size='sm'diff --git a/web/app/routes/user-settings.tsx b/web/app/routes/user-settings.tsxindex 6eef0fca0..9ff13cba4 100644--- a/web/app/routes/user-settings.tsx+++ b/web/app/routes/user-settings.tsx@@ -12,6 +12,15 @@ import { getOgImageUrl, isSelfhosted } from '~/lib/constants'import { Metainfo } from '~/lib/models/Metainfo'import { UsageInfo } from '~/lib/models/Usageinfo'import { User } from '~/lib/models/User'+import {+ EVENT_TIERS,+ PLAN_TYPES,+ getPlanPrice,+ type BillingInterval,+ type CurrencyCode,+ type EventTierCode,+ type PlanTypeCode,+} from '~/lib/pricing/catalog'import UserSettings from '~/pages/UserSettings'import { getDescription, getPreviewImage, getTitle } from '~/utils/seo'import {@@ -94,6 +103,60 @@ export interface UserSettingsActionData {data?: unknown}+const resolveCatalogSelection = (formData: FormData) => {+ const rawPlanType = formData.get('planType')?.toString()+ const rawEventTier = formData.get('eventTier')?.toString()+ const rawBillingInterval = formData.get('billingFrequency')?.toString()+ const rawCurrencyCode = formData.get('currency')?.toString() || 'USD'++ if (rawPlanType || rawEventTier || rawBillingInterval) {+ if (!rawPlanType || !(rawPlanType in PLAN_TYPES)) {+ return { error: 'billing.invalidPlanSelection' }+ }+ if (!rawEventTier || !(rawEventTier in EVENT_TIERS)) {+ return { error: 'billing.invalidPlanSelection' }+ }+ if (+ rawBillingInterval !== 'monthly' &&+ rawBillingInterval !== 'yearly'+ ) {+ return { error: 'billing.invalidPlanSelection' }+ }+ if (!['USD', 'EUR', 'GBP'].includes(rawCurrencyCode)) {+ return { error: 'billing.invalidCurrency' }+ }++ const planType = rawPlanType as PlanTypeCode+ const eventTier = rawEventTier as EventTierCode+ const billingFrequency = rawBillingInterval as BillingInterval+ const currency = rawCurrencyCode as CurrencyCode+ const selectedPrice = getPlanPrice(+ planType,+ eventTier,+ billingFrequency,+ currency,+ )++ if (!selectedPrice?.paddlePlanId) {+ return { error: 'billing.planNotConfiguredForCheckout' }+ }++ return {+ planId: selectedPrice.paddlePlanId,+ planType,+ eventTier,+ }+ }++ const planId = Number(formData.get('planId'))++ if (!Number.isFinite(planId) || planId <= 0 || !Number.isInteger(planId)) {+ return { error: 'billing.invalidPlanSelection' }+ }++ return { planId }+}+export async function action({ request }: ActionFunctionArgs) {redirectIfNotAuthenticated(request)@@ -495,22 +558,18 @@ export async function action({ request }: ActionFunctionArgs) {}case 'preview-subscription-update': {- const planId = Number(formData.get('planId'))+ const selection = resolveCatalogSelection(formData)- if (- !Number.isFinite(planId) ||- planId <= 0 ||- !Number.isInteger(planId)- ) {+ if ('error' in selection) {return data<UserSettingsActionData>(- { intent, error: 'Invalid planId' },+ { intent, error: selection.error },{ status: 400 },)}const result = await serverFetch(request, 'user/preview-plan', {method: 'POST',- body: { planId },+ body: selection,})if (result.error) {@@ -527,15 +586,11 @@ export async function action({ request }: ActionFunctionArgs) {}case 'generate-pay-link': {- const planId = Number(formData.get('planId'))+ const selection = resolveCatalogSelection(formData)- if (- !Number.isFinite(planId) ||- planId <= 0 ||- !Number.isInteger(planId)- ) {+ if ('error' in selection) {return data<UserSettingsActionData>(- { intent, error: 'Invalid planId' },+ { intent, error: selection.error },{ status: 400 },)}@@ -545,7 +600,7 @@ export async function action({ request }: ActionFunctionArgs) {'user/generate-pay-link',{method: 'POST',- body: { planId },+ body: selection,},)@@ -563,22 +618,18 @@ export async function action({ request }: ActionFunctionArgs) {}case 'change-subscription-plan': {- const planId = Number(formData.get('planId'))+ const selection = resolveCatalogSelection(formData)- if (- !Number.isFinite(planId) ||- planId <= 0 ||- !Number.isInteger(planId)- ) {+ if ('error' in selection) {return data<UserSettingsActionData>(- { intent, error: 'Invalid planId' },+ { intent, error: selection.error },{ status: 400 },)}const result = await serverFetch(request, 'user/change-plan', {method: 'POST',- body: { planId },+ body: selection,})if (result.error) {diff --git a/web/package-lock.json b/web/package-lock.jsonindex 106d3b476..3331c2179 100644--- a/web/package-lock.json+++ b/web/package-lock.json@@ -8,6 +8,7 @@"dependencies": {"@headlessui/react": "^2.2.10","@nivo/sankey": "^0.99.0",+ "@number-flow/react": "^0.6.0","@phosphor-icons/react": "^2.1.10","@radix-ui/react-tooltip": "^1.2.8","@react-router/fs-routes": "^7.15.1",@@ -1353,6 +1354,20 @@],"license": "MIT"},+ "node_modules/@number-flow/react": {+ "version": "0.6.0",+ "resolved": "https://registry.npmjs.org/@number-flow/react/-/react-0.6.0.tgz",+ "integrity": "sha512-77Yfc9+zkV2UDSP8phhZzxJGuwxi/Tt1TikmipL+1r3e9GFKEYDZ1XwInj67NoSt3OnOB0KLvvcl3lfPZgBHVQ==",+ "license": "MIT",+ "dependencies": {+ "esm-env": "^1.1.4",+ "number-flow": "0.6.0"+ },+ "peerDependencies": {+ "react": "^18 || ^19",+ "react-dom": "^18 || ^19"+ }+ },"node_modules/@oxc-parser/binding-android-arm-eabi": {"version": "0.130.0","resolved": "https://registry.npmjs.org/@oxc-parser/binding-android-arm-eabi/-/binding-android-arm-eabi-0.130.0.tgz",@@ -6591,6 +6606,12 @@"url": "https://github.com/sponsors/sindresorhus"}},+ "node_modules/esm-env": {+ "version": "1.2.2",+ "resolved": "https://registry.npmjs.org/esm-env/-/esm-env-1.2.2.tgz",+ "integrity": "sha512-Epxrv+Nr/CaL4ZcFGPJIYLWFom+YeV1DqMLHJoEd9SYRxNbaFruBwfEX/kkHUJf55j2+TUbmDcmuilbP1TmXHA==",+ "license": "MIT"+ },"node_modules/etag": {"version": "1.8.1","resolved": "https://registry.npmjs.org/etag/-/etag-1.8.1.tgz",@@ -8168,6 +8189,15 @@"dev": true,"license": "MIT"},+ "node_modules/number-flow": {+ "version": "0.6.0",+ "resolved": "https://registry.npmjs.org/number-flow/-/number-flow-0.6.0.tgz",+ "integrity": "sha512-K8flNq2Wqus53vjp/btVo3qXFkagF8dIdYavreBfE7hlvFFG/b1HMGEH6nZL+mlrJ+4lbLP9OmPv3t2rmRkpSQ==",+ "license": "MIT",+ "dependencies": {+ "esm-env": "^1.1.4"+ }+ },"node_modules/object-assign": {"version": "4.1.1","resolved": "https://registry.npmjs.org/object-assign/-/object-assign-4.1.1.tgz",diff --git a/web/package.json b/web/package.jsonindex 3bf59bc51..6c6a3b138 100644--- a/web/package.json+++ b/web/package.json@@ -21,6 +21,7 @@"dependencies": {"@headlessui/react": "^2.2.10","@nivo/sankey": "^0.99.0",+ "@number-flow/react": "^0.6.0","@phosphor-icons/react": "^2.1.10","@radix-ui/react-tooltip": "^1.2.8","@react-router/fs-routes": "^7.15.1",diff --git a/web/public/locales/en.json b/web/public/locales/en.jsonindex 5deac2f75..a20694dcc 100644--- a/web/public/locales/en.json+++ b/web/public/locales/en.json@@ -165,6 +165,7 @@"dateRange": "Date range","dnsRecord": "DNS record","emailSupport": "Email Swetrix support",+ "emailSupportTitle": "Email us at {{email}}","eventFilters": "{{event}} filters","eventTotal": "{{event}} total","fiveOutOfFiveStars": "5 out of 5 stars",@@ -2850,7 +2851,21 @@"xPercentUsed": "{{percentage}}% used","xPercentRemaining": "{{percentage}}% remaining","paddleLoadError": "Could not load the payment system. Refresh the page and try again.",- "paddleStillLoading": "The payment system is still loading. Try again in a moment."+ "paddleStillLoading": "The payment system is still loading. Try again in a moment.",+ "subscriptionUpdateError": "An error occurred while updating subscription",+ "pricingPreviewError": "An error occurred while loading subscription update pricing preview",+ "checkoutPreparationError": "An error occurred while preparing checkout",+ "planNotConfiguredForCheckout": "This plan is not configured for self-serve checkout yet",+ "invalidPlanSelection": "Invalid plan selection",+ "invalidCurrency": "Invalid currency",+ "websites": "Websites",+ "addedWebsites": "+{{amount}} added",+ "sessionReplays": "Session replays",+ "perMonthQuota": "{{amount}} / month",+ "recordedSessionsQuota": "Recorded sessions quota",+ "api": "API",+ "perHourQuota": "{{amount}} / hour",+ "currentRateLimit": "Current rate limit"},"modals": {"paidFeature": {@@ -2881,8 +2896,8 @@}},"pricing": {- "title": "Simple, traffic-based pricing",- "adv": "Try Swetrix on your website for {{amount}} days - completely free of charge.\nA payment method is required, but you can cancel anytime before the trial ends.",+ "title": "Pricing that scales on volume and capability",+ "adv": "Choose the monthly event volume you need, then pick the feature set that fits your team.\nStart with a {{amount}} day free trial. Cancel anytime before the trial ends.","subscribe": "Subscribe","legacy": "Legacy","legacyDescription": "This plan or pricing is no longer available for new users. It is still available for existing users.",@@ -2895,6 +2910,97 @@"yearlyBilling": "Yearly","billedYearly": "Billed yearly","billedMonthly": "Billed monthly",+ "custom": "Custom",+ "customLimits": "Custom limits",+ "monthlyEvents": "Monthly events",+ "monthlyEventVolume": "Monthly event volume",+ "eventVolume": "Event volume",+ "startFreeTrial": "Start free trial",+ "planWithEvents": "{{plan}} plan, {{events}} events per month",+ "selectedPlanWithEvents": "{{plan}}, {{events}} events",+ "eventsWithReplay": "events, {{replayQuota}}",+ "websiteCount_one": "{{count}} website",+ "websiteCount_other": "{{count}} websites",+ "teamMemberCount_one": "{{count}} member",+ "teamMemberCount_other": "{{count}} members",+ "intervals": {+ "month": "month",+ "year": "year",+ "hour": "hour"+ },+ "planTypes": {+ "standard": {+ "name": "Standard",+ "description": "The default for growing projects.",+ "cta": "Start with Standard"+ },+ "plus": {+ "name": "Plus",+ "description": "For teams, agencies, and data-heavy work.",+ "cta": "Start with Plus"+ },+ "enterprise": {+ "name": "Enterprise",+ "description": "Custom infrastructure, limits, support, and legal terms.",+ "cta": "Contact sales"+ }+ },+ "sessionReplay": {+ "none": "No session replay included",+ "included": "{{amount}} replays included",+ "recordedSessions": "{{amount}} recorded sessions",+ "customQuota": "Custom session replay quota"+ },+ "benefits": {+ "upToWebsites": "Up to {{amount}} websites",+ "upToTeamMembers": "Up to {{amount}} team members",+ "upToOrganisations": "Up to {{amount}} organisations",+ "coreAnalytics": "Core analytics",+ "customEvents": "Custom events",+ "customEventsAndGoals": "Custom events and goals",+ "goals": "Goals",+ "webVitals": "Web vitals",+ "errorTracking": "Error tracking",+ "emailReports": "Email reports",+ "funnels": "Funnels",+ "journeys": "Journeys",+ "funnelsAndJourneys": "Funnels and journeys",+ "sessionsProfiles": "Sessions and profiles",+ "visitorSessionsAndProfiles": "Visitor sessions and profiles",+ "featureFlags": "Feature flags",+ "experiments": "Experiments",+ "abTests": "A/B tests",+ "revenueAnalytics": "Revenue analytics",+ "standardApi": "Standard API",+ "everythingInStandard": "Everything in Standard",+ "sessionReplay": "Session replay",+ "moreOrganisations": "More organisations",+ "higherApiLimits": "Higher API limits",+ "dataExports": "Data exports",+ "dataExportWorkflows": "Data export workflows",+ "largerReplayQuota": "Larger replay quota",+ "prioritySupport": "Priority support",+ "agencyOrganisations": "Agency-friendly organisations",+ "advancedExperiments": "Advanced experiments",+ "everythingInPlus": "Everything in Plus",+ "customUserLimit": "Custom user limit",+ "customSiteLimit": "Custom site limit",+ "customOrganisationLimit": "Custom organisation limit",+ "customEventVolume": "Custom event volume",+ "ssoSaml": "SSO and SAML",+ "dedicatedInstance": "Dedicated isolated instance",+ "onPremise": "On-premise installation",+ "manualInvoicing": "Manual invoicing",+ "sla": "SLA",+ "whitelabeling": "Whitelabeling",+ "securityLegalSupport": "Security and legal support"+ },+ "addons": {+ "websiteTitle": "Website add-ons",+ "sessionReplayTitle": "Session replay add-ons",+ "websiteBundle": "+{{amount}} websites",+ "sessionReplayBundle": "+{{amount}} recorded sessions"+ },"billedAnnuallyAt": "Billed annually at {{amount}}","switchToMonthly": "Switch to monthly billing","upToXEvents": "Up to {{amount}} monthly events.",