Update landing page
This commit is contained in:
@@ -1,9 +1,14 @@
|
||||
/**
|
||||
* Custom hook to detect pilot program participation via URL parameter
|
||||
* Checks for ?pilot=true in URL and provides pilot status and coupon code
|
||||
* Custom hook to detect pilot program participation
|
||||
*
|
||||
* Checks both environment variable (VITE_PILOT_MODE_ENABLED) and URL parameter (?pilot=true)
|
||||
* to determine if pilot mode is active.
|
||||
*
|
||||
* Priority: Environment variable OR URL parameter (either can enable pilot mode)
|
||||
*/
|
||||
import { useMemo } from 'react';
|
||||
import { useLocation } from 'react-router-dom';
|
||||
import PILOT_CONFIG from '../config/pilot';
|
||||
|
||||
interface PilotDetectionResult {
|
||||
isPilot: boolean;
|
||||
@@ -16,15 +21,18 @@ export const usePilotDetection = (): PilotDetectionResult => {
|
||||
const location = useLocation();
|
||||
|
||||
const pilotInfo = useMemo(() => {
|
||||
// Check URL parameter
|
||||
const searchParams = new URLSearchParams(location.search);
|
||||
const pilotParam = searchParams.get('pilot');
|
||||
const isPilot = pilotParam === 'true';
|
||||
const urlPilotParam = searchParams.get('pilot') === 'true';
|
||||
|
||||
// Pilot mode is active if EITHER env var is true OR URL param is true
|
||||
const isPilot = PILOT_CONFIG.enabled || urlPilotParam;
|
||||
|
||||
return {
|
||||
isPilot,
|
||||
couponCode: isPilot ? 'PILOT2025' : null,
|
||||
trialMonths: isPilot ? 3 : 0,
|
||||
trialDays: isPilot ? 90 : 14,
|
||||
couponCode: isPilot ? PILOT_CONFIG.couponCode : null,
|
||||
trialMonths: isPilot ? PILOT_CONFIG.trialMonths : 0,
|
||||
trialDays: isPilot ? PILOT_CONFIG.trialDays : 14,
|
||||
};
|
||||
}, [location.search]);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user