Skip to content

📈 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!

add param to allow some legacy plans

Blue Mouse6f7d4df31b14
diff --git a/web/app/components/pricing/BillingPricing.tsx b/web/app/components/pricing/BillingPricing.tsx
index 6e5f7da30..b2e3efd18 100644
--- a/web/app/components/pricing/BillingPricing.tsx
+++ b/web/app/components/pricing/BillingPricing.tsx
@@ -17,6 +17,7 @@ import {
PLAN_LIMITS,
REFERRAL_DISCOUNT_CODE,
STANDARD_PLANS,
+ PURCHASABLE_LEGACY_PLANS,
paddleLanguageMapping,
} from '~/lib/constants'
import { DEFAULT_METAINFO, Metainfo } from '~/lib/models/Metainfo'
@@ -58,19 +59,34 @@ const BillingPricing = ({ lastEvent }: BillingPricingProps) => {
} | null>(null)
const [showDowngradeModal, setShowDowngradeModal] = useState(false)
const [billingFrequency, setBillingFrequency] = useState(user?.billingFrequency || BillingFrequency.monthly)
+ const [enableLegacyPlans, setEnableLegacyPlans] = useState(false)
+
+ useEffect(() => {
+ const urlParams = new URLSearchParams(window.location.search)
+ const legacyParam = urlParams.get('__ENABLE_LEGACY_PLANS')
+ if (legacyParam === 'true') {
+ setEnableLegacyPlans(true)
+ }
+ }, [])
const PLAN_CODES_ARRAY = useMemo(() => {
- if (!isAuthenticated) return STANDARD_PLANS
+ let basePlans = STANDARD_PLANS
+
+ if (enableLegacyPlans) {
+ basePlans = [...PURCHASABLE_LEGACY_PLANS, ...STANDARD_PLANS]
+ }
+
+ if (!isAuthenticated) return basePlans
const userPlan = user?.planCode
// Hide non-purchasable pseudo-plans from the list
if (userPlan === 'trial' || userPlan === 'none') {
- return STANDARD_PLANS
+ return basePlans
}
- return _includes(STANDARD_PLANS, userPlan) ? STANDARD_PLANS : [userPlan, ...STANDARD_PLANS]
- }, [isAuthenticated, user?.planCode])
+ return _includes(basePlans, userPlan) ? basePlans : [userPlan, ...basePlans]
+ }, [isAuthenticated, user?.planCode, enableLegacyPlans])
const currencyCode = user?.tierCurrency || metainfo.code
const currency = CURRENCIES[currencyCode]
diff --git a/web/app/lib/constants/index.ts b/web/app/lib/constants/index.ts
index 77bb50e65..d559c50f4 100644
--- a/web/app/lib/constants/index.ts
+++ b/web/app/lib/constants/index.ts
@@ -897,6 +897,8 @@ export const PLAN_LIMITS = {
export const STANDARD_PLANS = ['100k', '200k', '500k', 'startup', '2m', 'enterprise', '10m', '15m', '20m']
+export const PURCHASABLE_LEGACY_PLANS = ['hobby']
+
export const TRIAL_DAYS = 14
export const chartTypes = Object.freeze({