payload-ab
Version:
Payload CMS plugin for A/B testing with PostHog
18 lines (17 loc) • 715 B
TypeScript
/**
* Server-side helper for determining which A/B test variant to serve
* For use in Next.js App Router with React Server Components
*
* @param document The document from Payload CMS containing A/B testing data
* @param cookies The cookies object from Next.js (from cookies() function)
* @returns The content to display (either the variant or the original)
*/
export declare const getServerSideABVariant: <D extends {
abVariant?: Record<string, unknown>;
enableABTesting?: boolean;
posthogFeatureFlagKey?: string;
}, T extends Record<string, unknown> = Record<string, unknown>>(document: D & T, cookies: {
get: (name: string) => {
value: string;
} | undefined;
}) => Promise<T>;