Skip to content

Commit ef2e5ab

Browse files
committed
refactor: derive TIER_FEATURES from lower tiers to reduce duplication
1 parent 0dd0955 commit ef2e5ab

1 file changed

Lines changed: 14 additions & 24 deletions

File tree

packages/shared/src/constants.ts

Lines changed: 14 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -50,38 +50,28 @@ export const DEFAULT_BLACKLISTED_PATTERNS = [
5050

5151
/**
5252
* Tier feature flags.
53+
* Higher tiers inherit all features from lower tiers.
5354
*/
55+
const FREE_FEATURES = ['presence', 'friends', 'globalLeaderboard'] as const;
56+
const PRO_ADDITIONAL = ['ghostMode', 'customEmoji', 'history30d', 'themes'] as const;
57+
const TEAM_ADDITIONAL = [
58+
'conflictRadar',
59+
'privateInstance',
60+
'slackIntegration',
61+
'analytics',
62+
] as const;
63+
5464
export const TIER_FEATURES = {
55-
HACKER: ['presence', 'friends', 'globalLeaderboard'] as const,
56-
PRO: [
57-
'presence',
58-
'friends',
59-
'globalLeaderboard',
60-
'ghostMode',
61-
'customEmoji',
62-
'history30d',
63-
'themes',
64-
] as const,
65-
TEAM: [
66-
'presence',
67-
'friends',
68-
'globalLeaderboard',
69-
'ghostMode',
70-
'customEmoji',
71-
'history30d',
72-
'themes',
73-
'conflictRadar',
74-
'privateInstance',
75-
'slackIntegration',
76-
'analytics',
77-
] as const,
65+
FREE: FREE_FEATURES,
66+
PRO: [...FREE_FEATURES, ...PRO_ADDITIONAL] as const,
67+
TEAM: [...FREE_FEATURES, ...PRO_ADDITIONAL, ...TEAM_ADDITIONAL] as const,
7868
} as const;
7969

8070
/**
8171
* API rate limits per tier (requests per minute).
8272
*/
8373
export const RATE_LIMITS = {
84-
HACKER: 60,
74+
FREE: 60,
8575
PRO: 120,
8676
TEAM: 300,
8777
} as const;

0 commit comments

Comments
 (0)