This commit is contained in:
2025-08-22 14:11:18 -05:00
commit 3e9ca1a146
88 changed files with 14387 additions and 0 deletions

22
web/lib/ab.ts Normal file
View File

@@ -0,0 +1,22 @@
'use client';
import { useState, useEffect } from 'react';
export const useVariant = () => {
const [variant, setVariant] = useState<string | null>(null);
const [mounted, setMounted] = useState(false);
useEffect(() => {
setMounted(true);
const u = new URL(window.location.href);
setVariant(u.searchParams.get('ab') ?? 'control');
}, []);
return { variant: variant || 'control', mounted };
};
// Legacy function for backward compatibility
export const variant = () => {
if (typeof window === 'undefined') return 'control';
const u = new URL(window.location.href);
return u.searchParams.get('ab') ?? 'control';
};