-
Notifications
You must be signed in to change notification settings - Fork 294
Expand file tree
/
Copy pathfeatureManagement.ts
More file actions
165 lines (132 loc) · 4.83 KB
/
featureManagement.ts
File metadata and controls
165 lines (132 loc) · 4.83 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
import type { JSONValue } from '@growthbook/growthbook';
import type { FeedAdTemplate } from './feed';
import type { FeedSettingsKeys } from '../contexts/FeedContext';
import type { PlusItemStatus } from '../components/plus/PlusListItem';
import { isDevelopment } from './constants';
import { BriefingType } from '../graphql/posts';
export class Feature<T extends JSONValue> {
readonly id: string;
readonly defaultValue: T;
constructor(id: string, defaultValue: T) {
this.id = id;
this.defaultValue = defaultValue;
}
}
const feature = {
showError: new Feature('show_error', false),
feedVersion: new Feature('feed_version', 15),
feedAdSpot: new Feature('feed_ad_spot', 2),
searchVersion: new Feature('search_version', 2),
featureTheme: new Feature('feature_theme', {}),
showRoadmap: new Feature('show_roadmap', true),
showCodeSnippets: new Feature('show_code_snippets', false),
};
export const followingFeedVersion = new Feature('following_feed_version', 2);
export const popularFeedVersion = new Feature('popular_feed_version', 2);
export const upvotedFeedVersion = new Feature('upvoted_feed_version', 2);
export const discussedFeedVersion = new Feature('discussed_feed_version', 2);
export const latestFeedVersion = new Feature('latest_feed_version', 2);
export const customFeedVersion = new Feature('custom_feed_version', 2);
export const featureFeedV2Highlights = new Feature('feed_v2_highlights', false);
// @ts-expect-error stale feature without default
export const plusTakeoverContent = new Feature<{
title: string;
description: string;
features: Array<{ label: string; status: PlusItemStatus }>;
cta: string;
shouldShowRefund: boolean;
shouldShowReviews: boolean;
}>('plus_takeover_content');
export const featurePlusCtaCopy = new Feature('plus_cta_copy', {
full: 'Level Up with Plus',
short: 'Upgrade',
});
export const featurePlusApiLanding = new Feature('plus_api_landing_v2', false);
export const featureAutorotateAds = new Feature('autorotate_ads', 0);
export const featureAdReferralCta = new Feature('ad_referral_cta', false);
export const featureFeedAdTemplate = new Feature('feed_ad_template', {
default: {
adStart: 2,
},
} as Record<FeedSettingsKeys, FeedAdTemplate>);
export const featureValidLanguages = new Feature('valid_languages', {
en: 'English',
es: 'Spanish',
de: 'German',
fr: 'French',
it: 'Italian',
'zh-Hans': 'Chinese (Simplified)',
'pt-BR': 'Portuguese (Brazil)',
'pt-PT': 'Portuguese (Portugal)',
ja: 'Japanese',
ko: 'Korean',
});
export const featurePlusEntryMobile = new Feature('plus_entry_mobile', false);
export const featureReadingReminderVariation = new Feature<
'control' | 'hero' | 'inline'
>('reading_reminder_variation', 'control');
export const featureReadingReminderHeroCopy = new Feature(
'reading_reminder_hero_copy',
{
title: 'Never miss a learning day',
subtitle: 'Turn on your daily reading reminder and keep your routine.',
},
);
export const clickbaitTriesMax = new Feature('clickbait_tries_max', 5);
export const featureFeedClickbaitShieldWarning = new Feature(
'feed_clickbait_shield_warning',
true,
);
export { feature };
export const featureCores = new Feature('cores', isDevelopment);
// whether the user will see post boost ads
// does not necessarily mean they can't boost a post if they have access to cores
export const featurePostBoostAds = new Feature('post_boost_ads', isDevelopment);
export const briefCardFeedFeature = new Feature(
'brief_card_feed',
isDevelopment,
);
export const profileCompletionCardFeature = new Feature(
'profile_completion_card',
false,
);
export const briefGeneratePricing = new Feature<Record<BriefingType, number>>(
'brief_generate_pricing',
{
[BriefingType.Daily]: 300,
[BriefingType.Weekly]: 500,
},
);
export const briefFeedEntrypointPage = new Feature<false | number>(
'brief_feed_banner_page',
0,
);
export const briefUIFeature = new Feature('brief_ui', isDevelopment);
export const boostSettingsFeature = new Feature('boost_settings', {
min: 1000,
max: 100000,
step: 1000,
default_cores: 5000,
default_days: 7,
});
export const adImprovementsV3Feature = new Feature('ad_improvements_v3', false);
export const featureYearInReview = new Feature('year_in_review_2025', false);
export const featureProfileCompletionIndicator = new Feature(
'profile_completion_indicator',
0,
);
export const questsFeature = new Feature('quests', false);
export const achievementTrackingWidgetFeature = new Feature(
'achievement_tracking_widget',
false,
);
export const sharedPostPreviewFeature = new Feature(
'shared_post_preview',
false,
);
export const featureOnboardingV2 = new Feature('onboarding_v2', false);
export const featurePostSignupWidget = new Feature('post_signup_widget', false);
export const featureShortcutsExtensionPromo = new Feature(
'shortcuts_extension_promo',
false,
);