/** * Referrals — per-project referral codes + conversion tracking. * * GET /referrals — list (projectId required) * GET /referrals/stats — aggregated conversion stats * GET /referrals/:id — detail (projectId required as query) * POST /referrals — create (optional custom code) * POST /referrals/:id/expire — mark pending referral expired * * Referral data is sharded into per-project databases; the `projectId` * routes the request to the correct shard and is required on every call. */ import type { Client } from './client.js'; export type ReferralStatus = 'pending' | 'completed' | 'expired' | 'cancelled'; export type RewardType = 'points' | 'credit' | 'discount' | 'custom'; export interface UserRef { readonly id: string; readonly email: string; readonly name: string | null; } export interface Referral { readonly id: string; readonly projectId: string; readonly projectName: string; readonly code: string; readonly referrer: UserRef | null; readonly referredUser: UserRef | null; readonly status: ReferralStatus; readonly rewardType: RewardType; readonly createdAt: string; readonly completedAt: string | null; } export interface ReferralDetail extends Referral { readonly metadata: Readonly> | null; } export interface ListOptions { readonly environmentId?: string; readonly limit?: number; readonly offset?: number; } export declare const list: (client: Client, projectId: string, options?: ListOptions) => Promise; export declare const get: (client: Client, id: string, projectId: string) => Promise; export interface CreateInput { readonly projectId: string; readonly referrerId: string; readonly code?: string; readonly rewardType?: RewardType; } export interface CreateResult { readonly id: string; readonly code: string; } export declare const create: (client: Client, input: CreateInput) => Promise; export interface StatsOptions { readonly environmentId?: string; readonly days?: number; } export interface ReferralStats { readonly overall: { readonly total: number; readonly completed: number; readonly pending: number; readonly expired: number; readonly conversionRate: number; }; readonly period: { readonly days: number; readonly since: string; readonly created: number; readonly completed: number; readonly conversionRate: number; }; readonly byRewardType: readonly { readonly rewardType: RewardType; readonly total: number; readonly completed: number; readonly conversionRate: number; }[]; readonly byProject: readonly { readonly projectId: string; readonly total: number; readonly completed: number; readonly conversionRate: number; }[]; readonly dailyTrend: readonly { readonly date: string; readonly created: number; readonly completed: number; }[]; readonly topReferrers: readonly { readonly referrerId: string; readonly totalReferrals: number; readonly completedReferrals: number; }[]; } export declare const stats: (client: Client, projectId: string, options?: StatsOptions) => Promise; export declare const expire: (client: Client, id: string, projectId: string) => Promise<{ success: boolean; }>; //# sourceMappingURL=referrals.d.ts.map