autumn-js
Version:
Autumn JS Library
22 lines (19 loc) • 1.03 kB
text/typescript
import { b as ClientCreateReferralCodeParams, s as CreateReferralCodeResponse, k as ClientRedeemReferralCodeParams, R as RedeemReferralCodeResponse } from '../params-Bf18ATYi.mjs';
import { HookParams, HookResultWithMethods } from './types.mjs';
import '../plan-CUExbmy9.mjs';
import '@tanstack/react-query';
import '../client/AutumnClientError.mjs';
type UseReferralsParams = HookParams<ClientCreateReferralCodeParams, CreateReferralCodeResponse>;
type UseReferralsResult = HookResultWithMethods<CreateReferralCodeResponse, {
/** Redeems a referral code for the current customer. */
redeemCode: (params: ClientRedeemReferralCodeParams) => Promise<RedeemReferralCodeResponse>;
}>;
/**
* Referral helper hook.
*
* - `data` is the latest create-code response.
* - Access the code as `data?.code`.
* - Call `refetch()` to create/fetch the code for `programId`.
*/
declare const useReferrals: (params: UseReferralsParams) => UseReferralsResult;
export { type UseReferralsParams, type UseReferralsResult, useReferrals };