Skip to content

🤯 LobeHub - Super-Agents on Your Team. Add super-agents to the chats your team already uses.They take on work by themselves and get better every week.

✨ feat(feature-flag): add the mobile_new_tier_sales rollout flag (#22467)

Tsuki3286b2bb1342
diff --git a/packages/app-config/src/featureFlags/schema.test.ts b/packages/app-config/src/featureFlags/schema.test.ts
index 6ca61ec287a..c52734f3757 100644
--- a/packages/app-config/src/featureFlags/schema.test.ts
+++ b/packages/app-config/src/featureFlags/schema.test.ts
@@ -270,6 +270,26 @@ describe('mapFeatureFlagsEnvToState', () => {
expect(mapFeatureFlagsEnvToState(config).enableNewTierPlans).toBe(false);
});
+ it('should keep mobile new-tier sales off by default and enable them for listed users', () => {
+ expect(DEFAULT_FEATURE_FLAGS.mobile_new_tier_sales).toBe(false);
+ expect(
+ mapFeatureFlagsEnvToState(DEFAULT_FEATURE_FLAGS, 'user-1').enableMobileNewTierSales,
+ ).toBe(false);
+
+ const config = { mobile_new_tier_sales: ['tester-123'] };
+
+ expect(mapFeatureFlagsEnvToState(config, 'tester-123').enableMobileNewTierSales).toBe(true);
+ expect(mapFeatureFlagsEnvToState(config, 'user-456').enableMobileNewTierSales).toBe(false);
+ expect(mapFeatureFlagsEnvToState(config).enableMobileNewTierSales).toBe(false);
+ });
+
+ it('should not let the web new-tier flag open mobile new-tier sales', () => {
+ const state = mapFeatureFlagsEnvToState({ new_tier_plans: true }, 'user-1');
+
+ expect(state.enableNewTierPlans).toBe(true);
+ expect(state.enableMobileNewTierSales).toBeUndefined();
+ });
+
it('should keep topic previews off by default and enable them for listed users', () => {
expect(DEFAULT_FEATURE_FLAGS.topic_preview).toBe(false);
expect(mapFeatureFlagsEnvToState(DEFAULT_FEATURE_FLAGS, 'user-1').enableTopicPreview).toBe(
diff --git a/packages/app-config/src/featureFlags/schema.ts b/packages/app-config/src/featureFlags/schema.ts
index 48b76cc2c89..1689cf2bda2 100644
--- a/packages/app-config/src/featureFlags/schema.ts
+++ b/packages/app-config/src/featureFlags/schema.ts
@@ -107,6 +107,7 @@ export const FeatureFlagsSchema = z.object({
cloud_promotion: FeatureFlagValue.optional(),
onboarding_v2: FeatureFlagValue.optional(),
new_tier_plans: FeatureFlagValue.optional(),
+ mobile_new_tier_sales: FeatureFlagValue.optional(),
storage_overage: FeatureFlagValue.optional(),
workspace: FeatureFlagValue.optional(),
@@ -224,6 +225,7 @@ export const DEFAULT_FEATURE_FLAGS: IFeatureFlags = {
// Cloud-only grayscale for the new subscription tiers: off until an admin
// publishes a whitelist (array of user IDs) or flips it to true.
new_tier_plans: false,
+ mobile_new_tier_sales: false,
storage_overage: true,
workspace: isDev,
@@ -286,6 +288,11 @@ export const mapFeatureFlagsEnvToState = (
enableAuthCaptcha: evaluateFeatureFlag(config.auth_captcha, userId, 'auth_captcha'),
enableOnboardingV2: evaluateFeatureFlag(config.onboarding_v2, userId, 'onboarding_v2'),
enableNewTierPlans: evaluateFeatureFlag(config.new_tier_plans, userId, 'new_tier_plans'),
+ enableMobileNewTierSales: evaluateFeatureFlag(
+ config.mobile_new_tier_sales,
+ userId,
+ 'mobile_new_tier_sales',
+ ),
enableStorageOverage: evaluateFeatureFlag(config.storage_overage, userId, 'storage_overage'),
showCloudPromotion: evaluateFeatureFlag(config.cloud_promotion, userId, 'cloud_promotion'),
diff --git a/packages/types/src/serverConfig.ts b/packages/types/src/serverConfig.ts
index 5c3fbc7a8d5..01797fd1355 100644
--- a/packages/types/src/serverConfig.ts
+++ b/packages/types/src/serverConfig.ts
@@ -49,6 +49,12 @@ export type IFeatureFlagsState = {
* selling the current tiers; listed users see and can buy the new tiers instead.
*/
enableNewTierPlans: boolean | undefined;
+ /**
+ * Rollout gate for buying the new tiers in the mobile app
+ * (`mobile_new_tier_sales`). Separate from `enableNewTierPlans`, which covers
+ * the web plans page.
+ */
+ enableMobileNewTierSales: boolean | undefined;
/**
* LobeHub Mobile rollout gate for the multiplexed gateway socket and
* protocol-v2 payloads. Web follows `GlobalServerConfig.agentGatewayProtocol`.